|
@@ -351,13 +351,13 @@ false,a=0;for(c=P.length;a<c;a++){d=P[a];if(d.program===b){d.usedTimes--;d.usedT
|
|
|
i.createBuffer();if(a.hasUvs&&!a.__webglUvBuffer)a.__webglUvBuffer=i.createBuffer();if(a.hasColors&&!a.__webglColorBuffer)a.__webglColorBuffer=i.createBuffer();if(a.hasPositions){i.bindBuffer(i.ARRAY_BUFFER,a.__webglVertexBuffer);i.bufferData(i.ARRAY_BUFFER,a.positionArray,i.DYNAMIC_DRAW);i.enableVertexAttribArray(b.attributes.position);i.vertexAttribPointer(b.attributes.position,3,i.FLOAT,false,0,0)}if(a.hasNormals){i.bindBuffer(i.ARRAY_BUFFER,a.__webglNormalBuffer);if(c.shading===THREE.FlatShading){var d,
|
|
|
e,f,g,h,k,j,l,m,n,o,r=a.count*3;for(o=0;o<r;o=o+9){n=a.normalArray;d=n[o];e=n[o+1];f=n[o+2];g=n[o+3];k=n[o+4];l=n[o+5];h=n[o+6];j=n[o+7];m=n[o+8];d=(d+g+h)/3;e=(e+k+j)/3;f=(f+l+m)/3;n[o]=d;n[o+1]=e;n[o+2]=f;n[o+3]=d;n[o+4]=e;n[o+5]=f;n[o+6]=d;n[o+7]=e;n[o+8]=f}}i.bufferData(i.ARRAY_BUFFER,a.normalArray,i.DYNAMIC_DRAW);i.enableVertexAttribArray(b.attributes.normal);i.vertexAttribPointer(b.attributes.normal,3,i.FLOAT,false,0,0)}if(a.hasUvs&&c.map){i.bindBuffer(i.ARRAY_BUFFER,a.__webglUvBuffer);i.bufferData(i.ARRAY_BUFFER,
|
|
|
a.uvArray,i.DYNAMIC_DRAW);i.enableVertexAttribArray(b.attributes.uv);i.vertexAttribPointer(b.attributes.uv,2,i.FLOAT,false,0,0)}if(a.hasColors&&c.vertexColors!==THREE.NoColors){i.bindBuffer(i.ARRAY_BUFFER,a.__webglColorBuffer);i.bufferData(i.ARRAY_BUFFER,a.colorArray,i.DYNAMIC_DRAW);i.enableVertexAttribArray(b.attributes.color);i.vertexAttribPointer(b.attributes.color,3,i.FLOAT,false,0,0)}i.drawArrays(i.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,e,f){if(d.visible!==false){c=
|
|
|
-q(a,b,c,d,f);a=c.attributes;b=false;d=e.id*16777215+c.id*2+(d.wireframe?1:0);if(d!==ca){ca=d;b=true}if(f instanceof THREE.Mesh){f=e.offsets;d=0;for(c=f.length;d<c;++d){if(b){var g=e.vertexPositionBuffer.itemSize;i.bindBuffer(i.ARRAY_BUFFER,e.vertexPositionBuffer);i.vertexAttribPointer(a.position,g,i.FLOAT,false,0,f[d].index*g*4);if(a.normal>=0&&e.vertexNormalBuffer){g=e.vertexNormalBuffer.itemSize;i.bindBuffer(i.ARRAY_BUFFER,e.vertexNormalBuffer);i.vertexAttribPointer(a.normal,g,i.FLOAT,false,0,f[d].index*
|
|
|
-g*4)}if(a.uv>=0&&e.vertexUvBuffer)if(e.vertexUvBuffer){g=e.vertexUvBuffer.itemSize;i.bindBuffer(i.ARRAY_BUFFER,e.vertexUvBuffer);i.vertexAttribPointer(a.uv,g,i.FLOAT,false,0,f[d].index*g*4);i.enableVertexAttribArray(a.uv)}else i.disableVertexAttribArray(a.uv);if(a.color>=0&&e.vertexColorBuffer){g=e.vertexColorBuffer.itemSize;i.bindBuffer(i.ARRAY_BUFFER,e.vertexColorBuffer);i.vertexAttribPointer(a.color,g,i.FLOAT,false,0,f[d].index*g*4)}i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.vertexIndexBuffer)}i.drawElements(i.TRIANGLES,
|
|
|
-f[d].count,i.UNSIGNED_SHORT,f[d].start*2);D.info.render.calls++;D.info.render.vertices=D.info.render.vertices+f[d].count;D.info.render.faces=D.info.render.faces+f[d].count/3}}}};this.renderBuffer=function(a,b,c,d,e,f){if(d.visible!==false){var g,k,c=q(a,b,c,d,f),b=c.attributes,a=false,c=e.id*16777215+c.id*2+(d.wireframe?1:0);if(c!==ca){ca=c;a=true}if(!d.morphTargets&&b.position>=0){if(a){i.bindBuffer(i.ARRAY_BUFFER,e.__webglVertexBuffer);i.vertexAttribPointer(b.position,3,i.FLOAT,false,0,0)}}else if(f.morphTargetBase){c=
|
|
|
-d.program.attributes;if(f.morphTargetBase!==-1){i.bindBuffer(i.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[f.morphTargetBase]);i.vertexAttribPointer(c.position,3,i.FLOAT,false,0,0)}else if(c.position>=0){i.bindBuffer(i.ARRAY_BUFFER,e.__webglVertexBuffer);i.vertexAttribPointer(c.position,3,i.FLOAT,false,0,0)}if(f.morphTargetForcedOrder.length){var j=0;k=f.morphTargetForcedOrder;for(g=f.morphTargetInfluences;j<d.numSupportedMorphTargets&&j<k.length;){i.bindBuffer(i.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[k[j]]);
|
|
|
-i.vertexAttribPointer(c["morphTarget"+j],3,i.FLOAT,false,0,0);if(d.morphNormals){i.bindBuffer(i.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[k[j]]);i.vertexAttribPointer(c["morphNormal"+j],3,i.FLOAT,false,0,0)}f.__webglMorphTargetInfluences[j]=g[k[j]];j++}}else{k=[];g=f.morphTargetInfluences;var l,m=g.length;for(l=0;l<m;l++){j=g[l];j>0&&k.push([l,j])}if(k.length>d.numSupportedMorphTargets){k.sort(h);k.length=d.numSupportedMorphTargets}else k.length>d.numSupportedMorphNormals?k.sort(h):k.length===0&&
|
|
|
-k.push([0,0]);for(j=0;j<d.numSupportedMorphTargets;){if(k[j]){l=k[j][0];i.bindBuffer(i.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[l]);i.vertexAttribPointer(c["morphTarget"+j],3,i.FLOAT,false,0,0);if(d.morphNormals){i.bindBuffer(i.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[l]);i.vertexAttribPointer(c["morphNormal"+j],3,i.FLOAT,false,0,0)}f.__webglMorphTargetInfluences[j]=g[l]}else{i.vertexAttribPointer(c["morphTarget"+j],3,i.FLOAT,false,0,0);d.morphNormals&&i.vertexAttribPointer(c["morphNormal"+j],3,
|
|
|
-i.FLOAT,false,0,0);f.__webglMorphTargetInfluences[j]=0}j++}}d.program.uniforms.morphTargetInfluences!==null&&i.uniform1fv(d.program.uniforms.morphTargetInfluences,f.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList){g=0;for(k=e.__webglCustomAttributesList.length;g<k;g++){c=e.__webglCustomAttributesList[g];if(b[c.buffer.belongsToAttribute]>=0){i.bindBuffer(i.ARRAY_BUFFER,c.buffer);i.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,i.FLOAT,false,0,0)}}}if(b.color>=0){i.bindBuffer(i.ARRAY_BUFFER,
|
|
|
+q(a,b,c,d,f);a=c.attributes;b=false;d=e.id*16777215+c.id*2+(d.wireframe?1:0);if(d!==ca){ca=d;b=true}if(f instanceof THREE.Mesh){f=e.offsets;f.length>1&&(b=true);d=0;for(c=f.length;d<c;++d){if(b){var g=e.vertexPositionBuffer.itemSize;i.bindBuffer(i.ARRAY_BUFFER,e.vertexPositionBuffer);i.vertexAttribPointer(a.position,g,i.FLOAT,false,0,f[d].index*g*4);if(a.normal>=0&&e.vertexNormalBuffer){g=e.vertexNormalBuffer.itemSize;i.bindBuffer(i.ARRAY_BUFFER,e.vertexNormalBuffer);i.vertexAttribPointer(a.normal,
|
|
|
+g,i.FLOAT,false,0,f[d].index*g*4)}if(a.uv>=0&&e.vertexUvBuffer)if(e.vertexUvBuffer){g=e.vertexUvBuffer.itemSize;i.bindBuffer(i.ARRAY_BUFFER,e.vertexUvBuffer);i.vertexAttribPointer(a.uv,g,i.FLOAT,false,0,f[d].index*g*4);i.enableVertexAttribArray(a.uv)}else i.disableVertexAttribArray(a.uv);if(a.color>=0&&e.vertexColorBuffer){g=e.vertexColorBuffer.itemSize;i.bindBuffer(i.ARRAY_BUFFER,e.vertexColorBuffer);i.vertexAttribPointer(a.color,g,i.FLOAT,false,0,f[d].index*g*4)}i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,
|
|
|
+e.vertexIndexBuffer)}i.drawElements(i.TRIANGLES,f[d].count,i.UNSIGNED_SHORT,f[d].start*2);D.info.render.calls++;D.info.render.vertices=D.info.render.vertices+f[d].count;D.info.render.faces=D.info.render.faces+f[d].count/3}}}};this.renderBuffer=function(a,b,c,d,e,f){if(d.visible!==false){var g,k,c=q(a,b,c,d,f),b=c.attributes,a=false,c=e.id*16777215+c.id*2+(d.wireframe?1:0);if(c!==ca){ca=c;a=true}if(!d.morphTargets&&b.position>=0){if(a){i.bindBuffer(i.ARRAY_BUFFER,e.__webglVertexBuffer);i.vertexAttribPointer(b.position,
|
|
|
+3,i.FLOAT,false,0,0)}}else if(f.morphTargetBase){c=d.program.attributes;if(f.morphTargetBase!==-1){i.bindBuffer(i.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[f.morphTargetBase]);i.vertexAttribPointer(c.position,3,i.FLOAT,false,0,0)}else if(c.position>=0){i.bindBuffer(i.ARRAY_BUFFER,e.__webglVertexBuffer);i.vertexAttribPointer(c.position,3,i.FLOAT,false,0,0)}if(f.morphTargetForcedOrder.length){var j=0;k=f.morphTargetForcedOrder;for(g=f.morphTargetInfluences;j<d.numSupportedMorphTargets&&j<k.length;){i.bindBuffer(i.ARRAY_BUFFER,
|
|
|
+e.__webglMorphTargetsBuffers[k[j]]);i.vertexAttribPointer(c["morphTarget"+j],3,i.FLOAT,false,0,0);if(d.morphNormals){i.bindBuffer(i.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[k[j]]);i.vertexAttribPointer(c["morphNormal"+j],3,i.FLOAT,false,0,0)}f.__webglMorphTargetInfluences[j]=g[k[j]];j++}}else{k=[];g=f.morphTargetInfluences;var l,m=g.length;for(l=0;l<m;l++){j=g[l];j>0&&k.push([l,j])}if(k.length>d.numSupportedMorphTargets){k.sort(h);k.length=d.numSupportedMorphTargets}else k.length>d.numSupportedMorphNormals?
|
|
|
+k.sort(h):k.length===0&&k.push([0,0]);for(j=0;j<d.numSupportedMorphTargets;){if(k[j]){l=k[j][0];i.bindBuffer(i.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[l]);i.vertexAttribPointer(c["morphTarget"+j],3,i.FLOAT,false,0,0);if(d.morphNormals){i.bindBuffer(i.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[l]);i.vertexAttribPointer(c["morphNormal"+j],3,i.FLOAT,false,0,0)}f.__webglMorphTargetInfluences[j]=g[l]}else{i.vertexAttribPointer(c["morphTarget"+j],3,i.FLOAT,false,0,0);d.morphNormals&&i.vertexAttribPointer(c["morphNormal"+
|
|
|
+j],3,i.FLOAT,false,0,0);f.__webglMorphTargetInfluences[j]=0}j++}}d.program.uniforms.morphTargetInfluences!==null&&i.uniform1fv(d.program.uniforms.morphTargetInfluences,f.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList){g=0;for(k=e.__webglCustomAttributesList.length;g<k;g++){c=e.__webglCustomAttributesList[g];if(b[c.buffer.belongsToAttribute]>=0){i.bindBuffer(i.ARRAY_BUFFER,c.buffer);i.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,i.FLOAT,false,0,0)}}}if(b.color>=0){i.bindBuffer(i.ARRAY_BUFFER,
|
|
|
e.__webglColorBuffer);i.vertexAttribPointer(b.color,3,i.FLOAT,false,0,0)}if(b.normal>=0){i.bindBuffer(i.ARRAY_BUFFER,e.__webglNormalBuffer);i.vertexAttribPointer(b.normal,3,i.FLOAT,false,0,0)}if(b.tangent>=0){i.bindBuffer(i.ARRAY_BUFFER,e.__webglTangentBuffer);i.vertexAttribPointer(b.tangent,4,i.FLOAT,false,0,0)}if(b.uv>=0)if(e.__webglUVBuffer){i.bindBuffer(i.ARRAY_BUFFER,e.__webglUVBuffer);i.vertexAttribPointer(b.uv,2,i.FLOAT,false,0,0);i.enableVertexAttribArray(b.uv)}else i.disableVertexAttribArray(b.uv);
|
|
|
if(b.uv2>=0)if(e.__webglUV2Buffer){i.bindBuffer(i.ARRAY_BUFFER,e.__webglUV2Buffer);i.vertexAttribPointer(b.uv2,2,i.FLOAT,false,0,0);i.enableVertexAttribArray(b.uv2)}else i.disableVertexAttribArray(b.uv2);if(d.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0){i.bindBuffer(i.ARRAY_BUFFER,e.__webglSkinVertexABuffer);i.vertexAttribPointer(b.skinVertexA,4,i.FLOAT,false,0,0);i.bindBuffer(i.ARRAY_BUFFER,e.__webglSkinVertexBBuffer);i.vertexAttribPointer(b.skinVertexB,4,i.FLOAT,
|
|
|
false,0,0);i.bindBuffer(i.ARRAY_BUFFER,e.__webglSkinIndicesBuffer);i.vertexAttribPointer(b.skinIndex,4,i.FLOAT,false,0,0);i.bindBuffer(i.ARRAY_BUFFER,e.__webglSkinWeightsBuffer);i.vertexAttribPointer(b.skinWeight,4,i.FLOAT,false,0,0)}}if(f instanceof THREE.Mesh){if(d.wireframe){d=d.wireframeLinewidth;if(d!==$a){i.lineWidth(d);$a=d}a&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer);i.drawElements(i.LINES,e.__webglLineCount,i.UNSIGNED_SHORT,0)}else{a&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer);
|