37 lines
586 B
JavaScript
37 lines
586 B
JavaScript
|
/**
|
||
|
* Matrix 3 Maths
|
||
|
* @param row0 R3.API.Vector3
|
||
|
* @param row1 R3.API.Vector3
|
||
|
* @param row2 R3.API.Vector3
|
||
|
* @constructor
|
||
|
*/
|
||
|
R3.Matrix3 = function(
|
||
|
row0,
|
||
|
row1,
|
||
|
row2
|
||
|
) {
|
||
|
this.identity();
|
||
|
|
||
|
if (row0) {
|
||
|
this.rows[0] = row0;
|
||
|
}
|
||
|
|
||
|
if (row1) {
|
||
|
this.rows[1] = row1;
|
||
|
}
|
||
|
|
||
|
if (row2) {
|
||
|
this.rows[2] = row2;
|
||
|
}
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* Set matrix to identity
|
||
|
*/
|
||
|
R3.Matrix3.prototype.identity = function () {
|
||
|
this.rows = [
|
||
|
new R3.API.Vector3(1, 0, 0),
|
||
|
new R3.API.Vector3(0, 1, 0),
|
||
|
new R3.API.Vector3(0, 0, 1)
|
||
|
];
|
||
|
};
|