浏览代码

Added inlined version of lookAtX

TothBenoit 10 月之前
父节点
当前提交
9c89114062
共有 1 个文件被更改,包括 8 次插入3 次删除
  1. 8 3
      h3d/Matrix.hx

+ 8 - 3
h3d/Matrix.hx

@@ -831,9 +831,8 @@ class MatrixImpl {
 	/**
 		Build a rotation Matrix so the X axis will look at the given direction, and the Z axis will be the Up vector ([0,0,1] by default)
 	**/
-	public static function lookAtX( dir : Vector, ?up : Vector, ?m : Matrix ) {
-		if( up == null ) up = new Vector(0, 0, 1);
-		if( m == null ) m = new Matrix();
+
+	public static inline function lookAtXInline( dir : Vector, up : Vector, m : Matrix ) {
 		var ax = dir.normalized();
 		var ay = up.cross(ax).normalized();
 		if( ay.lengthSq() < Math.EPSILON2 ) {
@@ -861,4 +860,10 @@ class MatrixImpl {
 		return m;
 	}
 
+	public static function lookAtX( dir : Vector, ?up : Vector, ?m : Matrix ) {
+		if( up == null ) up = new Vector(0, 0, 1);
+		if( m == null ) m = new Matrix();
+		return lookAtXInline(dir, up, m);
+	}
+
 }