LOD.html 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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. <h2>Source</h2>
  55. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  56. </body>
  57. </html>