diff --git a/examples/js/wip/CircleTypedGeometry.js b/examples/js/wip/CircleTypedGeometry.js deleted file mode 100644 index d92ca629cb8eee54dde501d0647a101a38555da4..0000000000000000000000000000000000000000 --- a/examples/js/wip/CircleTypedGeometry.js +++ /dev/null @@ -1,76 +0,0 @@ -/** - * @author hughes - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.CircleTypedGeometry = function ( radius, segments, thetaStart, thetaLength ) { - - this.parameters = { - radius: radius, - segments: segments, - thetaStart: thetaStart, - thetaLength: thetaLength - }; - - radius = radius || 50; - segments = segments !== undefined ? Math.max( 3, segments ) : 8; - - thetaStart = thetaStart !== undefined ? thetaStart : 0; - thetaLength = thetaLength !== undefined ? thetaLength : Math.PI * 2; - - // - - var elements = segments + 2; - - var indices = new Uint16Array( segments * 3 ); - var vertices = new Float32Array( elements * 3 ); - var normals = new Float32Array( elements * 3 ); - var uvs = new Float32Array( elements * 2 ); - - // center - - normals[ 2 ] = 1; - - uvs[ 0 ] = 0.5; - uvs[ 1 ] = 0.5; - - var offset = 0, offset2 = 2, offset3 = 3; - - for ( var i = 0; i <= segments; i ++ ) { - - var segment = thetaStart + i / segments * thetaLength; - - var x = radius * Math.cos( segment ); - var y = radius * Math.sin( segment ); - - vertices[ offset3 ] = x; - vertices[ offset3 + 1 ] = y; - - normals[ offset3 + 2 ] = 1; - - uvs[ offset2 ] = ( x / radius + 1 ) / 2; - uvs[ offset2 + 1 ] = ( y / radius + 1 ) / 2; - - offset2 += 2; - offset3 += 3; - - // - - indices[ offset ] = 0; - indices[ offset + 1 ] = i + 1; - indices[ offset + 2 ] = i + 2; - - offset += 3; - - } - - THREE.IndexedTypedGeometry.call( this ); - - this.setArrays( indices, vertices, normals, uvs ); - - this.boundingSphere = new THREE.Sphere( new THREE.Vector3(), radius ); - -}; - -THREE.CircleTypedGeometry.prototype = Object.create( THREE.IndexedTypedGeometry.prototype ); -THREE.CircleTypedGeometry.prototype.constructor = THREE.CircleTypedGeometry; diff --git a/examples/js/wip/GeometryEditor.js b/examples/js/wip/GeometryEditor.js deleted file mode 100644 index fb58af55b1ec795948851a6a2e3c0f15e12d38e8..0000000000000000000000000000000000000000 --- a/examples/js/wip/GeometryEditor.js +++ /dev/null @@ -1,75 +0,0 @@ -/** - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.GeometryEditor = function ( geometry ) { - - this.geometry = geometry; - -}; - -Object.defineProperties( THREE.GeometryEditor.prototype, { - vertices: { - enumerable: true, - get: function() { return this.createVertexProxies(); } - }, - normals: { - enumerable: true, - get: function() { return this.createNormalProxies(); } - }, - uvs: { - enumerable: true, - get: function() { return this.createUVProxies(); } - } -} ); - -THREE.GeometryEditor.prototype.createVertexProxies = function () { - - Object.defineProperty( this, 'vertices', { value: [], writable: true } ); - - var attributes = this.geometry.attributes; - var length = attributes.position.array.length / 3; - - for ( var i = 0; i < length; i ++ ) { - - this.vertices.push( new THREE.ProxyVector3( attributes.position.array, i * 3 ) ); - - } - - return this.vertices; - -}; - -THREE.GeometryEditor.prototype.createNormalProxies = function () { - - Object.defineProperty( this, 'normals', { value: [], writable: true } ); - - var attributes = this.geometry.attributes; - var length = attributes.position.array.length / 3; - - for ( var i = 0; i < length; i ++ ) { - - this.normals.push( new THREE.ProxyVector3( attributes.normal.array, i * 3 ) ); - - } - - return this.normals; - -}; - -THREE.GeometryEditor.prototype.createUVProxies = function () { - - Object.defineProperty( this, 'uvs', { value: [], writable: true } ); - - var attributes = this.geometry.attributes; - var length = attributes.position.array.length / 3; - - for ( var i = 0; i < length; i ++ ) { - - this.uvs.push( new THREE.ProxyVector2( attributes.uv.array, i * 2 ) ); - - } - - return this.uvs; - -}; \ No newline at end of file diff --git a/examples/js/wip/IndexedTypedGeometry.js b/examples/js/wip/IndexedTypedGeometry.js deleted file mode 100644 index 29f529708bbcbce9e800e2dedb9e83ed92ca1587..0000000000000000000000000000000000000000 --- a/examples/js/wip/IndexedTypedGeometry.js +++ /dev/null @@ -1,28 +0,0 @@ -/** - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.IndexedTypedGeometry = function () { - - THREE.BufferGeometry.call( this ); - -}; - -THREE.IndexedTypedGeometry.prototype = Object.create( THREE.BufferGeometry.prototype ); -THREE.IndexedTypedGeometry.prototype.constructor = THREE.IndexedTypedGeometry; - -THREE.IndexedTypedGeometry.prototype.setArrays = function ( indices, vertices, normals, uvs ) { - - this.indices = indices; - this.vertices = vertices; - this.normals = normals; - this.uvs = uvs; - - this.attributes[ 'index' ] = { array: indices, itemSize: 1 }; - this.attributes[ 'position' ] = { array: vertices, itemSize: 3 }; - this.attributes[ 'normal' ] = { array: normals, itemSize: 3 }; - this.attributes[ 'uv' ] = { array: uvs, itemSize: 2 }; - - return this; - -}; diff --git a/examples/js/wip/PlaneTypedGeometry.js b/examples/js/wip/PlaneTypedGeometry.js deleted file mode 100644 index 7d7378bae8beb6a231cefd61b3b3cd99243fe1ad..0000000000000000000000000000000000000000 --- a/examples/js/wip/PlaneTypedGeometry.js +++ /dev/null @@ -1,92 +0,0 @@ -/** - * @author mrdoob / http://mrdoob.com/ - * based on http://papervision3d.googlecode.com/svn/trunk/as3/trunk/src/org/papervision3d/objects/primitives/Plane.as - */ - -THREE.PlaneTypedGeometry = function ( width, height, widthSegments, heightSegments ) { - - this.parameters = { - width: width, - height: height, - widthSegments: widthSegments, - heightSegments: heightSegments - }; - - var width_half = width / 2; - var height_half = height / 2; - - var gridX = widthSegments || 1; - var gridY = heightSegments || 1; - - var gridX1 = gridX + 1; - var gridY1 = gridY + 1; - - var segment_width = width / gridX; - var segment_height = height / gridY; - - var vertices = new Float32Array( gridX1 * gridY1 * 3 ); - var normals = new Float32Array( gridX1 * gridY1 * 3 ); - var uvs = new Float32Array( gridX1 * gridY1 * 2 ); - - var offset = 0; - var offset2 = 0; - - for ( var iy = 0; iy < gridY1; iy ++ ) { - - var y = iy * segment_height - height_half; - - for ( var ix = 0; ix < gridX1; ix ++ ) { - - var x = ix * segment_width - width_half; - - vertices[ offset ] = x; - vertices[ offset + 1 ] = - y; - - normals[ offset + 2 ] = 1; - - uvs[ offset2 ] = ix / gridX; - uvs[ offset2 + 1 ] = 1 - ( iy / gridY ); - - offset += 3; - offset2 += 2; - - } - - } - - offset = 0; - - var indices = new ( ( vertices.length / 3 ) > 65535 ? Uint32Array : Uint16Array )( gridX * gridY * 6 ); - - for ( var iy = 0; iy < gridY; iy ++ ) { - - for ( var ix = 0; ix < gridX; ix ++ ) { - - var a = ix + gridX1 * iy; - var b = ix + gridX1 * ( iy + 1 ); - var c = ( ix + 1 ) + gridX1 * ( iy + 1 ); - var d = ( ix + 1 ) + gridX1 * iy; - - indices[ offset ] = a; - indices[ offset + 1 ] = b; - indices[ offset + 2 ] = d; - - indices[ offset + 3 ] = b; - indices[ offset + 4 ] = c; - indices[ offset + 5 ] = d; - - offset += 6; - - } - - } - - THREE.IndexedTypedGeometry.call( this ); - - this.setArrays( indices, vertices, normals, uvs ); - this.computeBoundingSphere(); - -}; - -THREE.PlaneTypedGeometry.prototype = Object.create( THREE.IndexedTypedGeometry.prototype ); -THREE.PlaneTypedGeometry.prototype.constructor = THREE.PlaneTypedGeometry; diff --git a/examples/js/wip/ProxyGeometry.js b/examples/js/wip/ProxyGeometry.js deleted file mode 100644 index 6d09a630a8883feddd67be977ff9df9f8626cc7e..0000000000000000000000000000000000000000 --- a/examples/js/wip/ProxyGeometry.js +++ /dev/null @@ -1,755 +0,0 @@ -/** - * @author mrdoob / http://mrdoob.com/ - * @author kile / http://kile.stravaganza.org/ - * @author alteredq / http://alteredqualia.com/ - * @author mikael emtinger / http://gomo.se/ - * @author zz85 / http://www.lab4games.net/zz85/blog - * @author bhouston / http://exocortex.com - * @author jbaicoianu / http://baicoianu.com - */ - -THREE.ProxyGeometry = function ( ) { - - THREE.BufferGeometry.call( this ); - - this.addEventListener( 'allocate', this.onGeometryAllocate); - - // TODO - implement as BufferGeometry attributes - this.morphTargets = []; - this.morphColors = []; - -}; - -THREE.ProxyGeometry.prototype = Object.create( THREE.IndexedGeometry2.prototype ); -THREE.ProxyGeometry.prototype.constructor = THREE.ProxyGeometry; - -Object.defineProperties(THREE.ProxyGeometry.prototype, { - vertices: { - enumerable: true, - configurable: true, - get: function() { return this.createVertexProxies(); } - }, - faces: { - enumerable: true, - get: function() { return this.createFaceProxies() } - }, - faceVertexUvs: { - enumerable: true, - get: function() { return this.createUvProxies() } - }, - colors: { - enumerable: true, - get: function() { return this.createColorProxies() } - }, - skinIndices: { - enumerable: true, - get: function() { return this.createSkinIndexProxies() } - }, - skinWeights: { - enumerable: true, - get: function() { return this.createSkinWeightProxies() } - }, - // TODO - fill in additional proxies: - // - morphColors - // - morphNormals - // - morphTargets - - verticesNeedUpdate: { - enumerable: true, - get: function() { if (this.attributes[ 'position' ]) return this.attributes[ 'position' ].needsUpdate; }, - set: function(v) { if (this.attributes[ 'position' ]) this.attributes[ 'position' ].needsUpdate = v; } - }, - colorsNeedUpdate: { - enumerable: true, - get: function() { if (this.attributes[ 'color' ]) return this.attributes[ 'color' ].needsUpdate; }, - set: function(v) { if (this.attributes[ 'color' ]) this.attributes[ 'color' ].needsUpdate = v; } - }, - normalsNeedUpdate: { - enumerable: true, - get: function() { if (this.attributes[ 'normal' ]) return this.attributes[ 'normal' ].needsUpdate; }, - set: function(v) { if (this.attributes[ 'normal' ]) this.attributes[ 'normal' ].needsUpdate = v; } - }, -}); - -THREE.ProxyGeometry.prototype.createVertexProxies = function(values) { - - if (!this.hasOwnProperty('vertices')) { - - // Replace the prototype getter with a local array property - - Object.defineProperty( this, "vertices", { value: [], writable: true } ); - - } else { - - // Start with a new, empty array - - this.vertices = []; - - } - - // If the attribute buffer has already been populated, set up proxy objects - - this.populateProxyFromBuffer(this.vertices, "position", THREE.ProxyVector3, 3); - - // If values were passed in, store them in the buffer via the proxy objects - - if (values) { - - for (var i = 0; i < values.length; i ++) { - - this.vertices[i].copy(values[i]); - - } - } - - // Return a reference to the newly-created array - - return this.vertices; - -}; - -THREE.ProxyGeometry.prototype.createFaceProxies = function(values) { - - if (!this.hasOwnProperty("faces")) { - - // Replace the prototype getter with a local array property - - Object.defineProperty( this, "faces", { value: [], writable: true } ); - - } else { - - // Start with a new, empty array - - this.faces = []; - } - - // If the attribute buffer has already been populated, set up proxy objects - - var faces = this.faces, - indexarray = false, - positionarray = false, - normalarray = false, - colorarray = false, - tangentarray = false; - - if ( this.attributes[ 'index' ] ) { - indexarray = this.attributes[ 'index' ].array; - } - if ( this.attributes[ 'position' ] ) { - positionarray = this.attributes[ 'position' ].array; - } - if (this.attributes[ 'normal' ]) { - normalarray = this.attributes[ 'normal' ].array; - } - if (this.attributes[ 'color' ]) { - colorarray = this.attributes[ 'color' ].array; - } - if (this.attributes[ 'tangent' ]) { - tangentarray = this.attributes[ 'tangent' ].array; - } - - // TODO - this should be accomplished using "virtual" functions on various classes (IndexedGeometry, SmoothGeometry, etc) - - if (indexarray) { - - for ( var i = 0, l = indexarray.length / 3; i < l; i ++ ) { - - var o = i * 3; - - var face = new THREE.ProxyFace3( indexarray, i * 3 ); - faces.push(face); - - } - - } else if (positionarray) { - - for ( var i = 0, l = positionarray.length / 3; i < l; i += 3 ) { - - var o = i * 3; - var v1 = i, v2 = i + 1, v3 = i + 2; - - var face = new THREE.ProxyFace3( v1, v2, v3 ); - faces.push(face); - - } - - } - - // If values were passed in, store them in the buffer via the proxy objects - - if (values) { - - for (var i = 0, l = values.length; i < l; i ++) { - - var f = faces[i], - v = values[i]; - - f.a = v.a; - f.b = v.b; - f.c = v.c; - - } - - } - - if (normalarray) { - - this.createFaceVertexNormalProxies(values); - - } - - if (colorarray) { - - this.createFaceVertexColorProxies(values); - - } - - if (tangentarray) { - - this.createFaceVertexTangentProxies(values); - - } - - // Return a reference to the newly-created array - - return this.faces; - -}; - -THREE.ProxyGeometry.prototype.createFaceVertexNormalProxies = function(values) { - - if ( this.attributes[ 'normal' ] && this.attributes[ 'normal' ].array ) { - - var normalarray = this.attributes[ 'normal' ].array; - - for (var i = 0, l = this.faces.length; i < l; i ++) { - - var f = this.faces[i]; - - f.vertexNormals = [ - new THREE.ProxyVector3(normalarray, f.a * 3), - new THREE.ProxyVector3(normalarray, f.b * 3), - new THREE.ProxyVector3(normalarray, f.c * 3), - ]; - f.normal = new THREE.MultiVector3(f.vertexNormals); - - } - } - - // If values were passed in, store them in the buffer via the proxy objects - - if (values) { - - for (var i = 0, l = values.length; i < l; i ++) { - - var f = this.faces[i], - v = values[i]; - - if (v.vertexNormals.length > 0) { - - for (var j = 0, l2 = f.vertexNormals.length; j < l2; j ++) { - - f.vertexNormals[j].copy(v.vertexNormals[j]); - - } - - } else if (v.normal) { - - f.normal.copy(v.normal); - - } - - } - - } - -}; - -THREE.ProxyGeometry.prototype.createFaceVertexColorProxies = function(values) { - - if ( this.attributes[ 'color' ] && this.attributes[ 'color' ].array ) { - - var colorarray = this.attributes[ 'color' ].array; - - for (var i = 0, l = this.faces.length; i < l; i ++) { - var f = this.faces[i]; - - if ( this.attributes[ 'index' ] ) { - f.vertexColors = [ - new THREE.ProxyColor(colorarray, f.a * 3), - new THREE.ProxyColor(colorarray, f.b * 3), - new THREE.ProxyColor(colorarray, f.c * 3), - ]; - } else { - var o = i * 9; - - f.vertexColors = [ - new THREE.ProxyColor(colorarray, o), - new THREE.ProxyColor(colorarray, o + 3), - new THREE.ProxyColor(colorarray, o + 6), - ]; - } - f.color = new THREE.MultiColor(f.vertexColors); - - } - } - - // If values were passed in, store them in the buffer via the proxy objects - - if (values) { - - for (var i = 0, l = values.length; i < l; i ++) { - - var f = this.faces[i], - v = values[i]; - - for (var j = 0, l2 = f.vertexColors.length; j < l2; j ++) { - - if (v.vertexColors.length > 0) { - - f.vertexColors[j].copy(v.vertexColors[j]); - - } else if (v.color) { - - f.color.copy(v.color); - - } - - } - - } - - } - -}; - -THREE.ProxyGeometry.prototype.createFaceVertexTangentProxies = function(values) { - - if ( this.attributes[ 'tangent' ] && this.attributes[ 'tangent' ].array ) { - - var tangentarray = this.attributes[ 'tangent' ].array; - - for (var i = 0, l = this.faces.length; i < l; i ++) { - - var f = this.faces[i]; - - f.vertexTangents = [ - new THREE.ProxyVector3(tangentarray, f.a * 3), - new THREE.ProxyVector3(tangentarray, f.b * 3), - new THREE.ProxyVector3(tangentarray, f.c * 3), - ]; - - } - } - - // If values were passed in, store them in the buffer via the proxy objects - - if (values) { - - for (var i = 0, l = values.length; i < l; i ++) { - - var f = this.faces[i], - v = values[i]; - - if (v.vertexTangents.length > 0) { - - for (var j = 0, l2 = f.vertexTangents.length; j < l2; j ++) { - - f.vertexTangents[j].copy(v.vertexTangents[j]); - - } - - } - - } - - } - -}; - -THREE.ProxyGeometry.prototype.createUvProxies = function(values) { - - // Replace the prototype getter with a local array property - - if (!this.hasOwnProperty("faceVertexUvs")) { - Object.defineProperty( this, "faceVertexUvs", { value: [[]], writable: true } ); - } else { - this.faceVertexUvs = [[]]; - } - - // If the attribute buffer has already been populated, set up proxy objects - - if ( this.attributes[ 'uv' ] && this.attributes[ 'uv' ].array ) { - - var faces = this.faces; - var uvarray = this.attributes[ 'uv' ].array; - - for (var i = 0, l = faces.length; i < l; i ++) { - var f = faces[i]; - - this.faceVertexUvs[0][i] = []; - - if ( this.attributes[ 'index' ] ) { - this.faceVertexUvs[0][i][0] = new THREE.ProxyVector2(uvarray, f.a * 2); - this.faceVertexUvs[0][i][1] = new THREE.ProxyVector2(uvarray, f.b * 2); - this.faceVertexUvs[0][i][2] = new THREE.ProxyVector2(uvarray, f.c * 2); - } else { - var o = i * 6; - this.faceVertexUvs[0][i][0] = new THREE.ProxyVector2(uvarray, o); - this.faceVertexUvs[0][i][1] = new THREE.ProxyVector2(uvarray, o + 2); - this.faceVertexUvs[0][i][2] = new THREE.ProxyVector2(uvarray, o + 4); - } - - } - - } - - // If values were passed in, store them in the buffer via the proxy objects - - if (values) { - - for (var i = 0, l = values.length; i < l; i ++) { - - for (var j = 0, l2 = values[i].length; j < l2; j ++) { - - var uv = values[i][j]; - this.faceVertexUvs[0][i][j].copy(uv); - - } - - } - - } - - // Return a reference to the newly-created array - - return this.faceVertexUvs; - -}; - -THREE.ProxyGeometry.prototype.createSkinIndexProxies = function(values) { - - // Replace the prototype getter with a local array property - - if (!this.hasOwnProperty('skinIndices')) { - Object.defineProperty( this, "skinIndices", { value: [], writable: true } ); - } else { - this.skinIndices = []; - } - - // If the attribute buffer has already been populated, set up proxy objects - - this.populateProxyFromBuffer(this.skinIndices, "skinIndex", THREE.ProxyVector4, 4); - - // If values were passed in, store them in the buffer via the proxy objects - - if (values) { - - for (var i = 0; i < values.length; i ++) { - - this.skinIndices[i].copy(values[i]); - - } - - } - - // Return a reference to the newly-created array - - return this.skinIndices; - -}; - -THREE.ProxyGeometry.prototype.createSkinWeightProxies = function(values) { - - // Replace the prototype getter with a local array property - - if (!this.hasOwnProperty('skinWeights')) { - Object.defineProperty( this, "skinWeights", { value: [], writable: true } ); - } else { - this.skinWeights = []; - } - - // If the attribute buffer has already been populated, set up proxy objects - - this.populateProxyFromBuffer(this.skinWeights, "skinWeight", THREE.ProxyVector4, 4); - - // If values were passed in, store them in the buffer via the proxy objects - - if (values) { - - for (var i = 0; i < values.length; i ++) { - - this.skinWeights[i].copy(values[i]); - - } - - } - - // Return a reference to the newly-created array - - return this.skinWeights; - -}; - -THREE.ProxyGeometry.prototype.createColorProxies = function(values) { - - // Replace the prototype getter with a local array property - - if (!this.hasOwnProperty('colors')) { - Object.defineProperty( this, "colors", { value: [], writable: true } ); - } else { - this.colors = []; - } - - // If the attribute buffer has already been populated, set up proxy objects - - this.populateProxyFromBuffer(this.colors, "color", THREE.ProxyColor, 3); - - // If values were passed in, store them in the buffer via the proxy objects - - if (values) { - - for (var i = 0; i < values.length; i ++) { - - this.colors[i].copy(values[i]); - - } - - } - - // Return a reference to the newly-created array - - return this.colors; - -}; - -THREE.ProxyGeometry.prototype.populateProxyFromBuffer = function(attr, buffername, proxytype, itemsize, offset, count) { - - if ( this.attributes[ buffername ] && this.attributes[ buffername ].array ) { - - var array = this.attributes[ buffername ].array; - var size = itemsize || this.attributes[ buffername ].itemSize; - var start = offset || 0; - - count = count || (array.length / size - start); - - for ( var i = start, l = start + count; i < l; i ++ ) { - - attr.push( new proxytype( array, i * size ) ); - - } - - } - -}; - -/* - * Checks for duplicate vertices with hashmap. - * Duplicated vertices are removed - * and faces' vertices are updated. - */ - -THREE.ProxyGeometry.prototype.mergeVertices = function () { - - var verticesMap = {}; // Hashmap for looking up vertice by position coordinates (and making sure they are unique) - var unique = [], changes = []; - - var v, key; - var precisionPoints = 4; // number of decimal points, eg. 4 for epsilon of 0.0001 - var precision = Math.pow( 10, precisionPoints ); - var i,il, face; - var indices, k, j, jl, u; - - for ( i = 0, il = this.vertices.length; i < il; i ++ ) { - - v = this.vertices[ i ]; - key = Math.round( v.x * precision ) + '_' + Math.round( v.y * precision ) + '_' + Math.round( v.z * precision ); - - if ( verticesMap[ key ] === undefined ) { - - verticesMap[ key ] = i; - unique.push( this.vertices[ i ] ); - changes[ i ] = unique.length - 1; - - } else { - - //console.log('Duplicate vertex found. ', i, ' could be using ', verticesMap[key]); - changes[ i ] = changes[ verticesMap[ key ] ]; - - } - - } - - - // if faces are completely degenerate after merging vertices, we - // have to remove them from the geometry. - var faceIndicesToRemove = []; - - for ( i = 0, il = this.faces.length; i < il; i ++ ) { - - face = this.faces[ i ]; - - face.a = changes[ face.a ]; - face.b = changes[ face.b ]; - face.c = changes[ face.c ]; - - indices = [ face.a, face.b, face.c ]; - - var dupIndex = -1; - - // if any duplicate vertices are found in a Face3 - // we have to remove the face as nothing can be saved - for ( var n = 0; n < 3; n ++ ) { - if ( indices[ n ] == indices[ ( n + 1 ) % 3 ] ) { - - dupIndex = n; - faceIndicesToRemove.push( i ); - break; - - } - } - - } - - for ( i = faceIndicesToRemove.length - 1; i >= 0; i -- ) { - var idx = faceIndicesToRemove[ i ]; - - this.faces.splice( idx, 1 ); - - for ( j = 0, jl = this.faceVertexUvs.length; j < jl; j ++ ) { - - this.faceVertexUvs[ j ].splice( idx, 1 ); - - } - - } - - // Use unique set of vertices - - var diff = this.vertices.length - unique.length; - this.vertices = unique; - return diff; - -}; - -THREE.ProxyGeometry.prototype.onGeometryAllocate = function (ev) { - - // Prevent allocate event listener from firing multiple times - this.removeEventListener( 'allocate', this.onGeometryAllocate); - - if (this.hasOwnProperty('vertices')) { - var attr = new THREE.Float32Attribute(this.vertices.length, 3); - this.addAttribute('position', attr); - this.createVertexProxies(this.vertices); - } - if (this.hasOwnProperty('faces')) { - var idxattr = new THREE.Uint16Attribute(this.faces.length, 3); - this.addAttribute('index', idxattr); - - if (this.faces.length > 0) { - var hasnormals = (this.hasOwnProperty('normals') || this.faces[0].normal || this.faces[0].vertexNormals.length > 0); - var hascolors = (this.hasOwnProperty('colors') || this.faces[0].color || this.faces[0].vertexColors.length > 0); - var hastangents = (this.faces[0].vertexTangents.length > 0); - - if (hasnormals) { - var normalattr = new THREE.Float32Attribute(this.vertices.length, 3); - this.addAttribute('normal', normalattr); - } - - if (hascolors) { - var colorattr = new THREE.Float32Attribute(this.faces.length * 3, 3); - this.addAttribute('color', colorattr); - } - - if (hastangents) { - var tangentattr = new THREE.Float32Attribute(this.faces.length * 3, 3); - this.addAttribute('tangent', tangentattr); - } - } - - this.createFaceProxies(this.faces); - } - - if (this.hasOwnProperty('faceVertexUvs')) { - - var uvattr = new THREE.Float32Attribute(this.faces.length * 3, 2); - this.addAttribute('uv', uvattr); - this.createUvProxies(this.faceVertexUvs[0]); - - } - - if (this.hasOwnProperty('skinIndices')) { - - var skinidxattr = new THREE.Float32Attribute(this.skinIndices.length, 4); - this.addAttribute('skinIndex', skinidxattr); - this.createSkinIndexProxies(this.skinIndices); - - } - - if (this.hasOwnProperty('skinWeights')) { - - var skinweightattr = new THREE.Float32Attribute(this.skinWeights.length, 4); - this.addAttribute('skinWeight', skinweightattr); - this.createSkinWeightProxies(this.skinWeights); - - } -}; - -THREE.ProxyGeometry.prototype.computeFaceNormals = function() { - - this.dispatchEvent( { type: 'allocate' } ); - - return THREE.BufferGeometry.prototype.computeFaceNormals.call(this); - -}; - -THREE.ProxyGeometry.prototype.computeVertexNormals = function() { - - this.dispatchEvent( { type: 'allocate' } ); - - return THREE.BufferGeometry.prototype.computeVertexNormals.call(this); - -}; - -THREE.ProxyGeometry.prototype.computeTangents = function() { - - this.dispatchEvent( { type: 'allocate' } ); - - var ret = THREE.BufferGeometry.prototype.computeTangents.call(this); - - // FIXME - this doesn't work yet - //this.createFaceVertexTangentProxies(); - - return ret; - -}; - -THREE.ProxyGeometry.prototype.computeBoundingSphere = function() { - - this.dispatchEvent( { type: 'allocate' } ); - - return THREE.BufferGeometry.prototype.computeBoundingSphere.call(this); - -}; - -THREE.ProxyGeometry.prototype.computeBoundingBox = function () { - - this.dispatchEvent( { type: 'allocate' } ); - - return THREE.BufferGeometry.prototype.computeBoundingBox.call(this); - -}; -THREE.ProxyGeometry.prototype.clone = function () { - - var buff = THREE.BufferGeometry.prototype.clone.call(this); - var geo = new THREE.ProxyGeometry(); - geo.attributes = buff.attributes; - geo.offsets = buff.drawcalls; - - return geo; - -}; - -THREE.EventDispatcher.prototype.apply( THREE.ProxyGeometry.prototype ); - -THREE.ProxyGeometryIdCount = 0; diff --git a/examples/js/wip/TypedGeometry.js b/examples/js/wip/TypedGeometry.js deleted file mode 100644 index a859910b6ec612d2c86c49d4f93e302e77ec05e2..0000000000000000000000000000000000000000 --- a/examples/js/wip/TypedGeometry.js +++ /dev/null @@ -1,120 +0,0 @@ -/** - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.TypedGeometry = function ( size ) { - - THREE.BufferGeometry.call( this ); - - if ( size !== undefined ) { - - this.setArrays( - new Float32Array( size * 3 * 3 ), - new Float32Array( size * 3 * 3 ), - new Float32Array( size * 3 * 2 ) - ); - - } - -}; - -THREE.TypedGeometry.prototype = Object.create( THREE.BufferGeometry.prototype ); -THREE.TypedGeometry.prototype.constructor = THREE.TypedGeometry; - -THREE.TypedGeometry.prototype.setArrays = function ( vertices, normals, uvs ) { - - this.vertices = vertices; - this.normals = normals; - this.uvs = uvs; - - this.addAttribute( 'position', new THREE.BufferAttribute( vertices, 3 ) ); - this.addAttribute( 'normal', new THREE.BufferAttribute( normals, 3 ) ); - this.addAttribute( 'uv', new THREE.BufferAttribute( uvs, 2 ) ); - - return this; - -}; - -THREE.TypedGeometry.prototype.merge = ( function () { - - var offset = 0; - var normalMatrix = new THREE.Matrix3(); - - return function ( geometry, matrix, startOffset ) { - - if ( startOffset !== undefined ) offset = startOffset; - - var offset2 = offset * 2; - var offset3 = offset * 3; - - var vertices = this.attributes.position.array; - var normals = this.attributes.normal.array; - var uvs = this.attributes.uv.array; - - if ( geometry instanceof THREE.TypedGeometry ) { - - var vertices2 = geometry.attributes.position.array; - var normals2 = geometry.attributes.normal.array; - var uvs2 = geometry.attributes.uv.array; - - for ( var i = 0, l = vertices2.length; i < l; i += 3 ) { - - vertices[ i + offset3 ] = vertices2[ i ]; - vertices[ i + offset3 + 1 ] = vertices2[ i + 1 ]; - vertices[ i + offset3 + 2 ] = vertices2[ i + 2 ]; - - normals[ i + offset3 ] = normals2[ i ]; - normals[ i + offset3 + 1 ] = normals2[ i + 1 ]; - normals[ i + offset3 + 2 ] = normals2[ i + 2 ]; - - uvs[ i + offset2 ] = uvs2[ i ]; - uvs[ i + offset2 + 1 ] = uvs2[ i + 1 ]; - - } - - } else if ( geometry instanceof THREE.IndexedTypedGeometry ) { - - var indices2 = geometry.attributes.index.array; - var vertices2 = geometry.attributes.position.array; - var normals2 = geometry.attributes.normal.array; - var uvs2 = geometry.attributes.uv.array; - - for ( var i = 0, l = indices2.length; i < l; i ++ ) { - - var index = indices2[ i ]; - - var index3 = index * 3; - var i3 = i * 3; - - vertices[ i3 + offset3 ] = vertices2[ index3 ]; - vertices[ i3 + offset3 + 1 ] = vertices2[ index3 + 1 ]; - vertices[ i3 + offset3 + 2 ] = vertices2[ index3 + 2 ]; - - normals[ i3 + offset3 ] = normals2[ index3 ]; - normals[ i3 + offset3 + 1 ] = normals2[ index3 + 1 ]; - normals[ i3 + offset3 + 2 ] = normals2[ index3 + 2 ]; - - var index2 = index * 2; - var i2 = i * 2; - - uvs[ i2 + offset2 ] = uvs2[ index2 ]; - uvs[ i2 + offset2 + 1 ] = uvs2[ index2 + 1 ]; - - } - - if ( matrix !== undefined ) { - - matrix.applyToVector3Array( vertices, offset3, indices2.length * 3 ); - - normalMatrix.getNormalMatrix( matrix ); - normalMatrix.applyToVector3Array( normals, offset3, indices2.length * 3 ); - - } - - offset += indices2.length; - - } - - }; - -} )(); \ No newline at end of file diff --git a/examples/js/wip/benchmark/BoxGeometry2.js b/examples/js/wip/benchmark/BoxGeometry2.js deleted file mode 100644 index 75a351fd7c0dfe72a31fcd4ec2970ec0ae83ce24..0000000000000000000000000000000000000000 --- a/examples/js/wip/benchmark/BoxGeometry2.js +++ /dev/null @@ -1,114 +0,0 @@ -/** - * @author mrdoob / http://mrdoob.com/ - * based on http://papervision3d.googlecode.com/svn/trunk/as3/trunk/src/org/papervision3d/objects/primitives/Cube.as - */ - -THREE.BoxGeometry2 = function ( width, height, depth, widthSegments, heightSegments, depthSegments ) { - - var scope = this; - - this.width = width; - this.height = height; - this.depth = depth; - - this.widthSegments = widthSegments || 1; - this.heightSegments = heightSegments || 1; - this.depthSegments = depthSegments || 1; - - var width_half = this.width / 2; - var height_half = this.height / 2; - var depth_half = this.depth / 2; - - var vector = new THREE.Vector3(); - - var vectors = []; - var vertices = []; - - var addVertex = function ( a, b, c ) { - - vertices.push( vectors[ a ], vectors[ a + 1 ], vectors[ a + 2 ] ); - vertices.push( vectors[ b ], vectors[ b + 1 ], vectors[ b + 2 ] ); - vertices.push( vectors[ c ], vectors[ c + 1 ], vectors[ c + 2 ] ); - - }; - - buildPlane( 'z', 'y', - 1, - 1, this.depth, this.height, width_half, 0 ); // px - buildPlane( 'z', 'y', 1, - 1, this.depth, this.height, - width_half, 1 ); // nx - buildPlane( 'x', 'z', 1, 1, this.width, this.depth, height_half, 2 ); // py - buildPlane( 'x', 'z', 1, - 1, this.width, this.depth, - height_half, 3 ); // ny - buildPlane( 'x', 'y', 1, - 1, this.width, this.height, depth_half, 4 ); // pz - buildPlane( 'x', 'y', - 1, - 1, this.width, this.height, - depth_half, 5 ); // nz - - function buildPlane( u, v, udir, vdir, width, height, depth, materialIndex ) { - - var w, ix, iy, - gridX = scope.widthSegments, - gridY = scope.heightSegments, - width_half = width / 2, - height_half = height / 2, - offset = vectors.length; - - if ( ( u === 'x' && v === 'y' ) || ( u === 'y' && v === 'x' ) ) { - - w = 'z'; - - } else if ( ( u === 'x' && v === 'z' ) || ( u === 'z' && v === 'x' ) ) { - - w = 'y'; - gridY = scope.depthSegments; - - } else if ( ( u === 'z' && v === 'y' ) || ( u === 'y' && v === 'z' ) ) { - - w = 'x'; - gridX = scope.depthSegments; - - } - - var gridX1 = gridX + 1, - gridY1 = gridY + 1, - segment_width = width / gridX, - segment_height = height / gridY, - normal = new THREE.Vector3(); - - normal[ w ] = depth > 0 ? 1 : - 1; - - for ( iy = 0; iy < gridY1; iy ++ ) { - - for ( ix = 0; ix < gridX1; ix ++ ) { - - vector[ u ] = ( ix * segment_width - width_half ) * udir; - vector[ v ] = ( iy * segment_height - height_half ) * vdir; - vector[ w ] = depth; - - vectors.push( vector.x, vector.y, vector.z ); - - } - - } - - for ( iy = 0; iy < gridY; iy ++ ) { - - for ( ix = 0; ix < gridX; ix ++ ) { - - var a = ix + gridX1 * iy; - var b = ix + gridX1 * ( iy + 1 ); - var c = ( ix + 1 ) + gridX1 * ( iy + 1 ); - var d = ( ix + 1 ) + gridX1 * iy; - - addVertex( a * 3 + offset, b * 3 + offset, d * 3 + offset ); - addVertex( b * 3 + offset, c * 3 + offset, d * 3 + offset ); - - } - - } - - } - - THREE.Geometry2.call( this, vertices.length / 3 ); - - this.vertices.set( vertices ); - -}; - -THREE.BoxGeometry2.prototype = Object.create( THREE.Geometry2.prototype ); -THREE.BoxGeometry2.prototype.constructor = THREE.BoxGeometry2; diff --git a/examples/js/wip/benchmark/Geometry2.js b/examples/js/wip/benchmark/Geometry2.js deleted file mode 100644 index 3ba4e00c3fea597e2784403d662c51d92f47f9ce..0000000000000000000000000000000000000000 --- a/examples/js/wip/benchmark/Geometry2.js +++ /dev/null @@ -1,20 +0,0 @@ -/** - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.Geometry2 = function ( size ) { - - THREE.BufferGeometry.call( this ); - - this.vertices = new THREE.Float32Attribute( size, 3 ); - this.normals = new THREE.Float32Attribute( size, 3 ); - this.uvs = new THREE.Float32Attribute( size, 2 ); - - this.addAttribute( 'position', this.vertices ); - this.addAttribute( 'normal', this.normals ); - this.addAttribute( 'uv', this.uvs ); - -}; - -THREE.Geometry2.prototype = Object.create( THREE.BufferGeometry.prototype ); -THREE.Geometry2.prototype.constructor = THREE.Geometry2; \ No newline at end of file diff --git a/examples/js/wip/benchmark/Geometry2Loader.js b/examples/js/wip/benchmark/Geometry2Loader.js deleted file mode 100644 index 22a514f6cea18aedd8669bb6bb41020040fcd006..0000000000000000000000000000000000000000 --- a/examples/js/wip/benchmark/Geometry2Loader.js +++ /dev/null @@ -1,67 +0,0 @@ -/** - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.Geometry2Loader = function ( manager ) { - - this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager; - -}; - -THREE.Geometry2Loader.prototype = { - - constructor: THREE.Geometry2Loader, - - load: function ( url, onLoad, onProgress, onError ) { - - var scope = this; - - var loader = new THREE.XHRLoader(); - loader.setCrossOrigin( this.crossOrigin ); - loader.load( url, function ( text ) { - - onLoad( scope.parse( JSON.parse( text ) ) ); - - } ); - - }, - - setCrossOrigin: function ( value ) { - - this.crossOrigin = value; - - }, - - parse: function ( json ) { - - var geometry = new THREE.Geometry2( json.vertices.length / 3 ); - - var attributes = [ 'vertices', 'normals', 'uvs' ]; - var boundingSphere = json.boundingSphere; - - for ( var key in attributes ) { - - var attribute = attributes[ key ]; - geometry[ attribute ].set( json[ attribute ] ); - - } - - if ( boundingSphere !== undefined ) { - - var center = new THREE.Vector3(); - - if ( boundingSphere.center !== undefined ) { - - center.fromArray( boundingSphere.center ); - - } - - geometry.boundingSphere = new THREE.Sphere( center, boundingSphere.radius ); - - } - - return geometry; - - } - -}; diff --git a/examples/js/wip/benchmark/Geometry3.js b/examples/js/wip/benchmark/Geometry3.js deleted file mode 100644 index cffb1ed68be2b7b43cf98f4a891a3ec4b92994f6..0000000000000000000000000000000000000000 --- a/examples/js/wip/benchmark/Geometry3.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.Geometry3 = function ( size ) { - - THREE.BufferGeometry.call( this ); - - var verticesBuffer = new ArrayBuffer( size * 3 * 4 ); - var normalsBuffer = new ArrayBuffer( size * 3 * 4 ); - var uvsBuffer = new ArrayBuffer( size * 2 * 4 ); - - this.vertices = []; - this.normals = []; - this.uvs = []; - - for ( var i = 0; i < size; i ++ ) { - - this.vertices.push( new Float32Array( verticesBuffer, i * 3 * 4, 3 ) ); - this.normals.push( new Float32Array( normalsBuffer, i * 3 * 4, 3 ) ); - this.uvs.push( new Float32Array( uvsBuffer, i * 2 * 4, 2 ) ); - - } - - this.attributes[ 'position' ] = { array: new Float32Array( verticesBuffer, 0, size * 3 ), itemSize: 3 }; - this.attributes[ 'normal' ] = { array: new Float32Array( normalsBuffer, 0, size * 3 ), itemSize: 3 }; - this.attributes[ 'uv' ] = { array: new Float32Array( uvsBuffer, 0, size * 2 ), itemSize: 2 }; - -}; - -THREE.Geometry3.prototype = Object.create( THREE.BufferGeometry.prototype ); -THREE.Geometry3.prototype.constructor = THREE.Geometry3; \ No newline at end of file diff --git a/examples/js/wip/benchmark/Geometry4.js b/examples/js/wip/benchmark/Geometry4.js deleted file mode 100644 index 6bd2c2c52378848149ba2b1ebfefe3af6c29839d..0000000000000000000000000000000000000000 --- a/examples/js/wip/benchmark/Geometry4.js +++ /dev/null @@ -1,85 +0,0 @@ -THREE.Geometry4 = function ( size ) { - - THREE.BufferGeometry.call( this ); - - var verticesBuffer = new ArrayBuffer( size * 3 * 4 ); - var normalsBuffer = new ArrayBuffer( size * 3 * 4 ); - var uvsBuffer = new ArrayBuffer( size * 2 * 4 ); - - this.attributes[ 'position' ] = { array: new Float32Array( verticesBuffer, 0, size * 3 ), itemSize: 3 }; - this.attributes[ 'normal' ] = { array: new Float32Array( normalsBuffer, 0, size * 3 ), itemSize: 3 }; - this.attributes[ 'uv' ] = { array: new Float32Array( uvsBuffer, 0, size * 2 ), itemSize: 2 }; - - this.vertices = new THREE.VectorArrayProxy( this.attributes[ 'position' ] ); - this.normals = new THREE.VectorArrayProxy( this.attributes[ 'normal' ] ); - this.uvs = new THREE.VectorArrayProxy( this.attributes[ 'uv' ] ); - -}; -THREE.Geometry4.prototype = Object.create( THREE.BufferGeometry.prototype ); -THREE.Geometry4.prototype.constructor = THREE.Geometry4; - -THREE.VectorArrayProxy = function(attribute) { - - // Acts as a proxy for an array of vectors, by setting up accessors which return THREE.Vector*Proxy objects - - this.attribute = attribute; - - for (var i = 0, l = this.attribute.array.length / this.attribute.itemSize; i < l; i ++) { - - Object.defineProperty(this, i, { - get: (function(i) { return function() { return this.getValue(i); }})(i), - set: (function(i) { return function(v) { return this.setValue(i, v); }})(i), - }); - - } - -}; - -THREE.VectorArrayProxy.prototype.getValue = function(i) { - - // Allocates a new THREE.Vector2Proxy or THREE.Vector3Proxy depending on the itemSize of our attribute - - var subarray = this.attribute.array.subarray(i * this.attribute.itemSize, (i + 1) * this.attribute.itemSize); - - switch (this.attribute.itemSize) { - - case 2: - return new THREE.Vector2Proxy(subarray); - - case 3: - return new THREE.Vector3Proxy(subarray); - - } - -}; -THREE.VectorArrayProxy.prototype.setValue = function(i, v) { - - var vec = this[i]; - vec.copy(v); - -}; - -// Vector Proxy Objects - -THREE.Vector2Proxy = function(subarray) { - - this.subarray = subarray; - -}; -THREE.Vector2Proxy.prototype = Object.create( THREE.Vector2.prototype ); -THREE.Vector2Proxy.prototype.constructor = THREE.Vector2Proxy; -Object.defineProperty(THREE.Vector2Proxy.prototype, 'x', { get: function() { return this.subarray[0]; }, set: function(v) { this.subarray[0] = v; } }); -Object.defineProperty(THREE.Vector2Proxy.prototype, 'y', { get: function() { return this.subarray[1]; }, set: function(v) { this.subarray[1] = v; } }); - - -THREE.Vector3Proxy = function(subarray) { - - this.subarray = subarray; - -}; -THREE.Vector3Proxy.prototype = Object.create( THREE.Vector3.prototype ); -THREE.Vector3Proxy.prototype.constructor = THREE.Vector3Proxy; - -Object.defineProperty(THREE.Vector3Proxy.prototype, 'x', { get: function() { return this.subarray[0]; }, set: function(v) { this.subarray[0] = v; } }); -Object.defineProperty(THREE.Vector3Proxy.prototype, 'y', { get: function() { return this.subarray[1]; }, set: function(v) { this.subarray[1] = v; } }); -Object.defineProperty(THREE.Vector3Proxy.prototype, 'z', { get: function() { return this.subarray[2]; }, set: function(v) { this.subarray[2] = v; } }); \ No newline at end of file diff --git a/examples/js/wip/benchmark/Geometry5.js b/examples/js/wip/benchmark/Geometry5.js deleted file mode 100644 index 6ff702fae95010e4acadaedc26ba236cc9a22557..0000000000000000000000000000000000000000 --- a/examples/js/wip/benchmark/Geometry5.js +++ /dev/null @@ -1,78 +0,0 @@ -/** - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.Geometry5 = function ( size ) { - - THREE.BufferGeometry.call( this ); - - var verticesBuffer = new Float32Array( size * 3 ); - var normalsBuffer = new Float32Array( size * 3 ); - var uvsBuffer = new Float32Array( size * 2 ); - - this.vertices = []; - this.normals = []; - this.uvs = []; - - for ( var i = 0; i < size; i ++ ) { - - this.vertices.push( new THREE.TypedVector3( verticesBuffer, i * 3 ) ); - this.normals.push( new THREE.TypedVector3( normalsBuffer, i * 3 ) ); - this.uvs.push( new THREE.TypedVector2( uvsBuffer, i * 2 ) ); - - } - - this.attributes[ 'position' ] = { array: verticesBuffer, itemSize: 3 }; - this.attributes[ 'normal' ] = { array: normalsBuffer, itemSize: 3 }; - this.attributes[ 'uv' ] = { array: uvsBuffer, itemSize: 2 }; - -}; - -THREE.Geometry5.prototype = Object.create( THREE.BufferGeometry.prototype ); -THREE.Geometry5.prototype.constructor = THREE.Geometry5; - -THREE.TypedVector2 = function ( array, offset ) { - - this.array = array; - this.offset = offset; - -}; - -THREE.TypedVector2.prototype = Object.create( THREE.Vector2.prototype ); -THREE.TypedVector2.prototype.constructor = THREE.TypedVector2; - -Object.defineProperties( THREE.TypedVector2.prototype, { - 'x': { - get: function () { return this.array[ this.offset ]; }, - set: function ( v ) { this.array[ this.offset ] = v; } - }, - 'y': { - get: function () { return this.array[ this.offset + 1 ]; }, - set: function ( v ) { this.array[ this.offset + 1 ] = v; } - } -} ); - -THREE.TypedVector3 = function ( array, offset ) { - - this.array = array; - this.offset = offset; - -}; - -THREE.TypedVector3.prototype = Object.create( THREE.Vector3.prototype ); -THREE.TypedVector3.prototype.constructor = THREE.TypedVector3; - -Object.defineProperties( THREE.TypedVector3.prototype, { - 'x': { - get: function () { return this.array[ this.offset ]; }, - set: function ( v ) { this.array[ this.offset ] = v; } - }, - 'y': { - get: function () { return this.array[ this.offset + 1 ]; }, - set: function ( v ) { this.array[ this.offset + 1 ] = v; } - }, - 'z': { - get: function () { return this.array[ this.offset + 2 ]; }, - set: function ( v ) { this.array[ this.offset + 2 ] = v; } - } -} ); \ No newline at end of file diff --git a/examples/js/wip/benchmark/Geometry5b.js b/examples/js/wip/benchmark/Geometry5b.js deleted file mode 100644 index 190b2f53277c18b00df86fb2c43bc54c4767c9f5..0000000000000000000000000000000000000000 --- a/examples/js/wip/benchmark/Geometry5b.js +++ /dev/null @@ -1,76 +0,0 @@ -/** - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.Geometry5b = function ( bufferGeometry ) { - - THREE.BufferGeometry.call( this ); - - this.attributes = bufferGeometry.attributes; - - var verticesBuffer = this.attributes.position.array; - var normalsBuffer = this.attributes.normal.array; - var uvsBuffer = this.attributes.uv.array; - - this.vertices = []; - this.normals = []; - this.uvs = []; - - for ( var i = 0, l = verticesBuffer.length / 3; i < l; i ++ ) { - - this.vertices.push( new THREE.TypedVector3( verticesBuffer, i * 3 ) ); - this.normals.push( new THREE.TypedVector3( normalsBuffer, i * 3 ) ); - this.uvs.push( new THREE.TypedVector2( uvsBuffer, i * 2 ) ); - - } - -}; - -THREE.Geometry5b.prototype = Object.create( THREE.BufferGeometry.prototype ); -THREE.Geometry5b.prototype.constructor = THREE.Geometry5b; - -THREE.TypedVector2 = function ( array, offset ) { - - this.array = array; - this.offset = offset; - -}; - -THREE.TypedVector2.prototype = Object.create( THREE.Vector2.prototype ); -THREE.TypedVector2.prototype.constructor = THREE.TypedVector2; - -Object.defineProperties( THREE.TypedVector2.prototype, { - 'x': { - get: function () { return this.array[ this.offset ]; }, - set: function ( v ) { this.array[ this.offset ] = v; } - }, - 'y': { - get: function () { return this.array[ this.offset + 1 ]; }, - set: function ( v ) { this.array[ this.offset + 1 ] = v; } - } -} ); - -THREE.TypedVector3 = function ( array, offset ) { - - this.array = array; - this.offset = offset; - -}; - -THREE.TypedVector3.prototype = Object.create( THREE.Vector3.prototype ); -THREE.TypedVector3.prototype.constructor = THREE.TypedVector3; - -Object.defineProperties( THREE.TypedVector3.prototype, { - 'x': { - get: function () { return this.array[ this.offset ]; }, - set: function ( v ) { this.array[ this.offset ] = v; } - }, - 'y': { - get: function () { return this.array[ this.offset + 1 ]; }, - set: function ( v ) { this.array[ this.offset + 1 ] = v; } - }, - 'z': { - get: function () { return this.array[ this.offset + 2 ]; }, - set: function ( v ) { this.array[ this.offset + 2 ] = v; } - } -} ); \ No newline at end of file diff --git a/examples/js/wip/benchmark/IndexedGeometry3.js b/examples/js/wip/benchmark/IndexedGeometry3.js deleted file mode 100644 index d39f0f16737a0468627639887abc2da0e070708b..0000000000000000000000000000000000000000 --- a/examples/js/wip/benchmark/IndexedGeometry3.js +++ /dev/null @@ -1,34 +0,0 @@ -/** - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.IndexedGeometry3 = function ( indices, size ) { - - THREE.BufferGeometry.call( this ); - - var verticesBuffer = new ArrayBuffer( size * 3 * 4 ); - var normalsBuffer = new ArrayBuffer( size * 3 * 4 ); - var uvsBuffer = new ArrayBuffer( size * 2 * 4 ); - - this.indices = new Uint16Array( indices ); - this.vertices = []; - this.normals = []; - this.uvs = []; - - for ( var i = 0; i < size; i ++ ) { - - this.vertices.push( new Float32Array( verticesBuffer, i * 3 * 4, 3 ) ); - this.normals.push( new Float32Array( normalsBuffer, i * 3 * 4, 3 ) ); - this.uvs.push( new Float32Array( uvsBuffer, i * 2 * 4, 2 ) ); - - } - - this.attributes[ 'index' ] = { array: this.indices, itemSize: 1 }; - this.attributes[ 'position' ] = { array: new Float32Array( verticesBuffer, 0, size * 3 ), itemSize: 3 }; - this.attributes[ 'normal' ] = { array: new Float32Array( normalsBuffer, 0, size * 3 ), itemSize: 3 }; - this.attributes[ 'uv' ] = { array: new Float32Array( uvsBuffer, 0, size * 2 ), itemSize: 2 }; - -}; - -THREE.Geometry3.prototype = Object.create( THREE.BufferGeometry.prototype ); -THREE.Geometry3.prototype.constructor = THREE.Geometry3; \ No newline at end of file diff --git a/examples/js/wip/benchmark/IndexedGeometry5.js b/examples/js/wip/benchmark/IndexedGeometry5.js deleted file mode 100644 index 957877cc4a0e5dd41e41c95259355ec051998914..0000000000000000000000000000000000000000 --- a/examples/js/wip/benchmark/IndexedGeometry5.js +++ /dev/null @@ -1,80 +0,0 @@ -/** - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.IndexedGeometry5 = function ( indices, size ) { - - THREE.BufferGeometry.call( this ); - - var verticesBuffer = new Float32Array( size * 3 ); - var normalsBuffer = new Float32Array( size * 3 ); - var uvsBuffer = new Float32Array( size * 2 ); - - this.indices = new Uint16Array( indices ); - this.vertices = []; - this.normals = []; - this.uvs = []; - - for ( var i = 0; i < size; i ++ ) { - - this.vertices.push( new THREE.TypedVector3( verticesBuffer, i * 3 ) ); - this.normals.push( new THREE.TypedVector3( normalsBuffer, i * 3 ) ); - this.uvs.push( new THREE.TypedVector2( uvsBuffer, i * 2 ) ); - - } - - this.attributes[ 'index' ] = { array: this.indices, itemSize: 1 }; - this.attributes[ 'position' ] = { array: verticesBuffer, itemSize: 3 }; - this.attributes[ 'normal' ] = { array: normalsBuffer, itemSize: 3 }; - this.attributes[ 'uv' ] = { array: uvsBuffer, itemSize: 2 }; - -}; - -THREE.IndexedGeometry5.prototype = Object.create( THREE.BufferGeometry.prototype ); -THREE.IndexedGeometry5.prototype.constructor = THREE.IndexedGeometry5; - -THREE.TypedVector2 = function ( array, offset ) { - - this.array = array; - this.offset = offset; - -}; - -THREE.TypedVector2.prototype = Object.create( THREE.Vector2.prototype ); -THREE.TypedVector2.prototype.constructor = THREE.TypedVector2; - -Object.defineProperties( THREE.TypedVector2.prototype, { - 'x': { - get: function () { return this.array[ this.offset ]; }, - set: function ( v ) { this.array[ this.offset ] = v; } - }, - 'y': { - get: function () { return this.array[ this.offset + 1 ]; }, - set: function ( v ) { this.array[ this.offset + 1 ] = v; } - } -} ); - -THREE.TypedVector3 = function ( array, offset ) { - - this.array = array; - this.offset = offset; - -}; - -THREE.TypedVector3.prototype = Object.create( THREE.Vector3.prototype ); -THREE.TypedVector3.prototype.constructor = THREE.TypedVector3; - -Object.defineProperties( THREE.TypedVector3.prototype, { - 'x': { - get: function () { return this.array[ this.offset ]; }, - set: function ( v ) { this.array[ this.offset ] = v; } - }, - 'y': { - get: function () { return this.array[ this.offset + 1 ]; }, - set: function ( v ) { this.array[ this.offset + 1 ] = v; } - }, - 'z': { - get: function () { return this.array[ this.offset + 2 ]; }, - set: function ( v ) { this.array[ this.offset + 2 ] = v; } - } -} ); \ No newline at end of file diff --git a/examples/js/wip/benchmark/IndexedPlaneGeometry5.js b/examples/js/wip/benchmark/IndexedPlaneGeometry5.js deleted file mode 100644 index 2157839efc5b073ffbba4129ecec50f165679614..0000000000000000000000000000000000000000 --- a/examples/js/wip/benchmark/IndexedPlaneGeometry5.js +++ /dev/null @@ -1,83 +0,0 @@ -/** - * @author mrdoob / http://mrdoob.com/ - * based on http://papervision3d.googlecode.com/svn/trunk/as3/trunk/src/org/papervision3d/objects/primitives/Plane.as - */ - -THREE.IndexedPlaneGeometry5 = function ( width, height, widthSegments, heightSegments ) { - - this.width = width; - this.height = height; - - this.widthSegments = widthSegments || 1; - this.heightSegments = heightSegments || 1; - - var width_half = width / 2; - var height_half = height / 2; - - var gridX = this.widthSegments; - var gridY = this.heightSegments; - - var gridX1 = gridX + 1; - var gridY1 = gridY + 1; - - var segment_width = this.width / gridX; - var segment_height = this.height / gridY; - - var indices = gridX * gridY * 6; - var vertices = gridX1 * gridY1; - - THREE.IndexedGeometry5.call( this, indices, vertices ); - - var offset = 0; - - for ( var iy = 0; iy < gridY1; iy ++ ) { - - var y = iy * segment_height - height_half; - - for ( var ix = 0; ix < gridX1; ix ++ ) { - - var x = ix * segment_width - width_half; - - this.vertices[ offset ].x = x; - this.vertices[ offset ].y = - y; - - this.normals[ offset ].z = 1; - - this.uvs[ offset ].x = ix / gridX; - this.uvs[ offset ].y = iy / gridY; - - offset ++; - - } - - } - - var offset = 0; - - for ( var iy = 0; iy < gridY; iy ++ ) { - - for ( var ix = 0; ix < gridX; ix ++ ) { - - var a = ix + gridX1 * iy; - var b = ix + gridX1 * ( iy + 1 ); - var c = ( ix + 1 ) + gridX1 * ( iy + 1 ); - var d = ( ix + 1 ) + gridX1 * iy; - - this.indices[ offset ] = a; - this.indices[ offset + 1 ] = b; - this.indices[ offset + 2 ] = d; - - this.indices[ offset + 3 ] = b; - this.indices[ offset + 4 ] = c; - this.indices[ offset + 5 ] = d; - - offset += 6; - - } - - } - -}; - -THREE.IndexedPlaneGeometry5.prototype = Object.create( THREE.IndexedGeometry5.prototype ); -THREE.IndexedPlaneGeometry5.prototype.constructor = THREE.IndexedPlaneGeometry5; diff --git a/examples/js/wip/benchmark/PlaneGeometry.js b/examples/js/wip/benchmark/PlaneGeometry.js deleted file mode 100644 index 47b3420e4b6e530382313ec1df280d8b1ddd8d97..0000000000000000000000000000000000000000 --- a/examples/js/wip/benchmark/PlaneGeometry.js +++ /dev/null @@ -1,79 +0,0 @@ -/** - * @author mrdoob / http://mrdoob.com/ - * based on http://papervision3d.googlecode.com/svn/trunk/as3/trunk/src/org/papervision3d/objects/primitives/Plane.as - */ - -THREE.PlaneGeometry = function ( width, height, widthSegments, heightSegments ) { - - THREE.Geometry.call( this ); - - this.width = width; - this.height = height; - - this.widthSegments = widthSegments || 1; - this.heightSegments = heightSegments || 1; - - var ix, iz; - var width_half = width / 2; - var height_half = height / 2; - - var gridX = this.widthSegments; - var gridZ = this.heightSegments; - - var gridX1 = gridX + 1; - var gridZ1 = gridZ + 1; - - var segment_width = this.width / gridX; - var segment_height = this.height / gridZ; - - var normal = new THREE.Vector3( 0, 0, 1 ); - - for ( iz = 0; iz < gridZ1; iz ++ ) { - - for ( ix = 0; ix < gridX1; ix ++ ) { - - var x = ix * segment_width - width_half; - var y = iz * segment_height - height_half; - - this.vertices.push( new THREE.Vector3( x, - y, 0 ) ); - - } - - } - - for ( iz = 0; iz < gridZ; iz ++ ) { - - for ( ix = 0; ix < gridX; ix ++ ) { - - var a = ix + gridX1 * iz; - var b = ix + gridX1 * ( iz + 1 ); - var c = ( ix + 1 ) + gridX1 * ( iz + 1 ); - var d = ( ix + 1 ) + gridX1 * iz; - - var uva = new THREE.Vector2( ix / gridX, 1 - iz / gridZ ); - var uvb = new THREE.Vector2( ix / gridX, 1 - ( iz + 1 ) / gridZ ); - var uvc = new THREE.Vector2( ( ix + 1 ) / gridX, 1 - ( iz + 1 ) / gridZ ); - var uvd = new THREE.Vector2( ( ix + 1 ) / gridX, 1 - iz / gridZ ); - - var face = new THREE.Face3( a, b, d ); - face.normal.copy( normal ); - face.vertexNormals.push( normal.clone(), normal.clone(), normal.clone() ); - - this.faces.push( face ); - this.faceVertexUvs[ 0 ].push( [ uva, uvb, uvd ] ); - - face = new THREE.Face3( b, c, d ); - face.normal.copy( normal ); - face.vertexNormals.push( normal.clone(), normal.clone(), normal.clone() ); - - this.faces.push( face ); - this.faceVertexUvs[ 0 ].push( [ uvb.clone(), uvc, uvd.clone() ] ); - - } - - } - -}; - -THREE.PlaneGeometry.prototype = Object.create( THREE.Geometry.prototype ); -THREE.PlaneGeometry.prototype.constructor = THREE.PlaneGeometry; diff --git a/examples/js/wip/benchmark/PlaneGeometry2.js b/examples/js/wip/benchmark/PlaneGeometry2.js deleted file mode 100644 index 14f17ab2430777f9fc5239ae153c97c3b6462ab5..0000000000000000000000000000000000000000 --- a/examples/js/wip/benchmark/PlaneGeometry2.js +++ /dev/null @@ -1,76 +0,0 @@ -/** - * @author mrdoob / http://mrdoob.com/ - * based on http://papervision3d.googlecode.com/svn/trunk/as3/trunk/src/org/papervision3d/objects/primitives/Plane.as - */ - -THREE.PlaneGeometry2 = function ( width, height, widthSegments, heightSegments ) { - - THREE.Geometry2.call( this, ( widthSegments * heightSegments ) * 2 * 3 ); - - var vertices = this.vertices.array; - var normals = this.normals.array; - var uvs = this.uvs.array; - - this.width = width; - this.height = height; - - this.widthSegments = widthSegments || 1; - this.heightSegments = heightSegments || 1; - - var widthHalf = width / 2; - var heightHalf = height / 2; - - var gridX = this.widthSegments; - var gridY = this.heightSegments; - - var segmentWidth = this.width / gridX; - var segmentHeight = this.height / gridY; - - var offset = 0; - - for ( var iy = 0; iy < gridY; iy ++ ) { - - var y1 = iy * segmentHeight - heightHalf; - var y2 = ( iy + 1 ) * segmentHeight - heightHalf; - - for ( var ix = 0; ix < gridX; ix ++ ) { - - var x1 = ix * segmentWidth - widthHalf; - var x2 = ( ix + 1 ) * segmentWidth - widthHalf; - - vertices[ offset + 0 ] = x1; - vertices[ offset + 1 ] = y1; - - vertices[ offset + 3 ] = x2; - vertices[ offset + 4 ] = y1; - - vertices[ offset + 6 ] = x1; - vertices[ offset + 7 ] = y2; - - normals[ offset + 2 ] = 1; - normals[ offset + 5 ] = 1; - normals[ offset + 8 ] = 1; - - vertices[ offset + 9 ] = x2; - vertices[ offset + 10 ] = y1; - - vertices[ offset + 12 ] = x2; - vertices[ offset + 13 ] = y2; - - vertices[ offset + 15 ] = x1; - vertices[ offset + 16 ] = y2; - - normals[ offset + 11 ] = 1; - normals[ offset + 13 ] = 1; - normals[ offset + 17 ] = 1; - - offset += 18; - - } - - } - -}; - -THREE.PlaneGeometry2.prototype = Object.create( THREE.Geometry2.prototype ); -THREE.PlaneGeometry2.prototype.constructor = THREE.PlaneGeometry2; diff --git a/examples/js/wip/benchmark/PlaneGeometry2b.js b/examples/js/wip/benchmark/PlaneGeometry2b.js deleted file mode 100644 index 6582825b13cd25ccf3465395b41826e33d44da2f..0000000000000000000000000000000000000000 --- a/examples/js/wip/benchmark/PlaneGeometry2b.js +++ /dev/null @@ -1,66 +0,0 @@ -/** - * @author mrdoob / http://mrdoob.com/ - * based on http://papervision3d.googlecode.com/svn/trunk/as3/trunk/src/org/papervision3d/objects/primitives/Plane.as - */ - -THREE.PlaneGeometry2b = function ( width, height, widthSegments, heightSegments ) { - - THREE.Geometry2.call( this, ( widthSegments * heightSegments ) * 2 * 3 ); - - var vertices = this.vertices; - var normals = this.normals; - var uvs = this.uvs; - - this.width = width; - this.height = height; - - this.widthSegments = widthSegments || 1; - this.heightSegments = heightSegments || 1; - - var widthHalf = width / 2; - var heightHalf = height / 2; - - var gridX = this.widthSegments; - var gridY = this.heightSegments; - - var segmentWidth = this.width / gridX; - var segmentHeight = this.height / gridY; - - var index = 0; - - for ( var iy = 0; iy < gridY; iy ++ ) { - - var y1 = iy * segmentHeight - heightHalf; - var y2 = ( iy + 1 ) * segmentHeight - heightHalf; - - for ( var ix = 0; ix < gridX; ix ++ ) { - - var x1 = ix * segmentWidth - widthHalf; - var x2 = ( ix + 1 ) * segmentWidth - widthHalf; - - this.vertices.setXY( index + 0, x1, y1 ); - this.vertices.setXY( index + 1, x2, y1 ); - this.vertices.setXY( index + 2, x1, y2 ); - - this.vertices.setXY( index + 3, x2, y1 ); - this.vertices.setXY( index + 4, x2, y2 ); - this.vertices.setXY( index + 5, x1, y2 ); - - this.normals.setZ( index + 0, 1 ); - this.normals.setZ( index + 1, 1 ); - this.normals.setZ( index + 2, 1 ); - - this.normals.setZ( index + 3, 1 ); - this.normals.setZ( index + 4, 1 ); - this.normals.setZ( index + 5, 1 ); - - index += 6; - - } - - } - -}; - -THREE.PlaneGeometry2b.prototype = Object.create( THREE.Geometry2.prototype ); -THREE.PlaneGeometry2b.prototype.constructor = THREE.PlaneGeometry2b; diff --git a/examples/js/wip/benchmark/PlaneGeometry3.js b/examples/js/wip/benchmark/PlaneGeometry3.js deleted file mode 100644 index a2b61875ecc7e6d23b1ab83fb6ee679387c4b351..0000000000000000000000000000000000000000 --- a/examples/js/wip/benchmark/PlaneGeometry3.js +++ /dev/null @@ -1,76 +0,0 @@ -/** - * @author mrdoob / http://mrdoob.com/ - * based on http://papervision3d.googlecode.com/svn/trunk/as3/trunk/src/org/papervision3d/objects/primitives/Plane.as - */ - -THREE.PlaneGeometry3 = function ( width, height, widthSegments, heightSegments ) { - - THREE.Geometry3.call( this, ( widthSegments * heightSegments ) * 2 * 3 ); - - var vertices = this.vertices; - var normals = this.normals; - var uvs = this.uvs; - - this.width = width; - this.height = height; - - this.widthSegments = widthSegments || 1; - this.heightSegments = heightSegments || 1; - - var widthHalf = width / 2; - var heightHalf = height / 2; - - var gridX = this.widthSegments; - var gridY = this.heightSegments; - - var segmentWidth = this.width / gridX; - var segmentHeight = this.height / gridY; - - var offset = 0; - - for ( var iy = 0; iy < gridY; iy ++ ) { - - var y1 = iy * segmentHeight - heightHalf; - var y2 = ( iy + 1 ) * segmentHeight - heightHalf; - - for ( var ix = 0; ix < gridX; ix ++ ) { - - var x1 = ix * segmentWidth - widthHalf; - var x2 = ( ix + 1 ) * segmentWidth - widthHalf; - - vertices[ offset + 0 ][ 0 ] = x1; - vertices[ offset + 0 ][ 1 ] = y1; - - vertices[ offset + 1 ][ 0 ] = x2; - vertices[ offset + 1 ][ 1 ] = y1; - - vertices[ offset + 2 ][ 0 ] = x1; - vertices[ offset + 2 ][ 1 ] = y2; - - normals[ offset + 0 ][ 2 ] = 1; - normals[ offset + 1 ][ 2 ] = 1; - normals[ offset + 2 ][ 2 ] = 1; - - vertices[ offset + 3 ][ 0 ] = x2; - vertices[ offset + 3 ][ 1 ] = y1; - - vertices[ offset + 4 ][ 0 ] = x2; - vertices[ offset + 4 ][ 1 ] = y2; - - vertices[ offset + 5 ][ 0 ] = x1; - vertices[ offset + 5 ][ 1 ] = y2; - - normals[ offset + 3 ][ 2 ] = 1; - normals[ offset + 4 ][ 2 ] = 1; - normals[ offset + 5 ][ 2 ] = 1; - - offset += 6; - - } - - } - -}; - -THREE.PlaneGeometry3.prototype = Object.create( THREE.Geometry3.prototype ); -THREE.PlaneGeometry3.prototype.constructor = THREE.PlaneGeometry3; diff --git a/examples/js/wip/benchmark/PlaneGeometry5.js b/examples/js/wip/benchmark/PlaneGeometry5.js deleted file mode 100644 index a3218df8d80af0b232ff10f1add91182a39c77e5..0000000000000000000000000000000000000000 --- a/examples/js/wip/benchmark/PlaneGeometry5.js +++ /dev/null @@ -1,66 +0,0 @@ -/** - * @author mrdoob / http://mrdoob.com/ - * based on http://papervision3d.googlecode.com/svn/trunk/as3/trunk/src/org/papervision3d/objects/primitives/Plane.as - */ - -THREE.PlaneGeometry5 = function ( width, height, widthSegments, heightSegments ) { - - THREE.Geometry5.call( this, ( widthSegments * heightSegments ) * 2 * 3 ); - - var vertices = this.vertices; - var normals = this.normals; - var uvs = this.uvs; - - this.width = width; - this.height = height; - - this.widthSegments = widthSegments || 1; - this.heightSegments = heightSegments || 1; - - var widthHalf = width / 2; - var heightHalf = height / 2; - - var gridX = this.widthSegments; - var gridY = this.heightSegments; - - var segmentWidth = this.width / gridX; - var segmentHeight = this.height / gridY; - - var offset = 0; - - for ( var iy = 0; iy < gridY; iy ++ ) { - - var y1 = iy * segmentHeight - heightHalf; - var y2 = ( iy + 1 ) * segmentHeight - heightHalf; - - for ( var ix = 0; ix < gridX; ix ++ ) { - - var x1 = ix * segmentWidth - widthHalf; - var x2 = ( ix + 1 ) * segmentWidth - widthHalf; - - vertices[ offset + 0 ].set( x1, y1, 0 ); - vertices[ offset + 1 ].set( x2, y1, 0 ); - vertices[ offset + 2 ].set( x1, y2, 0 ); - - normals[ offset + 0 ].z = 1; - normals[ offset + 1 ].z = 1; - normals[ offset + 2 ].z = 1; - - vertices[ offset + 3 ].set( x2, y1, 0 ); - vertices[ offset + 4 ].set( x2, y2, 0 ); - vertices[ offset + 5 ].set( x1, y2, 0 ); - - normals[ offset + 3 ].z = 1; - normals[ offset + 4 ].z = 1; - normals[ offset + 5 ].z = 1; - - offset += 6; - - } - - } - -}; - -THREE.PlaneGeometry5.prototype = Object.create( THREE.Geometry5.prototype ); -THREE.PlaneGeometry5.prototype.constructor = THREE.PlaneGeometry5; diff --git a/examples/js/wip/benchmark/PlaneGeometry6.js b/examples/js/wip/benchmark/PlaneGeometry6.js deleted file mode 100644 index 0b6b7397b19165b10d7da6befb906a881b79b705..0000000000000000000000000000000000000000 --- a/examples/js/wip/benchmark/PlaneGeometry6.js +++ /dev/null @@ -1,30 +0,0 @@ -/** - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.PlaneGeometry6 = function ( width, height, widthSegments, heightSegments ) { - - THREE.PlaneBufferGeometry.call( this, width, height, widthSegments, heightSegments ); - - var indices = this.attributes.index.array; - var vertices = this.attributes.position.array; - var normals = this.attributes.normal.array; - var uvs = this.attributes.uv.array; - - this.indices = indices; - this.vertices = []; - this.normals = []; - this.uvs = []; - - for ( var i = 0, l = vertices.length / 3; i < l; i ++ ) { - - this.vertices.push( new THREE.TypedVector3( vertices, i * 3 ) ); - this.normals.push( new THREE.TypedVector3( normals, i * 3 ) ); - this.uvs.push( new THREE.TypedVector2( uvs, i * 2 ) ); - - } - -}; - -THREE.PlaneGeometry6.prototype = Object.create( THREE.PlaneBufferGeometry.prototype ); -THREE.PlaneGeometry6.prototype.constructor = THREE.PlaneGeometry6; \ No newline at end of file diff --git a/examples/js/wip/benchmark/PlaneGeometry99.js b/examples/js/wip/benchmark/PlaneGeometry99.js deleted file mode 100644 index 61db0bce5334c3cd65d2baa99e2c79f8ace18c4b..0000000000000000000000000000000000000000 --- a/examples/js/wip/benchmark/PlaneGeometry99.js +++ /dev/null @@ -1,93 +0,0 @@ -/** - * @author mrdoob / http://mrdoob.com/ - */ - -THREE.PlaneGeometry99 = function ( width, height, widthSegments, heightSegments ) { - - THREE.Geometry99.call( this ); - - this.parameters = { - width: width, - height: height, - widthSegments: widthSegments, - heightSegments: heightSegments - }; - - var width_half = width / 2; - var height_half = height / 2; - - var gridX = widthSegments || 1; - var gridY = heightSegments || 1; - - var gridX1 = gridX + 1; - var gridY1 = gridY + 1; - - var segment_width = width / gridX; - var segment_height = height / gridY; - - var vertices = new Float32Array( gridX1 * gridY1 * 3 ); - var normals = new Float32Array( gridX1 * gridY1 * 3 ); - var uvs = new Float32Array( gridX1 * gridY1 * 2 ); - - var offset = 0; - var offset2 = 0; - - for ( var iy = 0; iy < gridY1; iy ++ ) { - - var y = iy * segment_height - height_half; - - for ( var ix = 0; ix < gridX1; ix ++ ) { - - var x = ix * segment_width - width_half; - - vertices[ offset ] = x; - vertices[ offset + 1 ] = - y; - - normals[ offset + 2 ] = 1; - - uvs[ offset2 ] = ix / gridX; - uvs[ offset2 + 1 ] = 1 - ( iy / gridY ); - - offset += 3; - offset2 += 2; - - } - - } - - offset = 0; - - var indices = new Uint16Array( gridX * gridY * 6 ); - - for ( var iy = 0; iy < gridY; iy ++ ) { - - for ( var ix = 0; ix < gridX; ix ++ ) { - - var a = ix + gridX1 * iy; - var b = ix + gridX1 * ( iy + 1 ); - var c = ( ix + 1 ) + gridX1 * ( iy + 1 ); - var d = ( ix + 1 ) + gridX1 * iy; - - indices[ offset ] = a; - indices[ offset + 1 ] = b; - indices[ offset + 2 ] = d; - - indices[ offset + 3 ] = b; - indices[ offset + 4 ] = c; - indices[ offset + 5 ] = d; - - offset += 6; - - } - - } - - this.attributes[ 'index' ] = { array: indices, itemSize: 1 }; - this.attributes[ 'position' ] = { array: vertices, itemSize: 3 }; - this.attributes[ 'normal' ] = { array: normals, itemSize: 3 }; - this.attributes[ 'uv' ] = { array: uvs, itemSize: 2 }; - -}; - -THREE.PlaneGeometry99.prototype = Object.create( THREE.Geometry99.prototype ); -THREE.PlaneGeometry99.prototype.constructor = THREE.PlaneGeometry99; \ No newline at end of file diff --git a/examples/js/wip/benchmark/TypedGeometry.js b/examples/js/wip/benchmark/TypedGeometry.js deleted file mode 100644 index 3ea5be86d4b62bf9fd817cf436a8d0a5001fba0b..0000000000000000000000000000000000000000 --- a/examples/js/wip/benchmark/TypedGeometry.js +++ /dev/null @@ -1,178 +0,0 @@ -THREE.TypedVector2 = function ( array, offset ) { - - this.array = array; - this.offset = offset * 2; - -}; - -THREE.TypedVector2.prototype = { - - constructor: THREE.TypedVector2, - - get x () { - - return this.array[ this.offset ]; - - }, - - set x ( value ) { - - this.array[ this.offset ] = value; - - }, - - get y () { - - return this.array[ this.offset + 1 ]; - - }, - - set y ( value ) { - - this.array[ this.offset + 1 ] = value; - - }, - - set: function ( x, y ) { - - this.array[ this.offset ] = x; - this.array[ this.offset + 1 ] = y; - return this; - - } - -}; - -THREE.TypedVector3 = function ( array, offset ) { - - this.array = array; - this.offset = offset * 3; - -}; - -THREE.TypedVector3.prototype = { - - constructor: THREE.TypedVector3, - - get x () { - - return this.array[ this.offset ]; - - }, - - set x ( value ) { - - this.array[ this.offset ] = value; - - }, - - get y () { - - return this.array[ this.offset + 1 ]; - - }, - - set y ( value ) { - - this.array[ this.offset + 1 ] = value; - - }, - - get z () { - - return this.array[ this.offset + 2 ]; - - }, - - set z ( value ) { - - this.array[ this.offset + 2 ] = value; - - }, - - set: function ( x, y, z ) { - - this.array[ this.offset ] = x; - this.array[ this.offset + 1 ] = y; - this.array[ this.offset + 2 ] = z; - return this; - - }, - - toString: function () { - - return '[' + this.array[ this.offset ] + ',' + this.array[ this.offset + 1 ] + ',' + this.array[ this.offset + 2 ] + ']'; - - } - -}; - -THREE.TypedFace = function ( positions, normals, uvs, offset ) { - - this.positions = positions; - this.normals = normals; - this.uvs = uvs; - this.offset = offset * 3; - -}; - -THREE.TypedFace.prototype = { - - constructor: THREE.TypedFace, - - vertex: function ( index ) { - - return new THREE.TypedVector3( this.positions, this.offset + index ); - - }, - - normal: function ( index ) { - - return new THREE.TypedVector3( this.normals, this.offset + index ); - - }, - - uv: function ( index ) { - - return new THREE.TypedVector2( this.uvs, this.offset + index ); - - } - -}; - - -THREE.TypedGeometry = function ( size ) { - - this.id = THREE.GeometryIdCount ++; - this.uuid = THREE.Math.generateUUID(); - - this.name = ''; - - this.positions = new Float32Array( size * 3 * 3 ); - this.normals = new Float32Array( size * 3 * 3 ); - this.uvs = new Float32Array( size * 3 * 2 ); - - this.boundingBox = null; - this.boundingSphere = null; - -}; - -THREE.TypedGeometry.prototype = { - - constructor: THREE.TypedGeometry, - - face: function ( index ) { - - return new THREE.TypedFace( this.positions, this.normals, this.uvs, index ); - - }, - - dispose: function () { - - this.dispatchEvent( { type: 'dispose' } ); - - } - -}; - -THREE.EventDispatcher.prototype.apply( THREE.TypedGeometry.prototype ); diff --git a/examples/js/wip/proxies/MultiColor.js b/examples/js/wip/proxies/MultiColor.js deleted file mode 100644 index 1d62306f45ca875686213d530a6b5eae13231822..0000000000000000000000000000000000000000 --- a/examples/js/wip/proxies/MultiColor.js +++ /dev/null @@ -1,39 +0,0 @@ -// Allows updating of multiple THREE.Color objects with the same value -// Used for face.color -> face.vertexColor[] compatibility layer for non-indexed geometry - -THREE.MultiColor = function(links) { - - this.links = links; - -}; - -THREE.MultiColor.prototype = Object.create( THREE.Color.prototype ); -THREE.MultiColor.prototype.constructor = THREE.MultiColor; - -THREE.MultiColor.prototype.setAll = function(axis, value) { - - for (var i = 0, l = this.links.length; i < l; i ++) { - - this.links[i][axis] = value; - - } - -}; - -// Getters return value from the first linked color -// Setters set the same value for all linked colors -Object.defineProperties( THREE.MultiColor.prototype, { - 'r': { - get: function () { return (this.links[0] ? this.links[0].r : 0); }, - set: function ( v ) { this.setAll('r', v); } - }, - 'g': { - get: function () { return (this.links[0] ? this.links[0].g : 0); }, - set: function ( v ) { this.setAll('g', v); } - }, - 'b': { - get: function () { return (this.links[0] ? this.links[0].b : 0); }, - set: function ( v ) { this.setAll('b', v); } - } -} ); - diff --git a/examples/js/wip/proxies/MultiVector3.js b/examples/js/wip/proxies/MultiVector3.js deleted file mode 100644 index 956913627b03311a96a35d050fb642a7a147afe0..0000000000000000000000000000000000000000 --- a/examples/js/wip/proxies/MultiVector3.js +++ /dev/null @@ -1,40 +0,0 @@ -// Allows updating of multiple THREE.Vector3 objects with the same value -// Used for face.normal -> face.vertexNormal[] compatibility layer for FlatShading - -THREE.MultiVector3 = function(links) { - - this.links = links; - -}; - -THREE.MultiVector3.prototype = Object.create( THREE.Vector3.prototype ); -THREE.MultiVector3.prototype.constructor = THREE.MultiVector3; - -THREE.MultiVector3.prototype.setAll = function(axis, value) { - - for (var i = 0, l = this.links.length; i < l; i ++) { - - this.links[i][axis] = value; - - } - -}; - -// Getters return value from the first linked vector -// Setters set the same value for all linked vectors -Object.defineProperties( THREE.MultiVector3.prototype, { - 'x': { - get: function () { return (this.links[0] ? this.links[0].x : 0); }, - set: function ( v ) { this.setAll('x', v); } - }, - 'y': { - get: function () { return (this.links[0] ? this.links[0].y : 0); }, - set: function ( v ) { this.setAll('y', v); } - }, - 'z': { - get: function () { return (this.links[0] ? this.links[0].z : 0); }, - set: function ( v ) { this.setAll('z', v); } - } -} ); - - diff --git a/examples/js/wip/proxies/ProxyColor.js b/examples/js/wip/proxies/ProxyColor.js deleted file mode 100644 index 69e83ba60cf7f094d84b29e7aa7376a5c053e40f..0000000000000000000000000000000000000000 --- a/examples/js/wip/proxies/ProxyColor.js +++ /dev/null @@ -1,33 +0,0 @@ -/** - * @author mrdoob / http://mrdoob.com/ - * @author jbaicoianu / http://baicoianu.com/ - */ - -THREE.ProxyColor = function ( array, offset ) { - - this.array = array; - this.offset = offset; - -}; - -THREE.ProxyColor.prototype = Object.create( THREE.Color.prototype ); -THREE.ProxyColor.prototype.constructor = THREE.ProxyColor; - -Object.defineProperties( THREE.ProxyColor.prototype, { - 'r': { - enumerable: true, - get: function () { return this.array[ this.offset ]; }, - set: function ( v ) { this.array[ this.offset ] = v; } - }, - 'g': { - enumerable: true, - get: function () { return this.array[ this.offset + 1 ]; }, - set: function ( v ) { this.array[ this.offset + 1 ] = v; } - }, - 'b': { - enumerable: true, - get: function () { return this.array[ this.offset + 2 ]; }, - set: function ( v ) { this.array[ this.offset + 2 ] = v; } - } -} ); - diff --git a/examples/js/wip/proxies/ProxyFace3.js b/examples/js/wip/proxies/ProxyFace3.js deleted file mode 100644 index 783a2d5069df528f209187a8d4b8c1feba287276..0000000000000000000000000000000000000000 --- a/examples/js/wip/proxies/ProxyFace3.js +++ /dev/null @@ -1,40 +0,0 @@ -/** - * @author jbaicoianu / http://baicoianu.com/ - */ - -THREE.ProxyFace3 = function ( array, offset, vertexNormals, vertexColors, vertexTangents ) { - - this.array = array; - this.offset = offset; - this.vertexNormals = vertexNormals || []; - this.vertexColors = vertexColors || []; - this.vertexTangents = vertexTangents || []; - - this.normal = new THREE.MultiVector3( this.vertexNormals ); - this.color = new THREE.MultiColor( this.vertexColors ); - - //THREE.Face3.call( this, array[offset], array[offset+1], array[offset+2] /*, normal, color, materialIndex */); - -}; - -THREE.ProxyFace3.prototype = Object.create( THREE.Face3.prototype ); -THREE.ProxyFace3.prototype.constructor = THREE.ProxyFace3; - -Object.defineProperties( THREE.ProxyFace3.prototype, { - 'a': { - enumerable: true, - get: function () { return this.array[ this.offset ]; }, - set: function ( v ) { this.array[ this.offset ] = v; } - }, - 'b': { - enumerable: true, - get: function () { return this.array[ this.offset + 1 ]; }, - set: function ( v ) { this.array[ this.offset + 1 ] = v; } - }, - 'c': { - enumerable: true, - get: function () { return this.array[ this.offset + 2 ]; }, - set: function ( v ) { this.array[ this.offset + 2 ] = v; } - }, -} ); - diff --git a/examples/js/wip/proxies/ProxyVector2.js b/examples/js/wip/proxies/ProxyVector2.js deleted file mode 100644 index f1c81af60e7126fb80c2d1698e751fa437e520da..0000000000000000000000000000000000000000 --- a/examples/js/wip/proxies/ProxyVector2.js +++ /dev/null @@ -1,26 +0,0 @@ -/** - * @author mrdoob / http://mrdoob.com/ - * @author jbaicoianu / http://baicoianu.com/ - */ - -THREE.ProxyVector2 = function ( array, offset ) { - - this.array = array; - this.offset = offset; - -}; - -THREE.ProxyVector2.prototype = Object.create( THREE.Vector2.prototype ); -THREE.ProxyVector2.prototype.constructor = THREE.ProxyVector2; - -Object.defineProperties( THREE.ProxyVector2.prototype, { - 'x': { - get: function () { return this.array[ this.offset ]; }, - set: function ( v ) { this.array[ this.offset ] = v; } - }, - 'y': { - get: function () { return this.array[ this.offset + 1 ]; }, - set: function ( v ) { this.array[ this.offset + 1 ] = v; } - } -} ); - diff --git a/examples/js/wip/proxies/ProxyVector3.js b/examples/js/wip/proxies/ProxyVector3.js deleted file mode 100644 index 22689142b48b22b0e0a2708a2d343e43da6407f9..0000000000000000000000000000000000000000 --- a/examples/js/wip/proxies/ProxyVector3.js +++ /dev/null @@ -1,30 +0,0 @@ -/** - * @author mrdoob / http://mrdoob.com/ - * @author jbaicoianu / http://baicoianu.com/ - */ - -THREE.ProxyVector3 = function ( array, offset ) { - - this.array = array; - this.offset = offset; - -}; - -THREE.ProxyVector3.prototype = Object.create( THREE.Vector3.prototype ); -THREE.ProxyVector3.prototype.constructor = THREE.ProxyVector3; - -Object.defineProperties( THREE.ProxyVector3.prototype, { - 'x': { - get: function () { return this.array[ this.offset ]; }, - set: function ( v ) { this.array[ this.offset ] = v; } - }, - 'y': { - get: function () { return this.array[ this.offset + 1 ]; }, - set: function ( v ) { this.array[ this.offset + 1 ] = v; } - }, - 'z': { - get: function () { return this.array[ this.offset + 2 ]; }, - set: function ( v ) { this.array[ this.offset + 2 ] = v; } - } -} ); - diff --git a/examples/js/wip/proxies/ProxyVector4.js b/examples/js/wip/proxies/ProxyVector4.js deleted file mode 100644 index 501a42851f4e031614dd055b5e217685cdd0e5f8..0000000000000000000000000000000000000000 --- a/examples/js/wip/proxies/ProxyVector4.js +++ /dev/null @@ -1,34 +0,0 @@ -/** - * @author mrdoob / http://mrdoob.com/ - * @author jbaicoianu / http://baicoianu.com/ - */ - -THREE.ProxyVector4 = function ( array, offset ) { - - this.array = array; - this.offset = offset; - -}; - -THREE.ProxyVector4.prototype = Object.create( THREE.Vector4.prototype ); -THREE.ProxyVector4.prototype.constructor = THREE.ProxyVector4; - -Object.defineProperties( THREE.ProxyVector4.prototype, { - 'x': { - get: function () { return this.array[ this.offset ]; }, - set: function ( v ) { this.array[ this.offset ] = v; } - }, - 'y': { - get: function () { return this.array[ this.offset + 1 ]; }, - set: function ( v ) { this.array[ this.offset + 1 ] = v; } - }, - 'z': { - get: function () { return this.array[ this.offset + 2 ]; }, - set: function ( v ) { this.array[ this.offset + 2 ] = v; } - }, - 'w': { - get: function () { return this.array[ this.offset + 3 ]; }, - set: function ( v ) { this.array[ this.offset + 3 ] = v; } - } -} ); - diff --git a/examples/webgl_geometry_minecraft.html b/examples/webgl_geometry_minecraft.html index 77108b3d9884160cef6fd94f5a200272f8d2356d..706232415aba04f48e53bff1870b3d5201f5d6b2 100644 --- a/examples/webgl_geometry_minecraft.html +++ b/examples/webgl_geometry_minecraft.html @@ -49,10 +49,6 @@ - - - -