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. | |
8 * (Note this stores entries as 64-bit doubles, since there is no | |
9 * 32-bit float type on the vm.) | |
10 */ | |
11 class Float32Array { | |
12 final List<double> buf; | |
13 | |
14 Float32Array(int size) : buf = new List<double>(size) { | |
15 for (int i = 0; i < size; i++) { | |
16 buf[i] = 0.0; | |
17 } | |
18 } | |
19 | |
20 double operator [](int i) { | |
21 return buf[i]; | |
22 } | |
23 | |
24 void operator []=(int i, num value) { | |
25 buf[i] = (value != null) ? value.toDouble() : 0.0; | |
26 } | |
27 } | |
OLD | NEW |