Pārlūkot izejas kodu

Merge pull request #4201 from MackeyK24/master

Master
sebavan 7 gadi atpakaļ
vecāks
revīzija
d7d386df1e
1 mainītis faili ar 14 papildinājumiem un 1 dzēšanām
  1. 14 1
      src/Loading/Plugins/babylon.babylonFileLoader.ts

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

@@ -680,7 +680,20 @@
 
                 // 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 = new HDRCubeTexture(rootUrl + parsedData.environmentTexture, scene, hdrSize);
+                        if (parsedData.environmentTextureRotationY) {
+                            hdrTexture.rotationY = parsedData.environmentTextureRotationY;
+                        }
+                        scene.environmentTexture = hdrTexture;
+                    } else {
+                        var cubeTexture = CubeTexture.CreateFromPrefilteredData(rootUrl + parsedData.environmentTexture, scene);
+                        if (parsedData.environmentTextureRotationY) {
+                            cubeTexture.rotationY = parsedData.environmentTextureRotationY;
+                        }
+                        scene.environmentTexture = cubeTexture;                        
+                    }
                     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;