| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <title>BufferAttribute - Three.js Docs</title>
- <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
- <script src="../scripts/highlight.min.js"></script>
- <link type="text/css" rel="stylesheet" href="../styles/highlight-three.css">
- <link type="text/css" rel="stylesheet" href="../styles/page.css">
- </head>
- <body>
- <h1 translate="no">BufferAttribute</h1>
- <section>
- <header>
- <div class="class-description"><p>This class stores data for an attribute (such as vertex positions, face
- indices, normals, colors, UVs, and any custom attributes ) associated with
- a geometry, which allows for more efficient passing of data to the GPU.</p>
- <p>When working with vector-like data, the <code>fromBufferAttribute( attribute, index )</code>
- helper methods on vector and color class might be helpful. E.g. <a href="Vector3.html#fromBufferAttribute">Vector3#fromBufferAttribute</a>.</p></div>
- </header>
- <article>
- <div class="container-overview">
- <h2>Constructor</h2>
- <h3 class="name name-method" id="BufferAttribute" translate="no">new <a href="#BufferAttribute">BufferAttribute</a><span class="signature">( array : <span class="param-type">TypedArray</span>, itemSize : <span class="param-type">number</span>, normalized : <span class="param-type">boolean</span> )</span> </h3>
- <div class="method">
- <div class="description">
- <p>Constructs a new buffer attribute.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>array</strong>
- </td>
- <td class="description last">
- <p>The array holding the attribute data.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>itemSize</strong>
- </td>
- <td class="description last">
- <p>The item size.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>normalized</strong>
- </td>
- <td class="description last">
- <p>Whether the data are normalized or not.</p>
- <p>Default is <code>false</code>.</p>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- </div>
- <h2 class="subsection-title">Properties</h2>
- <div class="member">
- <h3 class="name" id="array" translate="no">.<a href="#array">array</a><span class="type-signature"> : TypedArray</span> </h3>
- <div class="description">
- <p>The array holding the attribute data. It should have <code>itemSize * numVertices</code>
- elements, where <code>numVertices</code> is the number of vertices in the associated geometry.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="count" translate="no">.<a href="#count">count</a><span class="type-signature"> : number</span> <span class="type-signature">(readonly) </span></h3>
- <div class="description">
- <p>Represents the number of items this buffer attribute stores. It is internally computed
- by dividing the <code>array</code> length by the <code>itemSize</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="gpuType" translate="no">.<a href="#gpuType">gpuType</a><span class="type-signature"> : <a href="global.html#FloatType">FloatType</a> | <a href="global.html#IntType">IntType</a></span> </h3>
- <div class="description">
- <p>Configures the bound GPU type for use in shaders.</p>
- <p>Note: this only has an effect for integer arrays and is not configurable for float arrays.
- For lower precision float types, use <code>Float16BufferAttribute</code>.</p>
- <p>Default is <code>FloatType</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="id" translate="no">.<a href="#id">id</a><span class="type-signature"> : number</span> <span class="type-signature">(readonly) </span></h3>
- <div class="description">
- <p>The ID of the buffer attribute.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="isBufferAttribute" translate="no">.<a href="#isBufferAttribute">isBufferAttribute</a><span class="type-signature"> : boolean</span> <span class="type-signature">(readonly) </span></h3>
- <div class="description">
- <p>This flag can be used for type testing.</p>
- <p>Default is <code>true</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="itemSize" translate="no">.<a href="#itemSize">itemSize</a><span class="type-signature"> : number</span> </h3>
- <div class="description">
- <p>The number of values of the array that should be associated with a particular vertex.
- For instance, if this attribute is storing a 3-component vector (such as a position,
- normal, or color), then the value should be <code>3</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="name" translate="no">.<a href="#name">name</a><span class="type-signature"> : string</span> </h3>
- <div class="description">
- <p>The name of the buffer attribute.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="needsUpdate" translate="no">.<a href="#needsUpdate">needsUpdate</a><span class="type-signature"> : number</span> </h3>
- <div class="description">
- <p>Flag to indicate that this attribute has changed and should be re-sent to
- the GPU. Set this to <code>true</code> when you modify the value of the array.</p>
- <p>Default is <code>false</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="normalized" translate="no">.<a href="#normalized">normalized</a><span class="type-signature"> : boolean</span> </h3>
- <div class="description">
- <p>Applies to integer data only. Indicates how the underlying data in the buffer maps to
- the values in the GLSL code. For instance, if <code>array</code> is an instance of <code>UInt16Array</code>,
- and <code>normalized</code> is <code>true</code>, the values <code>0 - +65535</code> in the array data will be mapped to
- <code>0.0f - +1.0f</code> in the GLSL attribute. If <code>normalized</code> is <code>false</code>, the values will be converted
- to floats unmodified, i.e. <code>65535</code> becomes <code>65535.0f</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="updateRanges" translate="no">.<a href="#updateRanges">updateRanges</a><span class="type-signature"> : Array.<Object></span> </h3>
- <div class="description">
- <p>This can be used to only update some components of stored vectors (for example, just the
- component related to color). Use the <code>addUpdateRange()</code> function to add ranges to this array.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="usage" translate="no">.<a href="#usage">usage</a><span class="type-signature"> : <a href="global.html#StaticDrawUsage">StaticDrawUsage</a> | <a href="global.html#DynamicDrawUsage">DynamicDrawUsage</a> | <a href="global.html#StreamDrawUsage">StreamDrawUsage</a> | <a href="global.html#StaticReadUsage">StaticReadUsage</a> | <a href="global.html#DynamicReadUsage">DynamicReadUsage</a> | <a href="global.html#StreamReadUsage">StreamReadUsage</a> | <a href="global.html#StaticCopyUsage">StaticCopyUsage</a> | <a href="global.html#DynamicCopyUsage">DynamicCopyUsage</a> | <a href="global.html#StreamCopyUsage">StreamCopyUsage</a></span> </h3>
- <div class="description">
- <p>Defines the intended usage pattern of the data store for optimization purposes.</p>
- <p>Note: After the initial use of a buffer, its usage cannot be changed. Instead,
- instantiate a new one and set the desired usage before the next render.</p>
- <p>Default is <code>StaticDrawUsage</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="version" translate="no">.<a href="#version">version</a><span class="type-signature"> : number</span> </h3>
- <div class="description">
- <p>A version number, incremented every time the <code>needsUpdate</code> is set to <code>true</code>.</p>
- </div>
- </div>
- <h2 class="subsection-title">Methods</h2>
- <h3 class="name name-method" id="addUpdateRange" translate="no">.<a href="#addUpdateRange">addUpdateRange</a><span class="signature">( start : <span class="param-type">number</span>, count : <span class="param-type">number</span> )</span> </h3>
- <div class="method">
- <div class="description">
- <p>Adds a range of data in the data array to be updated on the GPU.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>start</strong>
- </td>
- <td class="description last">
- <p>Position at which to start update.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>count</strong>
- </td>
- <td class="description last">
- <p>The number of components to update.</p>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- <h3 class="name name-method" id="applyMatrix3" translate="no">.<a href="#applyMatrix3">applyMatrix3</a><span class="signature">( m : <span class="param-type"><a href="Matrix3.html">Matrix3</a></span> )</span><span class="type-signature"> : <a href="BufferAttribute.html">BufferAttribute</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Applies the given 3x3 matrix to the given attribute. Works with
- item size <code>2</code> and <code>3</code>.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>m</strong>
- </td>
- <td class="description last">
- <p>The matrix to apply.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A reference to this instance.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="applyMatrix4" translate="no">.<a href="#applyMatrix4">applyMatrix4</a><span class="signature">( m : <span class="param-type"><a href="Matrix4.html">Matrix4</a></span> )</span><span class="type-signature"> : <a href="BufferAttribute.html">BufferAttribute</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Applies the given 4x4 matrix to the given attribute. Only works with
- item size <code>3</code>.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>m</strong>
- </td>
- <td class="description last">
- <p>The matrix to apply.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A reference to this instance.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="applyNormalMatrix" translate="no">.<a href="#applyNormalMatrix">applyNormalMatrix</a><span class="signature">( m : <span class="param-type"><a href="Matrix3.html">Matrix3</a></span> )</span><span class="type-signature"> : <a href="BufferAttribute.html">BufferAttribute</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Applies the given 3x3 normal matrix to the given attribute. Only works with
- item size <code>3</code>.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>m</strong>
- </td>
- <td class="description last">
- <p>The normal matrix to apply.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A reference to this instance.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="clearUpdateRanges" translate="no">.<a href="#clearUpdateRanges">clearUpdateRanges</a><span class="signature">()</span> </h3>
- <div class="method">
- <div class="description">
- <p>Clears the update ranges.</p>
- </div>
- </div>
- <h3 class="name name-method" id="clone" translate="no">.<a href="#clone">clone</a><span class="signature">()</span><span class="type-signature"> : <a href="BufferAttribute.html">BufferAttribute</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Returns a new buffer attribute with copied values from this instance.</p>
- </div>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A clone of this instance.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="copy" translate="no">.<a href="#copy">copy</a><span class="signature">( source : <span class="param-type"><a href="BufferAttribute.html">BufferAttribute</a></span> )</span><span class="type-signature"> : <a href="BufferAttribute.html">BufferAttribute</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Copies the values of the given buffer attribute to this instance.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>source</strong>
- </td>
- <td class="description last">
- <p>The buffer attribute to copy.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A reference to this instance.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="copyArray" translate="no">.<a href="#copyArray">copyArray</a><span class="signature">( array : <span class="param-type">TypedArray | Array</span> )</span><span class="type-signature"> : <a href="BufferAttribute.html">BufferAttribute</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Copies the given array data into this buffer attribute.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>array</strong>
- </td>
- <td class="description last">
- <p>The array to copy.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A reference to this instance.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="copyAt" translate="no">.<a href="#copyAt">copyAt</a><span class="signature">( index1 : <span class="param-type">number</span>, attribute : <span class="param-type"><a href="BufferAttribute.html">BufferAttribute</a></span>, index2 : <span class="param-type">number</span> )</span><span class="type-signature"> : <a href="BufferAttribute.html">BufferAttribute</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Copies a vector from the given buffer attribute to this one. The start
- and destination position in the attribute buffers are represented by the
- given indices.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>index1</strong>
- </td>
- <td class="description last">
- <p>The destination index into this buffer attribute.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>attribute</strong>
- </td>
- <td class="description last">
- <p>The buffer attribute to copy from.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>index2</strong>
- </td>
- <td class="description last">
- <p>The source index into the given buffer attribute.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A reference to this instance.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="getComponent" translate="no">.<a href="#getComponent">getComponent</a><span class="signature">( index : <span class="param-type">number</span>, component : <span class="param-type">number</span> )</span><span class="type-signature"> : number</span> </h3>
- <div class="method">
- <div class="description">
- <p>Returns the given component of the vector at the given index.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>index</strong>
- </td>
- <td class="description last">
- <p>The index into the buffer attribute.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>component</strong>
- </td>
- <td class="description last">
- <p>The component index.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The returned value.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="getW" translate="no">.<a href="#getW">getW</a><span class="signature">( index : <span class="param-type">number</span> )</span><span class="type-signature"> : number</span> </h3>
- <div class="method">
- <div class="description">
- <p>Returns the w component of the vector at the given index.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>index</strong>
- </td>
- <td class="description last">
- <p>The index into the buffer attribute.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The w component.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="getX" translate="no">.<a href="#getX">getX</a><span class="signature">( index : <span class="param-type">number</span> )</span><span class="type-signature"> : number</span> </h3>
- <div class="method">
- <div class="description">
- <p>Returns the x component of the vector at the given index.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>index</strong>
- </td>
- <td class="description last">
- <p>The index into the buffer attribute.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The x component.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="getY" translate="no">.<a href="#getY">getY</a><span class="signature">( index : <span class="param-type">number</span> )</span><span class="type-signature"> : number</span> </h3>
- <div class="method">
- <div class="description">
- <p>Returns the y component of the vector at the given index.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>index</strong>
- </td>
- <td class="description last">
- <p>The index into the buffer attribute.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The y component.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="getZ" translate="no">.<a href="#getZ">getZ</a><span class="signature">( index : <span class="param-type">number</span> )</span><span class="type-signature"> : number</span> </h3>
- <div class="method">
- <div class="description">
- <p>Returns the z component of the vector at the given index.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>index</strong>
- </td>
- <td class="description last">
- <p>The index into the buffer attribute.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The z component.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="onUpload" translate="no">.<a href="#onUpload">onUpload</a><span class="signature">( callback : <span class="param-type">function</span> )</span><span class="type-signature"> : <a href="BufferAttribute.html">BufferAttribute</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Sets the given callback function that is executed after the Renderer has transferred
- the attribute array data to the GPU. Can be used to perform clean-up operations after
- the upload when attribute data are not needed anymore on the CPU side.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>callback</strong>
- </td>
- <td class="description last">
- <p>The <code>onUpload()</code> callback.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A reference to this instance.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="onUploadCallback" translate="no">.<a href="#onUploadCallback">onUploadCallback</a><span class="signature">()</span> </h3>
- <div class="method">
- <div class="description">
- <p>A callback function that is executed after the renderer has transferred the attribute
- array data to the GPU.</p>
- </div>
- </div>
- <h3 class="name name-method" id="set" translate="no">.<a href="#set">set</a><span class="signature">( value : <span class="param-type">TypedArray | Array</span>, offset : <span class="param-type">number</span> )</span><span class="type-signature"> : <a href="BufferAttribute.html">BufferAttribute</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Sets the given array data in the buffer attribute.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>value</strong>
- </td>
- <td class="description last">
- <p>The array data to set.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>offset</strong>
- </td>
- <td class="description last">
- <p>The offset in this buffer attribute's array.</p>
- <p>Default is <code>0</code>.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A reference to this instance.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="setComponent" translate="no">.<a href="#setComponent">setComponent</a><span class="signature">( index : <span class="param-type">number</span>, component : <span class="param-type">number</span>, value : <span class="param-type">number</span> )</span><span class="type-signature"> : <a href="BufferAttribute.html">BufferAttribute</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Sets the given value to the given component of the vector at the given index.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>index</strong>
- </td>
- <td class="description last">
- <p>The index into the buffer attribute.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>component</strong>
- </td>
- <td class="description last">
- <p>The component index.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>value</strong>
- </td>
- <td class="description last">
- <p>The value to set.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A reference to this instance.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="setUsage" translate="no">.<a href="#setUsage">setUsage</a><span class="signature">( value : <span class="param-type"><a href="global.html#StaticDrawUsage">StaticDrawUsage</a> | <a href="global.html#DynamicDrawUsage">DynamicDrawUsage</a> | <a href="global.html#StreamDrawUsage">StreamDrawUsage</a> | <a href="global.html#StaticReadUsage">StaticReadUsage</a> | <a href="global.html#DynamicReadUsage">DynamicReadUsage</a> | <a href="global.html#StreamReadUsage">StreamReadUsage</a> | <a href="global.html#StaticCopyUsage">StaticCopyUsage</a> | <a href="global.html#DynamicCopyUsage">DynamicCopyUsage</a> | <a href="global.html#StreamCopyUsage">StreamCopyUsage</a></span> )</span><span class="type-signature"> : <a href="BufferAttribute.html">BufferAttribute</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Sets the usage of this buffer attribute.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>value</strong>
- </td>
- <td class="description last">
- <p>The usage to set.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A reference to this buffer attribute.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="setW" translate="no">.<a href="#setW">setW</a><span class="signature">( index : <span class="param-type">number</span>, w : <span class="param-type">number</span> )</span><span class="type-signature"> : <a href="BufferAttribute.html">BufferAttribute</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Sets the w component of the vector at the given index.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>index</strong>
- </td>
- <td class="description last">
- <p>The index into the buffer attribute.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>w</strong>
- </td>
- <td class="description last">
- <p>The value to set.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A reference to this instance.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="setX" translate="no">.<a href="#setX">setX</a><span class="signature">( index : <span class="param-type">number</span>, x : <span class="param-type">number</span> )</span><span class="type-signature"> : <a href="BufferAttribute.html">BufferAttribute</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Sets the x component of the vector at the given index.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>index</strong>
- </td>
- <td class="description last">
- <p>The index into the buffer attribute.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>x</strong>
- </td>
- <td class="description last">
- <p>The value to set.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A reference to this instance.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="setXY" translate="no">.<a href="#setXY">setXY</a><span class="signature">( index : <span class="param-type">number</span>, x : <span class="param-type">number</span>, y : <span class="param-type">number</span> )</span><span class="type-signature"> : <a href="BufferAttribute.html">BufferAttribute</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Sets the x and y component of the vector at the given index.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>index</strong>
- </td>
- <td class="description last">
- <p>The index into the buffer attribute.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>x</strong>
- </td>
- <td class="description last">
- <p>The value for the x component to set.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>y</strong>
- </td>
- <td class="description last">
- <p>The value for the y component to set.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A reference to this instance.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="setXYZ" translate="no">.<a href="#setXYZ">setXYZ</a><span class="signature">( index : <span class="param-type">number</span>, x : <span class="param-type">number</span>, y : <span class="param-type">number</span>, z : <span class="param-type">number</span> )</span><span class="type-signature"> : <a href="BufferAttribute.html">BufferAttribute</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Sets the x, y and z component of the vector at the given index.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>index</strong>
- </td>
- <td class="description last">
- <p>The index into the buffer attribute.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>x</strong>
- </td>
- <td class="description last">
- <p>The value for the x component to set.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>y</strong>
- </td>
- <td class="description last">
- <p>The value for the y component to set.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>z</strong>
- </td>
- <td class="description last">
- <p>The value for the z component to set.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A reference to this instance.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="setXYZW" translate="no">.<a href="#setXYZW">setXYZW</a><span class="signature">( index : <span class="param-type">number</span>, x : <span class="param-type">number</span>, y : <span class="param-type">number</span>, z : <span class="param-type">number</span>, w : <span class="param-type">number</span> )</span><span class="type-signature"> : <a href="BufferAttribute.html">BufferAttribute</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Sets the x, y, z and w component of the vector at the given index.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>index</strong>
- </td>
- <td class="description last">
- <p>The index into the buffer attribute.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>x</strong>
- </td>
- <td class="description last">
- <p>The value for the x component to set.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>y</strong>
- </td>
- <td class="description last">
- <p>The value for the y component to set.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>z</strong>
- </td>
- <td class="description last">
- <p>The value for the z component to set.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>w</strong>
- </td>
- <td class="description last">
- <p>The value for the w component to set.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A reference to this instance.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="setY" translate="no">.<a href="#setY">setY</a><span class="signature">( index : <span class="param-type">number</span>, y : <span class="param-type">number</span> )</span><span class="type-signature"> : <a href="BufferAttribute.html">BufferAttribute</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Sets the y component of the vector at the given index.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>index</strong>
- </td>
- <td class="description last">
- <p>The index into the buffer attribute.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>y</strong>
- </td>
- <td class="description last">
- <p>The value to set.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A reference to this instance.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="setZ" translate="no">.<a href="#setZ">setZ</a><span class="signature">( index : <span class="param-type">number</span>, z : <span class="param-type">number</span> )</span><span class="type-signature"> : <a href="BufferAttribute.html">BufferAttribute</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Sets the z component of the vector at the given index.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>index</strong>
- </td>
- <td class="description last">
- <p>The index into the buffer attribute.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>z</strong>
- </td>
- <td class="description last">
- <p>The value to set.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A reference to this instance.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="toJSON" translate="no">.<a href="#toJSON">toJSON</a><span class="signature">()</span><span class="type-signature"> : Object</span> </h3>
- <div class="method">
- <div class="description">
- <p>Serializes the buffer attribute into JSON.</p>
- </div>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A JSON object representing the serialized buffer attribute.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="transformDirection" translate="no">.<a href="#transformDirection">transformDirection</a><span class="signature">( m : <span class="param-type"><a href="Matrix4.html">Matrix4</a></span> )</span><span class="type-signature"> : <a href="BufferAttribute.html">BufferAttribute</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Applies the given 4x4 matrix to the given attribute. Only works with
- item size <code>3</code> and with direction vectors.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>m</strong>
- </td>
- <td class="description last">
- <p>The matrix to apply.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A reference to this instance.</dt>
- </dl>
- </div>
- <h2 class="subsection-title">Source</h2>
- <p>
- <a href="https://github.com/mrdoob/three.js/blob/master/src/core/BufferAttribute.js" translate="no" target="_blank" rel="noopener">src/core/BufferAttribute.js</a>
- </p>
- </article>
- </section>
- <script src="../scripts/linenumber.js"></script>
- <script src="../scripts/page.js"></script>
- </body>
- </html>
|