Uniform.html 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>Uniform - Three.js Docs</title>
  6. <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
  7. <script src="../scripts/highlight.min.js"></script>
  8. <link type="text/css" rel="stylesheet" href="../styles/highlight-three.css">
  9. <link type="text/css" rel="stylesheet" href="../styles/page.css">
  10. </head>
  11. <body>
  12. <h1 translate="no">Uniform</h1>
  13. <section>
  14. <header>
  15. <div class="class-description"><p>Represents a uniform which is a global shader variable. They are passed to shader programs.</p>
  16. <p>When declaring a uniform of a <a href="ShaderMaterial.html">ShaderMaterial</a>, it is declared by value or by object.</p>
  17. <p>Since this class can only be used in context of <a href="ShaderMaterial.html">ShaderMaterial</a>, it is only supported
  18. in <a href="WebGLRenderer.html">WebGLRenderer</a>.</p></div>
  19. <h2>Code Example</h2>
  20. <div translate="no"><pre><code class="language-js">uniforms: {
  21. time: { value: 1.0 },
  22. resolution: new Uniform( new Vector2() )
  23. };
  24. </code></pre></div>
  25. </header>
  26. <article>
  27. <div class="container-overview">
  28. <h2>Constructor</h2>
  29. <h3 class="name name-method" id="Uniform" translate="no">new <a href="#Uniform">Uniform</a><span class="signature">( value : <span class="param-type">any</span> )</span> </h3>
  30. <div class="method">
  31. <div class="description">
  32. <p>Constructs a new uniform.</p>
  33. </div>
  34. <table class="params">
  35. <tbody>
  36. <tr>
  37. <td class="name"><code>value</code></td>
  38. <td class="description last"><p>The uniform value.</p></td>
  39. </tr>
  40. </tbody>
  41. </table>
  42. </div>
  43. </div>
  44. <h2 class="subsection-title">Properties</h2>
  45. <div class="member">
  46. <h3 class="name" id="boundary" translate="no">.<a href="#boundary">boundary</a><span class="type-signature"> : number</span> </h3>
  47. <div class="description">
  48. <p>Used to build the uniform buffer according to the STD140 layout.
  49. Derived uniforms will set this property to a data type specific
  50. value.</p>
  51. </div>
  52. </div>
  53. <div class="member">
  54. <h3 class="name" id="itemSize" translate="no">.<a href="#itemSize">itemSize</a><span class="type-signature"> : number</span> </h3>
  55. <div class="description">
  56. <p>The item size. Derived uniforms will set this property to a data
  57. type specific value.</p>
  58. </div>
  59. </div>
  60. <div class="member">
  61. <h3 class="name" id="name" translate="no">.<a href="#name">name</a><span class="type-signature"> : string</span> </h3>
  62. <div class="description">
  63. <p>The uniform's name.</p>
  64. </div>
  65. </div>
  66. <div class="member">
  67. <h3 class="name" id="offset" translate="no">.<a href="#offset">offset</a><span class="type-signature"> : number</span> </h3>
  68. <div class="description">
  69. <p>This property is set by <a href="UniformsGroup.html">UniformsGroup</a> and marks
  70. the start position in the uniform buffer.</p>
  71. </div>
  72. </div>
  73. <div class="member">
  74. <h3 class="name" id="value" translate="no">.<a href="#value">value</a><span class="type-signature"> : <a href="global.html#any">any</a></span> </h3>
  75. <div class="description">
  76. <p>The uniform value.</p>
  77. </div>
  78. </div>
  79. <div class="member">
  80. <h3 class="name" id="value" translate="no">.<a href="#value">value</a><span class="type-signature"> : <a href="global.html#any">any</a></span> </h3>
  81. <div class="description">
  82. <p>The uniform's value.</p>
  83. </div>
  84. </div>
  85. <h2 class="subsection-title">Methods</h2>
  86. <h3 class="name name-method" id="clone" translate="no">.<a href="#clone">clone</a><span class="signature">()</span><span class="type-signature"> : <a href="Uniform.html">Uniform</a></span> </h3>
  87. <div class="method">
  88. <div class="description">
  89. <p>Returns a new uniform with copied values from this instance.
  90. If the value has a <code>clone()</code> method, the value is cloned as well.</p>
  91. </div>
  92. <dl class="details">
  93. <dt class="tag-returns"><strong>Returns:</strong> A clone of this instance.</dt>
  94. </dl>
  95. </div>
  96. <h3 class="name name-method" id="getValue" translate="no">.<a href="#getValue">getValue</a><span class="signature">()</span><span class="type-signature"> : <a href="global.html#any">any</a></span> </h3>
  97. <div class="method">
  98. <div class="description">
  99. <p>Returns the uniform's value.</p>
  100. </div>
  101. <dl class="details">
  102. <dt class="tag-returns"><strong>Returns:</strong> The value.</dt>
  103. </dl>
  104. </div>
  105. <h3 class="name name-method" id="setValue" translate="no">.<a href="#setValue">setValue</a><span class="signature">( value : <span class="param-type">any</span> )</span> </h3>
  106. <div class="method">
  107. <div class="description">
  108. <p>Sets the uniform's value.</p>
  109. </div>
  110. <table class="params">
  111. <tbody>
  112. <tr>
  113. <td class="name"><code>value</code></td>
  114. <td class="description last"><p>The value to set.</p></td>
  115. </tr>
  116. </tbody>
  117. </table>
  118. </div>
  119. <h2 class="subsection-title">Source</h2>
  120. <p>
  121. <a href="https://github.com/mrdoob/three.js/blob/master/src/core/Uniform.js" target="_blank" rel="noopener" translate="no">src/core/Uniform.js</a>
  122. </p>
  123. </article>
  124. </section>
  125. <script src="../scripts/linenumber.js"></script>
  126. <script src="../scripts/page.js"></script>
  127. </body>
  128. </html>
粤ICP备19079148号