CameraHelper.html 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>CameraHelper - 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. <p class="inheritance" translate="no"><a href="EventDispatcher.html">EventDispatcher</a> → <a href="Object3D.html">Object3D</a> → <a href="Line.html">Line</a> → <a href="LineSegments.html">LineSegments</a> → </p>
  13. <h1 translate="no">CameraHelper</h1>
  14. <section>
  15. <header>
  16. <div class="class-description"><p>This helps with visualizing what a camera contains in its frustum. It
  17. visualizes the frustum of a camera using a line segments.</p>
  18. <p>Based on frustum visualization in <a href="https://github.com/evanw/lightgl.js/blob/master/tests/shadowmap.html" target="_blank" rel="noopener">lightgl.js shadowmap example</a>.</p>
  19. <p><code>CameraHelper</code> must be a child of the scene.</p></div>
  20. <h2>Code Example</h2>
  21. <div translate="no"><pre><code class="language-js">const camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 0.1, 1000 );
  22. const helper = new THREE.CameraHelper( camera );
  23. scene.add( helper );
  24. </code></pre></div>
  25. </header>
  26. <article>
  27. <div class="container-overview">
  28. <h2>Constructor</h2>
  29. <h3 class="name name-method" id="CameraHelper" translate="no">new <a href="#CameraHelper">CameraHelper</a><span class="signature">( camera : <span class="param-type"><a href="Camera.html">Camera</a></span> )</span> </h3>
  30. <div class="method">
  31. <div class="description">
  32. <p>Constructs a new arrow helper.</p>
  33. </div>
  34. <table class="params">
  35. <tbody>
  36. <tr>
  37. <td class="name">
  38. <strong>camera</strong>
  39. </td>
  40. <td class="description last">
  41. <p>The camera to visualize.</p>
  42. </td>
  43. </tr>
  44. </tbody>
  45. </table>
  46. </div>
  47. </div>
  48. <h2 class="subsection-title">Properties</h2>
  49. <div class="member">
  50. <h3 class="name" id="camera" translate="no">.<a href="#camera">camera</a><span class="type-signature"> : <a href="Camera.html">Camera</a></span> </h3>
  51. <div class="description">
  52. <p>The camera being visualized.</p>
  53. </div>
  54. </div>
  55. <div class="member">
  56. <h3 class="name" id="pointMap" translate="no">.<a href="#pointMap">pointMap</a><span class="type-signature"> : Object.&lt;string, Array.&lt;number>></span> </h3>
  57. <div class="description">
  58. <p>This contains the points used to visualize the camera.</p>
  59. </div>
  60. </div>
  61. <h2 class="subsection-title">Methods</h2>
  62. <h3 class="name name-method" id="dispose" translate="no">.<a href="#dispose">dispose</a><span class="signature">()</span> </h3>
  63. <div class="method">
  64. <div class="description">
  65. <p>Frees the GPU-related resources allocated by this instance. Call this
  66. method whenever this instance is no longer used in your app.</p>
  67. </div>
  68. </div>
  69. <h3 class="name name-method" id="setColors" translate="no">.<a href="#setColors">setColors</a><span class="signature">( frustum : <span class="param-type"><a href="Color.html">Color</a></span>, cone : <span class="param-type"><a href="Color.html">Color</a></span>, up : <span class="param-type"><a href="Color.html">Color</a></span>, target : <span class="param-type"><a href="Color.html">Color</a></span>, cross : <span class="param-type"><a href="Color.html">Color</a></span> )</span><span class="type-signature"> : <a href="CameraHelper.html">CameraHelper</a></span> </h3>
  70. <div class="method">
  71. <div class="description">
  72. <p>Defines the colors of the helper.</p>
  73. </div>
  74. <table class="params">
  75. <tbody>
  76. <tr>
  77. <td class="name">
  78. <strong>frustum</strong>
  79. </td>
  80. <td class="description last">
  81. <p>The frustum line color.</p>
  82. </td>
  83. </tr>
  84. <tr>
  85. <td class="name">
  86. <strong>cone</strong>
  87. </td>
  88. <td class="description last">
  89. <p>The cone line color.</p>
  90. </td>
  91. </tr>
  92. <tr>
  93. <td class="name">
  94. <strong>up</strong>
  95. </td>
  96. <td class="description last">
  97. <p>The up line color.</p>
  98. </td>
  99. </tr>
  100. <tr>
  101. <td class="name">
  102. <strong>target</strong>
  103. </td>
  104. <td class="description last">
  105. <p>The target line color.</p>
  106. </td>
  107. </tr>
  108. <tr>
  109. <td class="name">
  110. <strong>cross</strong>
  111. </td>
  112. <td class="description last">
  113. <p>The cross line color.</p>
  114. </td>
  115. </tr>
  116. </tbody>
  117. </table>
  118. <dl class="details">
  119. <dt class="tag-returns"><strong>Returns:</strong> A reference to this helper.</dt>
  120. </dl>
  121. </div>
  122. <h3 class="name name-method" id="update" translate="no">.<a href="#update">update</a><span class="signature">()</span> </h3>
  123. <div class="method">
  124. <div class="description">
  125. <p>Updates the helper based on the projection matrix of the camera.</p>
  126. </div>
  127. </div>
  128. <h2 class="subsection-title">Source</h2>
  129. <p>
  130. <a href="https://github.com/mrdoob/three.js/blob/master/src/helpers/CameraHelper.js" translate="no" target="_blank" rel="noopener">src/helpers/CameraHelper.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号