123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- var __extends = this.__extends || function (d, b) {
- for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
- function __() { this.constructor = d; }
- __.prototype = b.prototype;
- d.prototype = new __();
- };
- var BABYLON;
- (function (BABYLON) {
- var GroundMesh = (function (_super) {
- __extends(GroundMesh, _super);
- function GroundMesh(name, scene) {
- _super.call(this, name, scene);
- this.chunkSize = 128;
- this._worldInverse = new BABYLON.Matrix();
- }
- Object.defineProperty(GroundMesh.prototype, "subdivisions", {
- get: function () {
- return this._subdivisions;
- },
- enumerable: true,
- configurable: true
- });
- GroundMesh.prototype.optimize = function (subdivisions) {
- if (this.getTotalVertices() < 2000) {
- BABYLON.Tools.Warn("Optimizing GroundMesh requires at least 2000 vertices.");
- }
- this.subdivide(subdivisions || this._subdivisions);
- this.createOrUpdateSubmeshesOctree();
- };
- GroundMesh.prototype.getHeightAtCoordinates = function (x, z) {
- var ray = new BABYLON.Ray(new BABYLON.Vector3(x, this.getBoundingInfo().boundingBox.maximumWorld.y + 1, z), new BABYLON.Vector3(0, -1, 0));
- this.getWorldMatrix().invertToRef(this._worldInverse);
- ray = BABYLON.Ray.Transform(ray, this._worldInverse);
- var pickInfo = this.intersects(ray);
- if (pickInfo.hit) {
- var result = BABYLON.Vector3.TransformCoordinates(pickInfo.pickedPoint, this.getWorldMatrix());
- return result.y;
- }
- return 0;
- };
- return GroundMesh;
- })(BABYLON.Mesh);
- BABYLON.GroundMesh = GroundMesh;
- })(BABYLON || (BABYLON = {}));
- //# sourceMappingURL=babylon.groundMesh.js.map
|