* Some of the controller models share the same material for different parts (buttons, triggers...). * In order to change their color independently we have to create separate materials.
(object3d)
| 475 | * In order to change their color independently we have to create separate materials. |
| 476 | */ |
| 477 | function cloneMeshMaterial (object3d) { |
| 478 | object3d.traverse(function (node) { |
| 479 | var newMaterial; |
| 480 | if (node.type !== 'Mesh') return; |
| 481 | newMaterial = node.material.clone(); |
| 482 | object3d.originalColor = node.material.color; |
| 483 | node.material.dispose(); |
| 484 | node.material = newMaterial; |
| 485 | }); |
| 486 | } |
no outgoing calls
no test coverage detected