新增renderablecomponent显示

优化返回值
This commit is contained in:
yhh
2020-07-27 16:10:36 +08:00
parent 149a3e5833
commit 506f8ddc0f
28 changed files with 631 additions and 512 deletions

View File

@@ -70,9 +70,10 @@ module es {
/**
* 获取矩形边界上与给定点最近的点
* @param point
* @param edgeNormal
*/
public getClosestPointOnRectangleBorderToPoint(point: Vector2): { res: Vector2, edgeNormal: Vector2 } {
let edgeNormal = Vector2.zero;
public getClosestPointOnRectangleBorderToPoint(point: Vector2, edgeNormal: Vector2): Vector2 {
edgeNormal = Vector2.zero;
// 对于每个轴,如果点在盒子外面
let res = new Vector2();
@@ -107,7 +108,7 @@ module es {
if (res.y == this.bottom) edgeNormal.y = 1;
}
return { res: res, edgeNormal: edgeNormal };
return res;
}
/**

View File

@@ -197,7 +197,8 @@ module es {
* @param matrix
*/
public static transform(position: Vector2, matrix: Matrix2D){
return new Vector2((position.x * matrix.m11) + (position.y * matrix.m21), (position.x * matrix.m12) + (position.y * matrix.m22));
return new Vector2((position.x * matrix.m11) + (position.y * matrix.m21) + matrix.m31,
(position.x * matrix.m12) + (position.y * matrix.m22) + matrix.m32);
}
/**
@@ -221,5 +222,9 @@ module es {
return result;
}
public equals(other: Vector2){
return other.x == this.x && other.y == this.y;
}
}
}