Browse Source

Add null check for ctx.camera.

borisrp 2 months ago
parent
commit
54a60a89cb
1 changed files with 5 additions and 3 deletions
  1. 5 3
      h3d/scene/pbr/Renderer.hx

+ 5 - 3
h3d/scene/pbr/Renderer.hx

@@ -474,9 +474,11 @@ class Renderer extends h3d.scene.Renderer {
 		ctx.setGlobal("ldrMap", textures.ldr);
 		ctx.setGlobal("velocity", textures.velocity);
 		ctx.setGlobal("global.time", ctx.time);
-		ctx.setGlobal("camera.position", ctx.camera.pos);
-		ctx.setGlobal("camera.inverseViewProj", ctx.camera.getInverseViewProj());
-		ctx.setGlobal("camera.inverseView", ctx.camera.getInverseView());
+		if(ctx.camera != null){
+			ctx.setGlobal("camera.position", ctx.camera.pos);
+			ctx.setGlobal("camera.inverseViewProj", ctx.camera.getInverseViewProj());
+			ctx.setGlobal("camera.inverseView", ctx.camera.getInverseView());
+		}
 	}
 
 	function beginPbr() {