Ver Fonte

Remove Sphere class. Give radius to octahedron.

Daniel há 14 anos atrás
pai
commit
5ef31d7fe8

+ 4 - 3
src/extras/geometries/OctahedronGeometry.js

@@ -5,10 +5,11 @@
  * to make a sharp edge choose a material that uses face normals instead.
  *
  * @author [email protected]
+ * @param radius
  * @param detail Final number of triangles = 4^detail * 8
  */
 
-THREE.OctahedronGeometry = function ( detail ) {
+THREE.OctahedronGeometry = function ( radius, detail ) {
 
 	THREE.Geometry.call( this );
 
@@ -40,7 +41,7 @@ THREE.OctahedronGeometry = function ( detail ) {
 	function prepare( vector ) {
 
 		var normal = vector.clone().normalize();
-		var vertex = new THREE.Vertex( normal );
+		var vertex = new THREE.Vertex( normal.clone().multiplyScalar( radius ) );
 		vertex.index = that.vertices.push( vertex ) - 1;
 
 		// Texture coords are equivalent to map coords, calculate angle and convert to fraction of a circle.
@@ -129,7 +130,7 @@ THREE.OctahedronGeometry = function ( detail ) {
 
 	}
 
-	this.boundingSphere = { radius: 1 };
+	this.boundingSphere = { radius: radius };
 
 };
 

+ 0 - 30
src/extras/objects/Sphere.js

@@ -1,30 +0,0 @@
-/**
- * This sphere is smooth and faces are evenly spaced in all directions.
- * 
- * To create there does not need to be a geometry, just a radius. eg.
- *   var sphere = new THREE.Sphere(100, new THREE.MeshBasicMaterial());
- * 
- * The number of faces multiplies by 4 for every 1 increase in `detail`.
- * 1 detail = 32 faces
- * 2 detail = 128 faces
- * 3 detail = 512 faces
- * 
- * @author [email protected]
- * @param radius
- * @param materials
- * @param detail A logarithmic value of fidelity. Defaults to 3.
- */
-
-THREE.Sphere = function ( radius, materials, detail ) {
-
-	var geometry = new THREE.OctahedronGeometry( detail );
-
-	THREE.Mesh.call( this, geometry, materials );
-
-	this.scale.multiplyScalar(radius);
-
-}
-
-THREE.Sphere.prototype = new THREE.Mesh();
-THREE.Sphere.prototype.constructor = THREE.Sphere;
-THREE.Sphere.prototype.supr = THREE.Mesh.prototype;

+ 0 - 1
utils/build.py

@@ -117,7 +117,6 @@ EXTRAS_FILES = [
 'extras/loaders/SceneLoader.js',
 'extras/loaders/UTF8Loader.js',
 'extras/objects/MarchingCubes.js',
-'extras/objects/Sphere.js',
 'extras/objects/Trident.js',
 'extras/physics/Collisions.js',
 'extras/physics/CollisionUtils.js',