From 9d270ecb9e3bf26f56af9077c9a348568085ec2b Mon Sep 17 00:00:00 2001 From: Sigve Sebastian Farstad Date: Thu, 27 Apr 2023 23:00:39 +0200 Subject: [PATCH] Add debugTexture support A very low-tech and un-fancy solution, but now you can quickly set renin.debugTexture = myTexture to view that texture -- useful for debugging purposes. --- renin/src/renin.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/renin/src/renin.ts b/renin/src/renin.ts index cdee1a1..0421f9d 100644 --- a/renin/src/renin.ts +++ b/renin/src/renin.ts @@ -7,6 +7,7 @@ import { Scene, ShaderMaterial, sRGBEncoding, + Texture, WebGLRenderer, WebGLRendererParameters, WebGLRenderTarget, @@ -136,6 +137,7 @@ export class Renin { queryIsActive: boolean = false; options: Options; needsSkipBecauseTabHasBeenInTheBackground = false; + debugTexture: Texture | null; constructor(options: Options) { Renin.instance = this; @@ -630,7 +632,7 @@ export class Renin { } this.framePanelTexture.needsUpdate = true; - this.screen.getMaterial().uniforms.screen.value = this.screenRenderTarget.texture; + this.screen.getMaterial().uniforms.screen.value = this.debugTexture ?? this.screenRenderTarget.texture; this.screen.getMaterial().uniforms.thirdsOverlay.value = thirdsOverlayTexture; this.screen.getMaterial().uniformsNeedUpdate = true; this.scene.background = new Color(colors.gray._700);