Pārlūkot izejas kodu

Camera : add backward() and forward() methods
SceneInspector : add connected public var
Viewer : remove shadow.lightdirection

bstouls 10 gadi atpakaļ
vecāks
revīzija
4a1383a3a2
3 mainītis faili ar 24 papildinājumiem un 3 dzēšanām
  1. 18 0
      h3d/Camera.hx
  2. 6 1
      hxd/net/SceneInspector.hx
  3. 0 2
      tools/fbx/Viewer.hx

+ 18 - 0
h3d/Camera.hx

@@ -161,6 +161,24 @@ class Camera {
 		target.z += p.z;
 		target.z += p.z;
 	}
 	}
 
 
+	public function forward(speed = 1.) {
+		var c = 1 - 0.025 * speed;
+		pos.set(
+			target.x + (pos.x - target.x) * c,
+			target.y + (pos.y - target.y) * c,
+			target.z + (pos.z - target.z) * c
+		);
+	}
+
+	public function backward(speed = 1.) {
+		var c = 1 + 0.025 * speed;
+		pos.set(
+			target.x + (pos.x - target.x) * c,
+			target.y + (pos.y - target.y) * c,
+			target.z + (pos.z - target.z) * c
+		);
+	}
+
 	function makeCameraMatrix( m : Matrix ) {
 	function makeCameraMatrix( m : Matrix ) {
 		// in leftHanded the z axis is positive else it's negative
 		// in leftHanded the z axis is positive else it's negative
 		// this way we make sure that our [ax,ay,-az] matrix follow the same handness as our world
 		// this way we make sure that our [ax,ay,-az] matrix follow the same handness as our world

+ 6 - 1
hxd/net/SceneInspector.hx

@@ -152,7 +152,8 @@ class SceneInspector {
 
 
 	static var CSS = hxd.res.Embed.getFileContent("hxd/net/inspect.css");
 	static var CSS = hxd.res.Embed.getFileContent("hxd/net/inspect.css");
 
 
-	public var scene(default,set) : h3d.scene.Scene;
+	public var scene(default, set) : h3d.scene.Scene;
+	public var connected(get, never): Bool;
 
 
 	var inspect : PropInspector;
 	var inspect : PropInspector;
 	var jroot : JQuery;
 	var jroot : JQuery;
@@ -201,6 +202,10 @@ class SceneInspector {
 		});
 		});
 	}
 	}
 
 
+	inline function get_connected() {
+		return inspect.connected;
+	}
+
 	public inline function J( ?elt : cdb.jq.Dom, ?query : String ) {
 	public inline function J( ?elt : cdb.jq.Dom, ?query : String ) {
 		return inspect.J(elt,query);
 		return inspect.J(elt,query);
 	}
 	}

+ 0 - 2
tools/fbx/Viewer.hx

@@ -140,7 +140,6 @@ class Viewer extends hxd.App {
 
 
 		light = new h3d.scene.DirLight(new h3d.Vector(-4, -3, -10), s3d);
 		light = new h3d.scene.DirLight(new h3d.Vector(-4, -3, -10), s3d);
 		var shadows = Std.instance(s3d.renderer.getPass("shadow"), h3d.pass.ShadowMap);
 		var shadows = Std.instance(s3d.renderer.getPass("shadow"), h3d.pass.ShadowMap);
-		shadows.lightDirection = light.direction;
 		shadows.power = 10;
 		shadows.power = 10;
 
 
 		if( props.curFile != null )
 		if( props.curFile != null )
@@ -475,7 +474,6 @@ class Viewer extends hxd.App {
 		}
 		}
 
 
 		s3d.addChild(obj);
 		s3d.addChild(obj);
-
 		infos = getInfos(obj);
 		infos = getInfos(obj);
 
 
 		//
 		//