新增渲染接口
This commit is contained in:
@@ -109,6 +109,16 @@ module es {
|
||||
return result;
|
||||
}
|
||||
|
||||
public static createRotationOut(radians: number, result: Matrix2D) {
|
||||
let val1 = Math.cos(radians);
|
||||
let val2 = Math.sin(radians);
|
||||
|
||||
result.m11 = val1;
|
||||
result.m12 = val2;
|
||||
result.m21 = -val2;
|
||||
result.m22 = val1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建一个新的缩放矩阵2D
|
||||
* @param xScale
|
||||
@@ -128,6 +138,17 @@ module es {
|
||||
return result;
|
||||
}
|
||||
|
||||
public static createScaleOut(xScale: number, yScale: number, result: Matrix2D) {
|
||||
result.m11 = xScale;
|
||||
result.m12 = 0;
|
||||
|
||||
result.m21 = 0;
|
||||
result.m22 = yScale;
|
||||
|
||||
result.m31 = 0;
|
||||
result.m32 = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建一个新的平移矩阵2D
|
||||
* @param xPosition
|
||||
@@ -147,6 +168,17 @@ module es {
|
||||
return result;
|
||||
}
|
||||
|
||||
public static createTranslationOut(position: Vector2, result: Matrix2D) {
|
||||
result.m11 = 1;
|
||||
result.m12 = 0;
|
||||
|
||||
result.m21 = 0;
|
||||
result.m22 = 1;
|
||||
|
||||
result.m31 = position.x;
|
||||
result.m32 = position.y;
|
||||
}
|
||||
|
||||
public static invert(matrix: Matrix2D) {
|
||||
let det = 1 / matrix.determinant();
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ module es {
|
||||
public static multiplyScaler(value1: Vector2, value2: number) {
|
||||
let result = es.Vector2.zero;
|
||||
result.x = value1.x * value2;
|
||||
result.y = value1.x * value2;
|
||||
result.y = value1.y * value2;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user