From 055ec426f0272f2c260c9b649a994a63e3635c98 Mon Sep 17 00:00:00 2001 From: "Mr.doob" Date: Fri, 24 Feb 2012 02:00:42 +0100 Subject: [PATCH] Documentation: Added all the available objects to the list. --- docs/index.html | 192 ++++++++++++++++-- src/extras/geometries/IcosahedronGeometry_.js | 148 -------------- src/extras/geometries/OctahedronGeometry_.js | 138 ------------- 3 files changed, 176 insertions(+), 302 deletions(-) delete mode 100644 src/extras/geometries/IcosahedronGeometry_.js delete mode 100644 src/extras/geometries/OctahedronGeometry_.js diff --git a/docs/index.html b/docs/index.html index 0032df9b9b..644cc49028 100644 --- a/docs/index.html +++ b/docs/index.html @@ -17,23 +17,23 @@ position: fixed; - width: 160px; - - padding-left: 20px; + width: 260px; overflow: auto; } + #panel h1 { color: #999; font-size: 18px; margin-top: 30px; + margin-left: 20px; } #panel ul { list-style-type: none; padding: 0px; - margin: 0px; + margin-left: 20px; } #viewer { @@ -84,13 +84,18 @@ var viewer = document.getElementById( 'viewer' ); var pages = { - "Arrya": "Array", - "Number": "Number", - "Camera": "cameras/Camera" + "Array": "Array", + "Number": "Number" }; var list = { + "Cameras": [ + { name: "Camera", path: "cameras/Camera" }, + { name: "PerspectiveCamera", path: "cameras/PerspectiveCamera" }, + { name: "OrtographicCamera", path: "cameras/OrtographicCamera" } + ], + "Core": [ { name: "Clock", path: "core/Clock" }, { name: "Color", path: "core/Color" }, @@ -115,17 +120,168 @@ { name: "Vertex", path: "core/Vertex" } ], - "Cameras": [ - { name: "PerspectiveCamera", path: "cameras/PerspectiveCamera" }, - { name: "OrtographicCamera", path: "cameras/OrtographicCamera" } - ], - "Lights": [ { name: "AmbientLight", path: "lights/AmbientLight" }, { name: "DirectionalLight", path: "lights/DirectionalLight" }, + { name: "Light", path: "lights/Light" }, { name: "PointLight", path: "lights/PointLight" }, - { name: "SpotLight", path: "lights/SpotLight" }, - ] + { name: "SpotLight", path: "lights/SpotLight" } + ], + + "Materials": [ + { name: "Material", path: "materials/Material" }, + { name: "LineBasicMaterial", path: "materials/LineBasicMaterial" }, + { name: "MeshBasicMaterial", path: "materials/MeshBasicMaterial" }, + { name: "MeshDepthMaterial", path: "materials/MeshDepthMaterial" }, + { name: "MeshFaceMaterial", path: "materials/MeshFaceMaterial" }, + { name: "MeshLambertMaterial", path: "materials/MeshLambertMaterial" }, + { name: "MeshNormalMaterial", path: "materials/MeshNormalMaterial" }, + { name: "MeshPhongMaterial", path: "materials/MeshPhongMaterial" }, + { name: "ParticleBasicMaterial", path: "materials/ParticleBasicMaterial" }, + { name: "ParticleCanvasMaterial", path: "materials/ParticleCanvasMaterial" }, + { name: "ParticleDOMMaterial", path: "materials/ParticleDOMMaterial" }, + { name: "ShaderMaterial", path: "materials/ShaderMaterial" } + + ], + + "Objects": [ + { name: "Bone", path: "objects/Bone" }, + { name: "Line", path: "objects/Line" }, + { name: "LOD", path: "objects/LOD" }, + { name: "Mesh", path: "objects/Mesh" }, + { name: "MorphAnimMesh", path: "objects/MorphAnimMesh" }, + { name: "Particle", path: "objects/Particle" }, + { name: "ParticleSystem", path: "objects/ParticleSystem" }, + { name: "Ribbon", path: "objects/Ribbon" }, + { name: "SkinnedMesh", path: "objects/SkinnedMesh" }, + { name: "Sprite", path: "objects/Sprite" } + + ], + + "Renderers": [ + { name: "CanvasRenderer", path: "renderers/CanvasRenderer" }, + { name: "DOMRenderer", path: "renderers/DOMRenderer" }, + { name: "SVGRenderer", path: "renderers/SVGRenderer" }, + { name: "WebGLRenderer", path: "renderers/WebGLRenderer" }, + { name: "WebGLRenderTarget", path: "renderers/WebGLRenderTarget" }, + { name: "WebGLRenderTargetCube", path: "renderers/WebGLRenderTargetCube" }, + { name: "WebGLShaders", path: "renderers/WebGLShaders" } + ], + + "Renderers / Renderables": [ + { name: "RenderableFace3", path: "renderers/renderables/RenderableFace3" }, + { name: "RenderableFace4", path: "renderers/renderables/RenderableFace4" }, + { name: "RenderableLine", path: "renderers/renderables/RenderableLine" }, + { name: "RenderableObject", path: "renderers/renderables/RenderableObject" }, + { name: "RenderableParticle", path: "renderers/renderables/RenderableParticle" }, + { name: "RenderableVertex", path: "renderers/renderables/RenderableVertex" } + ], + + "Scenes": [ + { name: "Fog", path: "scenes/Fog" }, + { name: "FogExp2", path: "scenes/FogExp2" }, + { name: "Scene", path: "scenes/Scene" } + ], + + "Textures": [ + { name: "DataTexture", path: "textures/DataTexture" }, + { name: "Texture", path: "textures/Texture" } + ], + + "Extras": [ + { name: "ColorUtils", path: "extras/ColorUtils" }, + { name: "GeometryUtils", path: "extras/GeometryUtils" }, + { name: "ImageUtils", path: "extras/ImageUtils" }, + { name: "SceneUtils", path: "extras/SceneUtils" }, + { name: "ShaderUtils", path: "extras/ShaderUtils" } + ], + + "Extras / Animation": [ + { name: "Animation", path: "extras/animation/Animation" }, + { name: "AnimationHandler", path: "extras/animation/AnimationHandler" }, + { name: "AnimationMorphTarget", path: "extras/animation/AnimationMorphTarget" }, + { name: "KeyFrameAnimation", path: "extras/animation/KeyFrameAnimation" } + ], + + "Extras / Cameras": [ + { name: "CombinedCamera", path: "extras/cameras/CombinedCamera" }, + { name: "CubeCamera", path: "extras/cameras/CubeCamera" } + ], + + "Extras / Controls": [ + { name: "FirstPersonControls", path: "extras/controls/FirstPersonControls" }, + { name: "FlyControls", path: "extras/controls/FlyControls" }, + { name: "PathControls", path: "extras/controls/PathControls" }, + { name: "RollControls", path: "extras/controls/RollControls" }, + { name: "TrackballControls", path: "extras/controls/TrackballControls" } + ], + + "Extras / Core": [ + { name: "BufferGeometry", path: "extras/core/BufferGeometry" }, + { name: "Curve", path: "extras/core/Curve" }, + { name: "CurvePath", path: "extras/core/CurvePath" }, + { name: "EventTarget", path: "extras/core/EventTarget" }, + { name: "Gyroscope", path: "extras/core/Gyroscope" }, + { name: "Path", path: "extras/core/Path" }, + { name: "Shape", path: "extras/core/Shape" }, + { name: "TextPath", path: "extras/core/TextPath" } + ], + + "Extras / Geometries": [ + { name: "CubeGeometry", path: "extras/geometries/CubeGeometry" }, + { name: "CylinderGeometry", path: "extras/geometries/CylinderGeometry" }, + { name: "ExtrudeGeometry", path: "extras/geometries/ExtrudeGeometry" }, + { name: "IcosahedronGeometry", path: "extras/geometries/IcosahedronGeometry" }, + { name: "LatheGeometry", path: "extras/geometries/LatheGeometry" }, + { name: "OctahedronGeometry", path: "extras/geometries/OctahedronGeometry" }, + { name: "PlaneGeometry", path: "extras/geometries/PlaneGeometry" }, + { name: "PolyhedronGeometry", path: "extras/geometries/PolyhedronGeometry" }, + { name: "SphereGeometry", path: "extras/geometries/SphereGeometry" }, + { name: "TetrahedronGeometry", path: "extras/geometries/TetrahedronGeometry" }, + { name: "TextGeometry", path: "extras/geometries/TextGeometry" }, + { name: "TorusGeometry", path: "extras/geometries/TorusGeometry" }, + { name: "TorusKnotGeometry", path: "extras/geometries/TorusKnotGeometry" } + ], + + "Extras / Helpers": [ + { name: "AxisHelper", path: "extras/helpers/AxisHelper" }, + { name: "CameraHelper", path: "extras/helpers/CameraHelper" } + ], + + "Extras / Loaders": [ + { name: "BinaryLoader", path: "extras/loaders/BinaryLoader" }, + { name: "ColladaLoader", path: "extras/loaders/ColladaLoader" }, + { name: "JSONLoader", path: "extras/loaders/JSONLoader" }, + { name: "Loader", path: "extras/loaders/Loader" }, + { name: "SceneLoader", path: "extras/loaders/SceneLoader" }, + { name: "UTF8Loader", path: "extras/loaders/UTF8Loader" } + ], + + "Extras / Modifiers": [ + { name: "SubdivisionModifier", path: "extras/modifiers/SubdivisionModifier" } + ], + + "Extras / Objects": [ + { name: "LensFlare", path: "extras/objects/LensFlare" }, + { name: "MarchingCubes", path: "extras/objects/MarchingCubes" } + ], + + "Extras / Renderers": [ + { name: "AnaglyphWebGLRenderer", path: "extras/renderers/AnaglyphWebGLRenderer" }, + { name: "CrosseyedWebGLRenderer", path: "extras/renderers/CrosseyedWebGLRenderer" }, + { name: "ParallaxBarrierWebGLRenderer", path: "extras/renderers/ParallaxBarrierWebGLRenderer" } + ], + + "Extras / Renderers / Plugins": [ + { name: "LensFlarePlugin", path: "extras/renderers/plugins/LensFlarePlugin" }, + { name: "ShadowMapPlugin", path: "extras/renderers/plugins/ShadowMapPlugin" }, + { name: "SpritePlugin", path: "extras/renderers/plugins/SpritePlugin" } + ], + + "Extras / Shaders": [ + { name: "ShaderFlares", path: "extras/shaders/ShaderFlares" }, + { name: "ShaderSprite", path: "extras/shaders/ShaderSprite" } + ], }; @@ -135,6 +291,8 @@ html += '

' + category + '

'; + html += ''; + } - panel.innerHTML += ''; + panel.innerHTML += html; // Page loading @@ -184,7 +344,7 @@ // Layout - var margin = 200; + var margin = 280; function updateLayout() { diff --git a/src/extras/geometries/IcosahedronGeometry_.js b/src/extras/geometries/IcosahedronGeometry_.js deleted file mode 100644 index f7415041bd..0000000000 --- a/src/extras/geometries/IcosahedronGeometry_.js +++ /dev/null @@ -1,148 +0,0 @@ -/** - * @author oosmoxiecode - * - * uvs are messed up in this one, and commented away for now. There is an ugly "seam" by the shared vertices - * when it "wraps" around, that needs to be fixed. It's because they share the first and the last vertices - * so it draws the entire texture on the seam-faces, I think... - */ - -THREE.IcosahedronGeometry_ = function ( subdivisions ) { - - var scope = this; - var tempScope = new THREE.Geometry(); - var tempFaces; - this.subdivisions = subdivisions || 0; - - THREE.Geometry.call( this ); - - // create 12 vertices of a Icosahedron - - var t = ( 1 + Math.sqrt( 5 ) ) / 2; - - v(-1, t, 0); - v( 1, t, 0); - v(-1, -t, 0); - v( 1, -t, 0); - - v( 0, -1, t); - v( 0, 1, t); - v( 0, -1, -t); - v( 0, 1, -t); - - v( t, 0, -1); - v( t, 0, 1); - v(-t, 0, -1); - v(-t, 0, 1); - - // 5 faces around point 0 - - f3(0, 11, 5, tempScope); - f3(0, 5, 1, tempScope); - f3(0, 1, 7, tempScope); - f3(0, 7, 10, tempScope); - f3(0, 10, 11, tempScope); - - // 5 adjacent faces - - f3(1, 5, 9, tempScope); - f3(5, 11, 4, tempScope); - f3(11, 10, 2, tempScope); - f3(10, 7, 6, tempScope); - f3(7, 1, 8, tempScope); - - // 5 faces around point 3 - - f3(3, 9, 4, tempScope); - f3(3, 4, 2, tempScope); - f3(3, 2, 6, tempScope); - f3(3, 6, 8, tempScope); - f3(3, 8, 9, tempScope); - - // 5 adjacent faces - - f3(4, 9, 5, tempScope); - f3(2, 4, 11, tempScope); - f3(6, 2, 10, tempScope); - f3(8, 6, 7, tempScope); - f3(9, 8, 1, tempScope); - - // subdivide faces to refine the triangles - - for ( var i = 0; i < this.subdivisions; i ++ ) { - - tempFaces = new THREE.Geometry(); - - for ( var i = 0, l = tempScope.faces.length; i < l; i ++ ) { - - // replace each triangle by 4 triangles - - var face = tempScope.faces[ i ]; - - var a = getMiddlePoint( face.a, face.b ); - var b = getMiddlePoint( face.b, face.c ); - var c = getMiddlePoint( face.c, face.a ); - - f3( face.a, a, c, tempFaces ); - f3( face.b, b, a, tempFaces ); - f3( face.c, c, b, tempFaces ); - f3( a, b, c, tempFaces ); - - } - - tempScope.faces = tempFaces.faces; - tempScope.faceVertexUvs[ 0 ] = tempFaces.faceVertexUvs[ 0 ]; - - } - - scope.faces = tempScope.faces; - scope.faceVertexUvs[ 0 ] = tempScope.faceVertexUvs[ 0 ]; - - this.mergeVertices(); - this.computeCentroids(); - this.computeFaceNormals(); - - function v( x, y, z ) { - - var length = Math.sqrt( x * x + y * y + z * z ); - var i = scope.vertices.push( new THREE.Vertex( new THREE.Vector3( x/length, y/length, z/length ) ) ); - - return i-1; - } - - function f3( a, b, c, inscope ) { - - var v1 = scope.vertices[ a ].position; - var v2 = scope.vertices[ b ].position; - var v3 = scope.vertices[ c ].position; - - var face = new THREE.Face3( a, b, c ); - face.vertexNormals.push( v1.clone().normalize(), v2.clone().normalize(), v3.clone().normalize() ); - - inscope.faces.push( face ); - - inscope.faceVertexUvs[ 0 ].push( [ - new THREE.UV( 1 - ( ( ( Math.atan2( v1.z, v1.x ) + Math.PI ) % Math.PI ) / Math.PI * 0.5 ), 0.5 - v1.y / 2 ), - new THREE.UV( 1 - ( ( ( Math.atan2( v2.z, v2.x ) + Math.PI ) % Math.PI ) / Math.PI * 0.5 ), 0.5 - v2.y / 2 ), - new THREE.UV( 1 - ( ( ( Math.atan2( v3.z, v3.x ) + Math.PI ) % Math.PI ) / Math.PI * 0.5 ), 0.5 - v3.y / 2 ) - ] ); - - } - - function getMiddlePoint( p1, p2 ) { - - var pos1 = scope.vertices[ p1 ].position; - var pos2 = scope.vertices[ p2 ].position; - - var x = ( pos1.x + pos2.x ) / 2; - var y = ( pos1.y + pos2.y ) / 2; - var z = ( pos1.z + pos2.z ) / 2; - - var i = v(x, y, z); - return i; - - } - -} - -THREE.IcosahedronGeometry_.prototype = new THREE.Geometry(); -THREE.IcosahedronGeometry_.prototype.constructor = THREE.IcosahedronGeometry_; diff --git a/src/extras/geometries/OctahedronGeometry_.js b/src/extras/geometries/OctahedronGeometry_.js deleted file mode 100644 index 38fb946112..0000000000 --- a/src/extras/geometries/OctahedronGeometry_.js +++ /dev/null @@ -1,138 +0,0 @@ -/** - * Octahedrons have 8 sides. This octahedron supports subdivision. - * - * Vertices have 'smooth' normals, - * 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 ( radius, detail ) { - - THREE.Geometry.call( this ); - - detail = detail || 0; - - var that = this; // ugly scope hack - - prepare( new THREE.Vector3( +1, 0, 0 ) ); // right - prepare( new THREE.Vector3( -1, 0, 0 ) ); // left - prepare( new THREE.Vector3( 0, +1, 0 ) ); // up - prepare( new THREE.Vector3( 0, -1, 0 ) ); // down - prepare( new THREE.Vector3( 0, 0, +1 ) ); // front - prepare( new THREE.Vector3( 0, 0, -1 ) ); // back - var midpoints = [], p = this.vertices; - - // careful to output faces counter-clockwise, that is required for meshes - make( p[0], p[2], p[4], detail ); - make( p[0], p[4], p[3], detail ); - make( p[0], p[3], p[5], detail ); - make( p[0], p[5], p[2], detail ); - make( p[1], p[2], p[5], detail ); - make( p[1], p[5], p[3], detail ); - make( p[1], p[3], p[4], detail ); - make( p[1], p[4], p[2], detail ); - - /** - * Project vector onto sphere's surface - */ - function prepare( vector ) { - - var normal = vector.clone().normalize(); - 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. - var u = azimuth( vector ) / 2 / Math.PI + 0.5; - var v = inclination( vector ) / Math.PI + 0.5; - vertex.uv = new THREE.UV( u, v ); - - return vertex; - - } - - /** - * Approximate a curved face with recursively sub-divided triangles. - */ - function make( v1, v2, v3, detail ) { - - if ( detail < 1 ) { - - var face = new THREE.Face3( v1.index, v2.index, v3.index, [ v1.position, v2.position, v3.position ] ); - face.centroid.addSelf( v1.position ).addSelf( v2.position ).addSelf( v3.position ).divideScalar( 3 ); - face.normal = face.centroid.clone().normalize(); - that.faces.push( face ); - - var azi = azimuth( face.centroid ); - that.faceVertexUvs[ 0 ].push( [ - correctUV( v1.uv, v1.position, azi ), - correctUV( v2.uv, v2.position, azi ), - correctUV( v3.uv, v3.position, azi ) - ] ); - - } - else { - - detail -= 1; - // split triangle into 4 smaller triangles - make( v1, midpoint( v1, v2 ), midpoint( v1, v3 ), detail ); // top quadrant - make( midpoint( v1, v2 ), v2, midpoint( v2, v3 ), detail ); // left quadrant - make( midpoint( v1, v3 ), midpoint( v2, v3 ), v3, detail ); // right quadrant - make( midpoint( v1, v2 ), midpoint( v2, v3 ), midpoint( v1, v3 ), detail ); // center quadrant - - } - - } - - function midpoint( v1, v2 ) { - - if ( !midpoints[ v1.index ] ) midpoints[ v1.index ] = []; - if ( !midpoints[ v2.index ] ) midpoints[ v2.index ] = []; - var mid = midpoints[ v1.index ][ v2.index ]; - if ( mid === undefined ) { - // generate mean point and project to surface with prepare() - midpoints[ v1.index ][ v2.index ] = midpoints[ v2.index ][ v1.index ] = mid = prepare( - new THREE.Vector3().add( v1.position, v2.position ).divideScalar( 2 ) - ); - } - return mid; - - } - - /** - * Angle around the Y axis, counter-clockwise when looking from above. - */ - function azimuth( vector ) { - - return Math.atan2( vector.z, -vector.x ); - - } - - /** - * Angle above the XZ plane. - */ - function inclination( vector ) { - - return Math.atan2( -vector.y, Math.sqrt( ( vector.x * vector.x ) + ( vector.z * vector.z ) ) ); - - } - - /** - * Texture fixing helper. Spheres have some odd behaviours. - */ - function correctUV( uv, vector, azimuth ) { - - if ( (azimuth < 0) && (uv.u === 1) ) uv = new THREE.UV( uv.u - 1, uv.v ); - if ( (vector.x === 0) && (vector.z === 0) ) uv = new THREE.UV( azimuth / 2 / Math.PI + 0.5, uv.v ); - return uv; - - } - - this.boundingSphere = { radius: radius }; - -}; - -THREE.OctahedronGeometry_.prototype = new THREE.Geometry(); -THREE.OctahedronGeometry_.prototype.constructor = THREE.OctahedronGeometry_; -- GitLab