mirror of
https://github.com/wahyd4/three.js.git
synced 2026-08-13 23:16:07 +10:00
Remove Sphere class. Give radius to octahedron.
This commit is contained in:
@@ -5,10 +5,11 @@
|
||||
* to make a sharp edge choose a material that uses face normals instead.
|
||||
*
|
||||
* @author daniel.deady@knectar.com
|
||||
* @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 };
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -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 daniel.deady@knectar.com
|
||||
* @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;
|
||||
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user