avm2: Implement `Matrix3D.prependScale`

This commit is contained in:
Abiel Deneke 2023-07-16 07:26:54 -05:00 committed by Nathan Adams
parent 288ed7e341
commit 6552b4e132
4 changed files with 10 additions and 0 deletions

View File

@ -371,6 +371,12 @@ package flash.geom {
this._rawData[15] = m141 * m214 + m142 * m224 + m143 * m234 + m144 * m244;
}
public function prependScale(xScale:Number, yScale:Number, zScale:Number):void {
var m = new Matrix3D();
m.appendScale(xScale, yScale, zScale);
this.prepend(m);
}
public function copyFrom(other:Matrix3D):void {
// This makes a copy of other.rawData
this._rawData = other.rawData;

View File

@ -149,6 +149,9 @@
newMat.prependRotation(90, Vector3D.X_AXIS);
trace("After prependRotation: " + newMat.rawData);
newMat.prependScale(1, 2, 3);
trace("After prependScale: " + newMat.rawData);
trace("// copyColumnFrom tests");
var columnMatrix:Matrix3D = new Matrix3D(Vector.<Number>([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]));

View File

@ -48,6 +48,7 @@ Row 4: ArgumentError: Error #2004: One of the parameters is invalid.
Copy from row 4: ArgumentError: Error #2004: One of the parameters is invalid.
After row copies: 100,500,900,1300,200,600,1000,1400,300,700,1100,1500,400,800,1200,1600
After prependRotation: 100,500,900,1300,300,700,1100,1500,-200,-600,-1000,-1400,400,800,1200,1600
After prependScale: 100,500,900,1300,600,1400,2200,3000,-600,-1800,-3000,-4200,400,800,1200,1600
// copyColumnFrom tests
Matrix raw data: 3,4,5,6,0,0,0,0,0,0,0,0,0,0,0,0
Matrix raw data: 3,4,5,6,3,4,5,6,0,0,0,0,0,0,0,0