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 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 shadowEffect.loadPixelShaderFromString(shadowPixelShader); | 253 shadowEffect.loadPixelShaderFromString(shadowPixelShader); |
254 | 254 |
255 g_shadowMaterial.effect = shadowEffect; | 255 g_shadowMaterial.effect = shadowEffect; |
256 shadowEffect.createUniformParameters(g_shadowMaterial); | 256 shadowEffect.createUniformParameters(g_shadowMaterial); |
257 | 257 |
258 g_shadowSampler = g_pack.createObject('Sampler'); | 258 g_shadowSampler = g_pack.createObject('Sampler'); |
259 g_shadowSampler.texture = g_shadowTexture; | 259 g_shadowSampler.texture = g_shadowTexture; |
260 g_shadowSampler.minFilter = g_o3d.Sampler.POINT; | 260 g_shadowSampler.minFilter = g_o3d.Sampler.POINT; |
261 g_shadowSampler.magFilter = g_o3d.Sampler.POINT; | 261 g_shadowSampler.magFilter = g_o3d.Sampler.POINT; |
262 g_shadowSampler.mipFilter = g_o3d.Sampler.POINT; | 262 g_shadowSampler.mipFilter = g_o3d.Sampler.POINT; |
263 g_shadowSampler.addressModeU = g_o3d.Sampler.BORDER; | 263 // Note: The o3d-plugin used BORDER as address mode, but that is not available |
264 g_shadowSampler.addressModeV = g_o3d.Sampler.BORDER; | 264 // in WebGL so use WRAP instead. |
265 g_shadowSampler.borderColor = [1, 1, 1, 1]; | 265 g_shadowSampler.addressModeU = g_o3d.Sampler.WRAP; |
| 266 g_shadowSampler.addressModeV = g_o3d.Sampler.WRAP; |
| 267 //g_shadowSampler.borderColor = [1, 1, 1, 1]; |
266 } | 268 } |
267 | 269 |
268 | 270 |
269 /** | 271 /** |
270 * Sets up reasonable view and projection matrices. | 272 * Sets up reasonable view and projection matrices. |
271 */ | 273 */ |
272 function updateCamera() { | 274 function updateCamera() { |
273 // Set up a perspective transformation for the projection. | 275 // Set up a perspective transformation for the projection. |
274 g_colorViewInfo.drawContext.projection = g_math.matrix4.perspective( | 276 g_colorViewInfo.drawContext.projection = g_math.matrix4.perspective( |
275 g_math.degToRad(30), // 30 degree frustum. | 277 g_math.degToRad(30), // 30 degree frustum. |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
622 <h1>Shadow Maps</h1> | 624 <h1>Shadow Maps</h1> |
623 This sample implements a basic shadow map. | 625 This sample implements a basic shadow map. |
624 <br/> | 626 <br/> |
625 <!-- Start of O3D plugin --> | 627 <!-- Start of O3D plugin --> |
626 <div id="o3d" style="width: 800px; height: 600px;"></div> | 628 <div id="o3d" style="width: 800px; height: 600px;"></div> |
627 <!-- End of O3D plugin --> | 629 <!-- End of O3D plugin --> |
628 Use A, S, D, W, I and O to move the light. | 630 Use A, S, D, W, I and O to move the light. |
629 Press spacebar to see the shadow map. | 631 Press spacebar to see the shadow map. |
630 </body> | 632 </body> |
631 </html> | 633 </html> |
OLD | NEW |