| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <title>ReferenceNode - 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>
- <p class="inheritance" translate="no"><a href="EventDispatcher.html">EventDispatcher</a> → <a href="Node.html">Node</a> → </p>
- <h1 translate="no">ReferenceNode</h1>
- <section>
- <header>
- <div class="class-description"><p>This type of node establishes a reference to a property of another object.
- In this way, the value of the node is automatically linked to the value of
- referenced object. Reference nodes internally represent the linked value
- as a uniform.</p></div>
- </header>
- <article>
- <div class="container-overview">
- <h2>Constructor</h2>
- <h3 class="name name-method" id="ReferenceNode" translate="no">new <a href="#ReferenceNode">ReferenceNode</a><span class="signature">( property : <span class="param-type">string</span>, uniformType : <span class="param-type">string</span>, object : <span class="param-type">Object</span>, count : <span class="param-type">number</span> )</span> </h3>
- <div class="method">
- <div class="description">
- <p>Constructs a new reference node.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>property</strong>
- </td>
- <td class="description last">
- <p>The name of the property the node refers to.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>uniformType</strong>
- </td>
- <td class="description last">
- <p>The uniform type that should be used to represent the property value.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>object</strong>
- </td>
- <td class="description last">
- <p>The object the property belongs to.</p>
- <p>Default is <code>null</code>.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>count</strong>
- </td>
- <td class="description last">
- <p>When the linked property is an array-like, this parameter defines its length.</p>
- <p>Default is <code>null</code>.</p>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- </div>
- <h2 class="subsection-title">Properties</h2>
- <div class="member">
- <h3 class="name" id="count" translate="no">.<a href="#count">count</a><span class="type-signature"> : number</span> </h3>
- <div class="description">
- <p>When the linked property is an array, this parameter defines its length.</p>
- <p>Default is <code>null</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="group" translate="no">.<a href="#group">group</a><span class="type-signature"> : <a href="UniformGroupNode.html">UniformGroupNode</a></span> </h3>
- <div class="description">
- <p>The uniform group of the internal uniform.</p>
- <p>Default is <code>null</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>An optional label of the internal uniform node.</p>
- <p>Default is <code>null</code>.</p>
- </div>
- <dl class="details">
- <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Node.html#name">Node#name</a></dt>
- </dl>
- </div>
- <div class="member">
- <h3 class="name" id="node" translate="no">.<a href="#node">node</a><span class="type-signature"> : <a href="UniformNode.html">UniformNode</a></span> </h3>
- <div class="description">
- <p>The uniform node that holds the value of the reference node.</p>
- <p>Default is <code>null</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="object" translate="no">.<a href="#object">object</a><span class="type-signature"> : Object</span> </h3>
- <div class="description">
- <p>The object the property belongs to.</p>
- <p>Default is <code>null</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="properties" translate="no">.<a href="#properties">properties</a><span class="type-signature"> : Array.<string></span> </h3>
- <div class="description">
- <p>The property name might have dots so nested properties can be referred.
- The hierarchy of the names is stored inside this array.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="property" translate="no">.<a href="#property">property</a><span class="type-signature"> : string</span> </h3>
- <div class="description">
- <p>The name of the property the node refers to.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="reference" translate="no">.<a href="#reference">reference</a><span class="type-signature"> : Object</span> </h3>
- <div class="description">
- <p>Points to the current referred object. This property exists next to <a href="ReferenceNode.html#object">ReferenceNode#object</a>
- since the final reference might be updated from calling code.</p>
- <p>Default is <code>null</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="uniformType" translate="no">.<a href="#uniformType">uniformType</a><span class="type-signature"> : string</span> </h3>
- <div class="description">
- <p>The uniform type that should be used to represent the property value.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="updateType" translate="no">.<a href="#updateType">updateType</a><span class="type-signature"> : string</span> </h3>
- <div class="description">
- <p>Overwritten since reference nodes are updated per object.</p>
- <p>Default is <code>'object'</code>.</p>
- </div>
- <dl class="details">
- <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Node.html#updateType">Node#updateType</a></dt>
- </dl>
- </div>
- <h2 class="subsection-title">Methods</h2>
- <h3 class="name name-method" id="element" translate="no">.<a href="#element">element</a><span class="signature">( indexNode : <span class="param-type"><a href="IndexNode.html">IndexNode</a></span> )</span><span class="type-signature"> : <a href="ReferenceElementNode.html">ReferenceElementNode</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>When the referred property is array-like, this method can be used
- to access elements via an index node.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>indexNode</strong>
- </td>
- <td class="description last">
- <p>indexNode.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A reference to an element.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="getNodeType" translate="no">.<a href="#getNodeType">getNodeType</a><span class="signature">( builder : <span class="param-type"><a href="NodeBuilder.html">NodeBuilder</a></span> )</span><span class="type-signature"> : string</span> </h3>
- <div class="method">
- <div class="description">
- <p>This method is overwritten since the node type is inferred from
- the type of the reference node.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>builder</strong>
- </td>
- <td class="description last">
- <p>The current node builder.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Node.html#getNodeType">Node#getNodeType</a></dt>
- </dl>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The node type.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="getValueFromReference" translate="no">.<a href="#getValueFromReference">getValueFromReference</a><span class="signature">( object : <span class="param-type">Object</span> )</span><span class="type-signature"> : <a href="global.html#any">any</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Returns the property value from the given referred object.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>object</strong>
- </td>
- <td class="description last">
- <p>The object to retrieve the property value from.</p>
- <p>Default is <code>this.reference</code>.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The value.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="label" translate="no">.<a href="#label">label</a><span class="signature">( name : <span class="param-type">string</span> )</span><span class="type-signature"> : <a href="ReferenceNode.html">ReferenceNode</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Sets the label for the internal uniform.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>name</strong>
- </td>
- <td class="description last">
- <p>The label to set.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="important tag-deprecated"><strong>Deprecated:</strong> Yes</dt>
- </dl>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A reference to this node.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="setGroup" translate="no">.<a href="#setGroup">setGroup</a><span class="signature">( group : <span class="param-type"><a href="UniformGroupNode.html">UniformGroupNode</a></span> )</span><span class="type-signature"> : <a href="ReferenceNode.html">ReferenceNode</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Sets the uniform group for this reference node.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>group</strong>
- </td>
- <td class="description last">
- <p>The uniform group to set.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A reference to this node.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="setName" translate="no">.<a href="#setName">setName</a><span class="signature">( name : <span class="param-type">string</span> )</span><span class="type-signature"> : <a href="ReferenceNode.html">ReferenceNode</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Sets the name for the internal uniform.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>name</strong>
- </td>
- <td class="description last">
- <p>The label to set.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A reference to this node.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="setNodeType" translate="no">.<a href="#setNodeType">setNodeType</a><span class="signature">( uniformType : <span class="param-type">string</span> )</span> </h3>
- <div class="method">
- <div class="description">
- <p>Sets the node type which automatically defines the internal
- uniform type.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>uniformType</strong>
- </td>
- <td class="description last">
- <p>The type to set.</p>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- <h3 class="name name-method" id="setup" translate="no">.<a href="#setup">setup</a><span class="signature">( builder : <span class="param-type"><a href="NodeBuilder.html">NodeBuilder</a></span> )</span><span class="type-signature"> : <a href="UniformNode.html">UniformNode</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>The output of the reference node is the internal uniform node.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>builder</strong>
- </td>
- <td class="description last">
- <p>The current node builder.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Node.html#setup">Node#setup</a></dt>
- </dl>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The output node.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="update" translate="no">.<a href="#update">update</a><span class="signature">( frame : <span class="param-type"><a href="NodeFrame.html">NodeFrame</a></span> )</span> </h3>
- <div class="method">
- <div class="description">
- <p>Overwritten to update the internal uniform value.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>frame</strong>
- </td>
- <td class="description last">
- <p>A reference to the current node frame.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Node.html#update">Node#update</a></dt>
- </dl>
- </div>
- <h3 class="name name-method" id="updateReference" translate="no">.<a href="#updateReference">updateReference</a><span class="signature">( state : <span class="param-type"><a href="NodeFrame.html">NodeFrame</a> | <a href="NodeBuilder.html">NodeBuilder</a></span> )</span><span class="type-signature"> : Object</span> </h3>
- <div class="method">
- <div class="description">
- <p>Allows to update the reference based on the given state. The state is only
- evaluated <a href="ReferenceNode.html#object">ReferenceNode#object</a> is not set.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>state</strong>
- </td>
- <td class="description last">
- <p>The current state.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Node.html#updateReference">Node#updateReference</a></dt>
- </dl>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The updated reference.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="updateValue" translate="no">.<a href="#updateValue">updateValue</a><span class="signature">()</span> </h3>
- <div class="method">
- <div class="description">
- <p>Retrieves the value from the referred object property and uses it
- to updated the internal uniform.</p>
- </div>
- </div>
- <h2 class="subsection-title">Source</h2>
- <p>
- <a href="https://github.com/mrdoob/three.js/blob/master/src/nodes/accessors/ReferenceNode.js" translate="no" target="_blank" rel="noopener">src/nodes/accessors/ReferenceNode.js</a>
- </p>
- </article>
- </section>
- <script src="../scripts/linenumber.js"></script>
- <script src="../scripts/page.js"></script>
- </body>
- </html>
|