AnaglyphEffect.html 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>AnaglyphEffect - 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">AnaglyphEffect</h1>
  13. <section>
  14. <header>
  15. <div class="class-description"><p>A class that creates an anaglyph effect using physically-correct
  16. off-axis stereo projection.</p>
  17. <p>This implementation uses CameraUtils.frameCorners() to align stereo
  18. camera frustums to a virtual screen plane, providing accurate depth
  19. perception with zero parallax at the plane distance.</p>
  20. <p>Note that this class can only be used with <a href="WebGLRenderer.html">WebGLRenderer</a>.
  21. When using <a href="WebGPURenderer.html">WebGPURenderer</a>, use <a href="AnaglyphPassNode.html">AnaglyphPassNode</a>.</p></div>
  22. </header>
  23. <article>
  24. <h2 class="subsection-title">Import</h2>
  25. <p><span translate="no">AnaglyphEffect</span> is an addon, and must be imported explicitly, see <a href="https://threejs.org/manual/#en/installation" target="_blank" rel="noopener">Installation#Addons</a>.</p>
  26. <pre><code class="language-js">import { AnaglyphEffect } from 'three/addons/effects/AnaglyphEffect.js';</code></pre>
  27. <div class="container-overview">
  28. <h2>Constructor</h2>
  29. <h3 class="name name-method" id="AnaglyphEffect" translate="no">new <a href="#AnaglyphEffect">AnaglyphEffect</a><span class="signature">( renderer : <span class="param-type"><a href="WebGLRenderer.html">WebGLRenderer</a></span>, width : <span class="param-type">number</span>, height : <span class="param-type">number</span> )</span> </h3>
  30. <div class="method">
  31. <div class="description">
  32. <p>Constructs a new anaglyph effect.</p>
  33. </div>
  34. <table class="params">
  35. <tbody>
  36. <tr>
  37. <td class="name">
  38. <strong translate="no">renderer</strong>
  39. </td>
  40. <td class="description last">
  41. <p>The renderer.</p>
  42. </td>
  43. </tr>
  44. <tr>
  45. <td class="name">
  46. <strong translate="no">width</strong>
  47. </td>
  48. <td class="description last">
  49. <p>The width of the effect in physical pixels.</p>
  50. <p>Default is <code>512</code>.</p>
  51. </td>
  52. </tr>
  53. <tr>
  54. <td class="name">
  55. <strong translate="no">height</strong>
  56. </td>
  57. <td class="description last">
  58. <p>The height of the effect in physical pixels.</p>
  59. <p>Default is <code>512</code>.</p>
  60. </td>
  61. </tr>
  62. </tbody>
  63. </table>
  64. </div>
  65. </div>
  66. <h2 class="subsection-title">Properties</h2>
  67. <div class="member">
  68. <h3 class="name" id="eyeSep" translate="no">.<a href="#eyeSep">eyeSep</a><span class="type-signature"> : number</span> </h3>
  69. <div class="description">
  70. <p>The interpupillary distance (eye separation) in world units.
  71. Typical human IPD is 0.064 meters (64mm).</p>
  72. <p>Default is <code>0.064</code>.</p>
  73. </div>
  74. </div>
  75. <div class="member">
  76. <h3 class="name" id="planeDistance" translate="no">.<a href="#planeDistance">planeDistance</a><span class="type-signature"> : number</span> </h3>
  77. <div class="description">
  78. <p>The distance in world units from the viewer to the virtual
  79. screen plane where zero parallax (screen depth) occurs.
  80. Objects at this distance appear at the screen surface.
  81. Objects closer appear in front of the screen (negative parallax).
  82. Objects further appear behind the screen (positive parallax).</p>
  83. <p>The screen dimensions are derived from the camera's FOV and aspect ratio
  84. at this distance, ensuring the stereo view matches the camera's field of view.</p>
  85. <p>Default is <code>0.5</code>.</p>
  86. </div>
  87. </div>
  88. <h2 class="subsection-title">Methods</h2>
  89. <h3 class="name name-method" id="dispose" translate="no">.<a href="#dispose">dispose</a><span class="signature">()</span> </h3>
  90. <div class="method">
  91. <div class="description">
  92. <p>Frees internal resources. This method should be called
  93. when the effect is no longer required.</p>
  94. </div>
  95. </div>
  96. <h3 class="name name-method" id="render" translate="no">.<a href="#render">render</a><span class="signature">( scene : <span class="param-type"><a href="Object3D.html">Object3D</a></span>, camera : <span class="param-type"><a href="Camera.html">Camera</a></span> )</span> </h3>
  97. <div class="method">
  98. <div class="description">
  99. <p>When using this effect, this method should be called instead of the
  100. default <a href="WebGLRenderer.html#render">WebGLRenderer#render</a>.</p>
  101. </div>
  102. <table class="params">
  103. <tbody>
  104. <tr>
  105. <td class="name">
  106. <strong translate="no">scene</strong>
  107. </td>
  108. <td class="description last">
  109. <p>The scene to render.</p>
  110. </td>
  111. </tr>
  112. <tr>
  113. <td class="name">
  114. <strong translate="no">camera</strong>
  115. </td>
  116. <td class="description last">
  117. <p>The camera.</p>
  118. </td>
  119. </tr>
  120. </tbody>
  121. </table>
  122. </div>
  123. <h3 class="name name-method" id="setSize" translate="no">.<a href="#setSize">setSize</a><span class="signature">( width : <span class="param-type">number</span>, height : <span class="param-type">number</span> )</span> </h3>
  124. <div class="method">
  125. <div class="description">
  126. <p>Resizes the effect.</p>
  127. </div>
  128. <table class="params">
  129. <tbody>
  130. <tr>
  131. <td class="name">
  132. <strong translate="no">width</strong>
  133. </td>
  134. <td class="description last">
  135. <p>The width of the effect in logical pixels.</p>
  136. </td>
  137. </tr>
  138. <tr>
  139. <td class="name">
  140. <strong translate="no">height</strong>
  141. </td>
  142. <td class="description last">
  143. <p>The height of the effect in logical pixels.</p>
  144. </td>
  145. </tr>
  146. </tbody>
  147. </table>
  148. </div>
  149. <h2 class="subsection-title">Source</h2>
  150. <p>
  151. <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/effects/AnaglyphEffect.js" translate="no" target="_blank" rel="noopener">examples/jsm/effects/AnaglyphEffect.js</a>
  152. </p>
  153. </article>
  154. </section>
  155. <script src="../scripts/linenumber.js"></script>
  156. <script src="../scripts/page.js"></script>
  157. </body>
  158. </html>
粤ICP备19079148号