Ver código fonte

fixed yflip was not correctly updated on GL

Nicolas Cannasse 1 ano atrás
pai
commit
4239894f15
2 arquivos alterados com 5 adições e 1 exclusões
  1. 1 0
      h3d/pass/Default.hx
  2. 4 1
      h3d/scene/RenderContext.hx

+ 1 - 0
h3d/pass/Default.hx

@@ -76,6 +76,7 @@ class Default extends Base {
 		if( passes.isEmpty() )
 			return;
 		#if sceneprof h3d.impl.SceneProf.begin("draw", ctx.frame); #end
+		ctx.setupTarget();
 		setupShaders(passes);
 		if( sort == null )
 			defaultSort(passes);

+ 4 - 1
h3d/scene/RenderContext.hx

@@ -62,11 +62,14 @@ class RenderContext extends h3d.impl.RenderContext {
 		cameraProj = cam.mproj;
 		cameraPos = cam.pos;
 		cameraProjDiag = new h3d.Vector4(cam.mproj._11,cam.mproj._22,cam.mproj._33,cam.mproj._44);
-		cameraProjFlip = engine.driver.hasFeature(BottomLeftCoords) && engine.getCurrentTarget() != null ? -1 : 1;
 		cameraViewProj = cam.m;
 		cameraInverseViewProj = camera.getInverseViewProj();
 	}
 
+	public function setupTarget() {
+		cameraProjFlip = engine.driver.hasFeature(BottomLeftCoords) && engine.getCurrentTarget() != null ? -1 : 1;
+	}
+
 	function getCurrentPixelSize() {
 		var t = engine.getCurrentTarget();
 		return new h3d.Vector(2 / (t == null ? engine.width : t.width), 2 / (t == null ? engine.height : t.height));