提交 02bec63c 编写于 作者: M Mr.doob

Updated builds.

上级 3f3cfa27
......@@ -8372,8 +8372,7 @@ THREE.Geometry = function () {
this.name = '';
this.vertices = [];
this.colors = []; // one-to-one vertex colors, used in ParticleSystem, Line and Ribbon
this.normals = []; // one-to-one vertex normals, used in Ribbon
this.colors = []; // one-to-one vertex colors, used in ParticleSystem and Line
this.faces = [];
......@@ -14884,31 +14883,6 @@ THREE.MorphAnimMesh.prototype.clone = function ( object ) {
};
/**
* @author alteredq / http://alteredqualia.com/
*/
THREE.Ribbon = function ( geometry, material ) {
THREE.Object3D.call( this );
this.geometry = geometry;
this.material = material;
};
THREE.Ribbon.prototype = Object.create( THREE.Object3D.prototype );
THREE.Ribbon.prototype.clone = function ( object ) {
if ( object === undefined ) object = new THREE.Ribbon( this.geometry, this.material );
THREE.Object3D.prototype.clone.call( this, object );
return object;
};
/**
* @author mikael emtinger / http://gomo.se/
* @author alteredq / http://alteredqualia.com/
......@@ -19994,16 +19968,6 @@ THREE.WebGLRenderer = function ( parameters ) {
};
function createRibbonBuffers ( geometry ) {
geometry.__webglVertexBuffer = _gl.createBuffer();
geometry.__webglColorBuffer = _gl.createBuffer();
geometry.__webglNormalBuffer = _gl.createBuffer();
_this.info.memory.geometries ++;
};
function createMeshBuffers ( geometryGroup ) {
geometryGroup.__webglVertexBuffer = _gl.createBuffer();
......@@ -20379,20 +20343,6 @@ THREE.WebGLRenderer = function ( parameters ) {
};
function initRibbonBuffers ( geometry, object ) {
var nvertices = geometry.vertices.length;
geometry.__vertexArray = new Float32Array( nvertices * 3 );
geometry.__colorArray = new Float32Array( nvertices * 3 );
geometry.__normalArray = new Float32Array( nvertices * 3 );
geometry.__webglVertexCount = nvertices;
initCustomAttributes ( geometry, object );
};
function initMeshBuffers ( geometryGroup, object ) {
var geometry = object.geometry,
......@@ -21142,182 +21092,6 @@ THREE.WebGLRenderer = function ( parameters ) {
};
function setRibbonBuffers ( geometry, hint ) {
var v, c, n, vertex, offset, color, normal,
i, il, ca, cal, customAttribute, value,
vertices = geometry.vertices,
colors = geometry.colors,
normals = geometry.normals,
vl = vertices.length,
cl = colors.length,
nl = normals.length,
vertexArray = geometry.__vertexArray,
colorArray = geometry.__colorArray,
normalArray = geometry.__normalArray,
dirtyVertices = geometry.verticesNeedUpdate,
dirtyColors = geometry.colorsNeedUpdate,
dirtyNormals = geometry.normalsNeedUpdate,
customAttributes = geometry.__webglCustomAttributesList;
if ( dirtyVertices ) {
for ( v = 0; v < vl; v ++ ) {
vertex = vertices[ v ];
offset = v * 3;
vertexArray[ offset ] = vertex.x;
vertexArray[ offset + 1 ] = vertex.y;
vertexArray[ offset + 2 ] = vertex.z;
}
_gl.bindBuffer( _gl.ARRAY_BUFFER, geometry.__webglVertexBuffer );
_gl.bufferData( _gl.ARRAY_BUFFER, vertexArray, hint );
}
if ( dirtyColors ) {
for ( c = 0; c < cl; c ++ ) {
color = colors[ c ];
offset = c * 3;
colorArray[ offset ] = color.r;
colorArray[ offset + 1 ] = color.g;
colorArray[ offset + 2 ] = color.b;
}
_gl.bindBuffer( _gl.ARRAY_BUFFER, geometry.__webglColorBuffer );
_gl.bufferData( _gl.ARRAY_BUFFER, colorArray, hint );
}
if ( dirtyNormals ) {
for ( n = 0; n < nl; n ++ ) {
normal = normals[ n ];
offset = n * 3;
normalArray[ offset ] = normal.x;
normalArray[ offset + 1 ] = normal.y;
normalArray[ offset + 2 ] = normal.z;
}
_gl.bindBuffer( _gl.ARRAY_BUFFER, geometry.__webglNormalBuffer );
_gl.bufferData( _gl.ARRAY_BUFFER, normalArray, hint );
}
if ( customAttributes ) {
for ( i = 0, il = customAttributes.length; i < il; i ++ ) {
customAttribute = customAttributes[ i ];
if ( customAttribute.needsUpdate &&
( customAttribute.boundTo === undefined ||
customAttribute.boundTo === "vertices" ) ) {
offset = 0;
cal = customAttribute.value.length;
if ( customAttribute.size === 1 ) {
for ( ca = 0; ca < cal; ca ++ ) {
customAttribute.array[ ca ] = customAttribute.value[ ca ];
}
} else if ( customAttribute.size === 2 ) {
for ( ca = 0; ca < cal; ca ++ ) {
value = customAttribute.value[ ca ];
customAttribute.array[ offset ] = value.x;
customAttribute.array[ offset + 1 ] = value.y;
offset += 2;
}
} else if ( customAttribute.size === 3 ) {
if ( customAttribute.type === "c" ) {
for ( ca = 0; ca < cal; ca ++ ) {
value = customAttribute.value[ ca ];
customAttribute.array[ offset ] = value.r;
customAttribute.array[ offset + 1 ] = value.g;
customAttribute.array[ offset + 2 ] = value.b;
offset += 3;
}
} else {
for ( ca = 0; ca < cal; ca ++ ) {
value = customAttribute.value[ ca ];
customAttribute.array[ offset ] = value.x;
customAttribute.array[ offset + 1 ] = value.y;
customAttribute.array[ offset + 2 ] = value.z;
offset += 3;
}
}
} else if ( customAttribute.size === 4 ) {
for ( ca = 0; ca < cal; ca ++ ) {
value = customAttribute.value[ ca ];
customAttribute.array[ offset ] = value.x;
customAttribute.array[ offset + 1 ] = value.y;
customAttribute.array[ offset + 2 ] = value.z;
customAttribute.array[ offset + 3 ] = value.w;
offset += 4;
}
}
_gl.bindBuffer( _gl.ARRAY_BUFFER, customAttribute.buffer );
_gl.bufferData( _gl.ARRAY_BUFFER, customAttribute.array, hint );
}
}
}
};
function setMeshBuffers( geometryGroup, object, hint, dispose, material ) {
if ( ! geometryGroup.__inittedArrays ) {
......@@ -22735,14 +22509,6 @@ THREE.WebGLRenderer = function ( parameters ) {
_this.info.render.calls ++;
_this.info.render.points += geometryGroup.__webglParticleCount;
// render ribbon
} else if ( object instanceof THREE.Ribbon ) {
_gl.drawArrays( _gl.TRIANGLE_STRIP, 0, geometryGroup.__webglVertexCount );
_this.info.render.calls ++;
}
};
......@@ -23536,19 +23302,6 @@ THREE.WebGLRenderer = function ( parameters ) {
}
} else if ( object instanceof THREE.Ribbon ) {
if ( ! geometry.__webglVertexBuffer ) {
createRibbonBuffers( geometry );
initRibbonBuffers( geometry, object );
geometry.verticesNeedUpdate = true;
geometry.colorsNeedUpdate = true;
geometry.normalsNeedUpdate = true;
}
} else if ( object instanceof THREE.Line ) {
if ( ! geometry.__webglVertexBuffer ) {
......@@ -23600,8 +23353,7 @@ THREE.WebGLRenderer = function ( parameters ) {
}
} else if ( object instanceof THREE.Ribbon ||
object instanceof THREE.Line ||
} else if ( object instanceof THREE.Line ||
object instanceof THREE.ParticleSystem ) {
geometry = object.geometry;
......@@ -23707,24 +23459,6 @@ THREE.WebGLRenderer = function ( parameters ) {
material.attributes && clearCustomAttributes( material );
} else if ( object instanceof THREE.Ribbon ) {
material = getBufferMaterial( object, geometry );
customAttributesDirty = material.attributes && areCustomAttributesDirty( material );
if ( geometry.verticesNeedUpdate || geometry.colorsNeedUpdate || geometry.normalsNeedUpdate || customAttributesDirty ) {
setRibbonBuffers( geometry, _gl.DYNAMIC_DRAW );
}
geometry.verticesNeedUpdate = false;
geometry.colorsNeedUpdate = false;
geometry.normalsNeedUpdate = false;
material.attributes && clearCustomAttributes( material );
} else if ( object instanceof THREE.Line ) {
material = getBufferMaterial( object, geometry );
......@@ -23795,7 +23529,6 @@ THREE.WebGLRenderer = function ( parameters ) {
if ( object instanceof THREE.Mesh ||
object instanceof THREE.ParticleSystem ||
object instanceof THREE.Ribbon ||
object instanceof THREE.Line ) {
removeInstances( scene.__webglObjects, object );
......
因为 它太大了无法显示 source diff 。你可以改为 查看blob
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册