First commit

This commit is contained in:
2021-03-07 05:58:59 +01:00
committed by Andreas Schaafsma
commit 5d4c4a054e
18475 changed files with 3309357 additions and 0 deletions

View File

@@ -0,0 +1,309 @@
// Class: lime.math.Matrix3
var $global = typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this
$global.Object.defineProperty(exports, "__esModule", {value: true});
var __map_reserved = {};
// Imports
var $hxClasses = require("./../../hxClasses_stub").default;
var $import = require("./../../import_stub").default;
function js__$Boot_HaxeError() {return require("./../../js/_Boot/HaxeError");}
function lime_math_Vector2() {return require("./../../lime/math/Vector2");}
function Std() {return require("./../../Std");}
// Constructor
var Matrix3 = function(a,b,c,d,tx,ty) {
if(ty == null) {
ty = 0;
}
if(tx == null) {
tx = 0;
}
if(d == null) {
d = 1;
}
if(c == null) {
c = 0;
}
if(b == null) {
b = 0;
}
if(a == null) {
a = 1;
}
this.a = a;
this.b = b;
this.c = c;
this.d = d;
this.tx = tx;
this.ty = ty;
}
// Meta
Matrix3.__name__ = ["lime","math","Matrix3"];
Matrix3.prototype = {
clone: function() {
return new Matrix3(this.a,this.b,this.c,this.d,this.tx,this.ty);
},
concat: function(m) {
var a1 = this.a * m.a + this.b * m.c;
this.b = this.a * m.b + this.b * m.d;
this.a = a1;
var c1 = this.c * m.a + this.d * m.c;
this.d = this.c * m.b + this.d * m.d;
this.c = c1;
var tx1 = this.tx * m.a + this.ty * m.c + m.tx;
this.ty = this.tx * m.b + this.ty * m.d + m.ty;
this.tx = tx1;
},
copyColumnFrom: function(column,vector4) {
if(column > 2) {
throw new (js__$Boot_HaxeError().default)("Column " + column + " out of bounds (2)");
} else if(column == 0) {
this.a = vector4.x;
this.c = vector4.y;
} else if(column == 1) {
this.b = vector4.x;
this.d = vector4.y;
} else {
this.tx = vector4.x;
this.ty = vector4.y;
}
},
copyColumnTo: function(column,vector4) {
if(column > 2) {
throw new (js__$Boot_HaxeError().default)("Column " + column + " out of bounds (2)");
} else if(column == 0) {
vector4.x = this.a;
vector4.y = this.c;
vector4.z = 0;
} else if(column == 1) {
vector4.x = this.b;
vector4.y = this.d;
vector4.z = 0;
} else {
vector4.x = this.tx;
vector4.y = this.ty;
vector4.z = 1;
}
},
copyFrom: function(sourceMatrix3) {
this.a = sourceMatrix3.a;
this.b = sourceMatrix3.b;
this.c = sourceMatrix3.c;
this.d = sourceMatrix3.d;
this.tx = sourceMatrix3.tx;
this.ty = sourceMatrix3.ty;
},
copyRowFrom: function(row,vector4) {
if(row > 2) {
throw new (js__$Boot_HaxeError().default)("Row " + row + " out of bounds (2)");
} else if(row == 0) {
this.a = vector4.x;
this.c = vector4.y;
} else if(row == 1) {
this.b = vector4.x;
this.d = vector4.y;
} else {
this.tx = vector4.x;
this.ty = vector4.y;
}
},
copyRowTo: function(row,vector4) {
if(row > 2) {
throw new (js__$Boot_HaxeError().default)("Row " + row + " out of bounds (2)");
} else if(row == 0) {
vector4.x = this.a;
vector4.y = this.b;
vector4.z = this.tx;
} else if(row == 1) {
vector4.x = this.c;
vector4.y = this.d;
vector4.z = this.ty;
} else {
vector4.setTo(0,0,1);
}
},
createBox: function(scaleX,scaleY,rotation,tx,ty) {
if(ty == null) {
ty = 0;
}
if(tx == null) {
tx = 0;
}
if(rotation == null) {
rotation = 0;
}
this.a = scaleX;
this.d = scaleY;
this.b = rotation;
this.tx = tx;
this.ty = ty;
},
createGradientBox: function(width,height,rotation,tx,ty) {
if(ty == null) {
ty = 0;
}
if(tx == null) {
tx = 0;
}
if(rotation == null) {
rotation = 0;
}
this.a = width / 1638.4;
this.d = height / 1638.4;
if(rotation != 0) {
var cos = Math.cos(rotation);
var sin = Math.sin(rotation);
this.b = sin * this.d;
this.c = -sin * this.a;
this.a *= cos;
this.d *= cos;
} else {
this.b = 0;
this.c = 0;
}
this.tx = tx + width / 2;
this.ty = ty + height / 2;
},
equals: function(Matrix3) {
if(Matrix3 != null && this.tx == Matrix3.tx && this.ty == Matrix3.ty && this.a == Matrix3.a && this.b == Matrix3.b && this.c == Matrix3.c) {
return this.d == Matrix3.d;
} else {
return false;
}
},
deltaTransformVector2: function(Vector2) {
return new (lime_math_Vector2().default)(Vector2.x * this.a + Vector2.y * this.c,Vector2.x * this.b + Vector2.y * this.d);
},
identity: function() {
this.a = 1;
this.b = 0;
this.c = 0;
this.d = 1;
this.tx = 0;
this.ty = 0;
},
invert: function() {
var norm = this.a * this.d - this.b * this.c;
if(norm == 0) {
this.a = this.b = this.c = this.d = 0;
this.tx = -this.tx;
this.ty = -this.ty;
} else {
norm = 1.0 / norm;
var a1 = this.d * norm;
this.d = this.a * norm;
this.a = a1;
this.b *= -norm;
this.c *= -norm;
var tx1 = -this.a * this.tx - this.c * this.ty;
this.ty = -this.b * this.tx - this.d * this.ty;
this.tx = tx1;
}
return this;
},
mult: function(m) {
var result = this.clone();
result.concat(m);
return result;
},
rotate: function(theta) {
var cos = Math.cos(theta);
var sin = Math.sin(theta);
var a1 = this.a * cos - this.b * sin;
this.b = this.a * sin + this.b * cos;
this.a = a1;
var c1 = this.c * cos - this.d * sin;
this.d = this.c * sin + this.d * cos;
this.c = c1;
var tx1 = this.tx * cos - this.ty * sin;
this.ty = this.tx * sin + this.ty * cos;
this.tx = tx1;
},
scale: function(sx,sy) {
this.a *= sx;
this.b *= sy;
this.c *= sx;
this.d *= sy;
this.tx *= sx;
this.ty *= sy;
},
setRotation: function(theta,scale) {
if(scale == null) {
scale = 1;
}
this.a = Math.cos(theta) * scale;
this.c = Math.sin(theta) * scale;
this.b = -this.c;
this.d = this.a;
},
setTo: function(a,b,c,d,tx,ty) {
this.a = a;
this.b = b;
this.c = c;
this.d = d;
this.tx = tx;
this.ty = ty;
},
to3DString: function(roundPixels) {
if(roundPixels == null) {
roundPixels = false;
}
if(roundPixels) {
return "Matrix33d(" + this.a + ", " + this.b + ", " + "0, 0, " + this.c + ", " + this.d + ", " + "0, 0, 0, 0, 1, 0, " + (Std().default)["int"](this.tx) + ", " + (Std().default)["int"](this.ty) + ", 0, 1)";
} else {
return "Matrix33d(" + this.a + ", " + this.b + ", " + "0, 0, " + this.c + ", " + this.d + ", " + "0, 0, 0, 0, 1, 0, " + this.tx + ", " + this.ty + ", 0, 1)";
}
},
toMozString: function() {
return "Matrix3(" + this.a + ", " + this.b + ", " + this.c + ", " + this.d + ", " + this.tx + "px, " + this.ty + "px)";
},
toString: function() {
return "Matrix3(" + this.a + ", " + this.b + ", " + this.c + ", " + this.d + ", " + this.tx + ", " + this.ty + ")";
},
transformVector2: function(pos) {
return new (lime_math_Vector2().default)(this.__transformX(pos),this.__transformY(pos));
},
translate: function(dx,dy) {
this.tx += dx;
this.ty += dy;
},
__cleanValues: function() {
this.a = Math.round(this.a * 1000) / 1000;
this.b = Math.round(this.b * 1000) / 1000;
this.c = Math.round(this.c * 1000) / 1000;
this.d = Math.round(this.d * 1000) / 1000;
this.tx = Math.round(this.tx * 10) / 10;
this.ty = Math.round(this.ty * 10) / 10;
},
__transformX: function(pos) {
return pos.x * this.a + pos.y * this.c + this.tx;
},
__transformY: function(pos) {
return pos.x * this.b + pos.y * this.d + this.ty;
},
__translateTransformed: function(pos) {
this.tx = this.__transformX(pos);
this.ty = this.__transformY(pos);
}
};
Matrix3.prototype.__class__ = $hxClasses["lime.math.Matrix3"] = Matrix3;
// Init
// Statics
Matrix3.__identity = new Matrix3()
// Export
exports.default = Matrix3;

View File

@@ -0,0 +1,307 @@
// Class: lime.math.Rectangle
var $global = typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this
$global.Object.defineProperty(exports, "__esModule", {value: true});
var __map_reserved = {};
// Imports
var $hxClasses = require("./../../hxClasses_stub").default;
var $import = require("./../../import_stub").default;
function lime_math_Vector2() {return require("./../../lime/math/Vector2");}
// Constructor
var Rectangle = function(x,y,width,height) {
if(height == null) {
height = 0;
}
if(width == null) {
width = 0;
}
if(y == null) {
y = 0;
}
if(x == null) {
x = 0;
}
this.x = x;
this.y = y;
this.width = width;
this.height = height;
}
// Meta
Rectangle.__name__ = ["lime","math","Rectangle"];
Rectangle.prototype = {
clone: function() {
return new Rectangle(this.x,this.y,this.width,this.height);
},
contains: function(x,y) {
if(x >= this.x && y >= this.y && x < this.get_right()) {
return y < this.get_bottom();
} else {
return false;
}
},
containsPoint: function(point) {
return this.contains(point.x,point.y);
},
containsRect: function(rect) {
if(rect.width <= 0 || rect.height <= 0) {
if(rect.x > this.x && rect.y > this.y && rect.get_right() < this.get_right()) {
return rect.get_bottom() < this.get_bottom();
} else {
return false;
}
} else if(rect.x >= this.x && rect.y >= this.y && rect.get_right() <= this.get_right()) {
return rect.get_bottom() <= this.get_bottom();
} else {
return false;
}
},
copyFrom: function(sourceRect) {
this.x = sourceRect.x;
this.y = sourceRect.y;
this.width = sourceRect.width;
this.height = sourceRect.height;
},
equals: function(toCompare) {
if(toCompare != null && this.x == toCompare.x && this.y == toCompare.y && this.width == toCompare.width) {
return this.height == toCompare.height;
} else {
return false;
}
},
inflate: function(dx,dy) {
this.x -= dx;
this.width += dx * 2;
this.y -= dy;
this.height += dy * 2;
},
inflatePoint: function(point) {
this.inflate(point.x,point.y);
},
intersection: function(toIntersect) {
var x0 = this.x < toIntersect.x ? toIntersect.x : this.x;
var x1 = this.get_right() > toIntersect.get_right() ? toIntersect.get_right() : this.get_right();
if(x1 <= x0) {
return new Rectangle();
}
var y0 = this.y < toIntersect.y ? toIntersect.y : this.y;
var y1 = this.get_bottom() > toIntersect.get_bottom() ? toIntersect.get_bottom() : this.get_bottom();
if(y1 <= y0) {
return new Rectangle();
}
return new Rectangle(x0,y0,x1 - x0,y1 - y0);
},
intersects: function(toIntersect) {
var x0 = this.x < toIntersect.x ? toIntersect.x : this.x;
var x1 = this.get_right() > toIntersect.get_right() ? toIntersect.get_right() : this.get_right();
if(x1 <= x0) {
return false;
}
var y0 = this.y < toIntersect.y ? toIntersect.y : this.y;
var y1 = this.get_bottom() > toIntersect.get_bottom() ? toIntersect.get_bottom() : this.get_bottom();
return y1 > y0;
},
isEmpty: function() {
if(!(this.width <= 0)) {
return this.height <= 0;
} else {
return true;
}
},
offset: function(dx,dy) {
this.x += dx;
this.y += dy;
},
offsetPoint: function(point) {
this.x += point.x;
this.y += point.y;
},
setEmpty: function() {
this.x = this.y = this.width = this.height = 0;
},
setTo: function(xa,ya,widtha,heighta) {
this.x = xa;
this.y = ya;
this.width = widtha;
this.height = heighta;
},
transform: function(m) {
var tx0 = m.a * this.x + m.c * this.y;
var tx1 = tx0;
var ty0 = m.b * this.x + m.d * this.y;
var ty1 = ty0;
var tx = m.a * (this.x + this.width) + m.c * this.y;
var ty = m.b * (this.x + this.width) + m.d * this.y;
if(tx < tx0) {
tx0 = tx;
}
if(ty < ty0) {
ty0 = ty;
}
if(tx > tx1) {
tx1 = tx;
}
if(ty > ty1) {
ty1 = ty;
}
tx = m.a * (this.x + this.width) + m.c * (this.y + this.height);
ty = m.b * (this.x + this.width) + m.d * (this.y + this.height);
if(tx < tx0) {
tx0 = tx;
}
if(ty < ty0) {
ty0 = ty;
}
if(tx > tx1) {
tx1 = tx;
}
if(ty > ty1) {
ty1 = ty;
}
tx = m.a * this.x + m.c * (this.y + this.height);
ty = m.b * this.x + m.d * (this.y + this.height);
if(tx < tx0) {
tx0 = tx;
}
if(ty < ty0) {
ty0 = ty;
}
if(tx > tx1) {
tx1 = tx;
}
if(ty > ty1) {
ty1 = ty;
}
return new Rectangle(tx0 + m.tx,ty0 + m.ty,tx1 - tx0,ty1 - ty0);
},
union: function(toUnion) {
if(this.width == 0 || this.height == 0) {
return toUnion.clone();
} else if(toUnion.width == 0 || toUnion.height == 0) {
return this.clone();
}
var x0 = this.x > toUnion.x ? toUnion.x : this.x;
var x1 = this.get_right() < toUnion.get_right() ? toUnion.get_right() : this.get_right();
var y0 = this.y > toUnion.y ? toUnion.y : this.y;
var y1 = this.get_bottom() < toUnion.get_bottom() ? toUnion.get_bottom() : this.get_bottom();
return new Rectangle(x0,y0,x1 - x0,y1 - y0);
},
__contract: function(x,y,width,height) {
if(this.width == 0 && this.height == 0) {
return;
}
if(this.x < x) {
this.x = x;
}
if(this.y < y) {
this.y = y;
}
if(this.get_right() > x + width) {
this.width = x + width - this.x;
}
if(this.get_bottom() > y + height) {
this.height = y + height - this.y;
}
},
__expand: function(x,y,width,height) {
if(this.width == 0 && this.height == 0) {
this.x = x;
this.y = y;
this.width = width;
this.height = height;
return;
}
var cacheRight = this.get_right();
var cacheBottom = this.get_bottom();
if(this.x > x) {
this.x = x;
}
if(this.y > y) {
this.y = y;
}
if(cacheRight < x + width) {
this.width = x + width - this.x;
}
if(cacheBottom < y + height) {
this.height = y + height - this.y;
}
},
__toFlashRectangle: function() {
return null;
},
get_bottom: function() {
return this.y + this.height;
},
set_bottom: function(b) {
this.height = b - this.y;
return b;
},
get_bottomRight: function() {
return new (lime_math_Vector2().default)(this.x + this.width,this.y + this.height);
},
set_bottomRight: function(p) {
this.width = p.x - this.x;
this.height = p.y - this.y;
return p.clone();
},
get_left: function() {
return this.x;
},
set_left: function(l) {
this.width -= l - this.x;
this.x = l;
return l;
},
get_right: function() {
return this.x + this.width;
},
set_right: function(r) {
this.width = r - this.x;
return r;
},
get_size: function() {
return new (lime_math_Vector2().default)(this.width,this.height);
},
set_size: function(p) {
this.width = p.x;
this.height = p.y;
return p.clone();
},
get_top: function() {
return this.y;
},
set_top: function(t) {
this.height -= t - this.y;
this.y = t;
return t;
},
get_topLeft: function() {
return new (lime_math_Vector2().default)(this.x,this.y);
},
set_topLeft: function(p) {
this.x = p.x;
this.y = p.y;
return p.clone();
}
};
Rectangle.prototype.__class__ = $hxClasses["lime.math.Rectangle"] = Rectangle;
// Init
// Statics
// Export
exports.default = Rectangle;

View File

@@ -0,0 +1,94 @@
// Class: lime.math.Vector2
var $global = typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this
$global.Object.defineProperty(exports, "__esModule", {value: true});
var __map_reserved = {};
// Imports
var $hxClasses = require("./../../hxClasses_stub").default;
var $import = require("./../../import_stub").default;
// Constructor
var Vector2 = function(x,y) {
if(y == null) {
y = 0;
}
if(x == null) {
x = 0;
}
this.x = x;
this.y = y;
}
// Meta
Vector2.__name__ = ["lime","math","Vector2"];
Vector2.prototype = {
add: function(v) {
return new Vector2(v.x + this.x,v.y + this.y);
},
clone: function() {
return new Vector2(this.x,this.y);
},
equals: function(toCompare) {
if(toCompare != null && toCompare.x == this.x) {
return toCompare.y == this.y;
} else {
return false;
}
},
normalize: function(thickness) {
if(this.x == 0 && this.y == 0) {
return;
} else {
var norm = thickness / Math.sqrt(this.x * this.x + this.y * this.y);
this.x *= norm;
this.y *= norm;
}
},
offset: function(dx,dy) {
this.x += dx;
this.y += dy;
},
setTo: function(xa,ya) {
this.x = xa;
this.y = ya;
},
subtract: function(v) {
return new Vector2(this.x - v.x,this.y - v.y);
},
__toFlashPoint: function() {
return null;
},
get_length: function() {
return Math.sqrt(this.x * this.x + this.y * this.y);
}
};
Vector2.prototype.__class__ = $hxClasses["lime.math.Vector2"] = Vector2;
// Init
// Statics
Vector2.distance = function(pt1,pt2) {
var dx = pt1.x - pt2.x;
var dy = pt1.y - pt2.y;
return Math.sqrt(dx * dx + dy * dy);
}
Vector2.interpolate = function(pt1,pt2,f) {
return new Vector2(pt2.x + f * (pt1.x - pt2.x),pt2.y + f * (pt1.y - pt2.y));
}
Vector2.polar = function(len,angle) {
return new Vector2(len * Math.cos(angle),len * Math.sin(angle));
}
// Export
exports.default = Vector2;

View File

@@ -0,0 +1,170 @@
// Class: lime.math.Vector4
var $global = typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this
$global.Object.defineProperty(exports, "__esModule", {value: true});
var __map_reserved = {};
// Imports
var $hxClasses = require("./../../hxClasses_stub").default;
var $import = require("./../../import_stub").default;
// Constructor
var Vector4 = function(x,y,z,w) {
if(w == null) {
w = 0.;
}
if(z == null) {
z = 0.;
}
if(y == null) {
y = 0.;
}
if(x == null) {
x = 0.;
}
this.w = w;
this.x = x;
this.y = y;
this.z = z;
}
// Meta
Vector4.__name__ = ["lime","math","Vector4"];
Vector4.prototype = {
add: function(a) {
return new Vector4(this.x + a.x,this.y + a.y,this.z + a.z);
},
clone: function() {
return new Vector4(this.x,this.y,this.z,this.w);
},
copyFrom: function(sourceVector4) {
this.x = sourceVector4.x;
this.y = sourceVector4.y;
this.z = sourceVector4.z;
},
crossProduct: function(a) {
return new Vector4(this.y * a.z - this.z * a.y,this.z * a.x - this.x * a.z,this.x * a.y - this.y * a.x,1);
},
decrementBy: function(a) {
this.x -= a.x;
this.y -= a.y;
this.z -= a.z;
},
dotProduct: function(a) {
return this.x * a.x + this.y * a.y + this.z * a.z;
},
equals: function(toCompare,allFour) {
if(allFour == null) {
allFour = false;
}
if(this.x == toCompare.x && this.y == toCompare.y && this.z == toCompare.z) {
if(!(!allFour)) {
return this.w == toCompare.w;
} else {
return true;
}
} else {
return false;
}
},
incrementBy: function(a) {
this.x += a.x;
this.y += a.y;
this.z += a.z;
},
nearEquals: function(toCompare,tolerance,allFour) {
if(allFour == null) {
allFour = false;
}
if(Math.abs(this.x - toCompare.x) < tolerance && Math.abs(this.y - toCompare.y) < tolerance && Math.abs(this.z - toCompare.z) < tolerance) {
if(!(!allFour)) {
return Math.abs(this.w - toCompare.w) < tolerance;
} else {
return true;
}
} else {
return false;
}
},
negate: function() {
this.x *= -1;
this.y *= -1;
this.z *= -1;
},
normalize: function() {
var l = this.get_length();
if(l != 0) {
this.x /= l;
this.y /= l;
this.z /= l;
}
return l;
},
project: function() {
this.x /= this.w;
this.y /= this.w;
this.z /= this.w;
},
scaleBy: function(s) {
this.x *= s;
this.y *= s;
this.z *= s;
},
setTo: function(xa,ya,za) {
this.x = xa;
this.y = ya;
this.z = za;
},
subtract: function(a) {
return new Vector4(this.x - a.x,this.y - a.y,this.z - a.z);
},
toString: function() {
return "Vector4(" + this.x + ", " + this.y + ", " + this.z + ")";
},
get_length: function() {
return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z);
},
get_lengthSquared: function() {
return this.x * this.x + this.y * this.y + this.z * this.z;
}
};
Vector4.prototype.__class__ = $hxClasses["lime.math.Vector4"] = Vector4;
// Init
// Statics
Vector4.angleBetween = function(a,b) {
var a0 = a.clone();
a0.normalize();
var b0 = b.clone();
b0.normalize();
return Math.acos(a0.dotProduct(b0));
}
Vector4.distance = function(pt1,pt2) {
var x = pt2.x - pt1.x;
var y = pt2.y - pt1.y;
var z = pt2.z - pt1.z;
return Math.sqrt(x * x + y * y + z * z);
}
Vector4.get_X_AXIS = function() {
return new Vector4(1,0,0);
}
Vector4.get_Y_AXIS = function() {
return new Vector4(0,1,0);
}
Vector4.get_Z_AXIS = function() {
return new Vector4(0,0,1);
}
// Export
exports.default = Vector4;

View File

@@ -0,0 +1,247 @@
// Class: lime.math._ColorMatrix.ColorMatrix_Impl_
var $global = typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this
$global.Object.defineProperty(exports, "__esModule", {value: true});
var __map_reserved = {};
// Imports
var $hxClasses = require("./../../../hxClasses_stub").default;
var $import = require("./../../../import_stub").default;
function Std() {return require("./../../../Std");}
// Constructor
var ColorMatrix_Impl_ = function(){}
// Meta
ColorMatrix_Impl_.__name__ = ["lime","math","_ColorMatrix","ColorMatrix_Impl_"];
ColorMatrix_Impl_.prototype = {
};
ColorMatrix_Impl_.prototype.__class__ = $hxClasses["lime.math._ColorMatrix.ColorMatrix_Impl_"] = ColorMatrix_Impl_;
// Init
// Statics
ColorMatrix_Impl_._new = function(data) {
var this1;
if(data != null && data.length == 20) {
this1 = data;
} else {
var array = ColorMatrix_Impl_.__identity;
var this2;
if(array != null) {
this2 = new Float32Array(array);
} else {
this2 = null;
}
this1 = this2;
}
return this1;
}
ColorMatrix_Impl_.clone = function(this1) {
var this2;
if(this1 != null) {
this2 = new Float32Array(this1);
} else {
this2 = null;
}
return ColorMatrix_Impl_._new(this2);
}
ColorMatrix_Impl_.concat = function(this1,second) {
var _g = this1;
_g[0] += second[0];
var _g1 = this1;
_g1[6] += second[6];
var _g2 = this1;
_g2[12] += second[12];
var _g3 = this1;
_g3[18] += second[18];
}
ColorMatrix_Impl_.copyFrom = function(this1,other) {
this1.set(other);
}
ColorMatrix_Impl_.identity = function(this1) {
this1[0] = 1;
this1[1] = 0;
this1[2] = 0;
this1[3] = 0;
this1[4] = 0;
this1[5] = 0;
this1[6] = 1;
this1[7] = 0;
this1[8] = 0;
this1[9] = 0;
this1[10] = 0;
this1[11] = 0;
this1[12] = 1;
this1[13] = 0;
this1[14] = 0;
this1[15] = 0;
this1[16] = 0;
this1[17] = 0;
this1[18] = 1;
this1[19] = 0;
}
ColorMatrix_Impl_.getAlphaTable = function(this1) {
if(ColorMatrix_Impl_.__alphaTable == null) {
var this2 = new Uint8Array(256);
ColorMatrix_Impl_.__alphaTable = this2;
}
var value;
ColorMatrix_Impl_.__alphaTable[0] = 0;
var _g = 1;
while(_g < 256) {
var i = _g++;
value = Math.floor(i * this1[18] + this1[19] * 255);
if(value > 255) {
value = 255;
}
if(value < 0) {
value = 0;
}
ColorMatrix_Impl_.__alphaTable[i] = value;
}
return ColorMatrix_Impl_.__alphaTable;
}
ColorMatrix_Impl_.getBlueTable = function(this1) {
if(ColorMatrix_Impl_.__blueTable == null) {
var this2 = new Uint8Array(256);
ColorMatrix_Impl_.__blueTable = this2;
}
var value;
var _g = 0;
while(_g < 256) {
var i = _g++;
value = Math.floor(i * this1[12] + this1[14] * 255);
if(value > 255) {
value = 255;
}
if(value < 0) {
value = 0;
}
ColorMatrix_Impl_.__blueTable[i] = value;
}
return ColorMatrix_Impl_.__blueTable;
}
ColorMatrix_Impl_.getGreenTable = function(this1) {
if(ColorMatrix_Impl_.__greenTable == null) {
var this2 = new Uint8Array(256);
ColorMatrix_Impl_.__greenTable = this2;
}
var value;
var _g = 0;
while(_g < 256) {
var i = _g++;
value = Math.floor(i * this1[6] + this1[9] * 255);
if(value > 255) {
value = 255;
}
if(value < 0) {
value = 0;
}
ColorMatrix_Impl_.__greenTable[i] = value;
}
return ColorMatrix_Impl_.__greenTable;
}
ColorMatrix_Impl_.getRedTable = function(this1) {
if(ColorMatrix_Impl_.__redTable == null) {
var this2 = new Uint8Array(256);
ColorMatrix_Impl_.__redTable = this2;
}
var value;
var _g = 0;
while(_g < 256) {
var i = _g++;
value = Math.floor(i * this1[0] + this1[4] * 255);
if(value > 255) {
value = 255;
}
if(value < 0) {
value = 0;
}
ColorMatrix_Impl_.__redTable[i] = value;
}
return ColorMatrix_Impl_.__redTable;
}
ColorMatrix_Impl_.__toFlashColorTransform = function(this1) {
return null;
}
ColorMatrix_Impl_.get_alphaMultiplier = function(this1) {
return this1[18];
}
ColorMatrix_Impl_.set_alphaMultiplier = function(this1,value) {
return this1[18] = value;
}
ColorMatrix_Impl_.get_alphaOffset = function(this1) {
return this1[19] * 255;
}
ColorMatrix_Impl_.set_alphaOffset = function(this1,value) {
return this1[19] = value / 255;
}
ColorMatrix_Impl_.get_blueMultiplier = function(this1) {
return this1[12];
}
ColorMatrix_Impl_.set_blueMultiplier = function(this1,value) {
return this1[12] = value;
}
ColorMatrix_Impl_.get_blueOffset = function(this1) {
return this1[14] * 255;
}
ColorMatrix_Impl_.set_blueOffset = function(this1,value) {
return this1[14] = value / 255;
}
ColorMatrix_Impl_.get_color = function(this1) {
return (Std().default)["int"](this1[4] * 255) << 16 | (Std().default)["int"](this1[9] * 255) << 8 | (Std().default)["int"](this1[14] * 255);
}
ColorMatrix_Impl_.set_color = function(this1,value) {
this1[4] = (value >> 16 & 255) / 255;
this1[9] = (value >> 8 & 255) / 255;
this1[14] = (value & 255) / 255;
this1[0] = 0;
this1[6] = 0;
this1[12] = 0;
return ColorMatrix_Impl_.get_color(this1);
}
ColorMatrix_Impl_.get_greenMultiplier = function(this1) {
return this1[6];
}
ColorMatrix_Impl_.set_greenMultiplier = function(this1,value) {
return this1[6] = value;
}
ColorMatrix_Impl_.get_greenOffset = function(this1) {
return this1[9] * 255;
}
ColorMatrix_Impl_.set_greenOffset = function(this1,value) {
return this1[9] = value / 255;
}
ColorMatrix_Impl_.get_redMultiplier = function(this1) {
return this1[0];
}
ColorMatrix_Impl_.set_redMultiplier = function(this1,value) {
return this1[0] = value;
}
ColorMatrix_Impl_.get_redOffset = function(this1) {
return this1[4] * 255;
}
ColorMatrix_Impl_.set_redOffset = function(this1,value) {
return this1[4] = value / 255;
}
ColorMatrix_Impl_.get = function(this1,index) {
return this1[index];
}
ColorMatrix_Impl_.set = function(this1,index,value) {
return this1[index] = value;
}
ColorMatrix_Impl_.__identity = [1.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0]
// Export
exports.default = ColorMatrix_Impl_;

View File

@@ -0,0 +1,642 @@
// Class: lime.math._Matrix4.Matrix4_Impl_
var $global = typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this
$global.Object.defineProperty(exports, "__esModule", {value: true});
var __map_reserved = {};
// Imports
var $hxClasses = require("./../../../hxClasses_stub").default;
var $import = require("./../../../import_stub").default;
function lime_utils_Log() {return require("./../../../lime/utils/Log");}
function js_Boot() {return require("./../../../js/Boot");}
function lime_math_Vector4() {return require("./../../../lime/math/Vector4");}
// Constructor
var Matrix4_Impl_ = function(){}
// Meta
Matrix4_Impl_.__name__ = ["lime","math","_Matrix4","Matrix4_Impl_"];
Matrix4_Impl_.prototype = {
};
Matrix4_Impl_.prototype.__class__ = $hxClasses["lime.math._Matrix4.Matrix4_Impl_"] = Matrix4_Impl_;
// Init
// Statics
Matrix4_Impl_._new = function(data) {
var this1;
if(data != null && data.length == 16) {
this1 = data;
} else {
var array = Matrix4_Impl_.__identity;
var this2;
if(array != null) {
this2 = new Float32Array(array);
} else {
this2 = null;
}
this1 = this2;
}
return this1;
}
Matrix4_Impl_.append = function(this1,lhs) {
var m111 = this1[0];
var m121 = this1[4];
var m131 = this1[8];
var m141 = this1[12];
var m112 = this1[1];
var m122 = this1[5];
var m132 = this1[9];
var m142 = this1[13];
var m113 = this1[2];
var m123 = this1[6];
var m133 = this1[10];
var m143 = this1[14];
var m114 = this1[3];
var m124 = this1[7];
var m134 = this1[11];
var m144 = this1[15];
var m211 = Matrix4_Impl_.get(lhs,0);
var m221 = Matrix4_Impl_.get(lhs,4);
var m231 = Matrix4_Impl_.get(lhs,8);
var m241 = Matrix4_Impl_.get(lhs,12);
var m212 = Matrix4_Impl_.get(lhs,1);
var m222 = Matrix4_Impl_.get(lhs,5);
var m232 = Matrix4_Impl_.get(lhs,9);
var m242 = Matrix4_Impl_.get(lhs,13);
var m213 = Matrix4_Impl_.get(lhs,2);
var m223 = Matrix4_Impl_.get(lhs,6);
var m233 = Matrix4_Impl_.get(lhs,10);
var m243 = Matrix4_Impl_.get(lhs,14);
var m214 = Matrix4_Impl_.get(lhs,3);
var m224 = Matrix4_Impl_.get(lhs,7);
var m234 = Matrix4_Impl_.get(lhs,11);
var m244 = Matrix4_Impl_.get(lhs,15);
this1[0] = m111 * m211 + m112 * m221 + m113 * m231 + m114 * m241;
this1[1] = m111 * m212 + m112 * m222 + m113 * m232 + m114 * m242;
this1[2] = m111 * m213 + m112 * m223 + m113 * m233 + m114 * m243;
this1[3] = m111 * m214 + m112 * m224 + m113 * m234 + m114 * m244;
this1[4] = m121 * m211 + m122 * m221 + m123 * m231 + m124 * m241;
this1[5] = m121 * m212 + m122 * m222 + m123 * m232 + m124 * m242;
this1[6] = m121 * m213 + m122 * m223 + m123 * m233 + m124 * m243;
this1[7] = m121 * m214 + m122 * m224 + m123 * m234 + m124 * m244;
this1[8] = m131 * m211 + m132 * m221 + m133 * m231 + m134 * m241;
this1[9] = m131 * m212 + m132 * m222 + m133 * m232 + m134 * m242;
this1[10] = m131 * m213 + m132 * m223 + m133 * m233 + m134 * m243;
this1[11] = m131 * m214 + m132 * m224 + m133 * m234 + m134 * m244;
this1[12] = m141 * m211 + m142 * m221 + m143 * m231 + m144 * m241;
this1[13] = m141 * m212 + m142 * m222 + m143 * m232 + m144 * m242;
this1[14] = m141 * m213 + m142 * m223 + m143 * m233 + m144 * m243;
this1[15] = m141 * m214 + m142 * m224 + m143 * m234 + m144 * m244;
}
Matrix4_Impl_.appendRotation = function(this1,degrees,axis,pivotPoint) {
var m = Matrix4_Impl_.__getAxisRotation(this1,axis.x,axis.y,axis.z,degrees);
if(pivotPoint != null) {
var p = pivotPoint;
Matrix4_Impl_.appendTranslation(m,p.x,p.y,p.z);
}
Matrix4_Impl_.append(this1,m);
}
Matrix4_Impl_.appendScale = function(this1,xScale,yScale,zScale) {
var array = [xScale,0.0,0.0,0.0,0.0,yScale,0.0,0.0,0.0,0.0,zScale,0.0,0.0,0.0,0.0,1.0];
var this2;
if(array != null) {
this2 = new Float32Array(array);
} else {
this2 = null;
}
Matrix4_Impl_.append(this1,Matrix4_Impl_._new(this2));
}
Matrix4_Impl_.appendTranslation = function(this1,x,y,z) {
this1[12] += x;
this1[13] += y;
this1[14] += z;
}
Matrix4_Impl_.clone = function(this1) {
var this2;
if(this1 != null) {
this2 = new Float32Array(this1);
} else {
this2 = null;
}
return Matrix4_Impl_._new(this2);
}
Matrix4_Impl_.copyColumnFrom = function(this1,column,vector) {
switch(column) {
case 0:
this1[0] = vector.x;
this1[1] = vector.y;
this1[2] = vector.z;
this1[3] = vector.w;
break;
case 1:
this1[4] = vector.x;
this1[5] = vector.y;
this1[6] = vector.z;
this1[7] = vector.w;
break;
case 2:
this1[8] = vector.x;
this1[9] = vector.y;
this1[10] = vector.z;
this1[11] = vector.w;
break;
case 3:
this1[12] = vector.x;
this1[13] = vector.y;
this1[14] = vector.z;
this1[15] = vector.w;
break;
default:
(lime_utils_Log().default).error("Column " + column + " out of bounds [0, ..., 3]",{ fileName : "Matrix4.hx", lineNumber : 139, className : "lime.math._Matrix4.Matrix4_Impl_", methodName : "copyColumnFrom"});
}
}
Matrix4_Impl_.copyColumnTo = function(this1,column,vector) {
switch(column) {
case 0:
vector.x = this1[0];
vector.y = this1[1];
vector.z = this1[2];
vector.w = this1[3];
break;
case 1:
vector.x = this1[4];
vector.y = this1[5];
vector.z = this1[6];
vector.w = this1[7];
break;
case 2:
vector.x = this1[8];
vector.y = this1[9];
vector.z = this1[10];
vector.w = this1[11];
break;
case 3:
vector.x = this1[12];
vector.y = this1[13];
vector.z = this1[14];
vector.w = this1[15];
break;
default:
(lime_utils_Log().default).error("Column " + column + " out of bounds [0, ..., 3]",{ fileName : "Matrix4.hx", lineNumber : 180, className : "lime.math._Matrix4.Matrix4_Impl_", methodName : "copyColumnTo"});
}
}
Matrix4_Impl_.copyFrom = function(this1,other) {
this1.set(other);
}
Matrix4_Impl_.copythisFrom = function(this1,array,index,transposeValues) {
if(transposeValues == null) {
transposeValues = false;
}
if(index == null) {
index = 0;
}
if(transposeValues) {
Matrix4_Impl_.transpose(this1);
}
var l = array.length - index;
var _g1 = 0;
var _g = l;
while(_g1 < _g) {
var c = _g1++;
this1[c] = array[c + index];
}
if(transposeValues) {
Matrix4_Impl_.transpose(this1);
}
}
Matrix4_Impl_.copythisTo = function(this1,array,index,transposeValues) {
if(transposeValues == null) {
transposeValues = false;
}
if(index == null) {
index = 0;
}
if(transposeValues) {
Matrix4_Impl_.transpose(this1);
}
var l = this1.length;
var _g1 = 0;
var _g = l;
while(_g1 < _g) {
var c = _g1++;
array[c + index] = this1[c];
}
if(transposeValues) {
Matrix4_Impl_.transpose(this1);
}
}
Matrix4_Impl_.copyRowFrom = function(this1,row,vector) {
switch(row) {
case 0:
this1[0] = vector.x;
this1[4] = vector.y;
this1[8] = vector.z;
this1[12] = vector.w;
break;
case 1:
this1[1] = vector.x;
this1[5] = vector.y;
this1[9] = vector.z;
this1[13] = vector.w;
break;
case 2:
this1[2] = vector.x;
this1[6] = vector.y;
this1[10] = vector.z;
this1[14] = vector.w;
break;
case 3:
this1[3] = vector.x;
this1[7] = vector.y;
this1[11] = vector.z;
this1[15] = vector.w;
break;
default:
(lime_utils_Log().default).error("Row " + row + " out of bounds [0, ..., 3]",{ fileName : "Matrix4.hx", lineNumber : 258, className : "lime.math._Matrix4.Matrix4_Impl_", methodName : "copyRowFrom"});
}
}
Matrix4_Impl_.create2D = function(x,y,scale,rotation) {
if(rotation == null) {
rotation = 0;
}
if(scale == null) {
scale = 1;
}
var theta = rotation * Math.PI / 180.0;
var c = Math.cos(theta);
var s = Math.sin(theta);
var array = [c * scale,-s * scale,0,0,s * scale,c * scale,0,0,0,0,1,0,x,y,0,1];
var this1;
if(array != null) {
this1 = new Float32Array(array);
} else {
this1 = null;
}
return Matrix4_Impl_._new(this1);
}
Matrix4_Impl_.createABCD = function(a,b,c,d,tx,ty,matrix) {
if(matrix == null) {
matrix = Matrix4_Impl_._new();
}
Matrix4_Impl_.set(matrix,0,a);
Matrix4_Impl_.set(matrix,1,b);
Matrix4_Impl_.set(matrix,2,0);
Matrix4_Impl_.set(matrix,3,0);
Matrix4_Impl_.set(matrix,4,c);
Matrix4_Impl_.set(matrix,5,d);
Matrix4_Impl_.set(matrix,6,0);
Matrix4_Impl_.set(matrix,7,0);
Matrix4_Impl_.set(matrix,8,0);
Matrix4_Impl_.set(matrix,9,0);
Matrix4_Impl_.set(matrix,10,1);
Matrix4_Impl_.set(matrix,11,0);
Matrix4_Impl_.set(matrix,12,tx);
Matrix4_Impl_.set(matrix,13,ty);
Matrix4_Impl_.set(matrix,14,0);
Matrix4_Impl_.set(matrix,15,1);
return matrix;
}
Matrix4_Impl_.createOrtho = function(x0,x1,y0,y1,zNear,zFar) {
var sx = 1.0 / (x1 - x0);
var sy = 1.0 / (y1 - y0);
var sz = 1.0 / (zFar - zNear);
var array = [2.0 * sx,0,0,0,0,2.0 * sy,0,0,0,0,-2.0 * sz,0,-(x0 + x1) * sx,-(y0 + y1) * sy,-(zNear + zFar) * sz,1];
var this1;
if(array != null) {
this1 = new Float32Array(array);
} else {
this1 = null;
}
return Matrix4_Impl_._new(this1);
}
Matrix4_Impl_.copyRowTo = function(this1,row,vector) {
switch(row) {
case 0:
vector.x = this1[0];
vector.y = this1[4];
vector.z = this1[8];
vector.w = this1[12];
break;
case 1:
vector.x = this1[1];
vector.y = this1[5];
vector.z = this1[9];
vector.w = this1[13];
break;
case 2:
vector.x = this1[2];
vector.y = this1[6];
vector.z = this1[10];
vector.w = this1[14];
break;
case 3:
vector.x = this1[3];
vector.y = this1[7];
vector.z = this1[11];
vector.w = this1[15];
break;
default:
(lime_utils_Log().default).error("Row " + row + " out of bounds [0, ..., 3]",{ fileName : "Matrix4.hx", lineNumber : 360, className : "lime.math._Matrix4.Matrix4_Impl_", methodName : "copyRowTo"});
}
}
Matrix4_Impl_.copyToMatrix4 = function(this1,other) {
((js_Boot().default).__cast(other , Float32Array)).set(this1);
}
Matrix4_Impl_.deltaTransformVector = function(this1,v) {
var x = v.x;
var y = v.y;
var z = v.z;
return new (lime_math_Vector4().default)(x * this1[0] + y * this1[4] + z * this1[8] + this1[3],x * this1[1] + y * this1[5] + z * this1[9] + this1[7],x * this1[2] + y * this1[6] + z * this1[10] + this1[11],0);
}
Matrix4_Impl_.identity = function(this1) {
this1[0] = 1;
this1[1] = 0;
this1[2] = 0;
this1[3] = 0;
this1[4] = 0;
this1[5] = 1;
this1[6] = 0;
this1[7] = 0;
this1[8] = 0;
this1[9] = 0;
this1[10] = 1;
this1[11] = 0;
this1[12] = 0;
this1[13] = 0;
this1[14] = 0;
this1[15] = 1;
}
Matrix4_Impl_.interpolate = function(thisMat,toMat,percent) {
var m = Matrix4_Impl_._new();
var _g = 0;
while(_g < 16) {
var i = _g++;
Matrix4_Impl_.set(m,i,Matrix4_Impl_.get(thisMat,i) + (Matrix4_Impl_.get(toMat,i) - Matrix4_Impl_.get(thisMat,i)) * percent);
}
return m;
}
Matrix4_Impl_.interpolateTo = function(this1,toMat,percent) {
var _g = 0;
while(_g < 16) {
var i = _g++;
this1[i] += (Matrix4_Impl_.get(toMat,i) - this1[i]) * percent;
}
}
Matrix4_Impl_.invert = function(this1) {
var d = Matrix4_Impl_.get_determinant(this1);
var invertable = Math.abs(d) > 0.00000000001;
if(invertable) {
d = 1 / d;
var m11 = this1[0];
var m21 = this1[4];
var m31 = this1[8];
var m41 = this1[12];
var m12 = this1[1];
var m22 = this1[5];
var m32 = this1[9];
var m42 = this1[13];
var m13 = this1[2];
var m23 = this1[6];
var m33 = this1[10];
var m43 = this1[14];
var m14 = this1[3];
var m24 = this1[7];
var m34 = this1[11];
var m44 = this1[15];
this1[0] = d * (m22 * (m33 * m44 - m43 * m34) - m32 * (m23 * m44 - m43 * m24) + m42 * (m23 * m34 - m33 * m24));
this1[1] = -d * (m12 * (m33 * m44 - m43 * m34) - m32 * (m13 * m44 - m43 * m14) + m42 * (m13 * m34 - m33 * m14));
this1[2] = d * (m12 * (m23 * m44 - m43 * m24) - m22 * (m13 * m44 - m43 * m14) + m42 * (m13 * m24 - m23 * m14));
this1[3] = -d * (m12 * (m23 * m34 - m33 * m24) - m22 * (m13 * m34 - m33 * m14) + m32 * (m13 * m24 - m23 * m14));
this1[4] = -d * (m21 * (m33 * m44 - m43 * m34) - m31 * (m23 * m44 - m43 * m24) + m41 * (m23 * m34 - m33 * m24));
this1[5] = d * (m11 * (m33 * m44 - m43 * m34) - m31 * (m13 * m44 - m43 * m14) + m41 * (m13 * m34 - m33 * m14));
this1[6] = -d * (m11 * (m23 * m44 - m43 * m24) - m21 * (m13 * m44 - m43 * m14) + m41 * (m13 * m24 - m23 * m14));
this1[7] = d * (m11 * (m23 * m34 - m33 * m24) - m21 * (m13 * m34 - m33 * m14) + m31 * (m13 * m24 - m23 * m14));
this1[8] = d * (m21 * (m32 * m44 - m42 * m34) - m31 * (m22 * m44 - m42 * m24) + m41 * (m22 * m34 - m32 * m24));
this1[9] = -d * (m11 * (m32 * m44 - m42 * m34) - m31 * (m12 * m44 - m42 * m14) + m41 * (m12 * m34 - m32 * m14));
this1[10] = d * (m11 * (m22 * m44 - m42 * m24) - m21 * (m12 * m44 - m42 * m14) + m41 * (m12 * m24 - m22 * m14));
this1[11] = -d * (m11 * (m22 * m34 - m32 * m24) - m21 * (m12 * m34 - m32 * m14) + m31 * (m12 * m24 - m22 * m14));
this1[12] = -d * (m21 * (m32 * m43 - m42 * m33) - m31 * (m22 * m43 - m42 * m23) + m41 * (m22 * m33 - m32 * m23));
this1[13] = d * (m11 * (m32 * m43 - m42 * m33) - m31 * (m12 * m43 - m42 * m13) + m41 * (m12 * m33 - m32 * m13));
this1[14] = -d * (m11 * (m22 * m43 - m42 * m23) - m21 * (m12 * m43 - m42 * m13) + m41 * (m12 * m23 - m22 * m13));
this1[15] = d * (m11 * (m22 * m33 - m32 * m23) - m21 * (m12 * m33 - m32 * m13) + m31 * (m12 * m23 - m22 * m13));
}
return invertable;
}
Matrix4_Impl_.pointAt = function(this1,pos,at,up) {
if(at == null) {
at = new (lime_math_Vector4().default)(0,0,-1);
}
if(up == null) {
up = new (lime_math_Vector4().default)(0,-1,0);
}
var dir = at.subtract(pos);
var vup = up.clone();
var right;
dir.normalize();
vup.normalize();
var dir2 = dir.clone();
dir2.scaleBy(vup.dotProduct(dir));
vup = vup.subtract(dir2);
if(vup.get_length() > 0) {
vup.normalize();
} else if(dir.x != 0) {
vup = new (lime_math_Vector4().default)(-dir.y,dir.x,0);
} else {
vup = new (lime_math_Vector4().default)(1,0,0);
}
right = vup.crossProduct(dir);
right.normalize();
this1[0] = right.x;
this1[4] = right.y;
this1[8] = right.z;
this1[12] = 0.0;
this1[1] = vup.x;
this1[5] = vup.y;
this1[9] = vup.z;
this1[13] = 0.0;
this1[2] = dir.x;
this1[6] = dir.y;
this1[10] = dir.z;
this1[14] = 0.0;
this1[3] = pos.x;
this1[7] = pos.y;
this1[11] = pos.z;
this1[15] = 1.0;
}
Matrix4_Impl_.prepend = function(this1,rhs) {
var m111 = Matrix4_Impl_.get(rhs,0);
var m121 = Matrix4_Impl_.get(rhs,4);
var m131 = Matrix4_Impl_.get(rhs,8);
var m141 = Matrix4_Impl_.get(rhs,12);
var m112 = Matrix4_Impl_.get(rhs,1);
var m122 = Matrix4_Impl_.get(rhs,5);
var m132 = Matrix4_Impl_.get(rhs,9);
var m142 = Matrix4_Impl_.get(rhs,13);
var m113 = Matrix4_Impl_.get(rhs,2);
var m123 = Matrix4_Impl_.get(rhs,6);
var m133 = Matrix4_Impl_.get(rhs,10);
var m143 = Matrix4_Impl_.get(rhs,14);
var m114 = Matrix4_Impl_.get(rhs,3);
var m124 = Matrix4_Impl_.get(rhs,7);
var m134 = Matrix4_Impl_.get(rhs,11);
var m144 = Matrix4_Impl_.get(rhs,15);
var m211 = this1[0];
var m221 = this1[4];
var m231 = this1[8];
var m241 = this1[12];
var m212 = this1[1];
var m222 = this1[5];
var m232 = this1[9];
var m242 = this1[13];
var m213 = this1[2];
var m223 = this1[6];
var m233 = this1[10];
var m243 = this1[14];
var m214 = this1[3];
var m224 = this1[7];
var m234 = this1[11];
var m244 = this1[15];
this1[0] = m111 * m211 + m112 * m221 + m113 * m231 + m114 * m241;
this1[1] = m111 * m212 + m112 * m222 + m113 * m232 + m114 * m242;
this1[2] = m111 * m213 + m112 * m223 + m113 * m233 + m114 * m243;
this1[3] = m111 * m214 + m112 * m224 + m113 * m234 + m114 * m244;
this1[4] = m121 * m211 + m122 * m221 + m123 * m231 + m124 * m241;
this1[5] = m121 * m212 + m122 * m222 + m123 * m232 + m124 * m242;
this1[6] = m121 * m213 + m122 * m223 + m123 * m233 + m124 * m243;
this1[7] = m121 * m214 + m122 * m224 + m123 * m234 + m124 * m244;
this1[8] = m131 * m211 + m132 * m221 + m133 * m231 + m134 * m241;
this1[9] = m131 * m212 + m132 * m222 + m133 * m232 + m134 * m242;
this1[10] = m131 * m213 + m132 * m223 + m133 * m233 + m134 * m243;
this1[11] = m131 * m214 + m132 * m224 + m133 * m234 + m134 * m244;
this1[12] = m141 * m211 + m142 * m221 + m143 * m231 + m144 * m241;
this1[13] = m141 * m212 + m142 * m222 + m143 * m232 + m144 * m242;
this1[14] = m141 * m213 + m142 * m223 + m143 * m233 + m144 * m243;
this1[15] = m141 * m214 + m142 * m224 + m143 * m234 + m144 * m244;
}
Matrix4_Impl_.prependRotation = function(this1,degrees,axis,pivotPoint) {
var m = Matrix4_Impl_.__getAxisRotation(this1,axis.x,axis.y,axis.z,degrees);
if(pivotPoint != null) {
var p = pivotPoint;
Matrix4_Impl_.appendTranslation(m,p.x,p.y,p.z);
}
Matrix4_Impl_.prepend(this1,m);
}
Matrix4_Impl_.prependScale = function(this1,xScale,yScale,zScale) {
var array = [xScale,0.0,0.0,0.0,0.0,yScale,0.0,0.0,0.0,0.0,zScale,0.0,0.0,0.0,0.0,1.0];
var this2;
if(array != null) {
this2 = new Float32Array(array);
} else {
this2 = null;
}
Matrix4_Impl_.prepend(this1,Matrix4_Impl_._new(this2));
}
Matrix4_Impl_.prependTranslation = function(this1,x,y,z) {
var m = Matrix4_Impl_._new();
Matrix4_Impl_.set_position(m,new (lime_math_Vector4().default)(x,y,z));
Matrix4_Impl_.prepend(this1,m);
}
Matrix4_Impl_.transformVector = function(this1,v) {
var x = v.x;
var y = v.y;
var z = v.z;
return new (lime_math_Vector4().default)(x * this1[0] + y * this1[4] + z * this1[8] + this1[12],x * this1[1] + y * this1[5] + z * this1[9] + this1[13],x * this1[2] + y * this1[6] + z * this1[10] + this1[14],x * this1[3] + y * this1[7] + z * this1[11] + this1[15]);
}
Matrix4_Impl_.transformVectors = function(this1,ain,aout) {
var i = 0;
var x;
var y;
var z;
while(i + 3 <= ain.length) {
x = ain[i];
y = ain[i + 1];
z = ain[i + 2];
aout[i] = x * this1[0] + y * this1[4] + z * this1[8] + this1[12];
aout[i + 1] = x * this1[1] + y * this1[5] + z * this1[9] + this1[13];
aout[i + 2] = x * this1[2] + y * this1[6] + z * this1[10] + this1[14];
i += 3;
}
}
Matrix4_Impl_.transpose = function(this1) {
var temp = this1[1];
this1[1] = this1[4];
this1[4] = temp;
var temp1 = this1[2];
this1[2] = this1[8];
this1[8] = temp1;
var temp2 = this1[3];
this1[3] = this1[12];
this1[12] = temp2;
var temp3 = this1[6];
this1[6] = this1[9];
this1[9] = temp3;
var temp4 = this1[7];
this1[7] = this1[13];
this1[13] = temp4;
var temp5 = this1[11];
this1[11] = this1[14];
this1[14] = temp5;
}
Matrix4_Impl_.__getAxisRotation = function(this1,x,y,z,degrees) {
var m = Matrix4_Impl_._new();
var a1 = new (lime_math_Vector4().default)(x,y,z);
var rad = -degrees * (Math.PI / 180);
var c = Math.cos(rad);
var s = Math.sin(rad);
var t = 1.0 - c;
Matrix4_Impl_.set(m,0,c + a1.x * a1.x * t);
Matrix4_Impl_.set(m,5,c + a1.y * a1.y * t);
Matrix4_Impl_.set(m,10,c + a1.z * a1.z * t);
var tmp1 = a1.x * a1.y * t;
var tmp2 = a1.z * s;
Matrix4_Impl_.set(m,4,tmp1 + tmp2);
Matrix4_Impl_.set(m,1,tmp1 - tmp2);
tmp1 = a1.x * a1.z * t;
tmp2 = a1.y * s;
Matrix4_Impl_.set(m,8,tmp1 - tmp2);
Matrix4_Impl_.set(m,2,tmp1 + tmp2);
tmp1 = a1.y * a1.z * t;
tmp2 = a1.x * s;
Matrix4_Impl_.set(m,9,tmp1 + tmp2);
Matrix4_Impl_.set(m,6,tmp1 - tmp2);
return m;
}
Matrix4_Impl_.__swap = function(this1,a,b) {
var temp = this1[a];
this1[a] = this1[b];
this1[b] = temp;
}
Matrix4_Impl_.get_determinant = function(this1) {
return (this1[0] * this1[5] - this1[4] * this1[1]) * (this1[10] * this1[15] - this1[14] * this1[11]) - (this1[0] * this1[9] - this1[8] * this1[1]) * (this1[6] * this1[15] - this1[14] * this1[7]) + (this1[0] * this1[13] - this1[12] * this1[1]) * (this1[6] * this1[11] - this1[10] * this1[7]) + (this1[4] * this1[9] - this1[8] * this1[5]) * (this1[2] * this1[15] - this1[14] * this1[3]) - (this1[4] * this1[13] - this1[12] * this1[5]) * (this1[2] * this1[11] - this1[10] * this1[3]) + (this1[8] * this1[13] - this1[12] * this1[9]) * (this1[2] * this1[7] - this1[6] * this1[3]);
}
Matrix4_Impl_.get_position = function(this1) {
return new (lime_math_Vector4().default)(this1[12],this1[13],this1[14]);
}
Matrix4_Impl_.set_position = function(this1,val) {
this1[12] = val.x;
this1[13] = val.y;
this1[14] = val.z;
return val;
}
Matrix4_Impl_.get = function(this1,index) {
return this1[index];
}
Matrix4_Impl_.set = function(this1,index,value) {
this1[index] = value;
return value;
}
Matrix4_Impl_.__identity = [1.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,1.0]
// Export
exports.default = Matrix4_Impl_;

View File

@@ -0,0 +1,168 @@
// Class: lime.math.color._ARGB.ARGB_Impl_
var $global = typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this
$global.Object.defineProperty(exports, "__esModule", {value: true});
var __map_reserved = {};
// Imports
var $hxClasses = require("./../../../../hxClasses_stub").default;
var $import = require("./../../../../import_stub").default;
function lime_math_color__$RGBA_RGBA_$Impl_$() {return require("./../../../../lime/math/color/_RGBA/RGBA_Impl_");}
// Constructor
var ARGB_Impl_ = function(){}
// Meta
ARGB_Impl_.__name__ = ["lime","math","color","_ARGB","ARGB_Impl_"];
ARGB_Impl_.prototype = {
};
ARGB_Impl_.prototype.__class__ = $hxClasses["lime.math.color._ARGB.ARGB_Impl_"] = ARGB_Impl_;
// Init
// Statics
ARGB_Impl_._new = function(argb) {
if(argb == null) {
argb = 0;
}
var this1 = argb;
return this1;
}
ARGB_Impl_.create = function(a,r,g,b) {
var this1 = 0;
var argb = this1;
argb = (a & 255) << 24 | (r & 255) << 16 | (g & 255) << 8 | b & 255;
return argb;
}
ARGB_Impl_.multiplyAlpha = function(this1) {
if((this1 >>> 24 & 255) == 0) {
this1 = 0;
} else if((this1 >>> 24 & 255) != 255) {
ARGB_Impl_.a16 = (lime_math_color__$RGBA_RGBA_$Impl_$().default).__alpha16[this1 >>> 24 & 255];
this1 = (this1 >>> 24 & 255 & 255) << 24 | ((this1 >>> 16 & 255) * ARGB_Impl_.a16 >> 16 & 255) << 16 | ((this1 >>> 8 & 255) * ARGB_Impl_.a16 >> 16 & 255) << 8 | (this1 & 255) * ARGB_Impl_.a16 >> 16 & 255;
}
}
ARGB_Impl_.readUInt8 = function(this1,data,offset,format,premultiplied) {
if(premultiplied == null) {
premultiplied = false;
}
if(format == null) {
format = 0;
}
switch(format) {
case 0:
this1 = (data[offset + 1] & 255) << 24 | (data[offset + 2] & 255) << 16 | (data[offset + 3] & 255) << 8 | data[offset] & 255;
break;
case 1:
this1 = (data[offset + 2] & 255) << 24 | (data[offset + 3] & 255) << 16 | (data[offset] & 255) << 8 | data[offset + 1] & 255;
break;
case 2:
this1 = (data[offset + 1] & 255) << 24 | (data[offset] & 255) << 16 | (data[offset + 3] & 255) << 8 | data[offset + 2] & 255;
break;
}
if(premultiplied) {
if((this1 >>> 24 & 255) != 0 && (this1 >>> 24 & 255) != 255) {
ARGB_Impl_.unmult = 255.0 / (this1 >>> 24 & 255);
this1 = (this1 >>> 24 & 255 & 255) << 24 | ((lime_math_color__$RGBA_RGBA_$Impl_$().default).__clamp[Math.floor((this1 >>> 16 & 255) * ARGB_Impl_.unmult)] & 255) << 16 | ((lime_math_color__$RGBA_RGBA_$Impl_$().default).__clamp[Math.floor((this1 >>> 8 & 255) * ARGB_Impl_.unmult)] & 255) << 8 | (lime_math_color__$RGBA_RGBA_$Impl_$().default).__clamp[Math.floor((this1 & 255) * ARGB_Impl_.unmult)] & 255;
}
}
}
ARGB_Impl_.set = function(this1,a,r,g,b) {
this1 = (a & 255) << 24 | (r & 255) << 16 | (g & 255) << 8 | b & 255;
}
ARGB_Impl_.unmultiplyAlpha = function(this1) {
if((this1 >>> 24 & 255) != 0 && (this1 >>> 24 & 255) != 255) {
ARGB_Impl_.unmult = 255.0 / (this1 >>> 24 & 255);
this1 = (this1 >>> 24 & 255 & 255) << 24 | ((lime_math_color__$RGBA_RGBA_$Impl_$().default).__clamp[Math.floor((this1 >>> 16 & 255) * ARGB_Impl_.unmult)] & 255) << 16 | ((lime_math_color__$RGBA_RGBA_$Impl_$().default).__clamp[Math.floor((this1 >>> 8 & 255) * ARGB_Impl_.unmult)] & 255) << 8 | (lime_math_color__$RGBA_RGBA_$Impl_$().default).__clamp[Math.floor((this1 & 255) * ARGB_Impl_.unmult)] & 255;
}
}
ARGB_Impl_.writeUInt8 = function(this1,data,offset,format,premultiplied) {
if(premultiplied == null) {
premultiplied = false;
}
if(format == null) {
format = 0;
}
if(premultiplied) {
if((this1 >>> 24 & 255) == 0) {
this1 = 0;
} else if((this1 >>> 24 & 255) != 255) {
ARGB_Impl_.a16 = (lime_math_color__$RGBA_RGBA_$Impl_$().default).__alpha16[this1 >>> 24 & 255];
this1 = (this1 >>> 24 & 255 & 255) << 24 | ((this1 >>> 16 & 255) * ARGB_Impl_.a16 >> 16 & 255) << 16 | ((this1 >>> 8 & 255) * ARGB_Impl_.a16 >> 16 & 255) << 8 | (this1 & 255) * ARGB_Impl_.a16 >> 16 & 255;
}
}
switch(format) {
case 0:
data[offset] = this1 >>> 16 & 255;
data[offset + 1] = this1 >>> 8 & 255;
data[offset + 2] = this1 & 255;
data[offset + 3] = this1 >>> 24 & 255;
break;
case 1:
data[offset] = this1 >>> 24 & 255;
data[offset + 1] = this1 >>> 16 & 255;
data[offset + 2] = this1 >>> 8 & 255;
data[offset + 3] = this1 & 255;
break;
case 2:
data[offset] = this1 & 255;
data[offset + 1] = this1 >>> 8 & 255;
data[offset + 2] = this1 >>> 16 & 255;
data[offset + 3] = this1 >>> 24 & 255;
break;
}
}
ARGB_Impl_.__fromBGRA = function(bgra) {
var this1 = 0;
var argb = this1;
argb = (bgra & 255 & 255) << 24 | (bgra >>> 8 & 255 & 255) << 16 | (bgra >>> 16 & 255 & 255) << 8 | bgra >>> 24 & 255 & 255;
return argb;
}
ARGB_Impl_.__fromRGBA = function(rgba) {
var this1 = 0;
var argb = this1;
argb = (rgba & 255 & 255) << 24 | (rgba >>> 24 & 255 & 255) << 16 | (rgba >>> 16 & 255 & 255) << 8 | rgba >>> 8 & 255 & 255;
return argb;
}
ARGB_Impl_.get_a = function(this1) {
return this1 >>> 24 & 255;
}
ARGB_Impl_.set_a = function(this1,value) {
this1 = (value & 255) << 24 | (this1 >>> 16 & 255 & 255) << 16 | (this1 >>> 8 & 255 & 255) << 8 | this1 & 255 & 255;
return value;
}
ARGB_Impl_.get_b = function(this1) {
return this1 & 255;
}
ARGB_Impl_.set_b = function(this1,value) {
this1 = (this1 >>> 24 & 255 & 255) << 24 | (this1 >>> 16 & 255 & 255) << 16 | (this1 >>> 8 & 255 & 255) << 8 | value & 255;
return value;
}
ARGB_Impl_.get_g = function(this1) {
return this1 >>> 8 & 255;
}
ARGB_Impl_.set_g = function(this1,value) {
this1 = (this1 >>> 24 & 255 & 255) << 24 | (this1 >>> 16 & 255 & 255) << 16 | (value & 255) << 8 | this1 & 255 & 255;
return value;
}
ARGB_Impl_.get_r = function(this1) {
return this1 >>> 16 & 255;
}
ARGB_Impl_.set_r = function(this1,value) {
this1 = (this1 >>> 24 & 255 & 255) << 24 | (value & 255) << 16 | (this1 >>> 8 & 255 & 255) << 8 | this1 & 255 & 255;
return value;
}
// Export
exports.default = ARGB_Impl_;

View File

@@ -0,0 +1,168 @@
// Class: lime.math.color._BGRA.BGRA_Impl_
var $global = typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this
$global.Object.defineProperty(exports, "__esModule", {value: true});
var __map_reserved = {};
// Imports
var $hxClasses = require("./../../../../hxClasses_stub").default;
var $import = require("./../../../../import_stub").default;
function lime_math_color__$RGBA_RGBA_$Impl_$() {return require("./../../../../lime/math/color/_RGBA/RGBA_Impl_");}
// Constructor
var BGRA_Impl_ = function(){}
// Meta
BGRA_Impl_.__name__ = ["lime","math","color","_BGRA","BGRA_Impl_"];
BGRA_Impl_.prototype = {
};
BGRA_Impl_.prototype.__class__ = $hxClasses["lime.math.color._BGRA.BGRA_Impl_"] = BGRA_Impl_;
// Init
// Statics
BGRA_Impl_._new = function(bgra) {
if(bgra == null) {
bgra = 0;
}
var this1 = bgra;
return this1;
}
BGRA_Impl_.create = function(b,g,r,a) {
var this1 = 0;
var bgra = this1;
bgra = (b & 255) << 24 | (g & 255) << 16 | (r & 255) << 8 | a & 255;
return bgra;
}
BGRA_Impl_.multiplyAlpha = function(this1) {
if((this1 & 255) == 0) {
this1 = 0;
} else if((this1 & 255) != 255) {
BGRA_Impl_.a16 = (lime_math_color__$RGBA_RGBA_$Impl_$().default).__alpha16[this1 & 255];
this1 = ((this1 >>> 24 & 255) * BGRA_Impl_.a16 >> 16 & 255) << 24 | ((this1 >>> 16 & 255) * BGRA_Impl_.a16 >> 16 & 255) << 16 | ((this1 >>> 8 & 255) * BGRA_Impl_.a16 >> 16 & 255) << 8 | this1 & 255 & 255;
}
}
BGRA_Impl_.readUInt8 = function(this1,data,offset,format,premultiplied) {
if(premultiplied == null) {
premultiplied = false;
}
if(format == null) {
format = 0;
}
switch(format) {
case 0:
this1 = (data[offset + 2] & 255) << 24 | (data[offset + 1] & 255) << 16 | (data[offset] & 255) << 8 | data[offset + 3] & 255;
break;
case 1:
this1 = (data[offset + 3] & 255) << 24 | (data[offset + 2] & 255) << 16 | (data[offset + 1] & 255) << 8 | data[offset] & 255;
break;
case 2:
this1 = (data[offset] & 255) << 24 | (data[offset + 1] & 255) << 16 | (data[offset + 2] & 255) << 8 | data[offset + 3] & 255;
break;
}
if(premultiplied) {
if((this1 & 255) != 0 && (this1 & 255) != 255) {
BGRA_Impl_.unmult = 255.0 / (this1 & 255);
this1 = ((lime_math_color__$RGBA_RGBA_$Impl_$().default).__clamp[Math.floor((this1 >>> 24 & 255) * BGRA_Impl_.unmult)] & 255) << 24 | ((lime_math_color__$RGBA_RGBA_$Impl_$().default).__clamp[Math.floor((this1 >>> 16 & 255) * BGRA_Impl_.unmult)] & 255) << 16 | ((lime_math_color__$RGBA_RGBA_$Impl_$().default).__clamp[Math.floor((this1 >>> 8 & 255) * BGRA_Impl_.unmult)] & 255) << 8 | this1 & 255 & 255;
}
}
}
BGRA_Impl_.set = function(this1,b,g,r,a) {
this1 = (b & 255) << 24 | (g & 255) << 16 | (r & 255) << 8 | a & 255;
}
BGRA_Impl_.unmultiplyAlpha = function(this1) {
if((this1 & 255) != 0 && (this1 & 255) != 255) {
BGRA_Impl_.unmult = 255.0 / (this1 & 255);
this1 = ((lime_math_color__$RGBA_RGBA_$Impl_$().default).__clamp[Math.floor((this1 >>> 24 & 255) * BGRA_Impl_.unmult)] & 255) << 24 | ((lime_math_color__$RGBA_RGBA_$Impl_$().default).__clamp[Math.floor((this1 >>> 16 & 255) * BGRA_Impl_.unmult)] & 255) << 16 | ((lime_math_color__$RGBA_RGBA_$Impl_$().default).__clamp[Math.floor((this1 >>> 8 & 255) * BGRA_Impl_.unmult)] & 255) << 8 | this1 & 255 & 255;
}
}
BGRA_Impl_.writeUInt8 = function(this1,data,offset,format,premultiplied) {
if(premultiplied == null) {
premultiplied = false;
}
if(format == null) {
format = 0;
}
if(premultiplied) {
if((this1 & 255) == 0) {
this1 = 0;
} else if((this1 & 255) != 255) {
BGRA_Impl_.a16 = (lime_math_color__$RGBA_RGBA_$Impl_$().default).__alpha16[this1 & 255];
this1 = ((this1 >>> 24 & 255) * BGRA_Impl_.a16 >> 16 & 255) << 24 | ((this1 >>> 16 & 255) * BGRA_Impl_.a16 >> 16 & 255) << 16 | ((this1 >>> 8 & 255) * BGRA_Impl_.a16 >> 16 & 255) << 8 | this1 & 255 & 255;
}
}
switch(format) {
case 0:
data[offset] = this1 >>> 8 & 255;
data[offset + 1] = this1 >>> 16 & 255;
data[offset + 2] = this1 >>> 24 & 255;
data[offset + 3] = this1 & 255;
break;
case 1:
data[offset] = this1 & 255;
data[offset + 1] = this1 >>> 8 & 255;
data[offset + 2] = this1 >>> 16 & 255;
data[offset + 3] = this1 >>> 24 & 255;
break;
case 2:
data[offset] = this1 >>> 24 & 255;
data[offset + 1] = this1 >>> 16 & 255;
data[offset + 2] = this1 >>> 8 & 255;
data[offset + 3] = this1 & 255;
break;
}
}
BGRA_Impl_.__fromARGB = function(argb) {
var this1 = 0;
var bgra = this1;
bgra = (argb & 255 & 255) << 24 | (argb >>> 8 & 255 & 255) << 16 | (argb >>> 16 & 255 & 255) << 8 | argb >>> 24 & 255 & 255;
return bgra;
}
BGRA_Impl_.__fromRGBA = function(rgba) {
var this1 = 0;
var bgra = this1;
bgra = (rgba >>> 8 & 255 & 255) << 24 | (rgba >>> 16 & 255 & 255) << 16 | (rgba >>> 24 & 255 & 255) << 8 | rgba & 255 & 255;
return bgra;
}
BGRA_Impl_.get_a = function(this1) {
return this1 & 255;
}
BGRA_Impl_.set_a = function(this1,value) {
this1 = (this1 >>> 24 & 255 & 255) << 24 | (this1 >>> 16 & 255 & 255) << 16 | (this1 >>> 8 & 255 & 255) << 8 | value & 255;
return value;
}
BGRA_Impl_.get_b = function(this1) {
return this1 >>> 24 & 255;
}
BGRA_Impl_.set_b = function(this1,value) {
this1 = (value & 255) << 24 | (this1 >>> 16 & 255 & 255) << 16 | (this1 >>> 8 & 255 & 255) << 8 | this1 & 255 & 255;
return value;
}
BGRA_Impl_.get_g = function(this1) {
return this1 >>> 16 & 255;
}
BGRA_Impl_.set_g = function(this1,value) {
this1 = (this1 >>> 24 & 255 & 255) << 24 | (value & 255) << 16 | (this1 >>> 8 & 255 & 255) << 8 | this1 & 255 & 255;
return value;
}
BGRA_Impl_.get_r = function(this1) {
return this1 >>> 8 & 255;
}
BGRA_Impl_.set_r = function(this1,value) {
this1 = (this1 >>> 24 & 255 & 255) << 24 | (this1 >>> 16 & 255 & 255) << 16 | (value & 255) << 8 | this1 & 255 & 255;
return value;
}
// Export
exports.default = BGRA_Impl_;

View File

@@ -0,0 +1,192 @@
// Class: lime.math.color._RGBA.RGBA_Impl_
var $global = typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this
$global.Object.defineProperty(exports, "__esModule", {value: true});
var __map_reserved = {};
// Imports
var $hxClasses = require("./../../../../hxClasses_stub").default;
var $import = require("./../../../../import_stub").default;
// Constructor
var RGBA_Impl_ = function(){}
// Meta
RGBA_Impl_.__name__ = ["lime","math","color","_RGBA","RGBA_Impl_"];
RGBA_Impl_.prototype = {
};
RGBA_Impl_.prototype.__class__ = $hxClasses["lime.math.color._RGBA.RGBA_Impl_"] = RGBA_Impl_;
// Init
{
var this1 = new Uint32Array(256);
RGBA_Impl_.__alpha16 = this1;
var _g = 0;
while(_g < 256) {
var i = _g++;
RGBA_Impl_.__alpha16[i] = Math.ceil(i * 257.003921568627447);
}
var this2 = new Uint8Array(510);
RGBA_Impl_.__clamp = this2;
var _g1 = 0;
while(_g1 < 255) {
var i1 = _g1++;
RGBA_Impl_.__clamp[i1] = i1;
}
var _g11 = 255;
var _g2 = 511;
while(_g11 < _g2) {
var i2 = _g11++;
RGBA_Impl_.__clamp[i2] = 255;
}
};
// Statics
RGBA_Impl_._new = function(rgba) {
if(rgba == null) {
rgba = 0;
}
var this1 = rgba;
return this1;
}
RGBA_Impl_.create = function(r,g,b,a) {
var this1 = 0;
var rgba = this1;
rgba = (r & 255) << 24 | (g & 255) << 16 | (b & 255) << 8 | a & 255;
return rgba;
}
RGBA_Impl_.multiplyAlpha = function(this1) {
if((this1 & 255) == 0) {
if(this1 != 0) {
this1 = 0;
}
} else if((this1 & 255) != 255) {
RGBA_Impl_.a16 = RGBA_Impl_.__alpha16[this1 & 255];
this1 = ((this1 >>> 24 & 255) * RGBA_Impl_.a16 >> 16 & 255) << 24 | ((this1 >>> 16 & 255) * RGBA_Impl_.a16 >> 16 & 255) << 16 | ((this1 >>> 8 & 255) * RGBA_Impl_.a16 >> 16 & 255) << 8 | this1 & 255 & 255;
}
}
RGBA_Impl_.readUInt8 = function(this1,data,offset,format,premultiplied) {
if(premultiplied == null) {
premultiplied = false;
}
if(format == null) {
format = 0;
}
switch(format) {
case 0:
this1 = (data[offset] & 255) << 24 | (data[offset + 1] & 255) << 16 | (data[offset + 2] & 255) << 8 | data[offset + 3] & 255;
break;
case 1:
this1 = (data[offset + 1] & 255) << 24 | (data[offset + 2] & 255) << 16 | (data[offset + 3] & 255) << 8 | data[offset] & 255;
break;
case 2:
this1 = (data[offset + 2] & 255) << 24 | (data[offset + 1] & 255) << 16 | (data[offset] & 255) << 8 | data[offset + 3] & 255;
break;
}
if(premultiplied) {
if((this1 & 255) != 0 && (this1 & 255) != 255) {
RGBA_Impl_.unmult = 255.0 / (this1 & 255);
this1 = (RGBA_Impl_.__clamp[Math.round((this1 >>> 24 & 255) * RGBA_Impl_.unmult)] & 255) << 24 | (RGBA_Impl_.__clamp[Math.round((this1 >>> 16 & 255) * RGBA_Impl_.unmult)] & 255) << 16 | (RGBA_Impl_.__clamp[Math.round((this1 >>> 8 & 255) * RGBA_Impl_.unmult)] & 255) << 8 | this1 & 255 & 255;
}
}
}
RGBA_Impl_.set = function(this1,r,g,b,a) {
this1 = (r & 255) << 24 | (g & 255) << 16 | (b & 255) << 8 | a & 255;
}
RGBA_Impl_.unmultiplyAlpha = function(this1) {
if((this1 & 255) != 0 && (this1 & 255) != 255) {
RGBA_Impl_.unmult = 255.0 / (this1 & 255);
this1 = (RGBA_Impl_.__clamp[Math.round((this1 >>> 24 & 255) * RGBA_Impl_.unmult)] & 255) << 24 | (RGBA_Impl_.__clamp[Math.round((this1 >>> 16 & 255) * RGBA_Impl_.unmult)] & 255) << 16 | (RGBA_Impl_.__clamp[Math.round((this1 >>> 8 & 255) * RGBA_Impl_.unmult)] & 255) << 8 | this1 & 255 & 255;
}
}
RGBA_Impl_.writeUInt8 = function(this1,data,offset,format,premultiplied) {
if(premultiplied == null) {
premultiplied = false;
}
if(format == null) {
format = 0;
}
if(premultiplied) {
if((this1 & 255) == 0) {
if(this1 != 0) {
this1 = 0;
}
} else if((this1 & 255) != 255) {
RGBA_Impl_.a16 = RGBA_Impl_.__alpha16[this1 & 255];
this1 = ((this1 >>> 24 & 255) * RGBA_Impl_.a16 >> 16 & 255) << 24 | ((this1 >>> 16 & 255) * RGBA_Impl_.a16 >> 16 & 255) << 16 | ((this1 >>> 8 & 255) * RGBA_Impl_.a16 >> 16 & 255) << 8 | this1 & 255 & 255;
}
}
switch(format) {
case 0:
data[offset] = this1 >>> 24 & 255;
data[offset + 1] = this1 >>> 16 & 255;
data[offset + 2] = this1 >>> 8 & 255;
data[offset + 3] = this1 & 255;
break;
case 1:
data[offset] = this1 & 255;
data[offset + 1] = this1 >>> 24 & 255;
data[offset + 2] = this1 >>> 16 & 255;
data[offset + 3] = this1 >>> 8 & 255;
break;
case 2:
data[offset] = this1 >>> 8 & 255;
data[offset + 1] = this1 >>> 16 & 255;
data[offset + 2] = this1 >>> 24 & 255;
data[offset + 3] = this1 & 255;
break;
}
}
RGBA_Impl_.__fromARGB = function(argb) {
var this1 = 0;
var rgba = this1;
rgba = (argb >>> 16 & 255 & 255) << 24 | (argb >>> 8 & 255 & 255) << 16 | (argb & 255 & 255) << 8 | argb >>> 24 & 255 & 255;
return rgba;
}
RGBA_Impl_.__fromBGRA = function(bgra) {
var this1 = 0;
var rgba = this1;
rgba = (bgra >>> 8 & 255 & 255) << 24 | (bgra >>> 16 & 255 & 255) << 16 | (bgra >>> 24 & 255 & 255) << 8 | bgra & 255 & 255;
return rgba;
}
RGBA_Impl_.get_a = function(this1) {
return this1 & 255;
}
RGBA_Impl_.set_a = function(this1,value) {
this1 = (this1 >>> 24 & 255 & 255) << 24 | (this1 >>> 16 & 255 & 255) << 16 | (this1 >>> 8 & 255 & 255) << 8 | value & 255;
return value;
}
RGBA_Impl_.get_b = function(this1) {
return this1 >>> 8 & 255;
}
RGBA_Impl_.set_b = function(this1,value) {
this1 = (this1 >>> 24 & 255 & 255) << 24 | (this1 >>> 16 & 255 & 255) << 16 | (value & 255) << 8 | this1 & 255 & 255;
return value;
}
RGBA_Impl_.get_g = function(this1) {
return this1 >>> 16 & 255;
}
RGBA_Impl_.set_g = function(this1,value) {
this1 = (this1 >>> 24 & 255 & 255) << 24 | (value & 255) << 16 | (this1 >>> 8 & 255 & 255) << 8 | this1 & 255 & 255;
return value;
}
RGBA_Impl_.get_r = function(this1) {
return this1 >>> 24 & 255;
}
RGBA_Impl_.set_r = function(this1,value) {
this1 = (value & 255) << 24 | (this1 >>> 16 & 255 & 255) << 16 | (this1 >>> 8 & 255 & 255) << 8 | this1 & 255 & 255;
return value;
}
// Export
exports.default = RGBA_Impl_;