|
@@ -165,17 +165,17 @@ namespace Mat4 {
|
|
|
}
|
|
|
|
|
|
export function fromBasis(a: Mat4, x: Vec3, y: Vec3, z: Vec3) {
|
|
|
- Mat4.setZero(a);
|
|
|
- Mat4.setValue(a, 0, 0, x[0]);
|
|
|
- Mat4.setValue(a, 1, 0, x[1]);
|
|
|
- Mat4.setValue(a, 2, 0, x[2]);
|
|
|
- Mat4.setValue(a, 0, 1, y[0]);
|
|
|
- Mat4.setValue(a, 1, 1, y[1]);
|
|
|
- Mat4.setValue(a, 2, 1, y[2]);
|
|
|
- Mat4.setValue(a, 0, 2, z[0]);
|
|
|
- Mat4.setValue(a, 1, 2, z[1]);
|
|
|
- Mat4.setValue(a, 2, 2, z[2]);
|
|
|
- Mat4.setValue(a, 3, 3, 1);
|
|
|
+ setZero(a);
|
|
|
+ setValue(a, 0, 0, x[0]);
|
|
|
+ setValue(a, 1, 0, x[1]);
|
|
|
+ setValue(a, 2, 0, x[2]);
|
|
|
+ setValue(a, 0, 1, y[0]);
|
|
|
+ setValue(a, 1, 1, y[1]);
|
|
|
+ setValue(a, 2, 1, y[2]);
|
|
|
+ setValue(a, 0, 2, z[0]);
|
|
|
+ setValue(a, 1, 2, z[1]);
|
|
|
+ setValue(a, 2, 2, z[2]);
|
|
|
+ setValue(a, 3, 3, 1);
|
|
|
return a;
|
|
|
}
|
|
|
|
|
@@ -200,7 +200,7 @@ namespace Mat4 {
|
|
|
}
|
|
|
|
|
|
export function clone(a: Mat4) {
|
|
|
- return Mat4.copy(Mat4.zero(), a);
|
|
|
+ return copy(zero(), a);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -541,7 +541,7 @@ namespace Mat4 {
|
|
|
b20, b21, b22;
|
|
|
|
|
|
if (Math.abs(len) < EPSILON) {
|
|
|
- return Mat4.identity();
|
|
|
+ return identity();
|
|
|
}
|
|
|
|
|
|
len = 1 / len;
|
|
@@ -1075,29 +1075,29 @@ namespace Mat4 {
|
|
|
const zAxis = Vec3.create(0, 0, 1);
|
|
|
|
|
|
/** Rotation matrix for 90deg around x-axis */
|
|
|
- export const rotX90: ReadonlyMat4 = fromRotation(Mat4(), degToRad(90), xAxis);
|
|
|
+ export const rotX90: ReadonlyMat4 = fromRotation(zero(), degToRad(90), xAxis);
|
|
|
/** Rotation matrix for 180deg around x-axis */
|
|
|
- export const rotX180: ReadonlyMat4 = fromRotation(Mat4(), degToRad(180), xAxis);
|
|
|
+ export const rotX180: ReadonlyMat4 = fromRotation(zero(), degToRad(180), xAxis);
|
|
|
/** Rotation matrix for 90deg around y-axis */
|
|
|
- export const rotY90: ReadonlyMat4 = fromRotation(Mat4(), degToRad(90), yAxis);
|
|
|
+ export const rotY90: ReadonlyMat4 = fromRotation(zero(), degToRad(90), yAxis);
|
|
|
/** Rotation matrix for 180deg around y-axis */
|
|
|
- export const rotY180: ReadonlyMat4 = fromRotation(Mat4(), degToRad(180), yAxis);
|
|
|
+ export const rotY180: ReadonlyMat4 = fromRotation(zero(), degToRad(180), yAxis);
|
|
|
/** Rotation matrix for 270deg around y-axis */
|
|
|
- export const rotY270: ReadonlyMat4 = fromRotation(Mat4(), degToRad(270), yAxis);
|
|
|
+ export const rotY270: ReadonlyMat4 = fromRotation(zero(), degToRad(270), yAxis);
|
|
|
/** Rotation matrix for 90deg around z-axis */
|
|
|
- export const rotZ90: ReadonlyMat4 = fromRotation(Mat4(), degToRad(90), zAxis);
|
|
|
+ export const rotZ90: ReadonlyMat4 = fromRotation(zero(), degToRad(90), zAxis);
|
|
|
/** Rotation matrix for 180deg around z-axis */
|
|
|
- export const rotZ180: ReadonlyMat4 = fromRotation(Mat4(), degToRad(180), zAxis);
|
|
|
+ export const rotZ180: ReadonlyMat4 = fromRotation(zero(), degToRad(180), zAxis);
|
|
|
/** Rotation matrix for 90deg around first x-axis and then y-axis */
|
|
|
- export const rotXY90: ReadonlyMat4 = mul(Mat4(), rotX90, rotY90);
|
|
|
+ export const rotXY90: ReadonlyMat4 = mul(zero(), rotX90, rotY90);
|
|
|
/** Rotation matrix for 90deg around first z-axis and then y-axis */
|
|
|
- export const rotZY90: ReadonlyMat4 = mul(Mat4(), rotZ90, rotY90);
|
|
|
+ export const rotZY90: ReadonlyMat4 = mul(zero(), rotZ90, rotY90);
|
|
|
/** Rotation matrix for 90deg around first z-axis and then y-axis and then z-axis */
|
|
|
- export const rotZYZ90: ReadonlyMat4 = mul(Mat4(), rotZY90, rotZ90);
|
|
|
+ export const rotZYZ90: ReadonlyMat4 = mul(zero(), rotZY90, rotZ90);
|
|
|
/** Rotation matrix for 90deg around first z-axis and then 180deg around x-axis */
|
|
|
- export const rotZ90X180: ReadonlyMat4 = mul(Mat4(), rotZ90, rotX180);
|
|
|
+ export const rotZ90X180: ReadonlyMat4 = mul(zero(), rotZ90, rotX180);
|
|
|
/** Rotation matrix for 90deg around first y-axis and then 180deg around z-axis */
|
|
|
- export const rotY90Z180: ReadonlyMat4 = mul(Mat4(), rotY90, rotZ180);
|
|
|
+ export const rotY90Z180: ReadonlyMat4 = mul(zero(), rotY90, rotZ180);
|
|
|
|
|
|
/** Identity matrix */
|
|
|
export const id: ReadonlyMat4 = identity();
|