Forráskód Böngészése

Added better description of how to calculate matrix transform in vertex shader, borrowing from https://github.com/mrdoob/three.js/issues/1188#issuecomment-3666286

Casey Grun 10 éve
szülő
commit
300cb9138f
1 módosított fájl, 14 hozzáadás és 1 törlés
  1. 14 1
      docs/api/renderers/webgl/WebGLProgram.html

+ 14 - 1
docs/api/renderers/webgl/WebGLProgram.html

@@ -35,15 +35,28 @@
 		uniform vec3 cameraPosition;
 		</code>
 		<code>
+		// default vertex attributes provided by Geometry and BufferGeometry
 		attribute vec3 position;
 		attribute vec3 normal;
 		attribute vec2 uv;
 		attribute vec2 uv2;
-		</code></div>
+		</code>
+		<p>
+		Note that you can therefore calculate the position of a vertex in the vertex shader by:
+		<code>
+		gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
+		</code>
+		or alternatively
+		<code>
+		gl_Position = projectionMatrix * viewMatrix * modelMatrix * vec4( position, 1.0 );
+		</code>
+		</p>
+		</div>
 		
 		<h3>Vertex shader (conditional):</h3>
 		<code>
 		#ifdef USE_COLOR
+			// vertex color attribute
 			attribute vec3 color;
 		#endif
 		</code>