CameraHelper.html 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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">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">Camera</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"><code>camera</code></td>
  38. <td class="description last"><p>The camera to visualize.</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="camera" translate="no">.<a href="#camera">camera</a><span class="type-signature"> : <a href="Camera.html">Camera</a></span> </h3>
  47. <div class="description">
  48. <p>The camera being visualized.</p>
  49. </div>
  50. </div>
  51. <div class="member">
  52. <h3 class="name" id="pointMap" translate="no">.<a href="#pointMap">pointMap</a><span class="type-signature"> : Object.&lt;string, Array.&lt;number>></span> </h3>
  53. <div class="description">
  54. <p>This contains the points used to visualize the camera.</p>
  55. </div>
  56. </div>
  57. <h2 class="subsection-title">Methods</h2>
  58. <h3 class="name name-method" id="dispose" translate="no">.<a href="#dispose">dispose</a><span class="signature">()</span> </h3>
  59. <div class="method">
  60. <div class="description">
  61. <p>Frees the GPU-related resources allocated by this instance. Call this
  62. method whenever this instance is no longer used in your app.</p>
  63. </div>
  64. </div>
  65. <h3 class="name name-method" id="setColors" translate="no">.<a href="#setColors">setColors</a><span class="signature">( frustum : <span class="param-type">Color</span>, cone : <span class="param-type">Color</span>, up : <span class="param-type">Color</span>, target : <span class="param-type">Color</span>, cross : <span class="param-type">Color</span> )</span><span class="type-signature"> : <a href="CameraHelper.html">CameraHelper</a></span> </h3>
  66. <div class="method">
  67. <div class="description">
  68. <p>Defines the colors of the helper.</p>
  69. </div>
  70. <table class="params">
  71. <tbody>
  72. <tr>
  73. <td class="name"><code>frustum</code></td>
  74. <td class="description last"><p>The frustum line color.</p></td>
  75. </tr>
  76. <tr>
  77. <td class="name"><code>cone</code></td>
  78. <td class="description last"><p>The cone line color.</p></td>
  79. </tr>
  80. <tr>
  81. <td class="name"><code>up</code></td>
  82. <td class="description last"><p>The up line color.</p></td>
  83. </tr>
  84. <tr>
  85. <td class="name"><code>target</code></td>
  86. <td class="description last"><p>The target line color.</p></td>
  87. </tr>
  88. <tr>
  89. <td class="name"><code>cross</code></td>
  90. <td class="description last"><p>The cross line color.</p></td>
  91. </tr>
  92. </tbody>
  93. </table>
  94. <dl class="details">
  95. <dt class="tag-returns"><strong>Returns:</strong> A reference to this helper.</dt>
  96. </dl>
  97. </div>
  98. <h3 class="name name-method" id="update" translate="no">.<a href="#update">update</a><span class="signature">()</span> </h3>
  99. <div class="method">
  100. <div class="description">
  101. <p>Updates the helper based on the projection matrix of the camera.</p>
  102. </div>
  103. </div>
  104. <h2 class="subsection-title">Source</h2>
  105. <p>
  106. <a href="https://github.com/mrdoob/three.js/blob/master/src/helpers/CameraHelper.js" target="_blank" rel="noopener" translate="no">src/helpers/CameraHelper.js</a>
  107. </p>
  108. </article>
  109. </section>
  110. <script src="../scripts/linenumber.js"></script>
  111. <script src="../scripts/page.js"></script>
  112. </body>
  113. </html>
粤ICP备19079148号