Преглед на файлове

new boundingInfo.center()

David Catuhe преди 7 години
родител
ревизия
664a4058b6

Файловите разлики са ограничени, защото са твърде много
+ 4199 - 4193
dist/preview release/babylon.d.ts


Файловите разлики са ограничени, защото са твърде много
+ 38 - 38
dist/preview release/babylon.js


+ 12 - 0
dist/preview release/babylon.max.js

@@ -12840,6 +12840,18 @@ var BABYLON;
             this.boundingBox._update(world);
             this.boundingSphere._update(world);
         };
+        /**
+         * Recreate the bounding info to be centered around a specific point given a specific extend.
+         * @param center New center of the bounding info
+         * @param extend New extend of the bounding info
+         */
+        BoundingInfo.prototype.center = function (center, extend) {
+            this.minimum = center.subtract(extend);
+            this.maximum = center.add(extend);
+            this.boundingBox = new BABYLON.BoundingBox(this.minimum, this.maximum);
+            this.boundingSphere = new BABYLON.BoundingSphere(this.minimum, this.maximum);
+            return this;
+        };
         BoundingInfo.prototype.isInFrustum = function (frustumPlanes) {
             if (!this.boundingSphere.isInFrustum(frustumPlanes))
                 return false;

Файловите разлики са ограничени, защото са твърде много
+ 4199 - 4193
dist/preview release/babylon.module.d.ts


Файловите разлики са ограничени, защото са твърде много
+ 38 - 38
dist/preview release/babylon.worker.js


Файловите разлики са ограничени, защото са твърде много
+ 822 - 816
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.d.ts


Файловите разлики са ограничени, защото са твърде много
+ 38 - 38
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.js


+ 12 - 0
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.max.js

@@ -12840,6 +12840,18 @@ var BABYLON;
             this.boundingBox._update(world);
             this.boundingSphere._update(world);
         };
+        /**
+         * Recreate the bounding info to be centered around a specific point given a specific extend.
+         * @param center New center of the bounding info
+         * @param extend New extend of the bounding info
+         */
+        BoundingInfo.prototype.center = function (center, extend) {
+            this.minimum = center.subtract(extend);
+            this.maximum = center.add(extend);
+            this.boundingBox = new BABYLON.BoundingBox(this.minimum, this.maximum);
+            this.boundingSphere = new BABYLON.BoundingSphere(this.minimum, this.maximum);
+            return this;
+        };
         BoundingInfo.prototype.isInFrustum = function (frustumPlanes) {
             if (!this.boundingSphere.isInFrustum(frustumPlanes))
                 return false;

Файловите разлики са ограничени, защото са твърде много
+ 822 - 816
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.module.d.ts


+ 1 - 0
dist/preview release/what's new.md

@@ -22,6 +22,7 @@
 - Complete rework of Unity3D exporter. [Doc here](http://doc.babylonjs.com/resources/intro) ([MackeyK24](https://github.com/MackeyK24))
 
 ## Updates
+- Added `boundingInfo.center` to recreate the bounding info to be centered around a specific point given a specific extend ([deltakosh](https://github.com/deltakosh))
 - Added `mesh.normalizeToUnitCube` to uniformly scales the mesh to fit inside of a unit cube (1 X 1 X 1 units) ([deltakosh](https://github.com/deltakosh))
 - Added `scene.onDataLoadedObservable` which is raised when SceneLoader.Append or SceneLoader.Load or SceneLoader.ImportMesh were successfully executed ([deltakosh](https://github.com/deltakosh))
 - Support for adaptiveKernelBlur on MirrorTexture ([deltakosh](https://github.com/deltakosh))

+ 15 - 0
src/Culling/babylon.boundingInfo.ts

@@ -55,6 +55,21 @@
             this.boundingSphere._update(world);
         }
 
+        /**
+         * Recreate the bounding info to be centered around a specific point given a specific extend.
+         * @param center New center of the bounding info
+         * @param extend New extend of the bounding info
+         */
+        public center(center: Vector3, extend: Vector3): BoundingInfo {
+            this.minimum = center.subtract(extend);
+            this.maximum = center.add(extend);
+
+            this.boundingBox = new BoundingBox(this.minimum, this.maximum);
+            this.boundingSphere = new BoundingSphere(this.minimum, this.maximum);
+
+            return this;
+        }
+
         public isInFrustum(frustumPlanes: Plane[]): boolean {
             if (!this.boundingSphere.isInFrustum(frustumPlanes))
                 return false;