Browse Source

Improved docs/Constants/DrawModes

looeee 8 years ago
parent
commit
ff09cbc137
1 changed files with 46 additions and 6 deletions
  1. 46 6
      docs/api/constants/DrawModes.html

+ 46 - 6
docs/api/constants/DrawModes.html

@@ -9,13 +9,53 @@
 	</head>
 	<body>
 		<h1>Draw Mode Constants</h1>
+		<p>
+			These are valid values for Mesh.drawMode, and control how the list of vertices is interpeted once sent to the GPU.</p>
+		</p>
+		<h2>Draw Modes</h2>
+		<code>
+			THREE.TrianglesDrawMode<br />
+		</code>
+		<p>
+			This is the default, and results in every three consecutive vertices (v0, v1, v2), (v2, v3, v5), ... being interpreted as a separate triangle. <br />
+			If the number of vertices is not a multiple of 3, excess vertices are ignored.
+		</p>
+		<code>
+			THREE.TriangleStripDrawMode<br />
+		</code>
+		<p>
+			This will result in a series of triangles connected in a strip, given by (v0, v1, v2), (v2, v1, v3), (v2, v3, v4), ... so that every subsequent triangle shares two vertices with the previous triangle.
+		</p>
+		<code>
+			THREE.TriangleFanDrawMode
+		</code>
+		<p>
+			This will result in a series of triangles each sharing the first vertex (like a fan), given by (v0, v1, v2), (v0, v2, v3), (v0, v3, v4), ...
+		</p>
+
+
+		<h2>Usage</h2>
+
+		<code>
+		var geometry = new THREE.Geometry();
+
+		geometry.vertices.push(
+			new THREE.Vector3( -10,  10, 0 ),
+			new THREE.Vector3( -10, -10, 0 ),
+			new THREE.Vector3(  10, -10, 0 ),
+			...
+		);
+		geometry.faces.push( new THREE.Face3( 0, 1, 2 ), ... );
+
+		var material = new THREE.MeshBasicMaterial( { color: 0xffff00 } );
+
+		var mesh = new THREE.Mesh( geometry, material );
+		mesh.drawMode = THREE.TrianglesDrawMode; //default
+
+		scene.add( mesh );
+		</code>
+
 
-		<h2>Draw Mode</h2>
-		<div>
-		THREE.TrianglesDrawMode<br />
-		THREE.TriangleStripDrawMode<br />
-		THREE.TriangleFanDrawMode
-		</div>
 
 		<h2>Source</h2>