Source.html 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  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">any</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"><code>data</code></td>
  31. <td class="description last"><p>The data definition of a texture.<br/>Default is <code>null</code>.</p></td>
  32. </tr>
  33. </tbody>
  34. </table>
  35. </div>
  36. </div>
  37. <h2 class="subsection-title">Properties</h2>
  38. <div class="member">
  39. <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>
  40. <div class="description">
  41. <p>The data definition of a texture.</p>
  42. </div>
  43. </div>
  44. <div class="member">
  45. <h3 class="name" id="dataReady" translate="no">.<a href="#dataReady">dataReady</a><span class="type-signature"> : boolean</span> </h3>
  46. <div class="description">
  47. <p>This property is only relevant when <a href="Source.html#needsUpdate">Source#needsUpdate</a> is set to <code>true</code> and
  48. provides more control on how texture data should be processed. When <code>dataReady</code> is set
  49. to <code>false</code>, the engine performs the memory allocation (if necessary) but does not transfer
  50. the data into the GPU memory.<br/>Default is <code>true</code>.</p>
  51. </div>
  52. </div>
  53. <div class="member">
  54. <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>
  55. <div class="description">
  56. <p>The ID of the source.</p>
  57. </div>
  58. </div>
  59. <div class="member">
  60. <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>
  61. <div class="description">
  62. <p>This flag can be used for type testing.<br/>Default is <code>true</code>.</p>
  63. </div>
  64. </div>
  65. <div class="member">
  66. <h3 class="name" id="needsUpdate" translate="no">.<a href="#needsUpdate">needsUpdate</a><span class="type-signature"> : boolean</span> </h3>
  67. <div class="description">
  68. <p>When the property is set to <code>true</code>, the engine allocates the memory
  69. for the texture (if necessary) and triggers the actual texture upload
  70. to the GPU next time the source is used.<br/>Default is <code>false</code>.</p>
  71. </div>
  72. </div>
  73. <div class="member">
  74. <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>
  75. <div class="description">
  76. <p>The UUID of the source.</p>
  77. </div>
  78. </div>
  79. <div class="member">
  80. <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>
  81. <div class="description">
  82. <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>.<br/>Default is <code>0</code>.</p>
  83. </div>
  84. </div>
  85. <h2 class="subsection-title">Methods</h2>
  86. <h3 class="name name-method" id="getSize" translate="no">.<a href="#getSize">getSize</a><span class="signature">( target : <span class="param-type">Vector2 | Vector3</span> )</span><span class="type-signature"> : <a href="Vector2.html">Vector2</a> | <a href="Vector3.html">Vector3</a></span> </h3>
  87. <div class="method">
  88. <div class="description">
  89. <p>Returns the dimensions of the source into the given target vector.</p>
  90. </div>
  91. <table class="params">
  92. <tbody>
  93. <tr>
  94. <td class="name"><code>target</code></td>
  95. <td class="description last"><p>The target object the result is written into.</p></td>
  96. </tr>
  97. </tbody>
  98. </table>
  99. <dl class="details">
  100. <dt class="tag-returns"><strong>Returns:</strong> The dimensions of the source.</dt>
  101. </dl>
  102. </div>
  103. <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>
  104. <div class="method">
  105. <div class="description">
  106. <p>Serializes the source into JSON.</p>
  107. </div>
  108. <table class="params">
  109. <tbody>
  110. <tr>
  111. <td class="name"><code>meta</code></td>
  112. <td class="description last"><p>An optional value holding meta information about the serialization.</p></td>
  113. </tr>
  114. </tbody>
  115. </table>
  116. <dl class="details">
  117. <dt class="tag-see">See:</dt>
  118. <dd class="tag-see">
  119. <ul>
  120. <li><a href="ObjectLoader.html#parse">ObjectLoader#parse</a></li>
  121. </ul>
  122. </dd>
  123. </dl>
  124. <dl class="details">
  125. <dt class="tag-returns"><strong>Returns:</strong> A JSON object representing the serialized source.</dt>
  126. </dl>
  127. </div>
  128. <h2 class="subsection-title">Source</h2>
  129. <p>
  130. <a href="https://github.com/mrdoob/three.js/blob/master/src/textures/Source.js" target="_blank" rel="noopener" translate="no">src/textures/Source.js</a>
  131. </p>
  132. </article>
  133. </section>
  134. <script src="../scripts/linenumber.js"></script>
  135. <script src="../scripts/page.js"></script>
  136. </body>
  137. </html>
粤ICP备19079148号