avm2: Format Matrix3D.as

This commit is contained in:
Aaron Hill 2023-03-03 16:57:14 -06:00
parent a4c8f27743
commit 3c03a769dc
1 changed files with 163 additions and 169 deletions

View File

@ -17,7 +17,7 @@ package flash.geom {
public function Matrix3D(v:Vector.<Number> = null) { public function Matrix3D(v:Vector.<Number> = null) {
this._rawData = v; this._rawData = v;
if (this._rawData == null) { if (this._rawData == null) {
this.identity() this.identity();
} }
} }
@ -41,8 +41,7 @@ package flash.geom {
var tx:Number, ty:Number, tz:Number; var tx:Number, ty:Number, tz:Number;
tx = ty = tz = 0; tx = ty = tz = 0;
if (pivotPoint != null) if (pivotPoint != null) {
{
tx = pivotPoint.x; tx = pivotPoint.x;
ty = pivotPoint.y; ty = pivotPoint.y;
tz = pivotPoint.z; tz = pivotPoint.z;
@ -57,8 +56,7 @@ package flash.geom {
var y2 = y * y; var y2 = y * y;
var z2 = z * z; var z2 = z * z;
var ls = x2 + y2 + z2; var ls = x2 + y2 + z2;
if (ls != 0) if (ls != 0) {
{
var l = Math.sqrt(ls); var l = Math.sqrt(ls);
x /= l; x /= l;
y /= l; y /= l;
@ -89,20 +87,17 @@ package flash.geom {
} }
public function copyRawDataFrom(vector:Vector.<Number>, index:uint = 0, transpose:Boolean = false):void { public function copyRawDataFrom(vector:Vector.<Number>, index:uint = 0, transpose:Boolean = false):void {
if (transpose) if (transpose) {
{
this.transpose(); this.transpose();
} }
var length = vector.length - index; var length = vector.length - index;
for (var i = 0; i < length; i ++) for (var i = 0; i < length; i++) {
{
this._rawData[i] = vector[i + index]; this._rawData[i] = vector[i + index];
} }
if (transpose) if (transpose) {
{
this.transpose(); this.transpose();
} }
} }
@ -123,8 +118,7 @@ package flash.geom {
this._rawData[13] = oRawData[7]; this._rawData[13] = oRawData[7];
this._rawData[14] = oRawData[11]; this._rawData[14] = oRawData[11];
} }
public function append(lhs:Matrix3D):void public function append(lhs:Matrix3D):void {
{
var m111:Number = this.rawData[0], var m111:Number = this.rawData[0],
m121:Number = this.rawData[4], m121:Number = this.rawData[4],
m131:Number = this.rawData[8], m131:Number = this.rawData[8],