File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11## 2.4.0-wip
22
33- Remove the deprecated ` SimplexNoise ` class.
4+ - Optimized the ` identity ` constructors on the ` Matrix ` classes.
45
56## 2.3.0
67
Original file line number Diff line number Diff line change @@ -62,7 +62,10 @@ class Matrix2 {
6262 Matrix2 .zero () : _m2storage = Float32List (4 );
6363
6464 /// Identity matrix.
65- factory Matrix2 .identity () => Matrix2 .zero ()..setIdentity ();
65+ factory Matrix2 .identity () =>
66+ Matrix2 .zero ()
67+ .._m2storage[0 ] = 1.0
68+ .._m2storage[3 ] = 1.0 ;
6669
6770 /// Copies values from [other] .
6871 factory Matrix2 .copy (Matrix2 other) => Matrix2 .zero ()..setFrom (other);
Original file line number Diff line number Diff line change @@ -131,7 +131,11 @@ class Matrix3 {
131131 Matrix3 .zero () : _m3storage = Float32List (9 );
132132
133133 /// Identity matrix.
134- factory Matrix3 .identity () => Matrix3 .zero ()..setIdentity ();
134+ factory Matrix3 .identity () =>
135+ Matrix3 .zero ()
136+ .._m3storage[0 ] = 1.0
137+ .._m3storage[4 ] = 1.0
138+ .._m3storage[8 ] = 1.0 ;
135139
136140 /// Copes values from [other] .
137141 factory Matrix3 .copy (Matrix3 other) => Matrix3 .zero ()..setFrom (other);
Original file line number Diff line number Diff line change @@ -245,7 +245,12 @@ class Matrix4 {
245245 Matrix4 .zero () : _m4storage = Float32List (16 );
246246
247247 /// Identity matrix.
248- factory Matrix4 .identity () => Matrix4 .zero ()..setIdentity ();
248+ factory Matrix4 .identity () =>
249+ Matrix4 .zero ()
250+ .._m4storage[0 ] = 1.0
251+ .._m4storage[5 ] = 1.0
252+ .._m4storage[10 ] = 1.0
253+ .._m4storage[15 ] = 1.0 ;
249254
250255 /// Copies values from [other] .
251256 factory Matrix4 .copy (Matrix4 other) => Matrix4 .zero ()..setFrom (other);
@@ -1777,7 +1782,7 @@ class Matrix4 {
17771782 /// Computes the result of `arg x this` and stores the result in-place in
17781783 /// `this` .
17791784 ///
1780- /// This method does not alter the [Matrix4] in ` arg` .
1785+ /// This method does not alter the [Matrix4] in [ arg] .
17811786 void leftMultiply (Matrix4 arg) {
17821787 final argStorage = arg._m4storage;
17831788 final m00 = argStorage[0 ];
Original file line number Diff line number Diff line change @@ -62,7 +62,10 @@ class Matrix2 {
6262 Matrix2 .zero () : _m2storage = Float64List (4 );
6363
6464 /// Identity matrix.
65- factory Matrix2 .identity () => Matrix2 .zero ()..setIdentity ();
65+ factory Matrix2 .identity () =>
66+ Matrix2 .zero ()
67+ .._m2storage[0 ] = 1.0
68+ .._m2storage[3 ] = 1.0 ;
6669
6770 /// Copies values from [other] .
6871 factory Matrix2 .copy (Matrix2 other) => Matrix2 .zero ()..setFrom (other);
Original file line number Diff line number Diff line change @@ -131,7 +131,11 @@ class Matrix3 {
131131 Matrix3 .zero () : _m3storage = Float64List (9 );
132132
133133 /// Identity matrix.
134- factory Matrix3 .identity () => Matrix3 .zero ()..setIdentity ();
134+ factory Matrix3 .identity () =>
135+ Matrix3 .zero ()
136+ .._m3storage[0 ] = 1.0
137+ .._m3storage[4 ] = 1.0
138+ .._m3storage[8 ] = 1.0 ;
135139
136140 /// Copes values from [other] .
137141 factory Matrix3 .copy (Matrix3 other) => Matrix3 .zero ()..setFrom (other);
Original file line number Diff line number Diff line change @@ -245,7 +245,12 @@ class Matrix4 {
245245 Matrix4 .zero () : _m4storage = Float64List (16 );
246246
247247 /// Identity matrix.
248- factory Matrix4 .identity () => Matrix4 .zero ()..setIdentity ();
248+ factory Matrix4 .identity () =>
249+ Matrix4 .zero ()
250+ .._m4storage[0 ] = 1.0
251+ .._m4storage[5 ] = 1.0
252+ .._m4storage[10 ] = 1.0
253+ .._m4storage[15 ] = 1.0 ;
249254
250255 /// Copies values from [other] .
251256 factory Matrix4 .copy (Matrix4 other) => Matrix4 .zero ()..setFrom (other);
You can’t perform that action at this time.
0 commit comments