|
@@ -11,15 +11,44 @@
|
|
|
<h1>[name]</h1>
|
|
|
|
|
|
<div class="desc">
|
|
|
- Triangle face.
|
|
|
+ Triangular face used in [page:Geometry]. These are created automatically for all
|
|
|
+ standard geometry types, however if you are building a custom geometry you will have to
|
|
|
+ create these manually.
|
|
|
</div>
|
|
|
|
|
|
|
|
|
- <h2>Example</h2>
|
|
|
+ <h2>Examples</h2>
|
|
|
|
|
|
- <code>var normal = new THREE.Vector3( 0, 1, 0 );
|
|
|
- var color = new THREE.Color( 0xffaa00 );
|
|
|
- var face = new THREE.Face3( 0, 1, 2, normal, color, 0 );</code>
|
|
|
+ <div>[example:misc_ubiquity_test ubiquity / test ]</div>
|
|
|
+ <div>[example:svg_sandbox svg / sandbox ]</div>
|
|
|
+ <div>[example:webgl_exporter_obj WebGL / exporter / obj ]</div>
|
|
|
+ <div>[example:webgl_shaders_vector WebGL / shaders / vector ]</div>
|
|
|
+
|
|
|
+
|
|
|
+ <code>
|
|
|
+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 new face using vertices 0, 1, 2
|
|
|
+var normal = new THREE.Vector3( 0, 1, 0 ); //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 );
|
|
|
+
|
|
|
+//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>Constructor</h2>
|
|
@@ -28,10 +57,18 @@
|
|
|
<div>
|
|
|
a — Vertex A index.<br />
|
|
|
b — Vertex B index.<br />
|
|
|
- c — Vertex C index.<br />
|
|
|
- normal — Face normal or array of vertex normals.<br />
|
|
|
- color — Face color or array of vertex colors.<br />
|
|
|
- materialIndex — Material index.
|
|
|
+ c — Vertex C index.<br /><br />
|
|
|
+
|
|
|
+ normal — (optional) Face normal ([page:Vector3 Vector3]) or array of vertex normals.
|
|
|
+ If a single vector is passed in, this sets [page:.normal], otherwise if and array of three
|
|
|
+ vectors is passed in this sets [page:.vertexNormals]<br /><br />
|
|
|
+
|
|
|
+ color — (optional) Face [page:Color color] or array of vertex [page:Color colors].
|
|
|
+ If a single vector is passed in, this sets [page:.color], otherwise if and array of three
|
|
|
+ vectors is passed in this sets [page:.vertexColors]<br /><br />
|
|
|
+
|
|
|
+ materialIndex — (optional) Material index - which index of a [page:MultiMaterial] to associate
|
|
|
+ with the face.
|
|
|
</div>
|
|
|
|
|
|
<h2>Properties</h2>
|
|
@@ -53,36 +90,41 @@
|
|
|
|
|
|
<h3>[property:Vector3 normal]</h3>
|
|
|
<div>
|
|
|
- Face normal.
|
|
|
+ Face normal - vector showing the direction of the Face3. If calculated automatically
|
|
|
+ (using [page:Geometry.computeFaceNormals]), this is the normalized cross product of two edges of the
|
|
|
+ triangle. Default is *(0, 0, 0)*.
|
|
|
</div>
|
|
|
|
|
|
<h3>[property:Color color]</h3>
|
|
|
<div>
|
|
|
- Face color.
|
|
|
+ Face color - for this to be used a material's [page:Material.vertexColors vertexColors] property
|
|
|
+ must be set to [page:Materials THREE.FaceColors].
|
|
|
</div>
|
|
|
|
|
|
<h3>[property:Array vertexNormals]</h3>
|
|
|
<div>
|
|
|
- Array of 3 vertex normals.
|
|
|
+ Array of 3 [page:Vector3 vertex normals].
|
|
|
</div>
|
|
|
|
|
|
<h3>[property:Array vertexColors]</h3>
|
|
|
<div>
|
|
|
- Array of 3 vertex colors.
|
|
|
+ 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].
|
|
|
</div>
|
|
|
|
|
|
|
|
|
<h3>[property:Integer materialIndex]</h3>
|
|
|
<div>
|
|
|
- Material index (points to [page:MultiMaterial MultiMaterial.materials]).
|
|
|
+ Material index (points to [page:MultiMaterial MultiMaterial.materials]). Default is *0*.
|
|
|
</div>
|
|
|
|
|
|
<h2>Methods</h2>
|
|
|
|
|
|
<h3>[method:Face3 clone]()</h3>
|
|
|
- <div>
|
|
|
- Creates a new clone of the Face3 object.
|
|
|
- </div>
|
|
|
+ <div>Creates a new clone of the Face3 object.</div>
|
|
|
+
|
|
|
+ <h3>[method:Face3 copy]( [page:Face3 face3] )</h3>
|
|
|
+ <div>Copy the paramaters of another Face3 into this.</div>
|
|
|
|
|
|
|
|
|
<h2>Source</h2>
|