Browse Source

added GLBufferAttribute to docs

raub 7 năm trước cách đây
mục cha
commit
bf283b5970

+ 88 - 0
docs/api/core/GLBufferAttribute.html

@@ -0,0 +1,88 @@
+<!DOCTYPE html>
+<html lang="en">
+	<head>
+		<meta charset="utf-8" />
+		<base href="../../" />
+		<script src="list.js"></script>
+		<script src="page.js"></script>
+		<link type="text/css" rel="stylesheet" href="page.css" />
+	</head>
+	<body>
+
+		<h1>[name]</h1>
+
+		<p class="desc">
+			This buffer attribute class does not construct a VBO. Instead, it uses
+			whatever VBO is passed in constructor and can later be altered via the
+			*buffer* property.<br /><br />
+			It is required to pass additional params alongside the VBO. Those are:
+			the GL context, the GL data type, the number of components per vertex
+			and the number of vertices.<br /><br />
+			The most common use case for this class is when some kind of GPGPU
+			calculation interferes or even produces the VBOs in question.
+		</p>
+
+		<h2>Constructor</h2>
+		<h3>[name]( [param:WebGLRenderingContext gl], [param:WebGLBuffer buffer], [param:GLenum type], [param:Integer itemSize], [param:Integer count] )</h3>
+		<p>
+		</p>
+
+		<h2>Properties</h2>
+
+		<h3>[property:WebGLBuffer buffer]</h3>
+		<p>
+			The current <a href="https://developer.mozilla.org/en-US/docs/Web/API/WebGLBuffer" target="_blank">WebGLBuffer</a> instance.
+		</p>
+
+		<h3>[property:Integer count]</h3>
+		<p>
+			The expected number of vertices in VBO.
+		</p>
+
+		<h3>[property:Integer itemSize]</h3>
+		<p>
+			How many values make up each item (vertex).
+		</p>
+
+		<h3>[property:Integer elementSize]</h3>
+		<p>
+			Stores the corresponding size in bytes for the current *type* property value.
+		</p>
+		<p>
+			<b>Don't touch</b>.
+		</p>
+
+		<h3>[property:GLenum type]</h3>
+		<p>
+			A <a href="https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/Constants#Standard_WebGL_1_constants" target="_blank">WebGL Data Type</a> describing the underlying VBO contents.
+		</p>
+		<p>
+			Setting this is only allowed with *setType*.
+		</p>
+
+		<h3>[property:Boolean isGLBufferAttribute]</h3>
+		<p>
+			Should be *true*.
+		</p>
+
+		<h2>Methods</h2>
+
+		<h3>[method:null setBuffer]( buffer ) </h3>
+		<p>Sets the *buffer* property.</p>
+
+		<h3>[method:null setType]( type ) </h3>
+		<p>Sets the *type* property.</p>
+
+		<h3>[method:null setItemSize]( itemSize ) </h3>
+		<p>Sets the *itemSize* property.</p>
+
+		<h3>[method:null setCount]( count ) </h3>
+		<p>Sets the *count* property.</p>
+
+
+
+		<h2>Source</h2>
+
+		[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
+	</body>
+</html>

+ 1 - 0
docs/list.js

@@ -86,6 +86,7 @@ var list = {
 			"Face3": "api/core/Face3",
 			"Geometry": "api/core/Geometry",
 			"InstancedBufferAttribute": "api/core/InstancedBufferAttribute",
+			"GLBufferAttribute": "api/core/GLBufferAttribute",
 			"InstancedBufferGeometry": "api/core/InstancedBufferGeometry",
 			"InstancedInterleavedBuffer": "api/core/InstancedInterleavedBuffer",
 			"InterleavedBuffer": "api/core/InterleavedBuffer",

+ 1 - 0
examples/files.js

@@ -287,6 +287,7 @@ var files = {
 		"webgl_buffergeometry_lines",
 		"webgl_buffergeometry_lines_indexed",
 		"webgl_buffergeometry_points",
+		"webgl_buffergeometry_points_glbufferattribute",
 		"webgl_buffergeometry_points_interleaved",
 		"webgl_buffergeometry_rawshader",
 		"webgl_buffergeometry_selective_draw",

+ 17 - 13
examples/webgl_buffergeometry_points_glbufferattribute.html

@@ -111,30 +111,34 @@
 				var gl = renderer.context;
 
 				var pos = gl.createBuffer();
-				gl.bindBuffer(gl.ARRAY_BUFFER, pos);
-				gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(positions), gl.STATIC_DRAW);
+				gl.bindBuffer( gl.ARRAY_BUFFER, pos );
+				gl.bufferData( gl.ARRAY_BUFFER, new Float32Array( positions ), gl.STATIC_DRAW );
 
 				var pos2 = gl.createBuffer();
-				gl.bindBuffer(gl.ARRAY_BUFFER, pos2);
-				gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(positions2), gl.STATIC_DRAW);
+				gl.bindBuffer( gl.ARRAY_BUFFER, pos2 );
+				gl.bufferData( gl.ARRAY_BUFFER, new Float32Array( positions2 ), gl.STATIC_DRAW );
 
 				var rgb = gl.createBuffer();
-				gl.bindBuffer(gl.ARRAY_BUFFER, rgb);
-				gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(colors), gl.STATIC_DRAW);
+				gl.bindBuffer( gl.ARRAY_BUFFER, rgb );
+				gl.bufferData( gl.ARRAY_BUFFER, new Float32Array( colors ), gl.STATIC_DRAW );
 
 				var posAttr = new THREE.GLBufferAttribute( gl, pos, gl.FLOAT, 3, particles );
 				geometry.addAttribute( 'position', posAttr );
 
-				setInterval(function () {
-					posAttr.buffer = (posAttr.buffer === pos) ? pos2 : pos;
+				setInterval( function () {
+
+					posAttr.buffer = (posAttr.buffer === pos ) ? pos2 : pos;
 					posAttr.needsUpdate = true;
-				}, 2000);
+
+				}, 2000 );
 
 				var drawCount = 0;
-				setInterval(function () {
-					drawCount = 1 + (drawCount + Math.floor(1000 * Math.random())) % particles;
-					geometry.setDrawRange(0, drawCount);
-				}, 20);
+				setInterval( function () {
+
+					drawCount = 1 + ( drawCount + Math.floor( 1000 * Math.random() ) ) % particles;
+					geometry.setDrawRange( 0, drawCount );
+
+				}, 20 );
 
 				geometry.addAttribute( 'color', new THREE.GLBufferAttribute( gl, rgb, gl.FLOAT, 3, particles ) );