소스 검색

Fixing hemispheric serialization

David Catuhe 11 년 전
부모
커밋
933e0446ae
4개의 변경된 파일24개의 추가작업 그리고 8개의 파일을 삭제
  1. 12 0
      Babylon/Loading/babylon.sceneLoader.js
  2. 4 2
      Babylon/Tools/babylon.sceneSerializer.js
  3. 4 2
      Babylon/Tools/babylon.sceneSerializer.ts
  4. 4 4
      babylon.1.12-beta.js

+ 12 - 0
Babylon/Loading/babylon.sceneLoader.js

@@ -54,6 +54,12 @@ var BABYLON = BABYLON || {};
             }, progressCallBack, database);
         },
 
+        /**
+        * Load a scene
+        * @param rootUrl a string that defines the root url for scene and resources
+        * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene
+        * @param engine is the instance of BABYLON.Engine to use to create the scene
+        */
         Load: function (rootUrl, sceneFilename, engine, onsuccess, progressCallBack, onerror) {
 
             var plugin = this._getPluginForFilename(sceneFilename.name || sceneFilename);
@@ -76,6 +82,12 @@ var BABYLON = BABYLON || {};
                 }
             };
 
+            if (sceneFilename.substr(0, 5) === "data:") {
+                // Direct load
+                loadSceneFromData(sceneFilename.substr(5));
+                return;
+            }
+
             if (rootUrl.indexOf("file:") === -1) {
                 // Checking if a manifest file has been set for this scene and if offline mode has been requested
                 database = new BABYLON.Database(rootUrl + sceneFilename);

+ 4 - 2
Babylon/Tools/babylon.sceneSerializer.js

@@ -22,8 +22,10 @@
             serializationObject.angle = spotLight.angle;
             serializationObject.exponent = spotLight.exponent;
         } else if (light instanceof BABYLON.HemisphericLight) {
-            serializationObject.type = 2;
-            serializationObject.groundColor = light.groundColor.asArray();
+            serializationObject.type = 3;
+            var hemisphericLight = light;
+            serializationObject.direction = hemisphericLight.direction.asArray();
+            serializationObject.groundColor = hemisphericLight.groundColor.asArray();
         }
 
         if (light.intensity) {

+ 4 - 2
Babylon/Tools/babylon.sceneSerializer.ts

@@ -22,8 +22,10 @@
             serializationObject.angle = spotLight.angle;
             serializationObject.exponent = spotLight.exponent;
         } else if (light instanceof BABYLON.HemisphericLight) {
-            serializationObject.type = 2;
-            serializationObject.groundColor = (<HemisphericLight>light).groundColor.asArray();
+            serializationObject.type = 3;
+            var hemisphericLight = <HemisphericLight>light;
+            serializationObject.direction = hemisphericLight.direction.asArray();
+            serializationObject.groundColor = hemisphericLight.groundColor.asArray();
         }
 
         if (light.intensity) {

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 4 - 4
babylon.1.12-beta.js