Sphere.js 865 B

123456789101112131415161718192021222324252627282930
  1. /**
  2. * This sphere is smooth and faces are evenly spaced in all directions.
  3. *
  4. * To create there does not need to be a geometry, just a radius. eg.
  5. * var sphere = new THREE.Sphere(100, new THREE.MeshBasicMaterial());
  6. *
  7. * The number of faces multiplies by 4 for every 1 increase in `detail`.
  8. * 1 detail = 32 faces
  9. * 2 detail = 128 faces
  10. * 3 detail = 512 faces
  11. *
  12. * @author daniel.deady@knectar.com
  13. * @param radius
  14. * @param materials
  15. * @param detail A logarithmic value of fidelity. Defaults to 3.
  16. */
  17. THREE.Sphere = function ( radius, materials, detail ) {
  18. var geometry = new THREE.OctahedronGeometry( detail );
  19. THREE.Mesh.call( this, geometry, materials );
  20. this.scale.multiplyScalar(radius);
  21. }
  22. THREE.Sphere.prototype = new THREE.Mesh();
  23. THREE.Sphere.prototype.constructor = THREE.Sphere;
  24. THREE.Sphere.prototype.supr = THREE.Mesh.prototype;
粤ICP备19079148号