MarchingCubes.html 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>MarchingCubes - 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">MarchingCubes</h1>
  13. <section>
  14. <header>
  15. <div class="class-description"><p>A marching cubes implementation.</p>
  16. <p>Port of: <a href="http://webglsamples.org/blob/blob.html" target="_blank" rel="noopener">http://webglsamples.org/blob/blob.html</a></p></div>
  17. </header>
  18. <article>
  19. <h2 class="subsection-title">Import</h2>
  20. <p><span translate="no">MarchingCubes</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>
  21. <pre><code class="language-js">import { MarchingCubes } from 'three/addons/objects/MarchingCubes.js';</code></pre>
  22. <div class="container-overview">
  23. <h2>Constructor</h2>
  24. <h3 class="name name-method" id="MarchingCubes" translate="no">new <a href="#MarchingCubes">MarchingCubes</a><span class="signature">( resolution : <span class="param-type">number</span>, material : <span class="param-type"><a href="Material.html">Material</a></span>, enableUvs : <span class="param-type">boolean</span>, enableColors : <span class="param-type">boolean</span>, maxPolyCount : <span class="param-type">number</span> )</span> </h3>
  25. <div class="method">
  26. <div class="description">
  27. <p>Constructs a new marching cubes instance.</p>
  28. </div>
  29. <table class="params">
  30. <tbody>
  31. <tr>
  32. <td class="name">
  33. <strong>resolution</strong>
  34. </td>
  35. <td class="description last">
  36. <p>The effect's resolution.</p>
  37. </td>
  38. </tr>
  39. <tr>
  40. <td class="name">
  41. <strong>material</strong>
  42. </td>
  43. <td class="description last">
  44. <p>The cube's material.</p>
  45. </td>
  46. </tr>
  47. <tr>
  48. <td class="name">
  49. <strong>enableUvs</strong>
  50. </td>
  51. <td class="description last">
  52. <p>Whether texture coordinates should be animated or not.</p>
  53. <p>Default is <code>false</code>.</p>
  54. </td>
  55. </tr>
  56. <tr>
  57. <td class="name">
  58. <strong>enableColors</strong>
  59. </td>
  60. <td class="description last">
  61. <p>Whether colors should be animated or not.</p>
  62. <p>Default is <code>false</code>.</p>
  63. </td>
  64. </tr>
  65. <tr>
  66. <td class="name">
  67. <strong>maxPolyCount</strong>
  68. </td>
  69. <td class="description last">
  70. <p>The maximum size of the geometry buffers.</p>
  71. <p>Default is <code>10000</code>.</p>
  72. </td>
  73. </tr>
  74. </tbody>
  75. </table>
  76. </div>
  77. </div>
  78. <h2 class="subsection-title">Properties</h2>
  79. <div class="member">
  80. <h3 class="name" id="enableColors" translate="no">.<a href="#enableColors">enableColors</a><span class="type-signature"> : boolean</span> </h3>
  81. <div class="description">
  82. <p>Whether colors should be animated or not.</p>
  83. <p>Default is <code>false</code>.</p>
  84. </div>
  85. </div>
  86. <div class="member">
  87. <h3 class="name" id="enableUvs" translate="no">.<a href="#enableUvs">enableUvs</a><span class="type-signature"> : boolean</span> </h3>
  88. <div class="description">
  89. <p>Whether texture coordinates should be animated or not.</p>
  90. <p>Default is <code>false</code>.</p>
  91. </div>
  92. </div>
  93. <div class="member">
  94. <h3 class="name" id="isMarchingCubes" translate="no">.<a href="#isMarchingCubes">isMarchingCubes</a><span class="type-signature"> : boolean</span> <span class="type-signature">(readonly) </span></h3>
  95. <div class="description">
  96. <p>This flag can be used for type testing.</p>
  97. <p>Default is <code>true</code>.</p>
  98. </div>
  99. </div>
  100. <h2 class="subsection-title">Methods</h2>
  101. <h3 class="name name-method" id="addBall" translate="no">.<a href="#addBall">addBall</a><span class="signature">( ballx : <span class="param-type">number</span>, bally : <span class="param-type">number</span>, ballz : <span class="param-type">number</span>, strength : <span class="param-type">number</span>, subtract : <span class="param-type">number</span>, colors : <span class="param-type"><a href="Color.html">Color</a></span> )</span> </h3>
  102. <div class="method">
  103. <div class="description">
  104. <p>Adds a reciprocal ball (nice and blobby) that, to be fast, fades to zero after
  105. a fixed distance, determined by strength and subtract.</p>
  106. </div>
  107. <table class="params">
  108. <tbody>
  109. <tr>
  110. <td class="name">
  111. <strong>ballx</strong>
  112. </td>
  113. <td class="description last">
  114. <p>The x-coordinate of the ball.</p>
  115. </td>
  116. </tr>
  117. <tr>
  118. <td class="name">
  119. <strong>bally</strong>
  120. </td>
  121. <td class="description last">
  122. <p>The y-coordinate of the ball.</p>
  123. </td>
  124. </tr>
  125. <tr>
  126. <td class="name">
  127. <strong>ballz</strong>
  128. </td>
  129. <td class="description last">
  130. <p>The z-coordinate of the ball.</p>
  131. </td>
  132. </tr>
  133. <tr>
  134. <td class="name">
  135. <strong>strength</strong>
  136. </td>
  137. <td class="description last">
  138. <p>The strength factor.</p>
  139. </td>
  140. </tr>
  141. <tr>
  142. <td class="name">
  143. <strong>subtract</strong>
  144. </td>
  145. <td class="description last">
  146. <p>The subtract factor.</p>
  147. </td>
  148. </tr>
  149. <tr>
  150. <td class="name">
  151. <strong>colors</strong>
  152. </td>
  153. <td class="description last">
  154. <p>The color.</p>
  155. </td>
  156. </tr>
  157. </tbody>
  158. </table>
  159. </div>
  160. <h3 class="name name-method" id="addPlaneX" translate="no">.<a href="#addPlaneX">addPlaneX</a><span class="signature">( strength : <span class="param-type">number</span>, subtract : <span class="param-type">number</span> )</span> </h3>
  161. <div class="method">
  162. <div class="description">
  163. <p>Adds a plane along the x-axis.</p>
  164. </div>
  165. <table class="params">
  166. <tbody>
  167. <tr>
  168. <td class="name">
  169. <strong>strength</strong>
  170. </td>
  171. <td class="description last">
  172. <p>The strength factor.</p>
  173. </td>
  174. </tr>
  175. <tr>
  176. <td class="name">
  177. <strong>subtract</strong>
  178. </td>
  179. <td class="description last">
  180. <p>The subtract factor.</p>
  181. </td>
  182. </tr>
  183. </tbody>
  184. </table>
  185. </div>
  186. <h3 class="name name-method" id="addPlaneY" translate="no">.<a href="#addPlaneY">addPlaneY</a><span class="signature">( strength : <span class="param-type">number</span>, subtract : <span class="param-type">number</span> )</span> </h3>
  187. <div class="method">
  188. <div class="description">
  189. <p>Adds a plane along the y-axis.</p>
  190. </div>
  191. <table class="params">
  192. <tbody>
  193. <tr>
  194. <td class="name">
  195. <strong>strength</strong>
  196. </td>
  197. <td class="description last">
  198. <p>The strength factor.</p>
  199. </td>
  200. </tr>
  201. <tr>
  202. <td class="name">
  203. <strong>subtract</strong>
  204. </td>
  205. <td class="description last">
  206. <p>The subtract factor.</p>
  207. </td>
  208. </tr>
  209. </tbody>
  210. </table>
  211. </div>
  212. <h3 class="name name-method" id="addPlaneZ" translate="no">.<a href="#addPlaneZ">addPlaneZ</a><span class="signature">( strength : <span class="param-type">number</span>, subtract : <span class="param-type">number</span> )</span> </h3>
  213. <div class="method">
  214. <div class="description">
  215. <p>Adds a plane along the z-axis.</p>
  216. </div>
  217. <table class="params">
  218. <tbody>
  219. <tr>
  220. <td class="name">
  221. <strong>strength</strong>
  222. </td>
  223. <td class="description last">
  224. <p>The strength factor.</p>
  225. </td>
  226. </tr>
  227. <tr>
  228. <td class="name">
  229. <strong>subtract</strong>
  230. </td>
  231. <td class="description last">
  232. <p>The subtract factor.</p>
  233. </td>
  234. </tr>
  235. </tbody>
  236. </table>
  237. </div>
  238. <h3 class="name name-method" id="blur" translate="no">.<a href="#blur">blur</a><span class="signature">( intensity : <span class="param-type">number</span> )</span> </h3>
  239. <div class="method">
  240. <div class="description">
  241. <p>Applies a blur with the given intensity.</p>
  242. </div>
  243. <table class="params">
  244. <tbody>
  245. <tr>
  246. <td class="name">
  247. <strong>intensity</strong>
  248. </td>
  249. <td class="description last">
  250. <p>The intensity of the blur.</p>
  251. <p>Default is <code>1</code>.</p>
  252. </td>
  253. </tr>
  254. </tbody>
  255. </table>
  256. </div>
  257. <h3 class="name name-method" id="getCell" translate="no">.<a href="#getCell">getCell</a><span class="signature">( x : <span class="param-type">number</span>, y : <span class="param-type">number</span>, z : <span class="param-type">number</span> )</span><span class="type-signature"> : number</span> </h3>
  258. <div class="method">
  259. <div class="description">
  260. <p>Returns the cell value for the given coordinates.</p>
  261. </div>
  262. <table class="params">
  263. <tbody>
  264. <tr>
  265. <td class="name">
  266. <strong>x</strong>
  267. </td>
  268. <td class="description last">
  269. <p>The x value.</p>
  270. </td>
  271. </tr>
  272. <tr>
  273. <td class="name">
  274. <strong>y</strong>
  275. </td>
  276. <td class="description last">
  277. <p>The y value.</p>
  278. </td>
  279. </tr>
  280. <tr>
  281. <td class="name">
  282. <strong>z</strong>
  283. </td>
  284. <td class="description last">
  285. <p>The z value.</p>
  286. </td>
  287. </tr>
  288. </tbody>
  289. </table>
  290. <dl class="details">
  291. <dt class="tag-returns"><strong>Returns:</strong> The value.</dt>
  292. </dl>
  293. </div>
  294. <h3 class="name name-method" id="reset" translate="no">.<a href="#reset">reset</a><span class="signature">()</span> </h3>
  295. <div class="method">
  296. <div class="description">
  297. <p>Resets the effect.</p>
  298. </div>
  299. </div>
  300. <h3 class="name name-method" id="setCell" translate="no">.<a href="#setCell">setCell</a><span class="signature">( x : <span class="param-type">number</span>, y : <span class="param-type">number</span>, z : <span class="param-type">number</span>, value : <span class="param-type">number</span> )</span> </h3>
  301. <div class="method">
  302. <div class="description">
  303. <p>Sets the cell value for the given coordinates.</p>
  304. </div>
  305. <table class="params">
  306. <tbody>
  307. <tr>
  308. <td class="name">
  309. <strong>x</strong>
  310. </td>
  311. <td class="description last">
  312. <p>The x value.</p>
  313. </td>
  314. </tr>
  315. <tr>
  316. <td class="name">
  317. <strong>y</strong>
  318. </td>
  319. <td class="description last">
  320. <p>The y value.</p>
  321. </td>
  322. </tr>
  323. <tr>
  324. <td class="name">
  325. <strong>z</strong>
  326. </td>
  327. <td class="description last">
  328. <p>The z value.</p>
  329. </td>
  330. </tr>
  331. <tr>
  332. <td class="name">
  333. <strong>value</strong>
  334. </td>
  335. <td class="description last">
  336. <p>The value to set.</p>
  337. </td>
  338. </tr>
  339. </tbody>
  340. </table>
  341. </div>
  342. <h3 class="name name-method" id="update" translate="no">.<a href="#update">update</a><span class="signature">()</span> </h3>
  343. <div class="method">
  344. <div class="description">
  345. <p>Updates the effect.</p>
  346. </div>
  347. </div>
  348. <h2 class="subsection-title">Source</h2>
  349. <p>
  350. <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/objects/MarchingCubes.js" translate="no" target="_blank" rel="noopener">examples/jsm/objects/MarchingCubes.js</a>
  351. </p>
  352. </article>
  353. </section>
  354. <script src="../scripts/linenumber.js"></script>
  355. <script src="../scripts/page.js"></script>
  356. </body>
  357. </html>
粤ICP备19079148号