Selaa lähdekoodia

new Primitives.TiledGround() in Geometry class (JS & TS)

Celian 11 vuotta sitten
vanhempi
commit
4f869f9119
2 muutettua tiedostoa jossa 52 lisäystä ja 0 poistoa
  1. 23 0
      Babylon/Mesh/babylon.geometry.js
  2. 29 0
      Babylon/Mesh/babylon.geometry.ts

+ 23 - 0
Babylon/Mesh/babylon.geometry.js

@@ -569,6 +569,29 @@ var BABYLON;
             })(_Primitive);
             Primitives.Ground = Ground;
 
+            var TiledGround = (function (_super) {
+                __extends(TiledGround, _super);
+                function TiledGround(id, scene, xmin, zmin, xmax, zmax, subdivisions, precision, canBeRegenerated, mesh) {
+                    this.xmin = xmin;
+                    this.zmin = zmin;
+                    this.xmax = xmax;
+                    this.zmax = zmax;
+                    this.subdivisions = subdivisions;
+                    this.precision = precision;
+
+                    _super.call(this, id, scene, this._regenerateVertexData(), canBeRegenerated, mesh);
+                }
+                TiledGround.prototype._regenerateVertexData = function () {
+                    return BABYLON.VertexData.CreateTiledGround(this.xmin, this.zmin, this.xmax, this.zmax, this.subdivisions, this.precision);
+                };
+
+                TiledGround.prototype.copy = function (id) {
+                    return new TiledGround(id, this.getScene(), this.xmin, this.zmin, this.xmax, this.zmax, this.subdivisions, this.precision, this.canBeRegenerated(), null);
+                };
+                return TiledGround;
+            })(_Primitive);
+            Primitives.TiledGround = TiledGround;
+
             var Plane = (function (_super) {
                 __extends(Plane, _super);
                 function Plane(id, scene, size, canBeRegenerated, mesh) {

+ 29 - 0
Babylon/Mesh/babylon.geometry.ts

@@ -592,6 +592,35 @@
             }
         }
 
+        export class TiledGround extends _Primitive {
+            // Members
+            public xmin: number;
+            public zmin: number;
+            public xmax: number;
+            public zmax: number;
+            public subdivisions: {w: number; h: number;};
+            public precision:    {w: number; h: number;};
+
+            constructor(id: string, scene: Scene, xmin: number, zmin: number, xmax: number, zmax: number, subdivisions: {w: number; h: number;}, precision: {w: number; h: number;}, canBeRegenerated?: boolean, mesh?: Mesh) {
+                this.xmin = xmin;
+                this.zmin = zmin;
+                this.xmax = xmax;
+                this.zmax = zmax;
+                this.subdivisions  = subdivisions;
+                this.precision     = precision;
+
+                super(id, scene, this._regenerateVertexData(), canBeRegenerated, mesh);
+            }
+
+            public _regenerateVertexData(): VertexData {
+                return VertexData.CreateTiledGround(this.xmin, this.zmin, this.xmax, this.zmax, this.subdivisions, this.precision);
+            }
+
+            public copy(id: string): Geometry {
+                return new TiledGround(id, this.getScene(), this.xmin, this.zmin, this.xmax, this.zmax, this.subdivisions, this.precision, this.canBeRegenerated(), null);
+            }
+        }
+
         export class Plane extends _Primitive {
             // Members
             public size: number;