Graphics Reference
In-Depth Information
var cylinderGeometry = new
THREE.CylinderGeometry(
3, 5, 10,20);
2. After the geometry, we can create the materials. You can use as many as you
want, but in this recipe, we'll just use two:
var material1 = new
THREE.MeshLambertMaterial(
{color:0xff0000,
transparent: true,
opacity: 0.7});
var material2 = new
THREE.MeshBasicMaterial(
{wireframe:true});
As you can see, we create a transparent THREE.MeshLambertMaterial
object and THREE.MeshBasicMaterial object, which only renders a wire-
frame.
3. Now, we can create the object that can be added to the scene. Instead of in-
stantiating THREE.Mesh , we use the createMultiMaterialObject func-
tion provided by the THREE.SceneUtils object:
var cylinder =
THREE.SceneUtils.createMultiMaterialObject(
cylinderGeometry,
[material1,
material2]);
You can add the result from this function to the scene:
scene.add(cylinder);
Search WWH ::




Custom Search