Skip to content

Commit

Permalink
Add debugTexture support
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
sigvef committed May 24, 2023
1 parent e0e3127 commit 9d270ec
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion renin/src/renin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
Scene,
ShaderMaterial,
sRGBEncoding,
Texture,
WebGLRenderer,
WebGLRendererParameters,
WebGLRenderTarget,
Expand Down Expand Up @@ -136,6 +137,7 @@ export class Renin {
queryIsActive: boolean = false;
options: Options;
needsSkipBecauseTabHasBeenInTheBackground = false;
debugTexture: Texture | null;

constructor(options: Options) {
Renin.instance = this;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 9d270ec

Please sign in to comment.