Selaa lähdekoodia

don't sync if not visible

ncannasse 7 vuotta sitten
vanhempi
commit
1a4546a8ef
1 muutettua tiedostoa jossa 10 lisäystä ja 5 poistoa
  1. 10 5
      h3d/scene/CameraController.hx

+ 10 - 5
h3d/scene/CameraController.hx

@@ -165,7 +165,7 @@ class CameraController extends h3d.scene.Object {
 				pan(-(e.relX - pushX) * m, (e.relY - pushY) * m);
 				pushX = e.relX;
 				pushY = e.relY;
-			case 2: 
+			case 2:
 				rot(e.relX - pushX, e.relY - pushY);
 				pushX = e.relX;
 				pushY = e.relY;
@@ -174,7 +174,7 @@ class CameraController extends h3d.scene.Object {
 		default:
 		}
 	}
-	
+
 	function fov(delta) {
 		targetOffset.w += delta;
 		if( targetOffset.w >= 179 )
@@ -182,16 +182,16 @@ class CameraController extends h3d.scene.Object {
 		if( targetOffset.w < 1 )
 			targetOffset.w = 1;
 	}
-	
+
 	function zoom(delta) {
 		targetPos.x *= Math.pow(zoomAmount, delta);
 	}
-	
+
 	function rot(dx, dy) {
 		moveX += dx;
 		moveY += dy;
 	}
-	
+
 	function pan(dx, dy) {
 		var v = new h3d.Vector(dx, dy);
 		scene.camera.update();
@@ -214,6 +214,11 @@ class CameraController extends h3d.scene.Object {
 
 	override function sync(ctx:RenderContext) {
 
+		if( !ctx.visibleFlag && !alwaysSync ) {
+			super.sync(ctx);
+			return;
+		}
+
 		if( moveX != 0 ) {
 			targetPos.y += moveX * 0.003 * rotateSpeed;
 			moveX *= 1 - friction;