LOD.html 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <script src="../../list.js"></script>
  6. <script src="../../page.js"></script>
  7. <link type="text/css" rel="stylesheet" href="../../page.css" />
  8. </head>
  9. <body>
  10. [page:Object3D] &rarr;
  11. <h1>[name]</h1>
  12. <div class="desc">Level of Detail - Show meshes with more or less geometry based on distance.</div>
  13. <h2>Example</h2>
  14. <div>
  15. [example:webgl_lod LOD]
  16. </div>
  17. <code>
  18. var lod = new THREE.LOD();
  19. //Create 5 levels of spheres
  20. for( var i = 0; i < 5; i++ ) {
  21. var geometry = new THREE.IcosahedronGeometry( 10, 5 - i )
  22. new THREE.Mesh( geometry, material );
  23. lod.addLevel( mesh, i * 50 );
  24. }
  25. </code>
  26. <h2>Constructor</h2>
  27. <h3>[name]()</h3>
  28. <h2>Properties</h2>
  29. <h3>[property:array objects]</h3>
  30. <div>
  31. An array of [page:Object3D Object3Ds]
  32. </div>
  33. <h2>Methods</h2>
  34. <h3>[method:null addLevel]([page:Object3D mesh], [page:Float distance])</h3>
  35. <div>
  36. mesh -- The Object3D to display <br />
  37. distance -- The distance at which to display this level of detail
  38. </div>
  39. <div>
  40. Adds a mesh that will display at a certain distance and greater. Typically the further away the distance,
  41. the lower the detail on the mesh.
  42. </div>
  43. <h3>[method:Object3D getObjectForDistance]([page:Float distance])</h3>
  44. <div>
  45. Get a reference to the first [page:Object3D] (mesh) that is greater than supplied distance.
  46. </div>
  47. <h3>[method:null update]([page:Camera camera])</h3>
  48. <div>
  49. camera -- The current camera
  50. </div>
  51. <div>
  52. Update the visiblility of the level of detail based on the distance from the camera.
  53. </div>
  54. <h3>[method:Object3D clone]([page:Object3D object])</h3>
  55. <div>
  56. object -- (optional) Object3D which needs to be cloned. If undefined, clone method will create a new cloned LOD Object.
  57. </div>
  58. <div>
  59. Clone a LOD Object.
  60. </div>
  61. <h2>Source</h2>
  62. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  63. </body>
  64. </html>