OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | |
2 // for details. All rights reserved. Use of this source code is governed by a | |
3 // BSD-style license that can be found in the LICENSE file. | |
4 | |
5 /** | |
6 * Emulates the browser's Float32Array (so Matrix4 can be used outside | |
7 * the browser. | |
Jacob
2011/12/12 18:38:17
note that this is really a Float64Array
mattsh
2011/12/12 19:14:45
Done.
| |
8 */ | |
9 | |
Jacob
2011/12/12 18:38:17
extra line break
mattsh
2011/12/12 19:14:45
Done.
| |
10 class Float32Array { | |
11 final List<double> buf; | |
12 | |
13 Float32Array(int size) : buf = new List<double>(size) { | |
14 for (int i = 0; i < size; i++) { | |
15 buf[i] = 0.0; | |
16 } | |
17 } | |
18 | |
19 double operator [](int i) { | |
20 return buf[i]; | |
21 } | |
22 | |
23 void operator []=(int i, num value) { | |
24 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
| |
25 } | |
26 } | |
OLD | NEW |