gl2d
Version:
2D graphics package for WebGL
1,033 lines • 36.5 kB
JavaScript
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var struct_1 = require("gulp-structify/struct");
var buffer_1 = require("gulp-structify/buffer");
var mixin_1 = require("gulp-structify/mixin");
/**
* A 4x4 matrix.
*/
var Mat4 = (function () {
/**
* A 4x4 matrix.
*/
function Mat4(c1r1, c1r2, c1r3, c1r4, c2r1, c2r2, c2r3, c2r4, c3r1, c3r2, c3r3, c3r4, c4r1, c4r2, c4r3, c4r4) {
if (c1r1 === void 0) { c1r1 = 0; }
if (c1r2 === void 0) { c1r2 = 0; }
if (c1r3 === void 0) { c1r3 = 0; }
if (c1r4 === void 0) { c1r4 = 0; }
if (c2r1 === void 0) { c2r1 = 0; }
if (c2r2 === void 0) { c2r2 = 0; }
if (c2r3 === void 0) { c2r3 = 0; }
if (c2r4 === void 0) { c2r4 = 0; }
if (c3r1 === void 0) { c3r1 = 0; }
if (c3r2 === void 0) { c3r2 = 0; }
if (c3r3 === void 0) { c3r3 = 0; }
if (c3r4 === void 0) { c3r4 = 0; }
if (c4r1 === void 0) { c4r1 = 0; }
if (c4r2 === void 0) { c4r2 = 0; }
if (c4r3 === void 0) { c4r3 = 0; }
if (c4r4 === void 0) { c4r4 = 0; }
this.c1r1 = c1r1;
this.c1r2 = c1r2;
this.c1r3 = c1r3;
this.c1r4 = c1r4;
this.c2r1 = c2r1;
this.c2r2 = c2r2;
this.c2r3 = c2r3;
this.c2r4 = c2r4;
this.c3r1 = c3r1;
this.c3r2 = c3r2;
this.c3r3 = c3r3;
this.c3r4 = c3r4;
this.c4r1 = c4r1;
this.c4r2 = c4r2;
this.c4r3 = c4r3;
this.c4r4 = c4r4;
}
Mat4.create = function (other) {
var mat4 = new Mat4();
mat4.set(other);
return mat4;
};
/**
* Sets this Mat4 to an othogonal transformation matrix given the
* dimensions of the near clipping plane as well as the
* near and far clipping plane distances.
* @param left left side of the near clipping plane viewport.
* @param right side of the near clipping plane viewport.
* @param top top of the near clipping plane viewport.
* @param bottom bottom of the near clipping plane viewport.
* @param near the depth (negative z coordinate) of the near clipping plane.
* @param far the depth (negative z coordinate) of the far clipping plane.
* @param dst where to store the result. Defaults to new Mat4.
* @returns the ortho matrix.
*/
Mat4.prototype.ortho = function (clip, near, far) {
this.ortho$(clip.left, clip.right, clip.bottom, clip.top, near, far);
};
/**
* Sets this Mat4 to an othogonal transformation matrix given the left, right,
* bottom, and top dimensions of the near clipping plane as well as the
* near and far clipping plane distances.
* @param left left side of the near clipping plane viewport.
* @param right side of the near clipping plane viewport.
* @param top top of the near clipping plane viewport.
* @param bottom bottom of the near clipping plane viewport.
* @param near the depth (negative z coordinate) of the near clipping plane.
* @param far the depth (negative z coordinate) of the far clipping plane.
* @param dst where to store the result. Defaults to new Mat4.
* @returns the ortho matrix.
*/
Mat4.prototype.ortho$ = function (left, right, bottom, top, near, far) {
var width = right - left, height = top - bottom, depth = near - far;
this.c1r1 = 2 / width;
this.c1r2 = 0;
this.c1r3 = 0;
this.c1r4 = 0;
this.c2r1 = 0;
this.c2r2 = 2 / height;
this.c2r3 = 0;
this.c2r4 = 0;
this.c3r1 = 0;
this.c3r2 = 0;
this.c3r3 = 1 / depth;
this.c3r4 = 0;
this.c4r1 = -(right + left) / width;
this.c4r2 = -(top + bottom) / height;
this.c4r3 = -near / depth;
this.c4r4 = 1;
};
/**
* Sets each component of this Mat4 to that of the other Mat4.
*/
Mat4.prototype.set = function (other) {
this.c1r1 = other.c1r1;
this.c1r2 = other.c1r2;
this.c1r3 = other.c1r3;
this.c1r4 = other.c1r4;
this.c2r1 = other.c2r1;
this.c2r2 = other.c2r2;
this.c2r3 = other.c2r3;
this.c2r4 = other.c2r4;
this.c3r1 = other.c3r1;
this.c3r2 = other.c3r2;
this.c3r3 = other.c3r3;
this.c3r4 = other.c3r4;
this.c4r1 = other.c4r1;
this.c4r2 = other.c4r2;
this.c4r3 = other.c4r3;
this.c4r4 = other.c4r4;
};
/**
* Sets each component of this Mat4.
*/
Mat4.prototype.set$ = function (c1r1, c1r2, c1r3, c1r4, c2r1, c2r2, c2r3, c2r4, c3r1, c3r2, c3r3, c3r4, c4r1, c4r2, c4r3, c4r4) {
this.c1r1 = c1r1;
this.c1r2 = c1r2;
this.c1r3 = c1r3;
this.c1r4 = c1r4;
this.c2r1 = c2r1;
this.c2r2 = c2r2;
this.c2r3 = c2r3;
this.c2r4 = c2r4;
this.c3r1 = c3r1;
this.c3r2 = c3r2;
this.c3r3 = c3r3;
this.c3r4 = c3r4;
this.c4r1 = c4r1;
this.c4r2 = c4r2;
this.c4r3 = c4r3;
this.c4r4 = c4r4;
};
/**
* Sets each component of this Mat4 to the specified scalar.
*/
Mat4.prototype.setScalar = function (k) {
this.c1r1 = k;
this.c1r2 = k;
this.c1r3 = k;
this.c1r4 = k;
this.c2r1 = k;
this.c2r2 = k;
this.c2r3 = k;
this.c2r4 = k;
this.c3r1 = k;
this.c3r2 = k;
this.c3r3 = k;
this.c3r4 = k;
this.c4r1 = k;
this.c4r2 = k;
this.c4r3 = k;
this.c4r4 = k;
};
/**
* Adds the other Mat4 to this Mat4 componentwise.
*/
Mat4.prototype.add = function (other) {
this.c1r1 += other.c1r1;
this.c1r2 += other.c1r2;
this.c1r3 += other.c1r3;
this.c1r4 += other.c1r4;
this.c2r1 += other.c2r1;
this.c2r2 += other.c2r2;
this.c2r3 += other.c2r3;
this.c2r4 += other.c2r4;
this.c3r1 += other.c3r1;
this.c3r2 += other.c3r2;
this.c3r3 += other.c3r3;
this.c3r4 += other.c3r4;
this.c4r1 += other.c4r1;
this.c4r2 += other.c4r2;
this.c4r3 += other.c4r3;
this.c4r4 += other.c4r4;
};
/**
* Adds the specified values to this Mat4 componentwise.
*/
Mat4.prototype.add$ = function (c1r1, c1r2, c1r3, c1r4, c2r1, c2r2, c2r3, c2r4, c3r1, c3r2, c3r3, c3r4, c4r1, c4r2, c4r3, c4r4) {
this.c1r1 += c1r1;
this.c1r2 += c1r2;
this.c1r3 += c1r3;
this.c1r4 += c1r4;
this.c2r1 += c2r1;
this.c2r2 += c2r2;
this.c2r3 += c2r3;
this.c2r4 += c2r4;
this.c3r1 += c3r1;
this.c3r2 += c3r2;
this.c3r3 += c3r3;
this.c3r4 += c3r4;
this.c4r1 += c4r1;
this.c4r2 += c4r2;
this.c4r3 += c4r3;
this.c4r4 += c4r4;
};
/**
* Subtracts the other Mat4 from this Mat4 componentwise.
*/
Mat4.prototype.subtract = function (other) {
this.c1r1 -= other.c1r1;
this.c1r2 -= other.c1r2;
this.c1r3 -= other.c1r3;
this.c1r4 -= other.c1r4;
this.c2r1 -= other.c2r1;
this.c2r2 -= other.c2r2;
this.c2r3 -= other.c2r3;
this.c2r4 -= other.c2r4;
this.c3r1 -= other.c3r1;
this.c3r2 -= other.c3r2;
this.c3r3 -= other.c3r3;
this.c3r4 -= other.c3r4;
this.c4r1 -= other.c4r1;
this.c4r2 -= other.c4r2;
this.c4r3 -= other.c4r3;
this.c4r4 -= other.c4r4;
};
/**
* Subtracts the specified values from this Mat4 componentwise.
*/
Mat4.prototype.subtract$ = function (c1r1, c1r2, c1r3, c1r4, c2r1, c2r2, c2r3, c2r4, c3r1, c3r2, c3r3, c3r4, c4r1, c4r2, c4r3, c4r4) {
this.c1r1 -= c1r1;
this.c1r2 -= c1r2;
this.c1r3 -= c1r3;
this.c1r4 -= c1r4;
this.c2r1 -= c2r1;
this.c2r2 -= c2r2;
this.c2r3 -= c2r3;
this.c2r4 -= c2r4;
this.c3r1 -= c3r1;
this.c3r2 -= c3r2;
this.c3r3 -= c3r3;
this.c3r4 -= c3r4;
this.c4r1 -= c4r1;
this.c4r2 -= c4r2;
this.c4r3 -= c4r3;
this.c4r4 -= c4r4;
};
/**
* Multiplies each component of this Mat4 by the specified scalar.
*/
Mat4.prototype.mulScalar = function (k) {
this.c1r1 *= k;
this.c1r2 *= k;
this.c1r3 *= k;
this.c1r4 *= k;
this.c2r1 *= k;
this.c2r2 *= k;
this.c2r3 *= k;
this.c2r4 *= k;
this.c3r1 *= k;
this.c3r2 *= k;
this.c3r3 *= k;
this.c3r4 *= k;
this.c4r1 *= k;
this.c4r2 *= k;
this.c4r3 *= k;
this.c4r4 *= k;
};
/**
* Divides each component of this Mat4 by the specified scalar.
*/
Mat4.prototype.divScalar = function (k) {
this.c1r1 /= k;
this.c1r2 /= k;
this.c1r3 /= k;
this.c1r4 /= k;
this.c2r1 /= k;
this.c2r2 /= k;
this.c2r3 /= k;
this.c2r4 /= k;
this.c3r1 /= k;
this.c3r2 /= k;
this.c3r3 /= k;
this.c3r4 /= k;
this.c4r1 /= k;
this.c4r2 /= k;
this.c4r3 /= k;
this.c4r4 /= k;
};
/**
* Checks if each component of this Mat4 is exactly equal to that of the other Mat4.
*/
Mat4.prototype.equals = function (other) {
return this.c1r1 === other.c1r1 && this.c1r2 === other.c1r2 && this.c1r3 === other.c1r3 && this.c1r4 === other.c1r4 && this.c2r1 === other.c2r1 && this.c2r2 === other.c2r2 && this.c2r3 === other.c2r3 && this.c2r4 === other.c2r4 && this.c3r1 === other.c3r1 && this.c3r2 === other.c3r2 && this.c3r3 === other.c3r3 && this.c3r4 === other.c3r4 && this.c4r1 === other.c4r1 && this.c4r2 === other.c4r2 && this.c4r3 === other.c4r3 && this.c4r4 === other.c4r4;
};
/**
* Checks if each component of this Mat4 is exactly equal to the specified scalar.
*/
Mat4.prototype.equalsScalar = function (k) {
return this.c1r1 === k && this.c1r2 === k && this.c1r3 === k && this.c1r4 === k && this.c2r1 === k && this.c2r2 === k && this.c2r3 === k && this.c2r4 === k && this.c3r1 === k && this.c3r2 === k && this.c3r3 === k && this.c3r4 === k && this.c4r1 === k && this.c4r2 === k && this.c4r3 === k && this.c4r4 === k;
};
/**
* Checks if each component of this Mat4 is approximately equal to that of the other Mat4.
*/
Mat4.prototype.epsilonEquals = function (other, e) {
return Math.abs(this.c1r1 - other.c1r1) <= e && Math.abs(this.c1r2 - other.c1r2) <= e && Math.abs(this.c1r3 - other.c1r3) <= e && Math.abs(this.c1r4 - other.c1r4) <= e && Math.abs(this.c2r1 - other.c2r1) <= e && Math.abs(this.c2r2 - other.c2r2) <= e && Math.abs(this.c2r3 - other.c2r3) <= e && Math.abs(this.c2r4 - other.c2r4) <= e && Math.abs(this.c3r1 - other.c3r1) <= e && Math.abs(this.c3r2 - other.c3r2) <= e && Math.abs(this.c3r3 - other.c3r3) <= e && Math.abs(this.c3r4 - other.c3r4) <= e && Math.abs(this.c4r1 - other.c4r1) <= e && Math.abs(this.c4r2 - other.c4r2) <= e && Math.abs(this.c4r3 - other.c4r3) <= e && Math.abs(this.c4r4 - other.c4r4) <= e;
};
/**
* Checks if each component of this Mat4 is approximately equal to the specified scalar.
*/
Mat4.prototype.epsilonEqualsScalar = function (k, e) {
return Math.abs(this.c1r1 - k) <= e && Math.abs(this.c1r2 - k) <= e && Math.abs(this.c1r3 - k) <= e && Math.abs(this.c1r4 - k) <= e && Math.abs(this.c2r1 - k) <= e && Math.abs(this.c2r2 - k) <= e && Math.abs(this.c2r3 - k) <= e && Math.abs(this.c2r4 - k) <= e && Math.abs(this.c3r1 - k) <= e && Math.abs(this.c3r2 - k) <= e && Math.abs(this.c3r3 - k) <= e && Math.abs(this.c3r4 - k) <= e && Math.abs(this.c4r1 - k) <= e && Math.abs(this.c4r2 - k) <= e && Math.abs(this.c4r3 - k) <= e && Math.abs(this.c4r4 - k) <= e;
};
/**
* Returns a string representation of this Mat4.
*/
Mat4.prototype.toString = function () {
return "{ c1r1: " + this.c1r1 + ", c1r2: " + this.c1r2 + ", c1r3: " + this.c1r3 + ", c1r4: " + this.c1r4 + ", c2r1: " + this.c2r1 + ", c2r2: " + this.c2r2 + ", c2r3: " + this.c2r3 + ", c2r4: " + this.c2r4 + ", c3r1: " + this.c3r1 + ", c3r2: " + this.c3r2 + ", c3r3: " + this.c3r3 + ", c3r4: " + this.c3r4 + ", c4r1: " + this.c4r1 + ", c4r2: " + this.c4r2 + ", c4r3: " + this.c4r3 + ", c4r4: " + this.c4r4 + " }";
};
return Mat4;
}());
exports.Mat4 = Mat4;
/**
* A Mat4 backed by a Float32Array.
*/
var Mat4Struct = (function (_super) {
__extends(Mat4Struct, _super);
/**
* Creates a Mat4 struct backed by the specified data.
*/
function Mat4Struct(data) {
if (data === void 0) { data = new Float32Array(16); }
return _super.call(this, data) || this;
}
Mat4Struct.create = function (other) {
var mat4 = new Mat4Struct();
mat4.set(other);
return mat4;
};
Mat4Struct.create$ = function (c1r1, c1r2, c1r3, c1r4, c2r1, c2r2, c2r3, c2r4, c3r1, c3r2, c3r3, c3r4, c4r1, c4r2, c4r3, c4r4) {
var mat4 = new Mat4Struct();
mat4.set$(c1r1, c1r2, c1r3, c1r4, c2r1, c2r2, c2r3, c2r4, c3r1, c3r2, c3r3, c3r4, c4r1, c4r2, c4r3, c4r4);
return mat4;
};
Object.defineProperty(Mat4Struct.prototype, "c1r1", {
/**
* The first entry in the first column of this Mat4.
*/
get: function () {
return this.data[0];
},
/**
* The first entry in the first column of this Mat4.
*/
set: function (value) {
this.data[0] = value;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Mat4Struct.prototype, "c1r2", {
/**
* The second entry in the first column of this Mat4.
*/
get: function () {
return this.data[1];
},
/**
* The second entry in the first column of this Mat4.
*/
set: function (value) {
this.data[1] = value;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Mat4Struct.prototype, "c1r3", {
/**
* The third entry in the first column of this Mat4.
*/
get: function () {
return this.data[2];
},
/**
* The third entry in the first column of this Mat4.
*/
set: function (value) {
this.data[2] = value;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Mat4Struct.prototype, "c1r4", {
/**
* The fourth entry in the first column of this Mat4.
*/
get: function () {
return this.data[3];
},
/**
* The fourth entry in the first column of this Mat4.
*/
set: function (value) {
this.data[3] = value;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Mat4Struct.prototype, "c2r1", {
/**
* The first entry in the second column of this Mat4.
*/
get: function () {
return this.data[4];
},
/**
* The first entry in the second column of this Mat4.
*/
set: function (value) {
this.data[4] = value;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Mat4Struct.prototype, "c2r2", {
/**
* The second entry in the second column of this Mat4.
*/
get: function () {
return this.data[5];
},
/**
* The second entry in the second column of this Mat4.
*/
set: function (value) {
this.data[5] = value;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Mat4Struct.prototype, "c2r3", {
/**
* The third entry in the second column of this Mat4.
*/
get: function () {
return this.data[6];
},
/**
* The third entry in the second column of this Mat4.
*/
set: function (value) {
this.data[6] = value;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Mat4Struct.prototype, "c2r4", {
/**
* The fourth entry in the second column of this Mat4.
*/
get: function () {
return this.data[7];
},
/**
* The fourth entry in the second column of this Mat4.
*/
set: function (value) {
this.data[7] = value;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Mat4Struct.prototype, "c3r1", {
/**
* The first entry in the third column of this Mat4.
*/
get: function () {
return this.data[8];
},
/**
* The first entry in the third column of this Mat4.
*/
set: function (value) {
this.data[8] = value;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Mat4Struct.prototype, "c3r2", {
/**
* The second entry in the third column of this Mat4.
*/
get: function () {
return this.data[9];
},
/**
* The second entry in the third column of this Mat4.
*/
set: function (value) {
this.data[9] = value;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Mat4Struct.prototype, "c3r3", {
/**
* The third entry in the third column of this Mat4.
*/
get: function () {
return this.data[10];
},
/**
* The third entry in the third column of this Mat4.
*/
set: function (value) {
this.data[10] = value;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Mat4Struct.prototype, "c3r4", {
/**
* The fourth entry in the third column of this Mat4.
*/
get: function () {
return this.data[11];
},
/**
* The fourth entry in the third column of this Mat4.
*/
set: function (value) {
this.data[11] = value;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Mat4Struct.prototype, "c4r1", {
/**
* The first entry in the fourth column of this Mat4.
*/
get: function () {
return this.data[12];
},
/**
* The first entry in the fourth column of this Mat4.
*/
set: function (value) {
this.data[12] = value;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Mat4Struct.prototype, "c4r2", {
/**
* The second entry in the fourth column of this Mat4.
*/
get: function () {
return this.data[13];
},
/**
* The second entry in the fourth column of this Mat4.
*/
set: function (value) {
this.data[13] = value;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Mat4Struct.prototype, "c4r3", {
/**
* The third entry in the fourth column of this Mat4.
*/
get: function () {
return this.data[14];
},
/**
* The third entry in the fourth column of this Mat4.
*/
set: function (value) {
this.data[14] = value;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Mat4Struct.prototype, "c4r4", {
/**
* The fourth entry in the fourth column of this Mat4.
*/
get: function () {
return this.data[15];
},
/**
* The fourth entry in the fourth column of this Mat4.
*/
set: function (value) {
this.data[15] = value;
},
enumerable: true,
configurable: true
});
return Mat4Struct;
}(struct_1.Struct));
exports.Mat4Struct = Mat4Struct;
mixin_1.applyMixins(Mat4Struct, Mat4);
/**
* A Mat4 buffer backed by a Float32Array.
*/
var Mat4Buffer = (function (_super) {
__extends(Mat4Buffer, _super);
function Mat4Buffer() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* Creates an empty Mat4 buffer with the specified Mat4 capacity.
*/
Mat4Buffer.create = function (capacity) {
return new Mat4Buffer(new Float32Array(capacity * 16));
};
Object.defineProperty(Mat4Buffer.prototype, "c1r1", {
/**
* The first entry in the first column of the current Mat4.
*/
get: function () {
return this.data[this.dataPosition + 0];
},
/**
* The first entry in the first column of the current Mat4.
*/
set: function (value) {
this.data[this.dataPosition + 0] = value;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Mat4Buffer.prototype, "c1r2", {
/**
* The second entry in the first column of the current Mat4.
*/
get: function () {
return this.data[this.dataPosition + 1];
},
/**
* The second entry in the first column of the current Mat4.
*/
set: function (value) {
this.data[this.dataPosition + 1] = value;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Mat4Buffer.prototype, "c1r3", {
/**
* The third entry in the first column of the current Mat4.
*/
get: function () {
return this.data[this.dataPosition + 2];
},
/**
* The third entry in the first column of the current Mat4.
*/
set: function (value) {
this.data[this.dataPosition + 2] = value;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Mat4Buffer.prototype, "c1r4", {
/**
* The fourth entry in the first column of the current Mat4.
*/
get: function () {
return this.data[this.dataPosition + 3];
},
/**
* The fourth entry in the first column of the current Mat4.
*/
set: function (value) {
this.data[this.dataPosition + 3] = value;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Mat4Buffer.prototype, "c2r1", {
/**
* The first entry in the second column of the current Mat4.
*/
get: function () {
return this.data[this.dataPosition + 4];
},
/**
* The first entry in the second column of the current Mat4.
*/
set: function (value) {
this.data[this.dataPosition + 4] = value;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Mat4Buffer.prototype, "c2r2", {
/**
* The second entry in the second column of the current Mat4.
*/
get: function () {
return this.data[this.dataPosition + 5];
},
/**
* The second entry in the second column of the current Mat4.
*/
set: function (value) {
this.data[this.dataPosition + 5] = value;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Mat4Buffer.prototype, "c2r3", {
/**
* The third entry in the second column of the current Mat4.
*/
get: function () {
return this.data[this.dataPosition + 6];
},
/**
* The third entry in the second column of the current Mat4.
*/
set: function (value) {
this.data[this.dataPosition + 6] = value;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Mat4Buffer.prototype, "c2r4", {
/**
* The fourth entry in the second column of the current Mat4.
*/
get: function () {
return this.data[this.dataPosition + 7];
},
/**
* The fourth entry in the second column of the current Mat4.
*/
set: function (value) {
this.data[this.dataPosition + 7] = value;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Mat4Buffer.prototype, "c3r1", {
/**
* The first entry in the third column of the current Mat4.
*/
get: function () {
return this.data[this.dataPosition + 8];
},
/**
* The first entry in the third column of the current Mat4.
*/
set: function (value) {
this.data[this.dataPosition + 8] = value;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Mat4Buffer.prototype, "c3r2", {
/**
* The second entry in the third column of the current Mat4.
*/
get: function () {
return this.data[this.dataPosition + 9];
},
/**
* The second entry in the third column of the current Mat4.
*/
set: function (value) {
this.data[this.dataPosition + 9] = value;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Mat4Buffer.prototype, "c3r3", {
/**
* The third entry in the third column of the current Mat4.
*/
get: function () {
return this.data[this.dataPosition + 10];
},
/**
* The third entry in the third column of the current Mat4.
*/
set: function (value) {
this.data[this.dataPosition + 10] = value;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Mat4Buffer.prototype, "c3r4", {
/**
* The fourth entry in the third column of the current Mat4.
*/
get: function () {
return this.data[this.dataPosition + 11];
},
/**
* The fourth entry in the third column of the current Mat4.
*/
set: function (value) {
this.data[this.dataPosition + 11] = value;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Mat4Buffer.prototype, "c4r1", {
/**
* The first entry in the fourth column of the current Mat4.
*/
get: function () {
return this.data[this.dataPosition + 12];
},
/**
* The first entry in the fourth column of the current Mat4.
*/
set: function (value) {
this.data[this.dataPosition + 12] = value;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Mat4Buffer.prototype, "c4r2", {
/**
* The second entry in the fourth column of the current Mat4.
*/
get: function () {
return this.data[this.dataPosition + 13];
},
/**
* The second entry in the fourth column of the current Mat4.
*/
set: function (value) {
this.data[this.dataPosition + 13] = value;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Mat4Buffer.prototype, "c4r3", {
/**
* The third entry in the fourth column of the current Mat4.
*/
get: function () {
return this.data[this.dataPosition + 14];
},
/**
* The third entry in the fourth column of the current Mat4.
*/
set: function (value) {
this.data[this.dataPosition + 14] = value;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Mat4Buffer.prototype, "c4r4", {
/**
* The fourth entry in the fourth column of the current Mat4.
*/
get: function () {
return this.data[this.dataPosition + 15];
},
/**
* The fourth entry in the fourth column of the current Mat4.
*/
set: function (value) {
this.data[this.dataPosition + 15] = value;
},
enumerable: true,
configurable: true
});
/**
* Gets the number of properties in a Mat4, namely 16.
*/
Mat4Buffer.prototype.structLength = function () {
return 16;
};
/**
* Gets the components of the Mat4 at the specified position of this buffer.
*/
Mat4Buffer.prototype.aget = function (position, dst) {
if (dst === void 0) {
dst = new Mat4();
}
;
var dataPos = position * this.structLength();
dst.c1r1 = this.data[dataPos++];
dst.c1r2 = this.data[dataPos++];
dst.c1r3 = this.data[dataPos++];
dst.c1r4 = this.data[dataPos++];
dst.c2r1 = this.data[dataPos++];
dst.c2r2 = this.data[dataPos++];
dst.c2r3 = this.data[dataPos++];
dst.c2r4 = this.data[dataPos++];
dst.c3r1 = this.data[dataPos++];
dst.c3r2 = this.data[dataPos++];
dst.c3r3 = this.data[dataPos++];
dst.c3r4 = this.data[dataPos++];
dst.c4r1 = this.data[dataPos++];
dst.c4r2 = this.data[dataPos++];
dst.c4r3 = this.data[dataPos++];
dst.c4r4 = this.data[dataPos++];
return dst;
};
/**
* Gets the components of the current Mat4, then moves to the next position of this buffer.
*/
Mat4Buffer.prototype.rget = function (dst) {
if (dst === void 0) {
dst = new Mat4();
}
;
dst.c1r1 = this.data[this.dataPosition++];
dst.c1r2 = this.data[this.dataPosition++];
dst.c1r3 = this.data[this.dataPosition++];
dst.c1r4 = this.data[this.dataPosition++];
dst.c2r1 = this.data[this.dataPosition++];
dst.c2r2 = this.data[this.dataPosition++];
dst.c2r3 = this.data[this.dataPosition++];
dst.c2r4 = this.data[this.dataPosition++];
dst.c3r1 = this.data[this.dataPosition++];
dst.c3r2 = this.data[this.dataPosition++];
dst.c3r3 = this.data[this.dataPosition++];
dst.c3r4 = this.data[this.dataPosition++];
dst.c4r1 = this.data[this.dataPosition++];
dst.c4r2 = this.data[this.dataPosition++];
dst.c4r3 = this.data[this.dataPosition++];
dst.c4r4 = this.data[this.dataPosition++];
return dst;
};
/**
* Sets each component of the Mat4 at the specified position to that of the src Mat4.
*/
Mat4Buffer.prototype.aset = function (position, src) {
var dataPos = position * this.structLength();
this.data[dataPos++] = src.c1r1;
this.data[dataPos++] = src.c1r2;
this.data[dataPos++] = src.c1r3;
this.data[dataPos++] = src.c1r4;
this.data[dataPos++] = src.c2r1;
this.data[dataPos++] = src.c2r2;
this.data[dataPos++] = src.c2r3;
this.data[dataPos++] = src.c2r4;
this.data[dataPos++] = src.c3r1;
this.data[dataPos++] = src.c3r2;
this.data[dataPos++] = src.c3r3;
this.data[dataPos++] = src.c3r4;
this.data[dataPos++] = src.c4r1;
this.data[dataPos++] = src.c4r2;
this.data[dataPos++] = src.c4r3;
this.data[dataPos++] = src.c4r4;
};
/**
* Sets each component of the Mat4 at the specified position.
*/
Mat4Buffer.prototype.aset$ = function (position, c1r1, c1r2, c1r3, c1r4, c2r1, c2r2, c2r3, c2r4, c3r1, c3r2, c3r3, c3r4, c4r1, c4r2, c4r3, c4r4) {
var dataPos = position * this.structLength();
this.data[dataPos++] = c1r1;
this.data[dataPos++] = c1r2;
this.data[dataPos++] = c1r3;
this.data[dataPos++] = c1r4;
this.data[dataPos++] = c2r1;
this.data[dataPos++] = c2r2;
this.data[dataPos++] = c2r3;
this.data[dataPos++] = c2r4;
this.data[dataPos++] = c3r1;
this.data[dataPos++] = c3r2;
this.data[dataPos++] = c3r3;
this.data[dataPos++] = c3r4;
this.data[dataPos++] = c4r1;
this.data[dataPos++] = c4r2;
this.data[dataPos++] = c4r3;
this.data[dataPos++] = c4r4;
};
/**
* Sets each component of the current Mat4 to that of the src Mat4, then moves to the next position of this buffer.
*/
Mat4Buffer.prototype.rset = function (src) {
this.data[this.dataPosition++] = src.c1r1;
this.data[this.dataPosition++] = src.c1r2;
this.data[this.dataPosition++] = src.c1r3;
this.data[this.dataPosition++] = src.c1r4;
this.data[this.dataPosition++] = src.c2r1;
this.data[this.dataPosition++] = src.c2r2;
this.data[this.dataPosition++] = src.c2r3;
this.data[this.dataPosition++] = src.c2r4;
this.data[this.dataPosition++] = src.c3r1;
this.data[this.dataPosition++] = src.c3r2;
this.data[this.dataPosition++] = src.c3r3;
this.data[this.dataPosition++] = src.c3r4;
this.data[this.dataPosition++] = src.c4r1;
this.data[this.dataPosition++] = src.c4r2;
this.data[this.dataPosition++] = src.c4r3;
this.data[this.dataPosition++] = src.c4r4;
};
/**
* Sets each component of the current Mat4, then moves to the next position of this buffer.
*/
Mat4Buffer.prototype.rset$ = function (c1r1, c1r2, c1r3, c1r4, c2r1, c2r2, c2r3, c2r4, c3r1, c3r2, c3r3, c3r4, c4r1, c4r2, c4r3, c4r4) {
this.data[this.dataPosition++] = c1r1;
this.data[this.dataPosition++] = c1r2;
this.data[this.dataPosition++] = c1r3;
this.data[this.dataPosition++] = c1r4;
this.data[this.dataPosition++] = c2r1;
this.data[this.dataPosition++] = c2r2;
this.data[this.dataPosition++] = c2r3;
this.data[this.dataPosition++] = c2r4;
this.data[this.dataPosition++] = c3r1;
this.data[this.dataPosition++] = c3r2;
this.data[this.dataPosition++] = c3r3;
this.data[this.dataPosition++] = c3r4;
this.data[this.dataPosition++] = c4r1;
this.data[this.dataPosition++] = c4r2;
this.data[this.dataPosition++] = c4r3;
this.data[this.dataPosition++] = c4r4;
};
return Mat4Buffer;
}(buffer_1.StructBuffer));
exports.Mat4Buffer = Mat4Buffer;
mixin_1.applyMixins(Mat4Buffer, Mat4);
//# sourceMappingURL=mat4.js.map