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 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 }; | 402 }; |
403 | 403 |
404 | 404 |
405 /** | 405 /** |
406 * Builds the vertex attribute declarations for a given material. | 406 * Builds the vertex attribute declarations for a given material. |
407 * @param {!o3d.Material} material The material to inspect. | 407 * @param {!o3d.Material} material The material to inspect. |
408 * @param {boolean} diffuse Whether to include stuff for diffuse calculations. | 408 * @param {boolean} diffuse Whether to include stuff for diffuse calculations. |
409 * @param {boolean} specular Whether to include stuff for diffuse | 409 * @param {boolean} specular Whether to include stuff for diffuse |
410 * calculations. | 410 * calculations. |
411 * @param {boolean} bumpSampler Whether there is a bump sampler. | 411 * @param {boolean} bumpSampler Whether there is a bump sampler. |
| 412 * @param {boolean} skinning Whether this mesh has a skin. |
412 * @return {string} The code for the declarations. | 413 * @return {string} The code for the declarations. |
413 */ | 414 */ |
414 o3djs.effect.buildAttributeDecls = | 415 o3djs.effect.buildAttributeDecls = |
415 function(material, diffuse, specular, bumpSampler) { | 416 function(material, diffuse, specular, bumpSampler, skinning) { |
416 var str = o3djs.effect.BEGIN_IN_STRUCT + | 417 var str = o3djs.effect.BEGIN_IN_STRUCT + |
417 o3djs.effect.ATTRIBUTE + o3djs.effect.FLOAT4 + ' ' + 'position' + | 418 o3djs.effect.ATTRIBUTE + o3djs.effect.FLOAT4 + ' ' + 'position' + |
418 o3djs.effect.semanticSuffix('POSITION') + ';\n'; | 419 o3djs.effect.semanticSuffix('POSITION') + ';\n'; |
419 if (diffuse || specular) { | 420 if (diffuse || specular) { |
420 str += o3djs.effect.ATTRIBUTE + o3djs.effect.FLOAT3 + ' ' + 'normal' + | 421 str += o3djs.effect.ATTRIBUTE + o3djs.effect.FLOAT3 + ' ' + 'normal' + |
421 o3djs.effect.semanticSuffix('NORMAL') + ';\n'; | 422 o3djs.effect.semanticSuffix('NORMAL') + ';\n'; |
422 } | 423 } |
| 424 if (skinning) { |
| 425 str += o3djs.effect.ATTRIBUTE + o3djs.effect.FLOAT4 + ' influenceWeights' + |
| 426 o3djs.effect.semanticSuffix('BLENDWEIGHT') + ';\n'; |
| 427 str += o3djs.effect.ATTRIBUTE + o3djs.effect.FLOAT4 + ' influenceIndices' + |
| 428 o3djs.effect.semanticSuffix('BLENDINDICES') + ';\n'; |
| 429 } |
423 str += o3djs.effect.buildTexCoords(material, false) + | 430 str += o3djs.effect.buildTexCoords(material, false) + |
424 o3djs.effect.buildBumpInputCoords(bumpSampler) + | 431 o3djs.effect.buildBumpInputCoords(bumpSampler) + |
425 o3djs.effect.END_STRUCT; | 432 o3djs.effect.END_STRUCT; |
426 return str; | 433 return str; |
427 }; | 434 }; |
428 | 435 |
429 | 436 |
430 /** | 437 /** |
431 * Caches the varying parameter declarations to be repeated in the case that | 438 * Caches the varying parameter declarations to be repeated in the case that |
432 * we're in glsl and need to declare the varying parameters in both shaders. | 439 * we're in glsl and need to declare the varying parameters in both shaders. |
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
831 * @param {string} effectType Type of effect to create ('phong', 'lambert', | 838 * @param {string} effectType Type of effect to create ('phong', 'lambert', |
832 * 'constant'). | 839 * 'constant'). |
833 * @return {{description: string, shader: string}} A description and the shader | 840 * @return {{description: string, shader: string}} A description and the shader |
834 * string. | 841 * string. |
835 */ | 842 */ |
836 o3djs.effect.buildStandardShaderString = function(material, | 843 o3djs.effect.buildStandardShaderString = function(material, |
837 effectType) { | 844 effectType) { |
838 var p = o3djs.effect; | 845 var p = o3djs.effect; |
839 var bumpSampler = material.getParam('bumpSampler'); | 846 var bumpSampler = material.getParam('bumpSampler'); |
840 var bumpUVInterpolant; | 847 var bumpUVInterpolant; |
| 848 var skinning; |
| 849 |
| 850 var maxSkinInfluences = 4; |
| 851 |
| 852 // Hardcode reasonable maximum for number of skinning uniforms. |
| 853 // glsl: Table 6.19: minimum MAX_VERTEX_UNIFORM_VECTORS is 128. |
| 854 // (DX9 requires a minimum of 256, so not a problem in o3d). |
| 855 var maxSkinUniforms = 36 * 3; |
| 856 if (o3djs.base.o3d && o3djs.base.o3d.SkinEval && |
| 857 o3djs.base.o3d.SkinEval.getMaxNumBones) { |
| 858 maxSkinUniforms = o3d.SkinEval.getMaxNumBones(material) * 3; |
| 859 skinning = true; |
| 860 } else { |
| 861 skinning = false; |
| 862 } |
841 | 863 |
842 /** | 864 /** |
843 * Extracts the texture type from a texture param. | 865 * Extracts the texture type from a texture param. |
844 * @param {!o3d.ParamTexture} textureParam The texture parameter to | 866 * @param {!o3d.ParamTexture} textureParam The texture parameter to |
845 * inspect. | 867 * inspect. |
846 * @return {string} The texture type (1D, 2D, 3D or CUBE). | 868 * @return {string} The texture type (1D, 2D, 3D or CUBE). |
847 */ | 869 */ |
848 var getTextureType = function(textureParam) { | 870 var getTextureType = function(textureParam) { |
849 var texture = textureParam.value; | 871 var texture = textureParam.value; |
850 if (!texture) return '2D'; // No texture value, have to make a guess. | 872 if (!texture) return '2D'; // No texture value, have to make a guess. |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
899 var buildLightingUniforms = function() { | 921 var buildLightingUniforms = function() { |
900 return 'uniform ' + p.MATRIX4 + ' world' + | 922 return 'uniform ' + p.MATRIX4 + ' world' + |
901 p.semanticSuffix('WORLD') + ';\n' + | 923 p.semanticSuffix('WORLD') + ';\n' + |
902 'uniform ' + p.MATRIX4 + | 924 'uniform ' + p.MATRIX4 + |
903 ' viewInverse' + p.semanticSuffix('VIEWINVERSE') + ';\n' + | 925 ' viewInverse' + p.semanticSuffix('VIEWINVERSE') + ';\n' + |
904 'uniform ' + p.MATRIX4 + ' worldInverseTranspose' + | 926 'uniform ' + p.MATRIX4 + ' worldInverseTranspose' + |
905 p.semanticSuffix('WORLDINVERSETRANSPOSE') + ';\n'; | 927 p.semanticSuffix('WORLDINVERSETRANSPOSE') + ';\n'; |
906 }; | 928 }; |
907 | 929 |
908 /** | 930 /** |
| 931 * If skinning is enabled, builds the bone matrix uniform variables needed |
| 932 * for skinning. Otherwise, returns the empty string. |
| 933 * @return {string} The effect code for skinning uniforms. |
| 934 */ |
| 935 var buildSkinningUniforms = function() { |
| 936 return skinning ? 'uniform ' + p.FLOAT4 + ' boneToWorld3x4' + |
| 937 '[' + maxSkinUniforms + '];\n' + |
| 938 'uniform float usingSkinShader;\n' : ''; |
| 939 }; |
| 940 |
| 941 /** |
909 * Builds uniform parameters for a given color input. If the material | 942 * Builds uniform parameters for a given color input. If the material |
910 * has a sampler parameter, a sampler uniform is created, otherwise a | 943 * has a sampler parameter, a sampler uniform is created, otherwise a |
911 * float4 color value is created. | 944 * float4 color value is created. |
912 * @param {!o3d.Material} material The material to inspect. | 945 * @param {!o3d.Material} material The material to inspect. |
913 * @param {!Array.<string>} descriptions Array to add descriptions too. | 946 * @param {!Array.<string>} descriptions Array to add descriptions too. |
914 * @param {string} name The name of the parameter to look for. Usually | 947 * @param {string} name The name of the parameter to look for. Usually |
915 * emissive, ambient, diffuse or specular. | 948 * emissive, ambient, diffuse or specular. |
916 * @param {boolean} opt_addColorParam Whether to add a color param if no | 949 * @param {boolean} opt_addColorParam Whether to add a color param if no |
917 * sampler exists. Default = true. | 950 * sampler exists. Default = true. |
918 * @return {string} The effect code for the uniform parameter. | 951 * @return {string} The effect code for the uniform parameter. |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
960 /** | 993 /** |
961 * Builds vertex and fragment shader string for the Constant lighting type. | 994 * Builds vertex and fragment shader string for the Constant lighting type. |
962 * @param {!o3d.Material} material The material for which to build | 995 * @param {!o3d.Material} material The material for which to build |
963 * shaders. | 996 * shaders. |
964 * @param {!Array.<string>} descriptions Array to add descriptions too. | 997 * @param {!Array.<string>} descriptions Array to add descriptions too. |
965 * @return {string} The effect code for the shader, ready to be parsed. | 998 * @return {string} The effect code for the shader, ready to be parsed. |
966 */ | 999 */ |
967 var buildConstantShaderString = function(material, descriptions) { | 1000 var buildConstantShaderString = function(material, descriptions) { |
968 descriptions.push('constant'); | 1001 descriptions.push('constant'); |
969 return buildCommonVertexUniforms() + | 1002 return buildCommonVertexUniforms() + |
| 1003 buildSkinningUniforms() + |
970 buildVertexDecls(material, false, false) + | 1004 buildVertexDecls(material, false, false) + |
971 p.beginVertexShaderMain() + | 1005 p.beginVertexShaderMain() + |
972 positionVertexShaderCode() + | 1006 positionVertexShaderCode() + |
973 p.buildUVPassthroughs(material) + | 1007 p.buildUVPassthroughs(material) + |
974 p.endVertexShaderMain() + | 1008 p.endVertexShaderMain() + |
975 p.pixelShaderHeader(material, false, false, bumpSampler) + | 1009 p.pixelShaderHeader(material, false, false, bumpSampler) + |
976 buildCommonPixelUniforms() + | 1010 buildCommonPixelUniforms() + |
977 p.repeatVaryingDecls() + | 1011 p.repeatVaryingDecls() + |
978 buildColorParam(material, descriptions, 'emissive') + | 1012 buildColorParam(material, descriptions, 'emissive') + |
979 p.beginPixelShaderMain() + | 1013 p.beginPixelShaderMain() + |
980 getColorParam(material, 'emissive') + | 1014 getColorParam(material, 'emissive') + |
981 p.endPixelShaderMain('emissive') + | 1015 p.endPixelShaderMain('emissive') + |
982 p.entryPoints() + | 1016 p.entryPoints() + |
983 p.matrixLoadOrder(); | 1017 p.matrixLoadOrder(); |
984 }; | 1018 }; |
985 | 1019 |
986 /** | 1020 /** |
987 * Builds vertex and fragment shader string for the Lambert lighting type. | 1021 * Builds vertex and fragment shader string for the Lambert lighting type. |
988 * @param {!o3d.Material} material The material for which to build | 1022 * @param {!o3d.Material} material The material for which to build |
989 * shaders. | 1023 * shaders. |
990 * @param {!Array.<string>} descriptions Array to add descriptions too. | 1024 * @param {!Array.<string>} descriptions Array to add descriptions too. |
991 * @return {string} The effect code for the shader, ready to be parsed. | 1025 * @return {string} The effect code for the shader, ready to be parsed. |
992 */ | 1026 */ |
993 var buildLambertShaderString = function(material, descriptions) { | 1027 var buildLambertShaderString = function(material, descriptions) { |
994 descriptions.push('lambert'); | 1028 descriptions.push('lambert'); |
995 return buildCommonVertexUniforms() + | 1029 return buildCommonVertexUniforms() + |
996 buildLightingUniforms() + | 1030 buildLightingUniforms() + |
| 1031 buildSkinningUniforms() + |
997 buildVertexDecls(material, true, false) + | 1032 buildVertexDecls(material, true, false) + |
998 p.beginVertexShaderMain() + | 1033 p.beginVertexShaderMain() + |
999 p.buildUVPassthroughs(material) + | 1034 p.buildUVPassthroughs(material) + |
1000 positionVertexShaderCode() + | 1035 positionVertexShaderCode() + |
1001 normalVertexShaderCode() + | 1036 normalVertexShaderCode() + |
1002 surfaceToLightVertexShaderCode() + | 1037 surfaceToLightVertexShaderCode() + |
1003 bumpVertexShaderCode() + | 1038 bumpVertexShaderCode() + |
1004 p.endVertexShaderMain() + | 1039 p.endVertexShaderMain() + |
1005 p.pixelShaderHeader(material, true, false) + | 1040 p.pixelShaderHeader(material, true, false) + |
1006 buildCommonPixelUniforms() + | 1041 buildCommonPixelUniforms() + |
(...skipping 27 matching lines...) Expand all Loading... |
1034 * shaders. | 1069 * shaders. |
1035 * @param {!Array.<string>} descriptions Array to add descriptions too. | 1070 * @param {!Array.<string>} descriptions Array to add descriptions too. |
1036 * @return {string} The effect code for the shader, ready to be parsed. | 1071 * @return {string} The effect code for the shader, ready to be parsed. |
1037 * TODO: This is actually just a copy of the Phong code. | 1072 * TODO: This is actually just a copy of the Phong code. |
1038 * Change to Blinn. | 1073 * Change to Blinn. |
1039 */ | 1074 */ |
1040 var buildBlinnShaderString = function(material, descriptions) { | 1075 var buildBlinnShaderString = function(material, descriptions) { |
1041 descriptions.push('phong'); | 1076 descriptions.push('phong'); |
1042 return buildCommonVertexUniforms() + | 1077 return buildCommonVertexUniforms() + |
1043 buildLightingUniforms() + | 1078 buildLightingUniforms() + |
| 1079 buildSkinningUniforms() + |
1044 buildVertexDecls(material, true, true) + | 1080 buildVertexDecls(material, true, true) + |
1045 p.beginVertexShaderMain() + | 1081 p.beginVertexShaderMain() + |
1046 p.buildUVPassthroughs(material) + | 1082 p.buildUVPassthroughs(material) + |
1047 positionVertexShaderCode() + | 1083 positionVertexShaderCode() + |
1048 normalVertexShaderCode() + | 1084 normalVertexShaderCode() + |
1049 surfaceToLightVertexShaderCode() + | 1085 surfaceToLightVertexShaderCode() + |
1050 surfaceToViewVertexShaderCode() + | 1086 surfaceToViewVertexShaderCode() + |
1051 bumpVertexShaderCode() + | 1087 bumpVertexShaderCode() + |
1052 p.endVertexShaderMain() + | 1088 p.endVertexShaderMain() + |
1053 p.pixelShaderHeader(material, true, true) + | 1089 p.pixelShaderHeader(material, true, true) + |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1092 * Builds vertex and fragment shader string for the Phong lighting type. | 1128 * Builds vertex and fragment shader string for the Phong lighting type. |
1093 * @param {!o3d.Material} material The material for which to build | 1129 * @param {!o3d.Material} material The material for which to build |
1094 * shaders. | 1130 * shaders. |
1095 * @param {!Array.<string>} descriptions Array to add descriptions too. | 1131 * @param {!Array.<string>} descriptions Array to add descriptions too. |
1096 * @return {string} The effect code for the shader, ready to be parsed. | 1132 * @return {string} The effect code for the shader, ready to be parsed. |
1097 */ | 1133 */ |
1098 var buildPhongShaderString = function(material, descriptions) { | 1134 var buildPhongShaderString = function(material, descriptions) { |
1099 descriptions.push('phong'); | 1135 descriptions.push('phong'); |
1100 return buildCommonVertexUniforms() + | 1136 return buildCommonVertexUniforms() + |
1101 buildLightingUniforms() + | 1137 buildLightingUniforms() + |
| 1138 buildSkinningUniforms() + |
1102 buildVertexDecls(material, true, true) + | 1139 buildVertexDecls(material, true, true) + |
1103 p.beginVertexShaderMain() + | 1140 p.beginVertexShaderMain() + |
1104 p.buildUVPassthroughs(material) + | 1141 p.buildUVPassthroughs(material) + |
1105 positionVertexShaderCode() + | 1142 positionVertexShaderCode() + |
1106 normalVertexShaderCode() + | 1143 normalVertexShaderCode() + |
1107 surfaceToLightVertexShaderCode() + | 1144 surfaceToLightVertexShaderCode() + |
1108 surfaceToViewVertexShaderCode() + | 1145 surfaceToViewVertexShaderCode() + |
1109 bumpVertexShaderCode() + | 1146 bumpVertexShaderCode() + |
1110 p.endVertexShaderMain() + | 1147 p.endVertexShaderMain() + |
1111 p.pixelShaderHeader(material, true, true) + | 1148 p.pixelShaderHeader(material, true, true) + |
(...skipping 30 matching lines...) Expand all Loading... |
1142 ' diffuse.a)') + | 1179 ' diffuse.a)') + |
1143 p.entryPoints() + | 1180 p.entryPoints() + |
1144 p.matrixLoadOrder(); | 1181 p.matrixLoadOrder(); |
1145 }; | 1182 }; |
1146 | 1183 |
1147 /** | 1184 /** |
1148 * Builds the position code for the vertex shader. | 1185 * Builds the position code for the vertex shader. |
1149 * @return {string} The code for the vertex shader. | 1186 * @return {string} The code for the vertex shader. |
1150 */ | 1187 */ |
1151 var positionVertexShaderCode = function() { | 1188 var positionVertexShaderCode = function() { |
1152 return ' ' + p.VERTEX_VARYING_PREFIX + 'position = ' + | 1189 var attribute_position = p.ATTRIBUTE_PREFIX + 'position'; |
1153 p.mul(p.ATTRIBUTE_PREFIX + | 1190 if (skinning) { |
1154 'position', 'worldViewProjection') + ';\n'; | 1191 return ' ' + p.FLOAT4 + ' weightedpos = ' + attribute_position + ';\n' + |
| 1192 ' for (int i = 0; i < ' + maxSkinInfluences + '; i++) {\n' + |
| 1193 ' ' + p.FLOAT4 + ' temp = ' + p.FLOAT4 + '(' + |
| 1194 'dot(boneToWorld3x4[int(influenceIndices[i] * 3.0)], ' + |
| 1195 attribute_position + '),\n' + |
| 1196 ' dot(boneToWorld3x4[int(influenceIndices[i] * 3.0 + 1.0)], ' + |
| 1197 attribute_position + '),\n' + |
| 1198 ' dot(boneToWorld3x4[int(influenceIndices[i] * 3.0 + 2.0)], ' + |
| 1199 attribute_position + '),\n' + |
| 1200 ' 1.0);\n' + |
| 1201 ' weightedpos += usingSkinShader * influenceWeights[i] * ' + |
| 1202 '(temp - ' + attribute_position + ');\n' + |
| 1203 ' }\n' + |
| 1204 ' ' + p.VERTEX_VARYING_PREFIX + 'position = ' + |
| 1205 p.mul('weightedpos', 'worldViewProjection') + ';\n'; |
| 1206 } else { |
| 1207 return ' ' + p.VERTEX_VARYING_PREFIX + 'position = ' + |
| 1208 p.mul(attribute_position, 'worldViewProjection') + ';\n'; |
| 1209 } |
1155 }; | 1210 }; |
1156 | 1211 |
1157 /** | 1212 /** |
1158 * Builds the normal code for the vertex shader. | 1213 * Builds the normal code for the vertex shader. |
1159 * @return {string} The code for the vertex shader. | 1214 * @return {string} The code for the vertex shader. |
1160 */ | 1215 */ |
1161 var normalVertexShaderCode = function() { | 1216 var normalVertexShaderCode = function() { |
1162 return ' ' + p.VERTEX_VARYING_PREFIX + 'normal = ' + | 1217 var attribute_normal = p.ATTRIBUTE_PREFIX + 'normal'; |
1163 p.mul(p.FLOAT4 + '(' + | 1218 if (skinning) { |
1164 p.ATTRIBUTE_PREFIX + | 1219 return ' ' + p.FLOAT3 + ' weightednorm = ' + attribute_normal + ';\n' + |
1165 'normal, 0)', 'worldInverseTranspose') + '.xyz;\n'; | 1220 ' for (int i = 0; i < ' + maxSkinInfluences + '; i++) {\n' + |
| 1221 ' ' + p.FLOAT3 + ' temp = ' + p.FLOAT3 + '(' + |
| 1222 'dot(boneToWorld3x4[int(influenceIndices[i] * 3.0)].xyz, ' + |
| 1223 attribute_normal + '),\n' + |
| 1224 ' dot(boneToWorld3x4[int(influenceIndices[i] * 3.0 + 1.0)].xyz, ' + |
| 1225 attribute_normal + '),\n' + |
| 1226 ' dot(boneToWorld3x4[int(influenceIndices[i] * 3.0 + 2.0)].xyz, ' + |
| 1227 attribute_normal + '));\n' + |
| 1228 ' weightednorm += usingSkinShader * influenceWeights[i] * ' + |
| 1229 '(temp - ' + attribute_normal + ');\n' + |
| 1230 ' }\n' + |
| 1231 ' ' + p.VERTEX_VARYING_PREFIX + 'normal = ' + |
| 1232 p.mul(p.FLOAT4 + '(' + 'weightednorm' + ', 0)', |
| 1233 'worldInverseTranspose') + '.xyz;\n'; |
| 1234 } else { |
| 1235 return ' ' + p.VERTEX_VARYING_PREFIX + 'normal = ' + |
| 1236 p.mul(p.FLOAT4 + '(' + |
| 1237 attribute_normal + ', 0)', 'worldInverseTranspose') + |
| 1238 '.xyz;\n'; |
| 1239 } |
1166 }; | 1240 }; |
1167 | 1241 |
1168 /** | 1242 /** |
1169 * Builds the surface to light code for the vertex shader. | 1243 * Builds the surface to light code for the vertex shader. |
1170 * @return {string} The code for the vertex shader. | 1244 * @return {string} The code for the vertex shader. |
1171 */ | 1245 */ |
1172 var surfaceToLightVertexShaderCode = function() { | 1246 var surfaceToLightVertexShaderCode = function() { |
1173 return ' ' + p.VERTEX_VARYING_PREFIX + | 1247 return ' ' + p.VERTEX_VARYING_PREFIX + |
1174 'surfaceToLight = lightWorldPos - \n' + | 1248 'surfaceToLight = lightWorldPos - \n' + |
1175 ' ' + | 1249 ' ' + |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1231 * Builds the vertex declarations for a given material. | 1305 * Builds the vertex declarations for a given material. |
1232 * @param {!o3d.Material} material The material to inspect. | 1306 * @param {!o3d.Material} material The material to inspect. |
1233 * @param {boolean} diffuse Whether to include stuff for diffuse | 1307 * @param {boolean} diffuse Whether to include stuff for diffuse |
1234 * calculations. | 1308 * calculations. |
1235 * @param {boolean} specular Whether to include stuff for diffuse | 1309 * @param {boolean} specular Whether to include stuff for diffuse |
1236 * calculations. | 1310 * calculations. |
1237 * @return {string} The code for the vertex declarations. | 1311 * @return {string} The code for the vertex declarations. |
1238 */ | 1312 */ |
1239 var buildVertexDecls = function(material, diffuse, specular) { | 1313 var buildVertexDecls = function(material, diffuse, specular) { |
1240 return p.buildAttributeDecls( | 1314 return p.buildAttributeDecls( |
1241 material, diffuse, specular, bumpSampler) + | 1315 material, diffuse, specular, bumpSampler, skinning) + |
1242 p.buildVaryingDecls( | 1316 p.buildVaryingDecls( |
1243 material, diffuse, specular, bumpSampler); | 1317 material, diffuse, specular, bumpSampler); |
1244 }; | 1318 }; |
1245 | 1319 |
1246 | 1320 |
1247 // Create a shader string of the appropriate type, based on the | 1321 // Create a shader string of the appropriate type, based on the |
1248 // effectType. | 1322 // effectType. |
1249 var str; | 1323 var str; |
1250 var descriptions = []; | 1324 var descriptions = []; |
1251 if (effectType == 'phong') { | 1325 if (effectType == 'phong') { |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1391 effect.name = o3djs.effect.TWO_COLOR_CHECKER_EFFECT_NAME; | 1465 effect.name = o3djs.effect.TWO_COLOR_CHECKER_EFFECT_NAME; |
1392 return effect; | 1466 return effect; |
1393 }; | 1467 }; |
1394 | 1468 |
1395 | 1469 |
1396 // For compatability with o3d code, the default language is o3d shading | 1470 // For compatability with o3d code, the default language is o3d shading |
1397 // language. | 1471 // language. |
1398 o3djs.effect.setLanguage('o3d'); | 1472 o3djs.effect.setLanguage('o3d'); |
1399 | 1473 |
1400 | 1474 |
OLD | NEW |