|
@@ -16,39 +16,40 @@
|
|
|
create them manually.
|
|
|
</p>
|
|
|
|
|
|
-
|
|
|
- <h2>Examples</h2>
|
|
|
-
|
|
|
- <p>[example:svg_sandbox svg / sandbox ]</p>
|
|
|
- <p>[example:misc_exporter_obj exporter / obj ]</p>
|
|
|
- <p>[example:webgl_shaders_vector WebGL / shaders / vector ]</p>
|
|
|
-
|
|
|
+ <h2>Code Example</h2>
|
|
|
|
|
|
<code>
|
|
|
-var material = new THREE.MeshStandardMaterial( { color : 0x00cc00 } );
|
|
|
+ var material = new THREE.MeshStandardMaterial( { color : 0x00cc00 } );
|
|
|
|
|
|
-//create a triangular geometry
|
|
|
-var 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 triangular geometry
|
|
|
+ var 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
|
|
|
-var normal = new THREE.Vector3( 0, 0, 1 ); //optional
|
|
|
-var color = new THREE.Color( 0xffaa00 ); //optional
|
|
|
-var materialIndex = 0; //optional
|
|
|
-var face = new THREE.Face3( 0, 1, 2, normal, color, materialIndex );
|
|
|
+ //create a new face using vertices 0, 1, 2
|
|
|
+ var normal = new THREE.Vector3( 0, 0, 1 ); //optional
|
|
|
+ var color = new THREE.Color( 0xffaa00 ); //optional
|
|
|
+ var materialIndex = 0; //optional
|
|
|
+ var face = new THREE.Face3( 0, 1, 2, normal, color, materialIndex );
|
|
|
|
|
|
-//add the face to the geometry's faces array
|
|
|
-geometry.faces.push( face );
|
|
|
+ //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();
|
|
|
+ //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 ) );
|
|
|
+ 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>
|
|
|
|
|
@@ -97,7 +98,7 @@ scene.add( new THREE.Mesh( geometry, material ) );
|
|
|
<h3>[property:Color color]</h3>
|
|
|
<p>
|
|
|
Face color - for this to be used a material's [page:Material.vertexColors vertexColors] property
|
|
|
- must be set to [page:Materials THREE.FaceColors].
|
|
|
+ must be set to *true*.
|
|
|
</p>
|
|
|
|
|
|
<h3>[property:Array vertexNormals]</h3>
|
|
@@ -108,7 +109,7 @@ scene.add( new THREE.Mesh( geometry, material ) );
|
|
|
<h3>[property:Array vertexColors]</h3>
|
|
|
<p>
|
|
|
Array of 3 vertex colors - for these to be used a material's [page:Material.vertexColors vertexColors] property
|
|
|
- must be set to [page:Materials THREE.VertexColors].
|
|
|
+ must be set to *true*.
|
|
|
</p>
|
|
|
|
|
|
|