Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## 2.4.0-wip

- Remove the deprecated `SimplexNoise` class.
- Optimized the `identity` constructors on the `Matrix` classes.

## 2.3.0

Expand Down
5 changes: 4 additions & 1 deletion lib/src/vector_math/matrix2.dart
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ class Matrix2 {
Matrix2.zero() : _m2storage = Float32List(4);

/// Identity matrix.
factory Matrix2.identity() => Matrix2.zero()..setIdentity();
factory Matrix2.identity() =>
Matrix2.zero()
.._m2storage[0] = 1.0
.._m2storage[3] = 1.0;

/// Copies values from [other].
factory Matrix2.copy(Matrix2 other) => Matrix2.zero()..setFrom(other);
Expand Down
6 changes: 5 additions & 1 deletion lib/src/vector_math/matrix3.dart
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,11 @@ class Matrix3 {
Matrix3.zero() : _m3storage = Float32List(9);

/// Identity matrix.
factory Matrix3.identity() => Matrix3.zero()..setIdentity();
factory Matrix3.identity() =>
Matrix3.zero()
.._m3storage[0] = 1.0
.._m3storage[4] = 1.0
.._m3storage[8] = 1.0;

/// Copes values from [other].
factory Matrix3.copy(Matrix3 other) => Matrix3.zero()..setFrom(other);
Expand Down
9 changes: 7 additions & 2 deletions lib/src/vector_math/matrix4.dart
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,12 @@ class Matrix4 {
Matrix4.zero() : _m4storage = Float32List(16);

/// Identity matrix.
factory Matrix4.identity() => Matrix4.zero()..setIdentity();
factory Matrix4.identity() =>
Matrix4.zero()
.._m4storage[0] = 1.0
.._m4storage[5] = 1.0
.._m4storage[10] = 1.0
.._m4storage[15] = 1.0;

/// Copies values from [other].
factory Matrix4.copy(Matrix4 other) => Matrix4.zero()..setFrom(other);
Expand Down Expand Up @@ -1777,7 +1782,7 @@ class Matrix4 {
/// Computes the result of `arg x this` and stores the result in-place in
/// `this`.
///
/// This method does not alter the [Matrix4] in `arg`.
/// This method does not alter the [Matrix4] in [arg].
void leftMultiply(Matrix4 arg) {
final argStorage = arg._m4storage;
final m00 = argStorage[0];
Expand Down
5 changes: 4 additions & 1 deletion lib/src/vector_math_64/matrix2.dart
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ class Matrix2 {
Matrix2.zero() : _m2storage = Float64List(4);

/// Identity matrix.
factory Matrix2.identity() => Matrix2.zero()..setIdentity();
factory Matrix2.identity() =>
Matrix2.zero()
.._m2storage[0] = 1.0
.._m2storage[3] = 1.0;

/// Copies values from [other].
factory Matrix2.copy(Matrix2 other) => Matrix2.zero()..setFrom(other);
Expand Down
6 changes: 5 additions & 1 deletion lib/src/vector_math_64/matrix3.dart
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,11 @@ class Matrix3 {
Matrix3.zero() : _m3storage = Float64List(9);

/// Identity matrix.
factory Matrix3.identity() => Matrix3.zero()..setIdentity();
factory Matrix3.identity() =>
Matrix3.zero()
.._m3storage[0] = 1.0
.._m3storage[4] = 1.0
.._m3storage[8] = 1.0;

/// Copes values from [other].
factory Matrix3.copy(Matrix3 other) => Matrix3.zero()..setFrom(other);
Expand Down
7 changes: 6 additions & 1 deletion lib/src/vector_math_64/matrix4.dart
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,12 @@ class Matrix4 {
Matrix4.zero() : _m4storage = Float64List(16);

/// Identity matrix.
factory Matrix4.identity() => Matrix4.zero()..setIdentity();
factory Matrix4.identity() =>
Matrix4.zero()
.._m4storage[0] = 1.0
.._m4storage[5] = 1.0
.._m4storage[10] = 1.0
.._m4storage[15] = 1.0;

/// Copies values from [other].
factory Matrix4.copy(Matrix4 other) => Matrix4.zero()..setFrom(other);
Expand Down
Loading