SceneUtils.html 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <!DOCTYPE html>
  2. <html lang="en">
  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. <h1>[name]</h1>
  11. <p class="desc">A class containing useful utility functions for scene manipulation.</p>
  12. <h2>Methods</h2>
  13. <h3>[method:Group createMeshesFromInstancedMesh]( [param:InstancedMesh instancedMesh] )</h3>
  14. <p>
  15. instancedMesh -- The instanced mesh.
  16. </p>
  17. <p>
  18. Creates a new group object that contains a new mesh for each instance of the given instanced mesh.
  19. </p>
  20. <h3>[method:Group createMeshesFromMultiMaterialMesh]( [param:Mesh mesh] )</h3>
  21. <p>
  22. mesh -- A mesh with multiple materials.
  23. </p>
  24. <p>
  25. Converts the given multi-material mesh into an instance of [page:Group] holding for each material a separate mesh.
  26. </p>
  27. <h3>[method:Group createMultiMaterialObject]( [param:BufferGeometry geometry], [param:Array materials] )</h3>
  28. <p>
  29. geometry -- The geometry for the set of materials. <br />
  30. materials -- The materials for the object.
  31. </p>
  32. <p>
  33. Creates a new Group that contains a new mesh for each material defined in materials. Beware that this is not the same as an array of materials which defines multiple materials for 1 mesh.<br />
  34. This is mostly useful for objects that need both a material and a wireframe implementation.
  35. </p>
  36. <h3>[method:undefined sortInstancedMesh]( [param:InstancedMesh mesh], [param:Function compareFn] )</h3>
  37. <p>
  38. mesh -- InstancedMesh in which instances will be sorted. <br />
  39. compareFn -- Comparator function defining the sort order.
  40. </p>
  41. <p>
  42. Sorts the instances within an [page:InstancedMesh], according to a user-defined
  43. callback. The callback will be provided with two arguments, <i>indexA</i>
  44. and <i>indexB</i>, and must return a numerical value. See
  45. [link:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#description Array.prototype.sort]
  46. for more information on sorting callbacks and their return values.
  47. </p>
  48. <p>
  49. Because of the high performance cost, three.js does not sort
  50. [page:InstancedMesh] instances automatically. Manually sorting may be
  51. helpful to improve display of alpha blended materials (back to front),
  52. and to reduce overdraw in opaque materials (front to back).
  53. </p>
  54. <h2>Source</h2>
  55. <p>
  56. [link:https://github.com/mrdoob/three.js/blob/master/examples/jsm/utils/SceneUtils.js examples/jsm/utils/SceneUtils.js]
  57. </p>
  58. </body>
  59. </html>