|
@@ -2,13 +2,12 @@
|
|
<html lang="en">
|
|
<html lang="en">
|
|
<head>
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<meta charset="utf-8" />
|
|
- <base href="../../" />
|
|
|
|
|
|
+ <base href="../../../" />
|
|
<script src="list.js"></script>
|
|
<script src="list.js"></script>
|
|
<script src="page.js"></script>
|
|
<script src="page.js"></script>
|
|
<link type="text/css" rel="stylesheet" href="page.css" />
|
|
<link type="text/css" rel="stylesheet" href="page.css" />
|
|
</head>
|
|
</head>
|
|
<body>
|
|
<body>
|
|
-
|
|
|
|
<h1>[name]</h1>
|
|
<h1>[name]</h1>
|
|
|
|
|
|
<p class="desc">
|
|
<p class="desc">
|
|
@@ -16,34 +15,34 @@
|
|
whatever VBO is passed in constructor and can later be altered via the
|
|
whatever VBO is passed in constructor and can later be altered via the
|
|
*buffer* property.<br /><br />
|
|
*buffer* property.<br /><br />
|
|
It is required to pass additional params alongside the VBO. Those are:
|
|
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 GL context, the GL data type, the number of components per vertex,
|
|
|
|
+ the number of bytes per component, and the number of vertices.<br /><br />
|
|
The most common use case for this class is when some kind of GPGPU
|
|
The most common use case for this class is when some kind of GPGPU
|
|
calculation interferes or even produces the VBOs in question.
|
|
calculation interferes or even produces the VBOs in question.
|
|
</p>
|
|
</p>
|
|
|
|
|
|
<h2>Constructor</h2>
|
|
<h2>Constructor</h2>
|
|
- <h3>[name]( [param:WebGLRenderingContext gl], [param:WebGLBuffer buffer], [param:GLenum type], [param:Integer itemSize], [param:Integer count], [param:Boolean normalized] )</h3>
|
|
|
|
|
|
+ <h3>[name]( [param:WebGLBuffer buffer], [param:GLenum type], [param:Integer itemSize], [param:Integer elementSize], [param:Integer count] )</h3>
|
|
<p>
|
|
<p>
|
|
- gl — Must be a [link:https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext].
|
|
|
|
- <br />
|
|
|
|
- buffer — Must be a [link:https://developer.mozilla.org/en-US/docs/Web/API/WebGLBuffer].
|
|
|
|
|
|
+ *buffer* — Must be a <a href="https://developer.mozilla.org/en-US/docs/Web/API/WebGLBuffer" target="_blank">WebGLBuffer</a>.
|
|
<br />
|
|
<br />
|
|
- type — One of [link:https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/Constants#Data_types].
|
|
|
|
|
|
+ *type* — One of <a href="https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/Constants#Data_types" target="_blank">WebGL Data Types</a>.
|
|
<br />
|
|
<br />
|
|
- itemSize — The number of values of the array that should be associated with
|
|
|
|
|
|
+ *itemSize* — The number of values of the array that should be associated with
|
|
a particular vertex. For instance, if this
|
|
a particular vertex. For instance, if this
|
|
attribute is storing a 3-component vector (such as a position, normal, or color), then itemSize should be 3.
|
|
attribute is storing a 3-component vector (such as a position, normal, or color), then itemSize should be 3.
|
|
<br />
|
|
<br />
|
|
- count — The expected number of vertices in VBO.
|
|
|
|
- <br /><br />
|
|
|
|
-
|
|
|
|
- normalized — (optional) Applies to integer data only. Indicates how the underlying data
|
|
|
|
- in the buffer maps to the values in the GLSL code. For instance, if [page:TypedArray array] is an instance
|
|
|
|
- of UInt16Array, and [page:Boolean normalized] is true, the values 0 - +65535 in the array
|
|
|
|
- data will be mapped to 0.0f - +1.0f in the GLSL attribute. An Int16Array (signed) would map
|
|
|
|
- from -32767 - +32767 to -1.0f - +1.0f. If [page:Boolean normalized] is false, the values
|
|
|
|
- will be converted to floats unmodified, i.e. 32767 becomes 32767.0f.
|
|
|
|
|
|
+ *elementSize* — 1, 2 or 4. The corresponding size (in bytes) for the given "type" param.
|
|
|
|
+ <ul>
|
|
|
|
+ <li>gl.FLOAT: 4</li>
|
|
|
|
+ <li>gl.UNSIGNED_SHORT: 2</li>
|
|
|
|
+ <li>gl.SHORT: 2</li>
|
|
|
|
+ <li>gl.UNSIGNED_INT: 4</li>
|
|
|
|
+ <li>gl.INT: 4</li>
|
|
|
|
+ <li>gl.BYTE: 1</li>
|
|
|
|
+ <li>gl.UNSIGNED_BYTE: 1</li>
|
|
|
|
+ </ul>
|
|
|
|
+ *count* — The expected number of vertices in VBO.
|
|
</p>
|
|
</p>
|
|
|
|
|
|
<h2>Properties</h2>
|
|
<h2>Properties</h2>
|
|
@@ -58,12 +57,6 @@
|
|
The expected number of vertices in VBO.
|
|
The expected number of vertices in VBO.
|
|
</p>
|
|
</p>
|
|
|
|
|
|
- <h3>[property:Boolean normalized]</h3>
|
|
|
|
- <p>
|
|
|
|
- Indicates how the underlying data in the buffer maps to the values in the GLSL shader code.
|
|
|
|
- See the constructor above for details.
|
|
|
|
- </p>
|
|
|
|
-
|
|
|
|
<h3>[property:Integer itemSize]</h3>
|
|
<h3>[property:Integer itemSize]</h3>
|
|
<p>
|
|
<p>
|
|
How many values make up each item (vertex).
|
|
How many values make up each item (vertex).
|
|
@@ -74,20 +67,22 @@
|
|
Stores the corresponding size in bytes for the current *type* property value.
|
|
Stores the corresponding size in bytes for the current *type* property value.
|
|
</p>
|
|
</p>
|
|
<p>
|
|
<p>
|
|
- <b>Don't touch</b>.
|
|
|
|
|
|
+ See above (constructor) for a list of known type sizes.
|
|
</p>
|
|
</p>
|
|
|
|
|
|
<h3>[property:GLenum type]</h3>
|
|
<h3>[property:GLenum type]</h3>
|
|
<p>
|
|
<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.
|
|
|
|
|
|
+ A <a href="https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/Constants#Data_types" target="_blank">WebGL Data Type</a>
|
|
|
|
+ describing the underlying VBO contents.
|
|
</p>
|
|
</p>
|
|
<p>
|
|
<p>
|
|
- Setting this is only allowed with *setType*.
|
|
|
|
|
|
+ Set this property together with *elementSize*. The recommended way is
|
|
|
|
+ using the *setType* method.
|
|
</p>
|
|
</p>
|
|
|
|
|
|
<h3>[property:Boolean isGLBufferAttribute]</h3>
|
|
<h3>[property:Boolean isGLBufferAttribute]</h3>
|
|
<p>
|
|
<p>
|
|
- Should be *true*.
|
|
|
|
|
|
+ Read-only. Always *true*.
|
|
</p>
|
|
</p>
|
|
|
|
|
|
<h2>Methods</h2>
|
|
<h2>Methods</h2>
|
|
@@ -95,8 +90,8 @@
|
|
<h3>[method:null setBuffer]( buffer ) </h3>
|
|
<h3>[method:null setBuffer]( buffer ) </h3>
|
|
<p>Sets the *buffer* property.</p>
|
|
<p>Sets the *buffer* property.</p>
|
|
|
|
|
|
- <h3>[method:null setType]( type ) </h3>
|
|
|
|
- <p>Sets the *type* property.</p>
|
|
|
|
|
|
+ <h3>[method:null setType]( type, elementSize ) </h3>
|
|
|
|
+ <p>Sets the both *type* and *elementSize* properties.</p>
|
|
|
|
|
|
<h3>[method:null setItemSize]( itemSize ) </h3>
|
|
<h3>[method:null setItemSize]( itemSize ) </h3>
|
|
<p>Sets the *itemSize* property.</p>
|
|
<p>Sets the *itemSize* property.</p>
|
|
@@ -104,10 +99,19 @@
|
|
<h3>[method:null setCount]( count ) </h3>
|
|
<h3>[method:null setCount]( count ) </h3>
|
|
<p>Sets the *count* property.</p>
|
|
<p>Sets the *count* property.</p>
|
|
|
|
|
|
|
|
+ <h3>[property:Integer version]</h3>
|
|
|
|
+ <p>
|
|
|
|
+ A version number, incremented every time the needsUpdate property is set to true.
|
|
|
|
+ </p>
|
|
|
|
|
|
|
|
+ <h3>[property:Boolean needsUpdate]</h3>
|
|
|
|
+ <p>
|
|
|
|
+ Default is *false*. Setting this to true increments [page:GLBufferAttribute.version version].
|
|
|
|
+ </p>
|
|
|
|
|
|
<h2>Source</h2>
|
|
<h2>Source</h2>
|
|
-
|
|
|
|
- [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
|
|
|
|
|
|
+ <p>
|
|
|
|
+ [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
|
|
|
|
+ </p>
|
|
</body>
|
|
</body>
|
|
</html>
|
|
</html>
|