1
0

Source.html 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>Source - 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">Source</h1>
  13. <section>
  14. <header>
  15. <div class="class-description"><p>Represents the data source of a texture.</p>
  16. <p>The main purpose of this class is to decouple the data definition from the texture
  17. definition so the same data can be used with multiple texture instances.</p></div>
  18. </header>
  19. <article>
  20. <div class="container-overview">
  21. <h2>Constructor</h2>
  22. <h3 class="name name-method" id="Source" translate="no">new <a href="#Source">Source</a><span class="signature">( data : <span class="param-type"><a href="global.html#any">any</a></span> )</span> </h3>
  23. <div class="method">
  24. <div class="description">
  25. <p>Constructs a new video texture.</p>
  26. </div>
  27. <table class="params">
  28. <tbody>
  29. <tr>
  30. <td class="name">
  31. <strong>data</strong>
  32. </td>
  33. <td class="description last">
  34. <p>The data definition of a texture.</p>
  35. <p>Default is <code>null</code>.</p>
  36. </td>
  37. </tr>
  38. </tbody>
  39. </table>
  40. </div>
  41. </div>
  42. <h2 class="subsection-title">Properties</h2>
  43. <div class="member">
  44. <h3 class="name" id="data" translate="no">.<a href="#data">data</a><span class="type-signature"> : <a href="global.html#any">any</a></span> </h3>
  45. <div class="description">
  46. <p>The data definition of a texture.</p>
  47. </div>
  48. </div>
  49. <div class="member">
  50. <h3 class="name" id="dataReady" translate="no">.<a href="#dataReady">dataReady</a><span class="type-signature"> : boolean</span> </h3>
  51. <div class="description">
  52. <p>This property is only relevant when <a href="Source.html#needsUpdate">Source#needsUpdate</a> is set to <code>true</code> and
  53. provides more control on how texture data should be processed. When <code>dataReady</code> is set
  54. to <code>false</code>, the engine performs the memory allocation (if necessary) but does not transfer
  55. the data into the GPU memory.</p>
  56. <p>Default is <code>true</code>.</p>
  57. </div>
  58. </div>
  59. <div class="member">
  60. <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>
  61. <div class="description">
  62. <p>The ID of the source.</p>
  63. </div>
  64. </div>
  65. <div class="member">
  66. <h3 class="name" id="isSource" translate="no">.<a href="#isSource">isSource</a><span class="type-signature"> : boolean</span> <span class="type-signature">(readonly) </span></h3>
  67. <div class="description">
  68. <p>This flag can be used for type testing.</p>
  69. <p>Default is <code>true</code>.</p>
  70. </div>
  71. </div>
  72. <div class="member">
  73. <h3 class="name" id="needsUpdate" translate="no">.<a href="#needsUpdate">needsUpdate</a><span class="type-signature"> : boolean</span> </h3>
  74. <div class="description">
  75. <p>When the property is set to <code>true</code>, the engine allocates the memory
  76. for the texture (if necessary) and triggers the actual texture upload
  77. to the GPU next time the source is used.</p>
  78. <p>Default is <code>false</code>.</p>
  79. </div>
  80. </div>
  81. <div class="member">
  82. <h3 class="name" id="uuid" translate="no">.<a href="#uuid">uuid</a><span class="type-signature"> : string</span> <span class="type-signature">(readonly) </span></h3>
  83. <div class="description">
  84. <p>The UUID of the source.</p>
  85. </div>
  86. </div>
  87. <div class="member">
  88. <h3 class="name" id="version" translate="no">.<a href="#version">version</a><span class="type-signature"> : number</span> <span class="type-signature">(readonly) </span></h3>
  89. <div class="description">
  90. <p>This starts at <code>0</code> and counts how many times <a href="Source.html#needsUpdate">Source#needsUpdate</a> is set to <code>true</code>.</p>
  91. <p>Default is <code>0</code>.</p>
  92. </div>
  93. </div>
  94. <h2 class="subsection-title">Methods</h2>
  95. <h3 class="name name-method" id="getSize" translate="no">.<a href="#getSize">getSize</a><span class="signature">( target : <span class="param-type"><a href="Vector2.html">Vector2</a> | <a href="Vector3.html">Vector3</a></span> )</span><span class="type-signature"> : <a href="Vector2.html">Vector2</a> | <a href="Vector3.html">Vector3</a></span> </h3>
  96. <div class="method">
  97. <div class="description">
  98. <p>Returns the dimensions of the source into the given target vector.</p>
  99. </div>
  100. <table class="params">
  101. <tbody>
  102. <tr>
  103. <td class="name">
  104. <strong>target</strong>
  105. </td>
  106. <td class="description last">
  107. <p>The target object the result is written into.</p>
  108. </td>
  109. </tr>
  110. </tbody>
  111. </table>
  112. <dl class="details">
  113. <dt class="tag-returns"><strong>Returns:</strong> The dimensions of the source.</dt>
  114. </dl>
  115. </div>
  116. <h3 class="name name-method" id="toJSON" translate="no">.<a href="#toJSON">toJSON</a><span class="signature">( meta : <span class="param-type">Object | string</span> )</span><span class="type-signature"> : Object</span> </h3>
  117. <div class="method">
  118. <div class="description">
  119. <p>Serializes the source into JSON.</p>
  120. </div>
  121. <table class="params">
  122. <tbody>
  123. <tr>
  124. <td class="name">
  125. <strong>meta</strong>
  126. </td>
  127. <td class="description last">
  128. <p>An optional value holding meta information about the serialization.</p>
  129. </td>
  130. </tr>
  131. </tbody>
  132. </table>
  133. <dl class="details">
  134. <dt class="tag-see">See:</dt>
  135. <dd class="tag-see">
  136. <ul>
  137. <li><a href="ObjectLoader.html#parse">ObjectLoader#parse</a></li>
  138. </ul>
  139. </dd>
  140. </dl>
  141. <dl class="details">
  142. <dt class="tag-returns"><strong>Returns:</strong> A JSON object representing the serialized source.</dt>
  143. </dl>
  144. </div>
  145. <h2 class="subsection-title">Source</h2>
  146. <p>
  147. <a href="https://github.com/mrdoob/three.js/blob/master/src/textures/Source.js" translate="no" target="_blank" rel="noopener">src/textures/Source.js</a>
  148. </p>
  149. </article>
  150. </section>
  151. <script src="../scripts/linenumber.js"></script>
  152. <script src="../scripts/page.js"></script>
  153. </body>
  154. </html>
粤ICP备19079148号