summaryrefslogtreecommitdiffstats
path: root/o3d/samples
diff options
context:
space:
mode:
authorgman@google.com <gman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-09 14:30:47 +0000
committergman@google.com <gman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-09 14:30:47 +0000
commitf39b11ef0d10b596df75782bf8db0f7f494abc8f (patch)
tree4aa2cdd63551abf419cb0e549c7b5c8c09ddf305 /o3d/samples
parent545d8d30f35291ea27e85a159d0148c14668d8ce (diff)
downloadchromium_src-f39b11ef0d10b596df75782bf8db0f7f494abc8f.zip
chromium_src-f39b11ef0d10b596df75782bf8db0f7f494abc8f.tar.gz
chromium_src-f39b11ef0d10b596df75782bf8db0f7f494abc8f.tar.bz2
Fixes the shader builder so the constant shader
does not need normals. This means more files, like sketchup files with no materials applied will at least load (though they will most likely still display incorrectly until we get the double-sided info in) Review URL: http://codereview.chromium.org/119029 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17938 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d/samples')
-rw-r--r--o3d/samples/o3djs/effect.js20
1 files changed, 11 insertions, 9 deletions
diff --git a/o3d/samples/o3djs/effect.js b/o3d/samples/o3djs/effect.js
index 469d4e4..d9d22c4 100644
--- a/o3d/samples/o3djs/effect.js
+++ b/o3d/samples/o3djs/effect.js
@@ -620,15 +620,17 @@ o3djs.effect.buildStandardShaderString = function(material,
*/
var buildVertexDecls = function(material, diffuse, specular) {
var str = 'struct InVertex {\n' +
- ' float4 position : POSITION;\n' +
- ' float3 normal : NORMAL;\n' +
- buildTexCoords(material) +
- buildBumpInputCoords() +
- '};\n' +
- 'struct OutVertex {\n' +
- ' float4 position : POSITION;\n' +
- buildTexCoords(material) +
- buildBumpOutputCoords();
+ ' float4 position : POSITION;\n';
+ if (diffuse || specular) {
+ str += ' float3 normal : NORMAL;\n';
+ }
+ str += buildTexCoords(material) +
+ buildBumpInputCoords() +
+ '};\n' +
+ 'struct OutVertex {\n' +
+ ' float4 position : POSITION;\n' +
+ buildTexCoords(material) +
+ buildBumpOutputCoords();
if (diffuse || specular) {
str += ' float3 normal : TEXCOORD' + interpolant++ + ';\n' +
' float3 surfaceToLight: TEXCOORD' + interpolant++ + ';\n';