OLD | NEW |
1 <!-- | 1 <!-- |
2 Copyright 2009, Google Inc. | 2 Copyright 2009, Google Inc. |
3 All rights reserved. | 3 All rights reserved. |
4 | 4 |
5 Redistribution and use in source and binary forms, with or without | 5 Redistribution and use in source and binary forms, with or without |
6 modification, are permitted provided that the following conditions are | 6 modification, are permitted provided that the following conditions are |
7 met: | 7 met: |
8 | 8 |
9 * Redistributions of source code must retain the above copyright | 9 * Redistributions of source code must retain the above copyright |
10 notice, this list of conditions and the following disclaimer. | 10 notice, this list of conditions and the following disclaimer. |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 * draws the plane. | 84 * draws the plane. |
85 * @param {Array} clientElements Array of o3d object elements. | 85 * @param {Array} clientElements Array of o3d object elements. |
86 */ | 86 */ |
87 function initStep2(clientElements) { | 87 function initStep2(clientElements) { |
88 // Init global variables. | 88 // Init global variables. |
89 initGlobals(clientElements); | 89 initGlobals(clientElements); |
90 | 90 |
91 // Set up the view and projection transformations. | 91 // Set up the view and projection transformations. |
92 initContext(); | 92 initContext(); |
93 | 93 |
94 // Add the shapes to the transform heirarchy. | 94 // Add the shapes to the transform hierarchy. |
95 createPlane(); | 95 createPlane(); |
96 | 96 |
97 // Setup render callback. | 97 // Setup render callback. |
98 g_client.setRenderCallback(onRender); | 98 g_client.setRenderCallback(onRender); |
99 | 99 |
100 window.g_finished = true; // for selenium testing. | 100 window.g_finished = true; // for selenium testing. |
101 } | 101 } |
102 | 102 |
103 | 103 |
104 /** | 104 /** |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 | 185 |
186 /** | 186 /** |
187 * Creates the plane using the primitives utility library, and adds it to the | 187 * Creates the plane using the primitives utility library, and adds it to the |
188 * transform graph at the root node. | 188 * transform graph at the root node. |
189 */ | 189 */ |
190 function createPlane() { | 190 function createPlane() { |
191 // This will create a plane subdivided into 180,000 triangles. | 191 // This will create a plane subdivided into 180,000 triangles. |
192 var plane = o3djs.primitives.createPlane( | 192 var plane = o3djs.primitives.createPlane( |
193 g_pack, createMaterial(), 4, 4, 300, 300); | 193 g_pack, createMaterial(), 4, 4, 300, 300); |
194 | 194 |
195 // Add the shape to the transform heirarchy. | 195 // Add the shape to the transform hierarchy. |
196 g_client.root.addShape(plane); | 196 g_client.root.addShape(plane); |
197 } | 197 } |
198 | 198 |
199 | 199 |
200 /** | 200 /** |
201 * Updates the clock for the animation. | 201 * Updates the clock for the animation. |
202 * @param {!o3d.RenderEvent} renderEvent Rendering Information. | 202 * @param {!o3d.RenderEvent} renderEvent Rendering Information. |
203 */ | 203 */ |
204 function onRender(renderEvent) { | 204 function onRender(renderEvent) { |
205 var elapsedTime = renderEvent.elapsedTime; | 205 var elapsedTime = renderEvent.elapsedTime; |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 return float4(0, 0.6, 0.7, 1) * dot(n, l) + specular; | 328 return float4(0, 0.6, 0.7, 1) * dot(n, l) + specular; |
329 } | 329 } |
330 | 330 |
331 | 331 |
332 // #o3d VertexShaderEntryPoint vertexShaderFunction | 332 // #o3d VertexShaderEntryPoint vertexShaderFunction |
333 // #o3d PixelShaderEntryPoint pixelShaderFunction | 333 // #o3d PixelShaderEntryPoint pixelShaderFunction |
334 // #o3d MatrixLoadOrder RowMajor | 334 // #o3d MatrixLoadOrder RowMajor |
335 </textarea> | 335 </textarea> |
336 </body> | 336 </body> |
337 </html> | 337 </html> |
OLD | NEW |