OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 * A solar system visualization. | 6 * A solar system visualization. |
7 */ | 7 */ |
8 | 8 |
9 library solar3d; | 9 library solar3d; |
10 | 10 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 canvas.parent.text = ">>> Browser does not support WebGL <<<"; | 53 canvas.parent.text = ">>> Browser does not support WebGL <<<"; |
54 return; | 54 return; |
55 } | 55 } |
56 var baseUrl = getBaseUrl(); | 56 var baseUrl = getBaseUrl(); |
57 baseUrl = '${baseUrl}textures/'; | 57 baseUrl = '${baseUrl}textures/'; |
58 textureManager = new TextureManager(baseUrl, glContext); | 58 textureManager = new TextureManager(baseUrl, glContext); |
59 solarSystem = new SolarSystem(); | 59 solarSystem = new SolarSystem(); |
60 skyBox = new Skybox(glContext); | 60 skyBox = new Skybox(glContext); |
61 orbitPath = new OrbitPath(glContext); | 61 orbitPath = new OrbitPath(glContext); |
62 // Measure the canvas element. | 62 // Measure the canvas element. |
63 window.setImmediate(() { | 63 window.immediate.then((_) { |
64 canvas.width = (canvas.parent as Element).clientWidth; | 64 canvas.width = (canvas.parent as Element).clientWidth; |
65 canvas.height = 400; | 65 canvas.height = 400; |
66 | 66 |
67 Future f = setupAssets(); | 67 Future f = setupAssets(); |
68 f.then((_) { | 68 f.then((_) { |
69 bind(); | 69 bind(); |
70 camera.aspectRatio = canvas.width / canvas.height; | 70 camera.aspectRatio = canvas.width / canvas.height; |
71 // Initialize the planets and start the simulation. | 71 // Initialize the planets and start the simulation. |
72 solarSystem.start(); | 72 solarSystem.start(); |
73 requestRedraw(); | 73 requestRedraw(); |
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 print(log); | 536 print(log); |
537 } | 537 } |
538 } | 538 } |
539 | 539 |
540 /** | 540 /** |
541 * The entry point to the application. | 541 * The entry point to the application. |
542 */ | 542 */ |
543 void main() { | 543 void main() { |
544 application.startup('#container'); | 544 application.startup('#container'); |
545 } | 545 } |
OLD | NEW |