Explorar o código

correctly init camera screen ratio before entering render()

ncannasse %!s(int64=9) %!d(string=hai) anos
pai
achega
f32e5de90a
Modificáronse 1 ficheiros con 4 adicións e 0 borrados
  1. 4 0
      h3d/scene/Scene.hx

+ 4 - 0
h3d/scene/Scene.hx

@@ -18,6 +18,10 @@ class Scene extends Object implements h3d.IDrawable implements hxd.SceneEvents.I
 		hitInteractives = [];
 		interactives = [];
 		camera = new h3d.Camera();
+		// update ratio before render (prevent first-frame difference)
+		var engine = h3d.Engine.getCurrent();
+		if( engine != null )
+			camera.screenRatio = engine.width / engine.height;
 		ctx = new RenderContext();
 		renderer = new Renderer();
 		lightSystem = new h3d.pass.LightSystem();