Prechádzať zdrojové kódy

Merge branch 'master' of https://github.com/BabylonJS/Babylon.js

David Catuhe 6 rokov pred
rodič
commit
aa94734b6a
2 zmenil súbory, kde vykonal 7 pridanie a 4 odobranie
  1. 6 4
      src/Meshes/polygonMesh.ts
  2. 1 0
      what's new.md

+ 6 - 4
src/Meshes/polygonMesh.ts

@@ -4,6 +4,8 @@ import { Vector3, Vector2, Path2 } from "../Maths/math";
 import { VertexBuffer } from "../Meshes/buffer";
 import { Mesh } from "../Meshes/mesh";
 import { VertexData } from "../Meshes/mesh.vertexData";
+import { Engine } from "../Engines/engine";
+import { Nullable } from "../types";
 
 declare var earcut: any;
 /**
@@ -154,7 +156,7 @@ export class PolygonMeshBuilder {
     private _holes = new Array<PolygonPoints>();
 
     private _name: string;
-    private _scene: Scene;
+    private _scene: Nullable<Scene>;
 
     private _epoints: number[] = new Array<number>();
     private _eholes: number[] = new Array<number>();
@@ -174,13 +176,13 @@ export class PolygonMeshBuilder {
      * Creates a PolygonMeshBuilder
      * @param name name of the builder
      * @param contours Path of the polygon
-     * @param scene scene to add to
+     * @param scene scene to add to when creating the mesh
      * @param earcutInjection can be used to inject your own earcut reference
      */
-    constructor(name: string, contours: Path2 | Vector2[] | any, scene: Scene, earcutInjection = earcut) {
+    constructor(name: string, contours: Path2 | Vector2[] | any, scene?: Scene, earcutInjection = earcut) {
         this.bjsEarcut = earcutInjection;
         this._name = name;
-        this._scene = scene;
+        this._scene = scene || Engine.LastCreatedScene;
 
         var points: Vector2[];
         if (contours instanceof Path2) {

+ 1 - 0
what's new.md

@@ -133,6 +133,7 @@
 - Added optional alphaFilter parameter to ```CreateGroundFromHeightMap``` to allow for heightmaps to be created that ignore any transparent data ([Postman-nz](https://github.com/Postman-nz))
 - Fixed renormalization of mesh weights to in cleanMatrixWeights function. ([Bolloxim](https://github.com/Bolloxim))
 - Added a validationSkin function to report out any errors on skinned meshes. ([Bolloxim](https://github.com/Bolloxim))
+- PolygonMeshBuilder can be used to generate ```VertexData``` instead of requiring a mesh to be built
 
 
 ### glTF Loader