Merge pull request #190 from lrhn/remove-uppercase-constants
Remove usage of deprecated Dart 1 upper-case constants.
diff --git a/.travis.yml b/.travis.yml
index 02caa43..103a8a0 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -2,5 +2,4 @@
sudo: false
dart:
- dev
- - stable
script: ./tool/travis.sh
diff --git a/bin/mesh_generator.dart b/bin/mesh_generator.dart
index fefb449..8f807d6 100644
--- a/bin/mesh_generator.dart
+++ b/bin/mesh_generator.dart
@@ -93,5 +93,5 @@
print('Error generating geometry for $type');
return;
}
- print(JSON.encode(geometry));
+ print(jsonEncode(geometry));
}
diff --git a/lib/src/vector_math/aabb2.dart b/lib/src/vector_math/aabb2.dart
index 1039aa4..510351a 100644
--- a/lib/src/vector_math/aabb2.dart
+++ b/lib/src/vector_math/aabb2.dart
@@ -42,11 +42,11 @@
/// Constructs [Aabb2] with a min/max [storage] that views given [buffer]
/// starting at [offset]. [offset] has to be multiple of
- /// [Float32List.BYTES_PER_ELEMENT].
+ /// [Float32List.bytesPerElement].
Aabb2.fromBuffer(ByteBuffer buffer, int offset)
: _min = new Vector2.fromBuffer(buffer, offset),
_max = new Vector2.fromBuffer(
- buffer, offset + Float32List.BYTES_PER_ELEMENT * 2);
+ buffer, offset + Float32List.bytesPerElement * 2);
/// Set the AABB by a [center] and [halfExtents].
void setCenterAndHalfExtents(Vector2 center, Vector2 halfExtents) {
diff --git a/lib/src/vector_math/aabb3.dart b/lib/src/vector_math/aabb3.dart
index c7c1488..c108034 100644
--- a/lib/src/vector_math/aabb3.dart
+++ b/lib/src/vector_math/aabb3.dart
@@ -57,11 +57,11 @@
/// Constructs [Aabb3] with a min/max [storage] that views given [buffer]
/// starting at [offset]. [offset] has to be multiple of
- /// [Float32List.BYTES_PER_ELEMENT].
+ /// [Float32List.bytesPerElement].
Aabb3.fromBuffer(ByteBuffer buffer, int offset)
: _min = new Vector3.fromBuffer(buffer, offset),
_max = new Vector3.fromBuffer(
- buffer, offset + Float32List.BYTES_PER_ELEMENT * 3);
+ buffer, offset + Float32List.bytesPerElement * 3);
/// Set the AABB by a [center] and [halfExtents].
void setCenterAndHalfExtents(Vector3 center, Vector3 halfExtents) {
diff --git a/lib/src/vector_math/matrix4.dart b/lib/src/vector_math/matrix4.dart
index 837c5f9..f83f838 100644
--- a/lib/src/vector_math/matrix4.dart
+++ b/lib/src/vector_math/matrix4.dart
@@ -321,7 +321,7 @@
Matrix4.fromFloat32List(this._m4storage);
/// Constructs Matrix4 with a [storage] that views given [buffer] starting at
- /// [offset]. [offset] has to be multiple of [Float32List.BYTES_PER_ELEMENT].
+ /// [offset]. [offset] has to be multiple of [Float32List.bytesPerElement].
Matrix4.fromBuffer(ByteBuffer buffer, int offset)
: _m4storage = new Float32List.view(buffer, offset, 16);
diff --git a/lib/src/vector_math/quaternion.dart b/lib/src/vector_math/quaternion.dart
index 0370e11..c25305b 100644
--- a/lib/src/vector_math/quaternion.dart
+++ b/lib/src/vector_math/quaternion.dart
@@ -84,7 +84,7 @@
/// Constructs a quaternion with a [storage] that views given [buffer]
/// starting at [offset]. [offset] has to be multiple of
- /// [Float32List.BYTES_PER_ELEMENT].
+ /// [Float32List.bytesPerElement].
Quaternion.fromBuffer(ByteBuffer buffer, int offset)
: _qStorage = new Float32List.view(buffer, offset, 4);
diff --git a/lib/src/vector_math/ray.dart b/lib/src/vector_math/ray.dart
index 60efc11..42d8561 100644
--- a/lib/src/vector_math/ray.dart
+++ b/lib/src/vector_math/ray.dart
@@ -204,8 +204,8 @@
final Vector3 otherMin = other.min;
final Vector3 otherMax = other.max;
- double tNear = -double.MAX_FINITE;
- double tFar = double.MAX_FINITE;
+ double tNear = -double.maxFinite;
+ double tFar = double.maxFinite;
for (int i = 0; i < 3; ++i) {
if (_direction[i] == 0.0) {
diff --git a/lib/src/vector_math/vector2.dart b/lib/src/vector_math/vector2.dart
index ec7f889..cd9de83 100644
--- a/lib/src/vector_math/vector2.dart
+++ b/lib/src/vector_math/vector2.dart
@@ -54,7 +54,7 @@
Vector2.fromFloat32List(this._v2storage);
/// Constructs Vector2 with a [storage] that views given [buffer] starting at
- /// [offset]. [offset] has to be multiple of [Float32List.BYTES_PER_ELEMENT].
+ /// [offset]. [offset] has to be multiple of [Float32List.bytesPerElement].
Vector2.fromBuffer(ByteBuffer buffer, int offset)
: _v2storage = new Float32List.view(buffer, offset, 2);
diff --git a/lib/src/vector_math/vector3.dart b/lib/src/vector_math/vector3.dart
index 432ef4d..4cfd78c 100644
--- a/lib/src/vector_math/vector3.dart
+++ b/lib/src/vector_math/vector3.dart
@@ -58,7 +58,7 @@
Vector3.fromFloat32List(this._v3storage);
/// Constructs Vector3 with a [storage] that views given [buffer] starting at
- /// [offset]. [offset] has to be multiple of [Float32List.BYTES_PER_ELEMENT].
+ /// [offset]. [offset] has to be multiple of [Float32List.bytesPerElement].
Vector3.fromBuffer(ByteBuffer buffer, int offset)
: _v3storage = new Float32List.view(buffer, offset, 3);
diff --git a/lib/src/vector_math/vector4.dart b/lib/src/vector_math/vector4.dart
index 086ad4f..4bc427c 100644
--- a/lib/src/vector_math/vector4.dart
+++ b/lib/src/vector_math/vector4.dart
@@ -64,7 +64,7 @@
Vector4.fromFloat32List(this._v4storage);
/// Constructs Vector4 with a [storage] that views given [buffer] starting at
- /// [offset]. [offset] has to be multiple of [Float32List.BYTES_PER_ELEMENT].
+ /// [offset]. [offset] has to be multiple of [Float32List.bytesPerElement].
Vector4.fromBuffer(ByteBuffer buffer, int offset)
: _v4storage = new Float32List.view(buffer, offset, 4);
diff --git a/lib/src/vector_math_64/aabb2.dart b/lib/src/vector_math_64/aabb2.dart
index 11e4215..3536766 100644
--- a/lib/src/vector_math_64/aabb2.dart
+++ b/lib/src/vector_math_64/aabb2.dart
@@ -42,11 +42,11 @@
/// Constructs [Aabb2] with a min/max [storage] that views given [buffer]
/// starting at [offset]. [offset] has to be multiple of
- /// [Float64List.BYTES_PER_ELEMENT].
+ /// [Float64List.bytesPerElement].
Aabb2.fromBuffer(ByteBuffer buffer, int offset)
: _min = new Vector2.fromBuffer(buffer, offset),
_max = new Vector2.fromBuffer(
- buffer, offset + Float64List.BYTES_PER_ELEMENT * 2);
+ buffer, offset + Float64List.bytesPerElement * 2);
/// Set the AABB by a [center] and [halfExtents].
void setCenterAndHalfExtents(Vector2 center, Vector2 halfExtents) {
diff --git a/lib/src/vector_math_64/aabb3.dart b/lib/src/vector_math_64/aabb3.dart
index 189cad5..ae07627 100644
--- a/lib/src/vector_math_64/aabb3.dart
+++ b/lib/src/vector_math_64/aabb3.dart
@@ -57,11 +57,11 @@
/// Constructs [Aabb3] with a min/max [storage] that views given [buffer]
/// starting at [offset]. [offset] has to be multiple of
- /// [Float64List.BYTES_PER_ELEMENT].
+ /// [Float64List.bytesPerElement].
Aabb3.fromBuffer(ByteBuffer buffer, int offset)
: _min = new Vector3.fromBuffer(buffer, offset),
_max = new Vector3.fromBuffer(
- buffer, offset + Float64List.BYTES_PER_ELEMENT * 3);
+ buffer, offset + Float64List.bytesPerElement * 3);
/// Set the AABB by a [center] and [halfExtents].
void setCenterAndHalfExtents(Vector3 center, Vector3 halfExtents) {
diff --git a/lib/src/vector_math_64/matrix4.dart b/lib/src/vector_math_64/matrix4.dart
index c01cc65..d995a95 100644
--- a/lib/src/vector_math_64/matrix4.dart
+++ b/lib/src/vector_math_64/matrix4.dart
@@ -321,7 +321,7 @@
Matrix4.fromFloat64List(this._m4storage);
/// Constructs Matrix4 with a [storage] that views given [buffer] starting at
- /// [offset]. [offset] has to be multiple of [Float64List.BYTES_PER_ELEMENT].
+ /// [offset]. [offset] has to be multiple of [Float64List.bytesPerElement].
Matrix4.fromBuffer(ByteBuffer buffer, int offset)
: _m4storage = new Float64List.view(buffer, offset, 16);
diff --git a/lib/src/vector_math_64/quaternion.dart b/lib/src/vector_math_64/quaternion.dart
index 5681555..f2e626d 100644
--- a/lib/src/vector_math_64/quaternion.dart
+++ b/lib/src/vector_math_64/quaternion.dart
@@ -84,7 +84,7 @@
/// Constructs a quaternion with a [storage] that views given [buffer]
/// starting at [offset]. [offset] has to be multiple of
- /// [Float64List.BYTES_PER_ELEMENT].
+ /// [Float64List.bytesPerElement].
Quaternion.fromBuffer(ByteBuffer buffer, int offset)
: _qStorage = new Float64List.view(buffer, offset, 4);
diff --git a/lib/src/vector_math_64/ray.dart b/lib/src/vector_math_64/ray.dart
index d79e6dc..a265908 100644
--- a/lib/src/vector_math_64/ray.dart
+++ b/lib/src/vector_math_64/ray.dart
@@ -204,8 +204,8 @@
final Vector3 otherMin = other.min;
final Vector3 otherMax = other.max;
- double tNear = -double.MAX_FINITE;
- double tFar = double.MAX_FINITE;
+ double tNear = -double.maxFinite;
+ double tFar = double.maxFinite;
for (int i = 0; i < 3; ++i) {
if (_direction[i] == 0.0) {
diff --git a/lib/src/vector_math_64/vector2.dart b/lib/src/vector_math_64/vector2.dart
index 847ae40..7464cb5 100644
--- a/lib/src/vector_math_64/vector2.dart
+++ b/lib/src/vector_math_64/vector2.dart
@@ -54,7 +54,7 @@
Vector2.fromFloat64List(this._v2storage);
/// Constructs Vector2 with a [storage] that views given [buffer] starting at
- /// [offset]. [offset] has to be multiple of [Float64List.BYTES_PER_ELEMENT].
+ /// [offset]. [offset] has to be multiple of [Float64List.bytesPerElement].
Vector2.fromBuffer(ByteBuffer buffer, int offset)
: _v2storage = new Float64List.view(buffer, offset, 2);
diff --git a/lib/src/vector_math_64/vector3.dart b/lib/src/vector_math_64/vector3.dart
index 73dea75..d027b1c 100644
--- a/lib/src/vector_math_64/vector3.dart
+++ b/lib/src/vector_math_64/vector3.dart
@@ -58,7 +58,7 @@
Vector3.fromFloat64List(this._v3storage);
/// Constructs Vector3 with a [storage] that views given [buffer] starting at
- /// [offset]. [offset] has to be multiple of [Float64List.BYTES_PER_ELEMENT].
+ /// [offset]. [offset] has to be multiple of [Float64List.bytesPerElement].
Vector3.fromBuffer(ByteBuffer buffer, int offset)
: _v3storage = new Float64List.view(buffer, offset, 3);
diff --git a/lib/src/vector_math_64/vector4.dart b/lib/src/vector_math_64/vector4.dart
index d65c8ac..43c569b 100644
--- a/lib/src/vector_math_64/vector4.dart
+++ b/lib/src/vector_math_64/vector4.dart
@@ -64,7 +64,7 @@
Vector4.fromFloat64List(this._v4storage);
/// Constructs Vector4 with a [storage] that views given [buffer] starting at
- /// [offset]. [offset] has to be multiple of [Float64List.BYTES_PER_ELEMENT].
+ /// [offset]. [offset] has to be multiple of [Float64List.bytesPerElement].
Vector4.fromBuffer(ByteBuffer buffer, int offset)
: _v4storage = new Float64List.view(buffer, offset, 4);
diff --git a/lib/src/vector_math_geometry/mesh_geometry.dart b/lib/src/vector_math_geometry/mesh_geometry.dart
index 3080a9a..b2452e3 100644
--- a/lib/src/vector_math_geometry/mesh_geometry.dart
+++ b/lib/src/vector_math_geometry/mesh_geometry.dart
@@ -96,7 +96,7 @@
MeshGeometry._internal(this.length, this.stride, this.attribs,
[Float32List externBuffer]) {
buffer = externBuffer ??
- new Float32List((length * stride) ~/ Float32List.BYTES_PER_ELEMENT);
+ new Float32List((length * stride) ~/ Float32List.bytesPerElement);
}
MeshGeometry.copy(MeshGeometry mesh)
diff --git a/lib/src/vector_math_operations/matrix.dart b/lib/src/vector_math_operations/matrix.dart
index d893325..8fb525c 100644
--- a/lib/src/vector_math_operations/matrix.dart
+++ b/lib/src/vector_math_operations/matrix.dart
@@ -271,25 +271,25 @@
final Float32x4 a2 = A[aOffset++];
final Float32x4 a3 = A[aOffset++];
final Float32x4 b0 = B[bOffset++];
- out[outOffset++] = b0.shuffle(Float32x4.XXXX) * a0 +
- b0.shuffle(Float32x4.YYYY) * a1 +
- b0.shuffle(Float32x4.ZZZZ) * a2 +
- b0.shuffle(Float32x4.WWWW) * a3;
+ out[outOffset++] = b0.shuffle(Float32x4.xxxx) * a0 +
+ b0.shuffle(Float32x4.yyyy) * a1 +
+ b0.shuffle(Float32x4.zzzz) * a2 +
+ b0.shuffle(Float32x4.wwww) * a3;
final Float32x4 b1 = B[bOffset++];
- out[outOffset++] = b1.shuffle(Float32x4.XXXX) * a0 +
- b1.shuffle(Float32x4.YYYY) * a1 +
- b1.shuffle(Float32x4.ZZZZ) * a2 +
- b1.shuffle(Float32x4.WWWW) * a3;
+ out[outOffset++] = b1.shuffle(Float32x4.xxxx) * a0 +
+ b1.shuffle(Float32x4.yyyy) * a1 +
+ b1.shuffle(Float32x4.zzzz) * a2 +
+ b1.shuffle(Float32x4.wwww) * a3;
final Float32x4 b2 = B[bOffset++];
- out[outOffset++] = b2.shuffle(Float32x4.XXXX) * a0 +
- b2.shuffle(Float32x4.YYYY) * a1 +
- b2.shuffle(Float32x4.ZZZZ) * a2 +
- b2.shuffle(Float32x4.WWWW) * a3;
+ out[outOffset++] = b2.shuffle(Float32x4.xxxx) * a0 +
+ b2.shuffle(Float32x4.yyyy) * a1 +
+ b2.shuffle(Float32x4.zzzz) * a2 +
+ b2.shuffle(Float32x4.wwww) * a3;
final Float32x4 b3 = B[bOffset++];
- out[outOffset++] = b3.shuffle(Float32x4.XXXX) * a0 +
- b3.shuffle(Float32x4.YYYY) * a1 +
- b3.shuffle(Float32x4.ZZZZ) * a2 +
- b3.shuffle(Float32x4.WWWW) * a3;
+ out[outOffset++] = b3.shuffle(Float32x4.xxxx) * a0 +
+ b3.shuffle(Float32x4.yyyy) * a1 +
+ b3.shuffle(Float32x4.zzzz) * a2 +
+ b3.shuffle(Float32x4.wwww) * a3;
}
/// Transform the 4D [vector] starting at [vectorOffset] by the 4x4 [matrix]
@@ -297,12 +297,12 @@
static void transform4(Float32x4List out, int outOffset, Float32x4List matrix,
int matrixOffset, Float32x4List vector, int vectorOffset) {
final Float32x4 v = vector[vectorOffset];
- final Float32x4 xxxx = v.shuffle(Float32x4.XXXX);
+ final Float32x4 xxxx = v.shuffle(Float32x4.xxxx);
Float32x4 z = new Float32x4.zero();
z += xxxx * matrix[0 + matrixOffset];
- final Float32x4 yyyy = v.shuffle(Float32x4.YYYY);
+ final Float32x4 yyyy = v.shuffle(Float32x4.yyyy);
z += yyyy * matrix[1 + matrixOffset];
- final Float32x4 zzzz = v.shuffle(Float32x4.ZZZZ);
+ final Float32x4 zzzz = v.shuffle(Float32x4.zzzz);
z += zzzz * matrix[2 + matrixOffset];
z += matrix[3 + matrixOffset];
out[0 + outOffset] = z;
diff --git a/pubspec.yaml b/pubspec.yaml
index f834141..cfaf2e5 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,10 +1,10 @@
name: vector_math
-version: 2.0.8-dev
+version: 2.0.8
author: John McCutchan <john@johnmccutchan.com>
description: A Vector Math library for 2D and 3D applications.
homepage: https://github.com/google/vector_math.dart
environment:
- sdk: '>=1.21.0 <2.0.0'
+ sdk: '>=2.0.0-dev.49.0 <3.0.0'
dev_dependencies:
benchmark_harness: any
browser: any
diff --git a/test/aabb3_test.dart b/test/aabb3_test.dart
index 66a3407..90317a2 100644
--- a/test/aabb3_test.dart
+++ b/test/aabb3_test.dart
@@ -17,7 +17,7 @@
new Float32List.fromList([1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0]).buffer;
final aabb = new Aabb3.fromBuffer(buffer, 0);
final aabbOffest =
- new Aabb3.fromBuffer(buffer, Float32List.BYTES_PER_ELEMENT);
+ new Aabb3.fromBuffer(buffer, Float32List.bytesPerElement);
expect(aabb.min.x, equals(1.0));
expect(aabb.min.y, equals(2.0));
diff --git a/test/matrix4_test.dart b/test/matrix4_test.dart
index 10f9655..a626c2f 100644
--- a/test/matrix4_test.dart
+++ b/test/matrix4_test.dart
@@ -80,7 +80,7 @@
final ByteBuffer buffer = float32List.buffer;
final Matrix4 zeroOffset = new Matrix4.fromBuffer(buffer, 0);
final Matrix4 offsetVector =
- new Matrix4.fromBuffer(buffer, Float32List.BYTES_PER_ELEMENT);
+ new Matrix4.fromBuffer(buffer, Float32List.bytesPerElement);
expect(zeroOffset.storage[0], equals(1.0));
expect(zeroOffset.storage[1], equals(2.0));
diff --git a/test/quaternion_test.dart b/test/quaternion_test.dart
index e98ed94..459dffd 100644
--- a/test/quaternion_test.dart
+++ b/test/quaternion_test.dart
@@ -30,7 +30,7 @@
final ByteBuffer buffer = float32List.buffer;
final Quaternion zeroOffset = new Quaternion.fromBuffer(buffer, 0);
final Quaternion offsetVector =
- new Quaternion.fromBuffer(buffer, Float32List.BYTES_PER_ELEMENT);
+ new Quaternion.fromBuffer(buffer, Float32List.bytesPerElement);
expect(zeroOffset.x, equals(1.0));
expect(zeroOffset.y, equals(2.0));
diff --git a/test/vector2_test.dart b/test/vector2_test.dart
index bff1a31..4fa3c6a 100644
--- a/test/vector2_test.dart
+++ b/test/vector2_test.dart
@@ -27,7 +27,7 @@
final buffer = float32List.buffer;
final zeroOffset = new Vector2.fromBuffer(buffer, 0);
final offsetVector =
- new Vector2.fromBuffer(buffer, Float32List.BYTES_PER_ELEMENT);
+ new Vector2.fromBuffer(buffer, Float32List.bytesPerElement);
expect(zeroOffset.x, equals(1.0));
expect(zeroOffset.y, equals(2.0));
diff --git a/test/vector3_test.dart b/test/vector3_test.dart
index 1da7a56..516d716 100644
--- a/test/vector3_test.dart
+++ b/test/vector3_test.dart
@@ -28,7 +28,7 @@
final ByteBuffer buffer = float32List.buffer;
final Vector3 zeroOffset = new Vector3.fromBuffer(buffer, 0);
final Vector3 offsetVector =
- new Vector3.fromBuffer(buffer, Float32List.BYTES_PER_ELEMENT);
+ new Vector3.fromBuffer(buffer, Float32List.bytesPerElement);
expect(zeroOffset.x, equals(1.0));
expect(zeroOffset.y, equals(2.0));
diff --git a/test/vector4_test.dart b/test/vector4_test.dart
index a4026e3..1045809 100644
--- a/test/vector4_test.dart
+++ b/test/vector4_test.dart
@@ -29,7 +29,7 @@
final buffer = float32List.buffer;
final zeroOffset = new Vector4.fromBuffer(buffer, 0);
final offsetVector =
- new Vector4.fromBuffer(buffer, Float32List.BYTES_PER_ELEMENT);
+ new Vector4.fromBuffer(buffer, Float32List.bytesPerElement);
expect(zeroOffset.x, equals(1.0));
expect(zeroOffset.y, equals(2.0));