Sfoglia il codice sorgente

Emit the uniform for the reflection matrix from the vertex code

Popov72 5 anni fa
parent
commit
14016b13b7

+ 4 - 3
src/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.ts

@@ -182,6 +182,10 @@ export abstract class ReflectionTextureBaseBlock extends NodeMaterialBlock {
         this._defineEquirectangularFixedName = state._getFreeDefineName("REFLECTIONMAP_EQUIRECTANGULAR_FIXED");
         this._defineSkyboxName = state._getFreeDefineName("REFLECTIONMAP_SKYBOX");
 
+        this._reflectionMatrixName = state._getFreeVariableName("reflectionMatrix");
+
+        state._emitUniformFromString(this._reflectionMatrixName, "mat4");
+
         let code = "";
 
         let worldPosVaryingName = "v_" + this.worldPosition.associatedVariableName;
@@ -239,9 +243,6 @@ export abstract class ReflectionTextureBaseBlock extends NodeMaterialBlock {
         this._reflectionColorName = state._getFreeVariableName("reflectionColor");
         this._reflectionVectorName = state._getFreeVariableName("reflectionUVW");
         this._reflectionCoordsName = state._getFreeVariableName("reflectionCoords");
-        this._reflectionMatrixName = state._getFreeVariableName("reflectionMatrix");
-
-        state._emitUniformFromString(this._reflectionMatrixName, "mat4");
     }
 
     public handleFragmentSideCodeReflectionCoords(worldNormalVarName: string): string {