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 1292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1303 material, | 1303 material, |
1304 effectType); | 1304 effectType); |
1305 if (effect) { | 1305 if (effect) { |
1306 material.effect = effect; | 1306 material.effect = effect; |
1307 effect.createUniformParameters(material); | 1307 effect.createUniformParameters(material); |
1308 | 1308 |
1309 // Set a couple of the default parameters in the hopes that this will | 1309 // Set a couple of the default parameters in the hopes that this will |
1310 // help the user get something on the screen. We check to make sure they | 1310 // help the user get something on the screen. We check to make sure they |
1311 // are not connected to something otherwise we'll get an error. | 1311 // are not connected to something otherwise we'll get an error. |
1312 var param = material.getParam('lightWorldPos'); | 1312 var param = material.getParam('lightWorldPos'); |
1313 if (!param.inputConnection) { | 1313 if (param && !param.inputConnection) { |
1314 param.value = lightPos; | 1314 param.value = lightPos; |
1315 } | 1315 } |
1316 var param = material.getParam('lightColor'); | 1316 var param = material.getParam('lightColor'); |
1317 if (!param.inputConnection) { | 1317 if (param && !param.inputConnection) { |
1318 param.value = [1, 1, 1, 1]; | 1318 param.value = [1, 1, 1, 1]; |
1319 } | 1319 } |
1320 return true; | 1320 return true; |
1321 } else { | 1321 } else { |
1322 return false; | 1322 return false; |
1323 } | 1323 } |
1324 }; | 1324 }; |
1325 | 1325 |
1326 /** | 1326 /** |
1327 * Creates the uniform parameters needed for an Effect on the given ParamObject. | 1327 * Creates the uniform parameters needed for an Effect on the given ParamObject. |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1374 effect.name = o3djs.effect.TWO_COLOR_CHECKER_EFFECT_NAME; | 1374 effect.name = o3djs.effect.TWO_COLOR_CHECKER_EFFECT_NAME; |
1375 return effect; | 1375 return effect; |
1376 }; | 1376 }; |
1377 | 1377 |
1378 | 1378 |
1379 // For compatability with o3d code, the default language is o3d shading | 1379 // For compatability with o3d code, the default language is o3d shading |
1380 // language. | 1380 // language. |
1381 o3djs.effect.setLanguage('o3d'); | 1381 o3djs.effect.setLanguage('o3d'); |
1382 | 1382 |
1383 | 1383 |
OLD | NEW |