Index: utils/matrix/float32.dart |
diff --git a/utils/matrix/float32.dart b/utils/matrix/float32.dart |
new file mode 100644 |
index 0000000000000000000000000000000000000000..2a83746370b16d3dc4fb01ea4810a329e3671eb0 |
--- /dev/null |
+++ b/utils/matrix/float32.dart |
@@ -0,0 +1,26 @@ |
+// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
+// for details. All rights reserved. Use of this source code is governed by a |
+// BSD-style license that can be found in the LICENSE file. |
+ |
+/** |
+ * Emulates the browser's Float32Array (so Matrix4 can be used outside |
+ * the browser. |
Jacob
2011/12/12 18:38:17
note that this is really a Float64Array
mattsh
2011/12/12 19:14:45
Done.
|
+ */ |
+ |
Jacob
2011/12/12 18:38:17
extra line break
mattsh
2011/12/12 19:14:45
Done.
|
+class Float32Array { |
+ final List<double> buf; |
+ |
+ Float32Array(int size) : buf = new List<double>(size) { |
+ for (int i = 0; i < size; i++) { |
+ buf[i] = 0.0; |
+ } |
+ } |
+ |
+ double operator [](int i) { |
+ return buf[i]; |
+ } |
+ |
+ void operator []=(int i, num value) { |
+ buf[i] = (value != null) ? value.toDouble() : 0.0; |
Bob Nystrom
2011/12/12 21:46:09
Why are you checking for null here?
mattsh
2011/12/12 22:48:26
Might not be necessary, but it's emulating the Flo
|
+ } |
+} |