BoxBufferGeometry.html 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <!DOCTYPE html>
  2. <html lang="zh">
  3. <head>
  4. <meta charset="utf-8" />
  5. <base href="../../../" />
  6. <script src="page.js"></script>
  7. <link type="text/css" rel="stylesheet" href="page.css" />
  8. </head>
  9. <body>
  10. [page:BufferGeometry] &rarr;
  11. <h1>立方缓冲几何体([name])</h1>
  12. <p class="desc">
  13. 这是[page:BoxGeometry]中的[page:BufferGeometry]接口。</p>
  14. <iframe id="scene" src="scenes/geometry-browser.html#BoxBufferGeometry"></iframe>
  15. <script>
  16. // iOS iframe auto-resize workaround
  17. if ( /(iPad|iPhone|iPod)/g.test( navigator.userAgent ) ) {
  18. const scene = document.getElementById( 'scene' );
  19. scene.style.width = getComputedStyle( scene ).width;
  20. scene.style.height = getComputedStyle( scene ).height;
  21. scene.setAttribute( 'scrolling', 'no' );
  22. }
  23. </script>
  24. <h2>代码示例</h2>
  25. <code>const geometry = new THREE.BoxBufferGeometry( 1, 1, 1 );
  26. const material = new THREE.MeshBasicMaterial( {color: 0x00ff00} );
  27. const cube = new THREE.Mesh( geometry, material );
  28. scene.add( cube );
  29. </code>
  30. <h2>构造器</h2>
  31. <h3>[name]([param:Float width], [param:Float height], [param:Float depth], [param:Integer widthSegments], [param:Integer heightSegments], [param:Integer depthSegments])</h3>
  32. <p>
  33. width — X轴上面的宽度,默认值为1。<br />
  34. height — Y轴上面的高度,默认值为1。<br />
  35. depth — Z轴上面的深度,默认值为1。<br />
  36. widthSegments — (可选)宽度的分段数,默认值是1。<br />
  37. heightSegments — (可选)宽度的分段数,默认值是1。<br />
  38. depthSegments — (可选)宽度的分段数,默认值是1。
  39. </p>
  40. <h2>属性</h2>
  41. <p>共有属性请参见其基类[page:BufferGeometry]。</p>
  42. <h3>[property:Object parameters]</h3>
  43. <p>
  44. 一个包含着构造函数中每个参数的对象。在对象实例化之后,对该属性的任何修改都不会改变这个几何体。
  45. </p>
  46. <p>
  47. 使用上面的示例代码来作为基础:
  48. <code>
  49. geometry.parameters; // outputs an object {width: 1, height: 1, depth: 1, widthSegments: undefined, heightSegments: undefined}
  50. cube.geometry.parameters; // as above
  51. cube.geometry.parameters.width; // === 1
  52. cube.geometry.parameters.widthSegments // === undefined.
  53. </code>
  54. </p>
  55. <h2>方法(Methods)</h2>
  56. <p>共有方法请参见其基类[page:BufferGeometry]。</p>
  57. <h2>源代码</h2>
  58. <p>
  59. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  60. </p>
  61. </body>
  62. </html>