|
@@ -15,41 +15,6 @@
|
|
|
create them manually.
|
|
|
</p>
|
|
|
|
|
|
- <h2>Code Example</h2>
|
|
|
-
|
|
|
- <code>
|
|
|
- const material = new THREE.MeshStandardMaterial( { color : 0x00cc00 } );
|
|
|
-
|
|
|
- //create a triangular geometry
|
|
|
- const geometry = new THREE.Geometry();
|
|
|
- geometry.vertices.push( new THREE.Vector3( -50, -50, 0 ) );
|
|
|
- geometry.vertices.push( new THREE.Vector3( 50, -50, 0 ) );
|
|
|
- geometry.vertices.push( new THREE.Vector3( 50, 50, 0 ) );
|
|
|
-
|
|
|
- //create a new face using vertices 0, 1, 2
|
|
|
- const normal = new THREE.Vector3( 0, 0, 1 ); //optional
|
|
|
- const color = new THREE.Color( 0xffaa00 ); //optional
|
|
|
- const materialIndex = 0; //optional
|
|
|
- const face = new THREE.Face3( 0, 1, 2, normal, color, materialIndex );
|
|
|
-
|
|
|
- //add the face to the geometry's faces array
|
|
|
- geometry.faces.push( face );
|
|
|
-
|
|
|
- //the face normals and vertex normals can be calculated automatically if not supplied above
|
|
|
- geometry.computeFaceNormals();
|
|
|
- geometry.computeVertexNormals();
|
|
|
-
|
|
|
- scene.add( new THREE.Mesh( geometry, material ) );
|
|
|
- </code>
|
|
|
-
|
|
|
- <h2>Examples</h2>
|
|
|
-
|
|
|
- <p>
|
|
|
- [example:svg_sandbox svg / sandbox ]<br />
|
|
|
- [example:misc_exporter_obj exporter / obj ]<br />
|
|
|
- [example:webgl_shaders_vector WebGL / shaders / vector ]
|
|
|
- </p>
|
|
|
-
|
|
|
<h2>Constructor</h2>
|
|
|
|
|
|
<h3>[name]( [param:Integer a], [param:Integer b], [param:Integer c], [param:Vector3 normal], [param:Color color], [param:Integer materialIndex] )</h3>
|