RoundedBoxGeometry.html 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>RoundedBoxGeometry - 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="BufferGeometry.html">BufferGeometry</a> → <a href="BoxGeometry.html">BoxGeometry</a> → </p>
  13. <h1 translate="no">RoundedBoxGeometry</h1>
  14. <section>
  15. <header>
  16. <div class="class-description"><p>A special type of box geometry with rounded corners and edges.</p></div>
  17. <h2>Code Example</h2>
  18. <div translate="no"><pre><code class="language-js">const geometry = new THREE.RoundedBoxGeometry();
  19. const material = new THREE.MeshStandardMaterial( { color: 0x00ff00 } );
  20. const cube = new THREE.Mesh( geometry, material );
  21. scene.add( cube );
  22. </code></pre></div>
  23. </header>
  24. <article>
  25. <h2 class="subsection-title">Import</h2>
  26. <p><span translate="no">RoundedBoxGeometry</span> is an addon, and must be imported explicitly, see <a href="https://threejs.org/manual/#en/installation" target="_blank">Installation#Addons</a>.</p>
  27. <pre><code class="language-js">import { RoundedBoxGeometry } from 'three/addons/geometries/RoundedBoxGeometry.js';</code></pre>
  28. <div class="container-overview">
  29. <h2>Constructor</h2>
  30. <h3 class="name name-method" id="RoundedBoxGeometry" translate="no">new <a href="#RoundedBoxGeometry">RoundedBoxGeometry</a><span class="signature">( width : <span class="param-type">number</span>, height : <span class="param-type">number</span>, depth : <span class="param-type">number</span>, segments : <span class="param-type">number</span>, radius : <span class="param-type">number</span> )</span> </h3>
  31. <div class="method">
  32. <div class="description">
  33. <p>Constructs a new rounded box geometry.</p>
  34. </div>
  35. <table class="params">
  36. <tbody>
  37. <tr>
  38. <td class="name"><code>width</code></td>
  39. <td class="description last"><p>The width. That is, the length of the edges parallel to the X axis.<br/>Default is <code>1</code>.</p></td>
  40. </tr>
  41. <tr>
  42. <td class="name"><code>height</code></td>
  43. <td class="description last"><p>The height. That is, the length of the edges parallel to the Y axis.<br/>Default is <code>1</code>.</p></td>
  44. </tr>
  45. <tr>
  46. <td class="name"><code>depth</code></td>
  47. <td class="description last"><p>The depth. That is, the length of the edges parallel to the Z axis.<br/>Default is <code>1</code>.</p></td>
  48. </tr>
  49. <tr>
  50. <td class="name"><code>segments</code></td>
  51. <td class="description last"><p>Number of segments that form the rounded corners.<br/>Default is <code>2</code>.</p></td>
  52. </tr>
  53. <tr>
  54. <td class="name"><code>radius</code></td>
  55. <td class="description last"><p>The radius of the rounded corners.<br/>Default is <code>0.1</code>.</p></td>
  56. </tr>
  57. </tbody>
  58. </table>
  59. </div>
  60. </div>
  61. <h2 class="subsection-title">Properties</h2>
  62. <div class="member">
  63. <h3 class="name" id="parameters" translate="no">.<a href="#parameters">parameters</a><span class="type-signature"> : Object</span> </h3>
  64. <div class="description">
  65. <p>Holds the constructor parameters that have been
  66. used to generate the geometry. Any modification
  67. after instantiation does not change the geometry.</p>
  68. </div>
  69. <dl class="details">
  70. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="BoxGeometry.html#parameters">BoxGeometry#parameters</a></dt>
  71. </dl>
  72. </div>
  73. <h2 class="subsection-title">Static Methods</h2>
  74. <h3 class="name name-method" id=".fromJSON" translate="no">.<a href="#.fromJSON">fromJSON</a><span class="signature">( data : <span class="param-type">Object</span> )</span><span class="type-signature"> : <a href="RoundedBoxGeometry.html">RoundedBoxGeometry</a></span> </h3>
  75. <div class="method">
  76. <div class="description">
  77. <p>Factory method for creating an instance of this class from the given
  78. JSON object.</p>
  79. </div>
  80. <table class="params">
  81. <tbody>
  82. <tr>
  83. <td class="name"><code>data</code></td>
  84. <td class="description last"><p>A JSON object representing the serialized geometry.</p></td>
  85. </tr>
  86. </tbody>
  87. </table>
  88. <dl class="details">
  89. <dt class="tag-returns"><strong>Returns:</strong> A new instance.</dt>
  90. </dl>
  91. </div>
  92. <h2 class="subsection-title">Source</h2>
  93. <p>
  94. <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/geometries/RoundedBoxGeometry.js" target="_blank" rel="noopener" translate="no">examples/jsm/geometries/RoundedBoxGeometry.js</a>
  95. </p>
  96. </article>
  97. </section>
  98. <script src="../scripts/linenumber.js"></script>
  99. <script src="../scripts/page.js"></script>
  100. </body>
  101. </html>
粤ICP备19079148号