소스 검색

merged with upstream 2

Benjamin Guignabert 8 년 전
부모
커밋
2b8061d899
4개의 변경된 파일5520개의 추가작업 그리고 5404개의 파일을 삭제
  1. 2753 2694
      dist/preview release/babylon.d.ts
  2. 2753 2694
      dist/preview release/babylon.module.d.ts
  3. 1 1
      index.html
  4. 13 15
      src/Materials/babylon.standardMaterial.ts

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 2753 - 2694
dist/preview release/babylon.d.ts


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 2753 - 2694
dist/preview release/babylon.module.d.ts


+ 1 - 1
index.html

@@ -69,7 +69,7 @@
 								sphere.material.diffuseColor = new BABYLON.Color3(Math.random(), Math.random(), Math.random());
 								sphere.material.specularColor = new BABYLON.Color3(Math.random() < 0.8 ? 0 : 1, Math.random() < 0.8 ? 0 : 1, Math.random() < 0.8 ? 0 : 1);
 								sphere.material.emissiveColor = new BABYLON.Color3(0, 0, 0);
-								sphere.material.freeze();
+								// sphere.material.freeze();
 								sphere.freezeWorldMatrix();
 								spheres.push(sphere);
 							}

+ 13 - 15
src/Materials/babylon.standardMaterial.ts

@@ -815,9 +815,6 @@ module BABYLON {
             MaterialHelper.BindBonesParameters(mesh, effect);
             
             if (!this.isFrozen || !this._uniformBuffer.isSync) {
-            if (this._mustRebind(scene, effect)) {
-                effect.setMatrix("viewProjection", scene.getTransformMatrix());
-
                 if (StandardMaterial.FresnelEnabled && defines.FRESNEL) {
                     // Fresnel
                     if (this.diffuseFresnelParameters && this.diffuseFresnelParameters.isEnabled) {
@@ -905,7 +902,7 @@ module BABYLON {
                     this._uniformBuffer.updateFloat("pointSize", this.pointSize);
                 }
 
-                if (this._defines.SPECULARTERM) {
+                if (defines.SPECULARTERM) {
                     this._uniformBuffer.updateColor4("vSpecularColor", this.specularColor, this.specularPower);
                 }
                 this._uniformBuffer.updateColor3("vEmissiveColor", this.emissiveColor);
@@ -913,19 +910,19 @@ module BABYLON {
                 // Diffuse
                 this._uniformBuffer.updateColor4("vDiffuseColor", this.diffuseColor, this.alpha * mesh.visibility);
 
+                this._uniformBuffer.update();
             }
             
-            this._uniformBuffer.update();
             
-            if (scene.getCachedMaterial() !== this) {
-                this._effect.bindUniformBuffer(this._uniformBuffer.getBuffer(), "Material");
+            if (this._mustRebind(scene, effect)) {
+                effect.bindUniformBuffer(this._uniformBuffer.getBuffer(), "Material");
 
-                this._effect.setMatrix("viewProjection", scene.getTransformMatrix());
+                effect.setMatrix("viewProjection", scene.getTransformMatrix());
 
                 // Textures     
                 if (scene.texturesEnabled) {
                     if (this.diffuseTexture && StandardMaterial.DiffuseTextureEnabled) {
-                        this._effect.setTexture("diffuseSampler", this.diffuseTexture);
+                        effect.setTexture("diffuseSampler", this.diffuseTexture);
                     }
 
                     if (this._ambientTexture && StandardMaterial.AmbientTextureEnabled) {
@@ -944,8 +941,6 @@ module BABYLON {
                         }
                     }
 
-                    }
-
                     if (this._emissiveTexture && StandardMaterial.EmissiveTextureEnabled) {
                         effect.setTexture("emissiveSampler", this._emissiveTexture);
                     }
@@ -985,10 +980,8 @@ module BABYLON {
                 effect.setVector3("vEyePosition", scene._mirroredCameraPosition ? scene._mirroredCameraPosition : scene.activeCamera.position);
                 effect.setColor3("vAmbientColor", this._globalAmbientColor);
 
-                // View
-                if (scene.fogEnabled && mesh.applyFog && scene.fogMode !== Scene.FOGMODE_NONE || this.reflectionTexture || this.refractionTexture) {
-                    this._effect.setMatrix("view", scene.getViewMatrix());
-                }
+            }
+
 
             if (this._mustRebind(scene, effect) || !this.isFrozen) {
                 // Lights
@@ -996,6 +989,11 @@ module BABYLON {
                     MaterialHelper.BindLights(scene, mesh, effect, defines, this._maxSimultaneousLights);
                 }
 
+                // View
+                if (scene.fogEnabled && mesh.applyFog && scene.fogMode !== Scene.FOGMODE_NONE || this.reflectionTexture || this.refractionTexture) {
+                    effect.setMatrix("view", scene.getViewMatrix());
+                }
+                
                 // Fog
                 MaterialHelper.BindFogParameters(scene, mesh, effect);