Browse Source

HDR Global Environment Texture

Support global environment HDRCubeTexture type.

- Added parsedData.environmentTextureType = “BABYLON.HDRCubeTexture”
option

- Added parsedData.environmentTextureSize HDR option

- Added parsedData.environmentTextureRotationY HDR option
MackeyK24 7 năm trước cách đây
mục cha
commit
40a8a98e56
1 tập tin đã thay đổi với 10 bổ sung1 xóa
  1. 10 1
      src/Loading/Plugins/babylon.babylonFileLoader.ts

+ 10 - 1
src/Loading/Plugins/babylon.babylonFileLoader.ts

@@ -680,7 +680,16 @@
 
                 // Environment texture		
                 if (parsedData.environmentTexture !== undefined && parsedData.environmentTexture !== null) {
-                    scene.environmentTexture = CubeTexture.CreateFromPrefilteredData(rootUrl + parsedData.environmentTexture, scene);
+                    if (parsedData.environmentTextureType && parsedData.environmentTextureType === "BABYLON.HDRCubeTexture") {
+                        var hdrSize:number = (parsedData.environmentTextureSize) ? parsedData.environmentTextureSize : 128;
+                        var hdrTexture:BABYLON.HDRCubeTexture = new BABYLON.HDRCubeTexture(rootUrl + parsedData.environmentTexture, scene, hdrSize);
+                        if (parsedData.environmentTextureRotationY) {
+                            hdrTexture.rotationY = parsedData.environmentTextureRotationY;
+                        }
+                        scene.environmentTexture = hdrTexture;
+                    } else {
+                        scene.environmentTexture = CubeTexture.CreateFromPrefilteredData(rootUrl + parsedData.environmentTexture, scene);
+                    }
                     if (parsedData.createDefaultSkybox === true) {
                         var skyboxScale = (scene.activeCamera !== undefined && scene.activeCamera !== null) ? (scene.activeCamera.maxZ - scene.activeCamera.minZ) / 2 : 1000;
                         var skyboxBlurLevel = parsedData.skyboxBlurLevel || 0;