فهرست منبع

caching textures for PP OK

Benjamin Guignabert 4 سال پیش
والد
کامیت
2549bf19f1

+ 2 - 1
src/Materials/Textures/mirrorTexture.ts

@@ -162,7 +162,8 @@ export class MirrorTexture extends RenderTargetTexture {
 
             this._mirrorMatrix.multiplyToRef(this._savedViewMatrix, this._transformMatrix);
 
-            scene.setTransformMatrix(this._transformMatrix, scene.getProjectionMatrix());
+            // Clone to not mark matrices as updated
+            scene.setTransformMatrix(this._transformMatrix.clone(), scene.getProjectionMatrix().clone());
 
             scene.clipPlane = this.mirrorPlane;
 

+ 1 - 1
src/PostProcesses/postProcess.ts

@@ -494,7 +494,7 @@ export class PostProcess {
             if (this._textureCache[i].width === textureSize.width && 
                 this._textureCache[i].height === textureSize.height &&
                 this._textureCache[i]._postProcessChannel === channel) {
-                // return this._textureCache[i];
+                return this._textureCache[i];
             }
         }
 

+ 2 - 2
src/PostProcesses/screenSpaceReflectionPostProcess.ts

@@ -136,8 +136,8 @@ export class ScreenSpaceReflectionPostProcess extends PostProcess {
                 return;
             }
 
-            const viewMatrix = camera.getViewMatrix();
-            const projectionMatrix = camera.getProjectionMatrix();
+            const viewMatrix = camera.getViewMatrix(true);
+            const projectionMatrix = camera.getProjectionMatrix(true);
 
             effect.setMatrix("projection", projectionMatrix);
             effect.setMatrix("view", viewMatrix);

+ 1 - 1
src/Shaders/default.fragment.fx

@@ -512,7 +512,7 @@ color.rgb = max(color.rgb, 0.);
     #endif
     #ifdef PREPASS_REFLECTIVITY
         #if defined(SPECULAR)
-            gl_FragData[PREPASS_REFLECTIVITY_INDEX] = vec3(specularMapColor.rgb, writeGeometryInfo);
+            gl_FragData[PREPASS_REFLECTIVITY_INDEX] = vec4(specularMapColor.rgb, writeGeometryInfo);
         #else
             gl_FragData[PREPASS_REFLECTIVITY_INDEX] = vec4(0.0, 0.0, 0.0, writeGeometryInfo);
         #endif