|
@@ -58,6 +58,34 @@ module BABYLON {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * Gets or sets the center of the bounding box associated with the cube texture
|
|
|
+ * It must define where the camera used to render the texture was set
|
|
|
+ */
|
|
|
+ public boundingBoxPosition = Vector3.Zero();
|
|
|
+
|
|
|
+ private _boundingBoxSize: Vector3;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Gets or sets the size of the bounding box associated with the cube texture
|
|
|
+ * When defined, the cubemap will switch to local mode
|
|
|
+ * @see https://community.arm.com/graphics/b/blog/posts/reflections-based-on-local-cubemaps-in-unity
|
|
|
+ * @example https://www.babylonjs-playground.com/#RNASML
|
|
|
+ */
|
|
|
+ public set boundingBoxSize(value: Vector3) {
|
|
|
+ if (this._boundingBoxSize && this._boundingBoxSize.equals(value)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this._boundingBoxSize = value;
|
|
|
+ let scene = this.getScene();
|
|
|
+ if (scene) {
|
|
|
+ scene.markAllMaterialsAsDirty(Material.TextureDirtyFlag);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ public get boundingBoxSize(): Vector3 {
|
|
|
+ return this._boundingBoxSize;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* Instantiates an HDRTexture from the following parameters.
|
|
|
*
|
|
|
* @param url The location of the HDR raw data (Panorama stored in RGBE format)
|
|
@@ -442,6 +470,14 @@ module BABYLON {
|
|
|
texture.coordinatesMode = parsedTexture.coordinatesMode;
|
|
|
texture.isBlocking = parsedTexture.isBlocking;
|
|
|
}
|
|
|
+ if (texture) {
|
|
|
+ if (parsedTexture.boundingBoxPosition) {
|
|
|
+ (<any>texture).boundingBoxPosition = BABYLON.Vector3.FromArray(parsedTexture.boundingBoxPosition);
|
|
|
+ }
|
|
|
+ if (parsedTexture.boundingBoxSize) {
|
|
|
+ (<any>texture).boundingBoxSize = BABYLON.Vector3.FromArray(parsedTexture.boundingBoxSize);
|
|
|
+ }
|
|
|
+ }
|
|
|
return texture;
|
|
|
}
|
|
|
|