输入:检查网格的更新材料

时间:2015-11-07 01:58:18

标签: javascript jquery three.js

如果我选中一个单选按钮,我想更改网格的材质。 基本上我想捕获已检查单选按钮的数据颜色属性并将其放在我的网格物体中。

怎么可以这样做?

材料

 var material = {
      "black":  new THREE.MeshPhongMaterial( {color: 0x111111,  shininess: 35, combine: THREE.MixOperation, shading: THREE.FlatShading } ),
      "white":  new THREE.MeshPhongMaterial( {color: 0xffffff,  shininess: 65}),
      "grey":   new THREE.MeshPhongMaterial( {color: 0xcccccc,  specular: 0x111111})
      }

var geometry = new THREE.BoxGeometry( 1, 1, 1 );
var mesh= new THREE.Mesh( geometry, material[ "black" ]);
mesh.name = "changematerial";
scene.add( mesh );

单选按钮

<input id="black" type="radio" data-color="black" name="material" checked>
<input id="white" type="radio" data-color="white" name="material">
<input id="grey" type="radio" data-color="grey" name="material">

0 个答案:

没有答案