提交 7d3e4825 编写于 作者: M Mr.doob

Merge remote-tracking branch 'alteredq/dev' into dev

......@@ -236,7 +236,7 @@ n);else if(x=="v3v"){if(!w._array)w._array=new Float32Array(3*n.length);x=0;for(
n),v=w.texture)if(v.image instanceof Array&&v.image.length==6){if(w=v,w.image.length==6)if(w.needsUpdate){if(!w.image.__webglTextureCube)w.image.__webglTextureCube=o.createTexture();o.activeTexture(o.TEXTURE0+n);o.bindTexture(o.TEXTURE_CUBE_MAP,w.image.__webglTextureCube);for(n=0;n<6;n++)o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+n,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,w.image[n]);B(o.TEXTURE_CUBE_MAP,w,w.image[0]);w.needsUpdate=!1}else o.activeTexture(o.TEXTURE0+n),o.bindTexture(o.TEXTURE_CUBE_MAP,w.image.__webglTextureCube)}else v instanceof
THREE.WebGLRenderTargetCube?(w=v,o.activeTexture(o.TEXTURE0+n),o.bindTexture(o.TEXTURE_CUBE_MAP,w.__webglTexture)):M(v,n)}else if(x=="tv"){if(!w._array){w._array=[];x=0;for(H=w.texture.length;x<H;x++)w._array[x]=n+x}o.uniform1iv(v,w._array);x=0;for(H=w.texture.length;x<H;x++)(v=w.texture[x])&&M(v,w._array[x])}(f instanceof THREE.ShaderMaterial||f instanceof THREE.MeshPhongMaterial||f.envMap)&&m.cameraPosition!==null&&o.uniform3f(m.cameraPosition,b.position.x,b.position.y,b.position.z);(f instanceof
THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.ShaderMaterial||f.skinning)&&m.viewMatrix!==null&&o.uniformMatrix4fv(m.viewMatrix,!1,Ea);f.skinning&&(o.uniformMatrix4fv(m.cameraInverseMatrix,!1,Ea),o.uniformMatrix4fv(m.boneGlobalMatrices,!1,k.boneMatrices))}o.uniformMatrix4fv(m.modelViewMatrix,!1,k._modelViewMatrixArray);m.normalMatrix&&o.uniformMatrix3fv(m.normalMatrix,!1,k._normalMatrixArray);(f instanceof THREE.ShaderMaterial||f.envMap||f.skinning||k.receiveShadow)&&
m.objectMatrix!==null&&o.uniformMatrix4fv(m.objectMatrix,!1,k._objectMatrixArray);return h}function f(b,c,f,k,h,m){if(k.opacity!=0){var n,f=e(b,c,f,k,m),b=f.attributes,c=!1,f=h.id*16777215+f.id;f!=oa&&(oa=f,c=!0);if(!k.morphTargets&&b.position>=0)c&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglVertexBuffer),o.vertexAttribPointer(b.position,3,o.FLOAT,!1,0,0));else if(m.morphTargetBase){f=k.program.attributes;m.morphTargetBase!==-1?(o.bindBuffer(o.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[m.morphTargetBase]),
m.objectMatrix!==null&&o.uniformMatrix4fv(m.objectMatrix,!1,k._objectMatrixArray);return h}function f(b,c,f,k,h,m){if(k.opacity!=0){var n,f=e(b,c,f,k,m),b=f.attributes,c=!1,f=h.id*16777215+f.id*2+(k.wireframe?1:0);f!=oa&&(oa=f,c=!0);if(!k.morphTargets&&b.position>=0)c&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglVertexBuffer),o.vertexAttribPointer(b.position,3,o.FLOAT,!1,0,0));else if(m.morphTargetBase){f=k.program.attributes;m.morphTargetBase!==-1?(o.bindBuffer(o.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[m.morphTargetBase]),
o.vertexAttribPointer(f.position,3,o.FLOAT,!1,0,0)):f.position>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglVertexBuffer),o.vertexAttribPointer(f.position,3,o.FLOAT,!1,0,0));if(m.morphTargetForcedOrder.length)for(var p=0,t=m.morphTargetForcedOrder,u=m.morphTargetInfluences;p<k.numSupportedMorphTargets&&p<t.length;)o.bindBuffer(o.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[t[p]]),o.vertexAttribPointer(f["morphTarget"+p],3,o.FLOAT,!1,0,0),m.__webglMorphTargetInfluences[p]=u[t[p]],p++;else{var t=[],w=-1,
x=0,u=m.morphTargetInfluences,v,H=u.length,p=0;for(m.morphTargetBase!==-1&&(t[m.morphTargetBase]=!0);p<k.numSupportedMorphTargets;){for(v=0;v<H;v++)!t[v]&&u[v]>w&&(x=v,w=u[x]);o.bindBuffer(o.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[x]);o.vertexAttribPointer(f["morphTarget"+p],3,o.FLOAT,!1,0,0);m.__webglMorphTargetInfluences[p]=w;t[x]=1;w=-1;p++}}k.program.uniforms.morphTargetInfluences!==null&&o.uniform1fv(k.program.uniforms.morphTargetInfluences,m.__webglMorphTargetInfluences)}if(c){if(h.__webglCustomAttributes)for(n in h.__webglCustomAttributes)b[n]>=
0&&(f=h.__webglCustomAttributes[n],o.bindBuffer(o.ARRAY_BUFFER,f.buffer),o.vertexAttribPointer(b[n],f.size,o.FLOAT,!1,0,0));b.color>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglColorBuffer),o.vertexAttribPointer(b.color,3,o.FLOAT,!1,0,0));b.normal>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglNormalBuffer),o.vertexAttribPointer(b.normal,3,o.FLOAT,!1,0,0));b.tangent>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglTangentBuffer),o.vertexAttribPointer(b.tangent,4,o.FLOAT,!1,0,0));b.uv>=0&&(h.__webglUVBuffer?(o.bindBuffer(o.ARRAY_BUFFER,
......
......@@ -192,7 +192,7 @@ k);else if(C=="v3v"){if(!n._array)n._array=new Float32Array(3*k.length);C=0;for(
k),q=n.texture)if(q.image instanceof Array&&q.image.length==6){if(n=q,n.image.length==6)if(n.needsUpdate){if(!n.image.__webglTextureCube)n.image.__webglTextureCube=f.createTexture();f.activeTexture(f.TEXTURE0+k);f.bindTexture(f.TEXTURE_CUBE_MAP,n.image.__webglTextureCube);for(k=0;k<6;k++)f.texImage2D(f.TEXTURE_CUBE_MAP_POSITIVE_X+k,0,f.RGBA,f.RGBA,f.UNSIGNED_BYTE,n.image[k]);v(f.TEXTURE_CUBE_MAP,n,n.image[0]);n.needsUpdate=!1}else f.activeTexture(f.TEXTURE0+k),f.bindTexture(f.TEXTURE_CUBE_MAP,n.image.__webglTextureCube)}else q instanceof
THREE.WebGLRenderTargetCube?(n=q,f.activeTexture(f.TEXTURE0+k),f.bindTexture(f.TEXTURE_CUBE_MAP,n.__webglTexture)):U(q,k)}else if(C=="tv"){if(!n._array){n._array=[];C=0;for(m=n.texture.length;C<m;C++)n._array[C]=k+C}f.uniform1iv(q,n._array);C=0;for(m=n.texture.length;C<m;C++)(q=n.texture[C])&&U(q,n._array[C])}(e instanceof THREE.ShaderMaterial||e instanceof THREE.MeshPhongMaterial||e.envMap)&&j.cameraPosition!==null&&f.uniform3f(j.cameraPosition,b.position.x,b.position.y,b.position.z);(e instanceof
THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.ShaderMaterial||e.skinning)&&j.viewMatrix!==null&&f.uniformMatrix4fv(j.viewMatrix,!1,Va);e.skinning&&(f.uniformMatrix4fv(j.cameraInverseMatrix,!1,Va),f.uniformMatrix4fv(j.boneGlobalMatrices,!1,i.boneMatrices))}f.uniformMatrix4fv(j.modelViewMatrix,!1,i._modelViewMatrixArray);j.normalMatrix&&f.uniformMatrix3fv(j.normalMatrix,!1,i._normalMatrixArray);(e instanceof THREE.ShaderMaterial||e.envMap||e.skinning||i.receiveShadow)&&
j.objectMatrix!==null&&f.uniformMatrix4fv(j.objectMatrix,!1,i._objectMatrixArray);return h}function e(b,c,e,i,h,j){if(i.opacity!=0){var k,e=d(b,c,e,i,j),b=e.attributes,c=!1,e=h.id*16777215+e.id;e!=S&&(S=e,c=!0);if(!i.morphTargets&&b.position>=0)c&&(f.bindBuffer(f.ARRAY_BUFFER,h.__webglVertexBuffer),f.vertexAttribPointer(b.position,3,f.FLOAT,!1,0,0));else if(j.morphTargetBase){e=i.program.attributes;j.morphTargetBase!==-1?(f.bindBuffer(f.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[j.morphTargetBase]),
j.objectMatrix!==null&&f.uniformMatrix4fv(j.objectMatrix,!1,i._objectMatrixArray);return h}function e(b,c,e,i,h,j){if(i.opacity!=0){var k,e=d(b,c,e,i,j),b=e.attributes,c=!1,e=h.id*16777215+e.id*2+(i.wireframe?1:0);e!=S&&(S=e,c=!0);if(!i.morphTargets&&b.position>=0)c&&(f.bindBuffer(f.ARRAY_BUFFER,h.__webglVertexBuffer),f.vertexAttribPointer(b.position,3,f.FLOAT,!1,0,0));else if(j.morphTargetBase){e=i.program.attributes;j.morphTargetBase!==-1?(f.bindBuffer(f.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[j.morphTargetBase]),
f.vertexAttribPointer(e.position,3,f.FLOAT,!1,0,0)):e.position>=0&&(f.bindBuffer(f.ARRAY_BUFFER,h.__webglVertexBuffer),f.vertexAttribPointer(e.position,3,f.FLOAT,!1,0,0));if(j.morphTargetForcedOrder.length)for(var n=0,x=j.morphTargetForcedOrder,p=j.morphTargetInfluences;n<i.numSupportedMorphTargets&&n<x.length;)f.bindBuffer(f.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[x[n]]),f.vertexAttribPointer(e["morphTarget"+n],3,f.FLOAT,!1,0,0),j.__webglMorphTargetInfluences[n]=p[x[n]],n++;else{var x=[],q=-1,
m=0,p=j.morphTargetInfluences,t,C=p.length,n=0;for(j.morphTargetBase!==-1&&(x[j.morphTargetBase]=!0);n<i.numSupportedMorphTargets;){for(t=0;t<C;t++)!x[t]&&p[t]>q&&(m=t,q=p[m]);f.bindBuffer(f.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[m]);f.vertexAttribPointer(e["morphTarget"+n],3,f.FLOAT,!1,0,0);j.__webglMorphTargetInfluences[n]=q;x[m]=1;q=-1;n++}}i.program.uniforms.morphTargetInfluences!==null&&f.uniform1fv(i.program.uniforms.morphTargetInfluences,j.__webglMorphTargetInfluences)}if(c){if(h.__webglCustomAttributes)for(k in h.__webglCustomAttributes)b[k]>=
0&&(e=h.__webglCustomAttributes[k],f.bindBuffer(f.ARRAY_BUFFER,e.buffer),f.vertexAttribPointer(b[k],e.size,f.FLOAT,!1,0,0));b.color>=0&&(f.bindBuffer(f.ARRAY_BUFFER,h.__webglColorBuffer),f.vertexAttribPointer(b.color,3,f.FLOAT,!1,0,0));b.normal>=0&&(f.bindBuffer(f.ARRAY_BUFFER,h.__webglNormalBuffer),f.vertexAttribPointer(b.normal,3,f.FLOAT,!1,0,0));b.tangent>=0&&(f.bindBuffer(f.ARRAY_BUFFER,h.__webglTangentBuffer),f.vertexAttribPointer(b.tangent,4,f.FLOAT,!1,0,0));b.uv>=0&&(h.__webglUVBuffer?(f.bindBuffer(f.ARRAY_BUFFER,
......
......@@ -2893,7 +2893,8 @@ THREE.WebGLRenderer = function ( parameters ) {
attributes = program.attributes;
var updateBuffers = false,
geometryGroupHash = geometryGroup.id * 0xffffff + program.id;
wireframeBit = material.wireframe ? 1 : 0,
geometryGroupHash = ( geometryGroup.id * 0xffffff ) + ( program.id * 2 ) + wireframeBit;
if ( geometryGroupHash != _currentGeometryGroupHash ) {
......@@ -3694,12 +3695,19 @@ THREE.WebGLRenderer = function ( parameters ) {
_this.info.render.faces = 0;
// hack: find parent of camera.
if (camera.matrixAutoUpdate) {
if ( camera.matrixAutoUpdate ) {
var parent = camera;
while ( parent.parent ) {
parent = parent.parent;
}
parent.update( undefined, true );
}
scene.update( undefined, false, camera );
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册