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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 * map and then render the scene, we need two subtrees of the render graph, one | 161 * map and then render the scene, we need two subtrees of the render graph, one |
162 * for shadow map render pass and one to draw the scene. | 162 * for shadow map render pass and one to draw the scene. |
163 */ | 163 */ |
164 function initRenderGraph() { | 164 function initRenderGraph() { |
165 // Create the texture that will store the depth information. | 165 // Create the texture that will store the depth information. |
166 g_shadowTexture = g_pack.createTexture2D(SHADOW_MAP_WIDTH, | 166 g_shadowTexture = g_pack.createTexture2D(SHADOW_MAP_WIDTH, |
167 SHADOW_MAP_HEIGHT, | 167 SHADOW_MAP_HEIGHT, |
168 g_o3d.Texture.ABGR32F, | 168 g_o3d.Texture.ABGR32F, |
169 1, | 169 1, |
170 true); | 170 true); |
171 var renderSurface = g_shadowTexture.getRenderSurface(0, g_pack); | 171 var renderSurface = g_shadowTexture.getRenderSurface(0); |
172 | 172 |
173 // Create the depth-stencil buffer required when rendering the teapot. | 173 // Create the depth-stencil buffer required when rendering the teapot. |
174 var depthSurface = g_pack.createDepthStencilSurface(SHADOW_MAP_WIDTH, | 174 var depthSurface = g_pack.createDepthStencilSurface(SHADOW_MAP_WIDTH, |
175 SHADOW_MAP_HEIGHT); | 175 SHADOW_MAP_HEIGHT); |
176 | 176 |
177 // The children of any one node in the render graph get traversed in order by | 177 // The children of any one node in the render graph get traversed in order by |
178 // priority. Here, we're forcing the shadow map to get rendered first by | 178 // priority. Here, we're forcing the shadow map to get rendered first by |
179 // by giving its render root lower priority. | 179 // by giving its render root lower priority. |
180 var shadowPassRenderRoot = g_pack.createObject('RenderNode'); | 180 var shadowPassRenderRoot = g_pack.createObject('RenderNode'); |
181 shadowPassRenderRoot.priority = 0; | 181 shadowPassRenderRoot.priority = 0; |
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
619 <h1>Shadow Maps</h1> | 619 <h1>Shadow Maps</h1> |
620 This sample implements a basic shadow map. | 620 This sample implements a basic shadow map. |
621 <br/> | 621 <br/> |
622 <!-- Start of O3D plugin --> | 622 <!-- Start of O3D plugin --> |
623 <div id="o3d" style="width: 600px; height: 600px;"></div> | 623 <div id="o3d" style="width: 600px; height: 600px;"></div> |
624 <!-- End of O3D plugin --> | 624 <!-- End of O3D plugin --> |
625 Use A, S, D, W, I and O to move the light. | 625 Use A, S, D, W, I and O to move the light. |
626 Press spacebar to see the shadow map. | 626 Press spacebar to see the shadow map. |
627 </body> | 627 </body> |
628 </html> | 628 </html> |
OLD | NEW |