Procházet zdrojové kódy

Add null check for ctx.camera.

borisrp před 2 měsíci
rodič
revize
54a60a89cb
1 změnil soubory, kde provedl 5 přidání a 3 odebrání
  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("ldrMap", textures.ldr);
 		ctx.setGlobal("velocity", textures.velocity);
 		ctx.setGlobal("velocity", textures.velocity);
 		ctx.setGlobal("global.time", ctx.time);
 		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() {
 	function beginPbr() {