This class stores data for an attribute associated with a [page:BufferGeometry]. See that page for details. This class is used to store builtin attributes such as vertex position, normals, color, etc., but can also be used in your code to store custom attributes in a [page:BufferGeometry].
Instantiates this attibute with data from the associated buffer. The array can either be a regular Array or a Typed Array.
itemSize gives the number of values of the array that should be associated with a particular vertex.
</div>
<h2>Properties</h2>
<h3>todo</h3>
<div></div>
<h3>.[page:Array array]</h3>
<div>
Stores the data associated with this attribute; can be an Array or a Typed Array. This element should have <code>itemSize * numVertices</code> elements, where numVertices is the number of vertices in the associated [page:BufferGeometry geometry].
</div>
<h3>.[page:Integer itemSize]</h3>
<div>
Records how many items of the array are associated with 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.
</div>
<h2>Properties</h2>
<h3>.[page:Integer length]</h3>
<div>
Gives the total number of elements in the array.
</div>
<h3>todo</h3>
<h3>.[page:Boolean needsUpdate]</h3>
<div>
todo
</div>
Flag to indicate that this attribute has changed and should be re-send to the GPU. Set this to true when you modify the value of the array.
Allows for vertices to be re-used across multiple triangles; this is called using "indexed triangles," and works much the same as it does in [page:Geometry]: each triangle is associated with the index of three vertices. This attribute therefore stores the index of each vertex for each triangular face.
If this attribute is not set, the [page:WebGLRenderer renderer] assumes that each three contiguous positions represent a single triangle.
</div>
<p>
In addition to the the built-in attributes, you can set your own custom attributes using the addAttribute method. With [page:Geometry], these attributes are set and stored on the [page:Material]. In BufferGeometry, the attributes are stored with the geometry itself. Note that you still need to set the attributes information on the material as well, but the value of each attribute is stored in the BufferGeometry.
</p>
<h2>Constructor</h2>
...
...
@@ -34,26 +113,33 @@
<h3>.[page:Hashmap attributes]</h3>
<div>
This hashmap has as id the name of the attribute to be set and as value the buffer to set it to.
This hashmap has as id the name of the attribute to be set and as value the [page:BufferAttribute buffer] to set it to.
Rather than accessing this property directly, use addAttribute and getAttribute to access attributes of this geometry.
</div>
<h3>.[page:Boolean dynamic]</h3>
<!--
<h3>.[page:Boolean dynamic]</h3>
<div>
When set, it holds certain buffers in memory to have faster updates for this object. When unset, it deletes those buffers and saves memory.
</div>
When set, it holds certain buffers in memory to have faster updates for this object. When unset, it deletes those buffers and saves memory.
This Array should contain every offset at which the buffers should be rendered. This is important for indexed buffers.
For geometries that use indexed triangles, this Array can be used to split the object into multiple WebGL draw calls. Each draw call will draw some subset of the vertices in this geometry using the configured [page:Material shader]. This may be necessary if, for instance, you have more than 65535 vertices in your object.
where start specifies the index of the first vertex in this draw call, count specifies how many vertices are included, and index specifies an optional offset.
Use addDrawCall to add draw calls, rather than modifying this array directly.
</div>
<h3>.[page:Object boundingBox]</h3>
<h3>.[page:Box3 boundingBox]</h3>
<div>
Bounding box.
<code>{ min: new THREE.Vector3(), max: new THREE.Vector3() }</code>
</div>
<h3>.[page:Object boundingSphere]</h3>
<h3>.[page:Sphere boundingSphere]</h3>
<div>
Bounding sphere.
<code>{ radius: float }</code>
...
...
@@ -75,6 +161,19 @@
<h3>[page:EventDispatcher EventDispatcher] methods are available on this class.</h3>