Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(172)

Side by Side Diff: samples/matrix/float32.dart

Issue 8966010: moved matrix class from utils to samples (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | samples/matrix/matrix4.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 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 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /** 5 /**
6 * Emulates the browser's Float32Array (so Matrix4 can be used outside 6 * Emulates the browser's Float32Array (so Matrix4 can be used outside
7 * the browser. 7 * the browser.
8 * (Note this stores entries as 64-bit doubles, since there is no 8 * (Note this stores entries as 64-bit doubles, since there is no
9 * 32-bit float type on the vm.) 9 * 32-bit float type on the vm.)
10 */ 10 */
11 class Float32Array { 11 class Float32Array {
12 final List<double> buf; 12 final List<double> buf;
13 13
14 Float32Array(int size) : buf = new List<double>(size) { 14 Float32Array(int size) : buf = new List<double>(size) {
15 for (int i = 0; i < size; i++) { 15 for (int i = 0; i < size; i++) {
16 buf[i] = 0.0; 16 buf[i] = 0.0;
17 } 17 }
18 } 18 }
19 19
20 double operator [](int i) { 20 double operator [](int i) {
21 return buf[i]; 21 return buf[i];
22 } 22 }
23 23
24 void operator []=(int i, num value) { 24 void operator []=(int i, num value) {
25 buf[i] = (value != null) ? value.toDouble() : 0.0; 25 buf[i] = (value != null) ? value.toDouble() : 0.0;
26 } 26 }
27 } 27 }
OLDNEW
« no previous file with comments | « no previous file | samples/matrix/matrix4.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698