|
|
|
@@ -106,9 +106,9 @@ THREE.MeshBasicMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.col
|
|
|
|
|
THREE.MeshLambertMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==void 0?new THREE.Color(b.color):new THREE.Color(16777215);this.ambient=b.ambient!==void 0?new THREE.Color(b.ambient):new THREE.Color(328965);this.map=b.map!==void 0?b.map:null;this.lightMap=b.lightMap!==void 0?b.lightMap:null;this.envMap=b.envMap!==void 0?b.envMap:null;this.combine=b.combine!==void 0?b.combine:THREE.MultiplyOperation;this.reflectivity=b.reflectivity!==void 0?b.reflectivity:1;this.refractionRatio=
|
|
|
|
|
b.refractionRatio!==void 0?b.refractionRatio:0.98;this.fog=b.fog!==void 0?b.fog:!0;this.shading=b.shading!==void 0?b.shading:THREE.SmoothShading;this.wireframe=b.wireframe!==void 0?b.wireframe:!1;this.wireframeLinewidth=b.wireframeLinewidth!==void 0?b.wireframeLinewidth:1;this.wireframeLinecap=b.wireframeLinecap!==void 0?b.wireframeLinecap:"round";this.wireframeLinejoin=b.wireframeLinejoin!==void 0?b.wireframeLinejoin:"round";this.vertexColors=b.vertexColors!==void 0?b.vertexColors:!1;this.skinning=
|
|
|
|
|
b.skinning!==void 0?b.skinning:!1;this.morphTargets=b.morphTargets!==void 0?b.morphTargets:!1};THREE.MeshLambertMaterial.prototype=new THREE.Material;THREE.MeshLambertMaterial.prototype.constructor=THREE.MeshLambertMaterial;
|
|
|
|
|
THREE.MeshPhongMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==void 0?new THREE.Color(b.color):new THREE.Color(16777215);this.ambient=b.ambient!==void 0?new THREE.Color(b.ambient):new THREE.Color(328965);this.specular=b.specular!==void 0?new THREE.Color(b.specular):new THREE.Color(1118481);this.shininess=b.shininess!==void 0?b.shininess:30;this.map=b.map!==void 0?b.map:null;this.lightMap=b.lightMap!==void 0?b.lightMap:null;this.envMap=b.envMap!==void 0?b.envMap:null;
|
|
|
|
|
this.combine=b.combine!==void 0?b.combine:THREE.MultiplyOperation;this.reflectivity=b.reflectivity!==void 0?b.reflectivity:1;this.refractionRatio=b.refractionRatio!==void 0?b.refractionRatio:0.98;this.fog=b.fog!==void 0?b.fog:!0;this.shading=b.shading!==void 0?b.shading:THREE.SmoothShading;this.wireframe=b.wireframe!==void 0?b.wireframe:!1;this.wireframeLinewidth=b.wireframeLinewidth!==void 0?b.wireframeLinewidth:1;this.wireframeLinecap=b.wireframeLinecap!==void 0?b.wireframeLinecap:"round";this.wireframeLinejoin=
|
|
|
|
|
b.wireframeLinejoin!==void 0?b.wireframeLinejoin:"round";this.vertexColors=b.vertexColors!==void 0?b.vertexColors:!1;this.skinning=b.skinning!==void 0?b.skinning:!1;this.morphTargets=b.morphTargets!==void 0?b.morphTargets:!1};THREE.MeshPhongMaterial.prototype=new THREE.Material;THREE.MeshPhongMaterial.prototype.constructor=THREE.MeshPhongMaterial;
|
|
|
|
|
THREE.MeshPhongMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==void 0?new THREE.Color(b.color):new THREE.Color(16777215);this.ambient=b.ambient!==void 0?new THREE.Color(b.ambient):new THREE.Color(328965);this.specular=b.specular!==void 0?new THREE.Color(b.specular):new THREE.Color(1118481);this.shininess=b.shininess!==void 0?b.shininess:30;this.metal=b.metal!==void 0?b.metal:!1;this.map=b.map!==void 0?b.map:null;this.lightMap=b.lightMap!==void 0?b.lightMap:null;this.envMap=
|
|
|
|
|
b.envMap!==void 0?b.envMap:null;this.combine=b.combine!==void 0?b.combine:THREE.MultiplyOperation;this.reflectivity=b.reflectivity!==void 0?b.reflectivity:1;this.refractionRatio=b.refractionRatio!==void 0?b.refractionRatio:0.98;this.fog=b.fog!==void 0?b.fog:!0;this.shading=b.shading!==void 0?b.shading:THREE.SmoothShading;this.wireframe=b.wireframe!==void 0?b.wireframe:!1;this.wireframeLinewidth=b.wireframeLinewidth!==void 0?b.wireframeLinewidth:1;this.wireframeLinecap=b.wireframeLinecap!==void 0?
|
|
|
|
|
b.wireframeLinecap:"round";this.wireframeLinejoin=b.wireframeLinejoin!==void 0?b.wireframeLinejoin:"round";this.vertexColors=b.vertexColors!==void 0?b.vertexColors:!1;this.skinning=b.skinning!==void 0?b.skinning:!1;this.morphTargets=b.morphTargets!==void 0?b.morphTargets:!1};THREE.MeshPhongMaterial.prototype=new THREE.Material;THREE.MeshPhongMaterial.prototype.constructor=THREE.MeshPhongMaterial;
|
|
|
|
|
THREE.MeshDepthMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.shading=b.shading!==void 0?b.shading:THREE.SmoothShading;this.wireframe=b.wireframe!==void 0?b.wireframe:!1;this.wireframeLinewidth=b.wireframeLinewidth!==void 0?b.wireframeLinewidth:1};THREE.MeshDepthMaterial.prototype=new THREE.Material;THREE.MeshDepthMaterial.prototype.constructor=THREE.MeshDepthMaterial;
|
|
|
|
|
THREE.MeshNormalMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.shading=b.shading?b.shading:THREE.FlatShading;this.wireframe=b.wireframe?b.wireframe:!1;this.wireframeLinewidth=b.wireframeLinewidth?b.wireframeLinewidth:1};THREE.MeshNormalMaterial.prototype=new THREE.Material;THREE.MeshNormalMaterial.prototype.constructor=THREE.MeshNormalMaterial;THREE.MeshFaceMaterial=function(){};
|
|
|
|
|
THREE.MeshShaderMaterial=function(b){console.warn("DEPRECATED: MeshShaderMaterial() is now ShaderMaterial().");return new THREE.ShaderMaterial(b)};
|
|
|
|
@@ -152,7 +152,7 @@ map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_
|
|
|
|
|
lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\nuniform sampler2D lightMap;\n#endif",lightmap_pars_vertex:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\n#endif",lightmap_fragment:"#ifdef USE_LIGHTMAP\ngl_FragColor = gl_FragColor * texture2D( lightMap, vUv2 );\n#endif",lightmap_vertex:"#ifdef USE_LIGHTMAP\nvUv2 = uv2;\n#endif",lights_pars_vertex:"uniform vec3 ambient;\nuniform vec3 diffuse;\nuniform bool enableLighting;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\nuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\n#endif",
|
|
|
|
|
lights_vertex:"if ( !enableLighting ) {\nvLightWeighting = vec3( 1.0 );\n} else {\nvLightWeighting = vec3( 0.0 );\n#if MAX_DIR_LIGHTS > 0\nfor( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nfloat directionalLightWeighting = max( dot( transformedNormal, normalize( lDirection.xyz ) ), 0.0 );\nvLightWeighting += directionalLightColor[ i ] * directionalLightWeighting;\n}\n#endif\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz - mvPosition.xyz;\nfloat lDistance = 1.0;\nif ( pointLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );\nlVector = normalize( lVector );\nfloat pointLightWeighting = max( dot( transformedNormal, lVector ), 0.0 );\nvLightWeighting += pointLightColor[ i ] * pointLightWeighting * lDistance;\n}\n#endif\nvLightWeighting = vLightWeighting * diffuse + ambient * ambientLightColor;\n}",
|
|
|
|
|
lights_phong_pars_vertex:"#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\nuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\nvarying vec4 vPointLight[ MAX_POINT_LIGHTS ];\n#endif",lights_phong_vertex:"#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz - mvPosition.xyz;\nfloat lDistance = 1.0;\nif ( pointLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );\nlVector = normalize( lVector );\nvPointLight[ i ] = vec4( lVector, lDistance );\n}\n#endif",
|
|
|
|
|
lights_pars_fragment:"uniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nvarying vec4 vPointLight[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",lights_fragment:"vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\n#if MAX_POINT_LIGHTS > 0\nvec3 pointDiffuse = vec3( 0.0 );\nvec3 pointSpecular = vec3( 0.0 );\nfor ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\nvec3 pointVector = normalize( vPointLight[ i ].xyz );\nvec3 pointHalfVector = normalize( vPointLight[ i ].xyz + viewPosition );\nfloat pointDistance = vPointLight[ i ].w;\nfloat pointDotNormalHalf = max( dot( normal, pointHalfVector ), 0.0 );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = pow( pointDotNormalHalf, shininess );\n#ifdef PHYSICALLY_BASED_SHADING\nvec3 schlick = specular + vec3( 1.0 - specular ) * pow( dot( pointVector, pointHalfVector ), 5.0 );\npointSpecular += schlick * pointLightColor[ i ] * pointSpecularWeight * pointDiffuseWeight * pointDistance;\n#else\npointSpecular += specular * pointLightColor[ i ] * pointSpecularWeight * pointDiffuseWeight * pointDistance;\n#endif\npointDiffuse += diffuse * pointLightColor[ i ] * pointDiffuseWeight * pointDistance;\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec3 dirDiffuse = vec3( 0.0 );\nvec3 dirSpecular = vec3( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + viewPosition );\nfloat dirDotNormalHalf = max( dot( normal, dirHalfVector ), 0.0 );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = pow( dirDotNormalHalf, shininess );\n#ifdef PHYSICALLY_BASED_SHADING\nvec3 schlick = specular + vec3( 1.0 - specular ) * pow( dot( dirVector, dirHalfVector ), 5.0 );\ndirSpecular += schlick * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight;\n#else\ndirSpecular += specular * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight;\n#endif\ndirDiffuse += diffuse * directionalLightColor[ i ] * dirDiffuseWeight;\n}\n#endif\nvec3 totalDiffuse = vec3( 0.0 );\nvec3 totalSpecular = vec3( 0.0 );\n#if MAX_DIR_LIGHTS > 0\ntotalDiffuse += dirDiffuse;\ntotalSpecular += dirSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalDiffuse += pointDiffuse;\ntotalSpecular += pointSpecular;\n#endif\ngl_FragColor.xyz = gl_FragColor.xyz * ( totalDiffuse + ambientLightColor * ambient ) + totalSpecular;",
|
|
|
|
|
lights_pars_fragment:"uniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nvarying vec4 vPointLight[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",lights_fragment:"vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\n#if MAX_POINT_LIGHTS > 0\nvec3 pointDiffuse = vec3( 0.0 );\nvec3 pointSpecular = vec3( 0.0 );\nfor ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\nvec3 pointVector = normalize( vPointLight[ i ].xyz );\nvec3 pointHalfVector = normalize( vPointLight[ i ].xyz + viewPosition );\nfloat pointDistance = vPointLight[ i ].w;\nfloat pointDotNormalHalf = max( dot( normal, pointHalfVector ), 0.0 );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = pow( pointDotNormalHalf, shininess );\n#ifdef PHYSICALLY_BASED_SHADING\nvec3 schlick = specular + vec3( 1.0 - specular ) * pow( dot( pointVector, pointHalfVector ), 5.0 );\npointSpecular += schlick * pointLightColor[ i ] * pointSpecularWeight * pointDiffuseWeight * pointDistance;\n#else\npointSpecular += specular * pointLightColor[ i ] * pointSpecularWeight * pointDiffuseWeight * pointDistance;\n#endif\npointDiffuse += diffuse * pointLightColor[ i ] * pointDiffuseWeight * pointDistance;\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec3 dirDiffuse = vec3( 0.0 );\nvec3 dirSpecular = vec3( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + viewPosition );\nfloat dirDotNormalHalf = max( dot( normal, dirHalfVector ), 0.0 );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = pow( dirDotNormalHalf, shininess );\n#ifdef PHYSICALLY_BASED_SHADING\nvec3 schlick = specular + vec3( 1.0 - specular ) * pow( dot( dirVector, dirHalfVector ), 5.0 );\ndirSpecular += schlick * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight;\n#else\ndirSpecular += specular * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight;\n#endif\ndirDiffuse += diffuse * directionalLightColor[ i ] * dirDiffuseWeight;\n}\n#endif\nvec3 totalDiffuse = vec3( 0.0 );\nvec3 totalSpecular = vec3( 0.0 );\n#if MAX_DIR_LIGHTS > 0\ntotalDiffuse += dirDiffuse;\ntotalSpecular += dirSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalDiffuse += pointDiffuse;\ntotalSpecular += pointSpecular;\n#endif\n#ifdef METAL\ngl_FragColor.xyz = gl_FragColor.xyz * ( totalDiffuse + ambientLightColor * ambient + totalSpecular );\n#else\ngl_FragColor.xyz = gl_FragColor.xyz * ( totalDiffuse + ambientLightColor * ambient ) + totalSpecular;\n#endif",
|
|
|
|
|
color_pars_fragment:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_fragment:"#ifdef USE_COLOR\ngl_FragColor = gl_FragColor * vec4( vColor, opacity );\n#endif",color_pars_vertex:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\n#ifdef GAMMA_INPUT\nvColor = color * color;\n#else\nvColor = color;\n#endif\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\nuniform mat4 boneGlobalMatrices[ MAX_BONES ];\n#endif",skinning_vertex:"#ifdef USE_SKINNING\ngl_Position = ( boneGlobalMatrices[ int( skinIndex.x ) ] * skinVertexA ) * skinWeight.x;\ngl_Position += ( boneGlobalMatrices[ int( skinIndex.y ) ] * skinVertexB ) * skinWeight.y;\ngl_Position = projectionMatrix * viewMatrix * objectMatrix * gl_Position;\n#endif",
|
|
|
|
|
morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\nuniform float morphTargetInfluences[ 8 ];\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\nvec3 morphed = vec3( 0.0, 0.0, 0.0 );\nmorphed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\nmorphed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\nmorphed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\nmorphed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\nmorphed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\nmorphed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\nmorphed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\nmorphed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\nmorphed += position;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( morphed, 1.0 );\n#endif",
|
|
|
|
|
default_vertex:"#ifndef USE_MORPHTARGETS\n#ifndef USE_SKINNING\ngl_Position = projectionMatrix * mvPosition;\n#endif\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\nuniform sampler2D shadowMap[ MAX_SHADOWS ];\nuniform float shadowDarkness;\nuniform float shadowBias;\nvarying vec4 vShadowCoord[ MAX_SHADOWS ];\nfloat unpackDepth( const in vec4 rgba_depth ) {\nconst vec4 bit_shift = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );\nfloat depth = dot( rgba_depth, bit_shift );\nreturn depth;\n}\n#endif",
|
|
|
|
@@ -243,59 +243,59 @@ e.deleteBuffer(c.__webglSkinVertexBBuffer);e.deleteBuffer(c.__webglSkinIndicesBu
|
|
|
|
|
THREE.Line)b=b.geometry,e.deleteBuffer(b.__webglVertexBuffer),e.deleteBuffer(b.__webglColorBuffer),J.info.memory.geometries--;else if(b instanceof THREE.ParticleSystem)b=b.geometry,e.deleteBuffer(b.__webglVertexBuffer),e.deleteBuffer(b.__webglColorBuffer),J.info.memory.geometries--};this.deallocateTexture=function(b){if(b.__webglInit)b.__webglInit=!1,e.deleteTexture(b.__webglTexture),J.info.memory.textures--};this.initMaterial=function(b,c,d,f){var h,i,j,k;b instanceof THREE.MeshDepthMaterial?k="depth":
|
|
|
|
|
b instanceof THREE.MeshNormalMaterial?k="normal":b instanceof THREE.MeshBasicMaterial?k="basic":b instanceof THREE.MeshLambertMaterial?k="lambert":b instanceof THREE.MeshPhongMaterial?k="phong":b instanceof THREE.LineBasicMaterial?k="basic":b instanceof THREE.ParticleBasicMaterial&&(k="particle_basic");if(k){var p=THREE.ShaderLib[k];b.uniforms=THREE.UniformsUtils.clone(p.uniforms);b.vertexShader=p.vertexShader;b.fragmentShader=p.fragmentShader}var m,n,o;m=o=p=0;for(n=c.length;m<n;m++)j=c[m],j instanceof
|
|
|
|
|
THREE.SpotLight&&o++,j instanceof THREE.DirectionalLight&&o++,j instanceof THREE.PointLight&&p++;p+o<=Za?m=o:(m=Math.ceil(Za*o/(p+o)),p=Za-m);j={directional:m,point:p};p=o=0;for(m=c.length;p<m;p++)n=c[p],n instanceof THREE.SpotLight&&n.castShadow&&o++;var r=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)r=f.bones.length;var x;a:{m=b.fragmentShader;n=b.vertexShader;var p=b.uniforms,c=b.attributes,d={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:d,useFog:b.fog,
|
|
|
|
|
sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:j.directional,maxPointLights:j.point,maxBones:r,shadowMapEnabled:this.shadowMapEnabled&&f.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:o,alphaTest:b.alphaTest},v,f=[];k?f.push(k):(f.push(m),f.push(n));for(v in d)f.push(v),f.push(d[v]);k=f.join();v=0;for(f=La.length;v<f;v++)if(La[v].code==
|
|
|
|
|
sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:j.directional,maxPointLights:j.point,maxBones:r,shadowMapEnabled:this.shadowMapEnabled&&f.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:o,alphaTest:b.alphaTest,metal:b.metal},v,f=[];k?f.push(k):(f.push(m),f.push(n));for(v in d)f.push(v),f.push(d[v]);k=f.join();v=0;for(f=La.length;v<f;v++)if(La[v].code==
|
|
|
|
|
k){x=La[v].program;break a}v=e.createProgram();f=[db?"#define VERTEX_TEXTURES":"",J.gammaInput?"#define GAMMA_INPUT":"",J.gammaOutput?"#define GAMMA_OUTPUT":"",J.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+d.maxDirLights,"#define MAX_POINT_LIGHTS "+d.maxPointLights,"#define MAX_SHADOWS "+d.maxShadows,"#define MAX_BONES "+d.maxBones,d.map?"#define USE_MAP":"",d.envMap?"#define USE_ENVMAP":"",d.lightMap?"#define USE_LIGHTMAP":"",d.vertexColors?"#define USE_COLOR":
|
|
|
|
|
"",d.skinning?"#define USE_SKINNING":"",d.morphTargets?"#define USE_MORPHTARGETS":"",d.shadowMapEnabled?"#define USE_SHADOWMAP":"",d.shadowMapSoft?"#define SHADOWMAP_SOFT":"",d.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
|
|
|
|
|
j=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+d.maxDirLights,"#define MAX_POINT_LIGHTS "+d.maxPointLights,"#define MAX_SHADOWS "+d.maxShadows,d.alphaTest?"#define ALPHATEST "+d.alphaTest:"",J.gammaInput?"#define GAMMA_INPUT":"",J.gammaOutput?"#define GAMMA_OUTPUT":"",J.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",d.useFog&&d.fog?"#define USE_FOG":"",d.useFog&&d.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",d.map?"#define USE_MAP":"",d.envMap?"#define USE_ENVMAP":
|
|
|
|
|
"",d.lightMap?"#define USE_LIGHTMAP":"",d.vertexColors?"#define USE_COLOR":"",d.shadowMapEnabled?"#define USE_SHADOWMAP":"",d.shadowMapSoft?"#define SHADOWMAP_SOFT":"",d.shadowMapSoft?"#define SHADOWMAP_WIDTH "+d.shadowMapWidth.toFixed(1):"",d.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+d.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");e.attachShader(v,ia("fragment",j+m));e.attachShader(v,ia("vertex",f+n));e.linkProgram(v);e.getProgramParameter(v,
|
|
|
|
|
e.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+e.getProgramParameter(v,e.VALIDATE_STATUS)+", gl error ["+e.getError()+"]");v.uniforms={};v.attributes={};var w,f=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(w in p)f.push(w);w=f;f=0;for(p=w.length;f<p;f++)m=w[f],v.uniforms[m]=e.getUniformLocation(v,m);f=["position","normal","uv","uv2","tangent",
|
|
|
|
|
"color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(w=0;w<d.maxMorphTargets;w++)f.push("morphTarget"+w);for(x in c)f.push(x);x=f;w=0;for(c=x.length;w<c;w++)d=x[w],v.attributes[d]=e.getAttribLocation(v,d);v.id=La.length;La.push({program:v,code:k});J.info.memory.programs=La.length;x=v}b.program=x;x=b.program.attributes;x.position>=0&&e.enableVertexAttribArray(x.position);x.color>=0&&e.enableVertexAttribArray(x.color);x.normal>=0&&e.enableVertexAttribArray(x.normal);x.tangent>=0&&e.enableVertexAttribArray(x.tangent);
|
|
|
|
|
b.skinning&&x.skinVertexA>=0&&x.skinVertexB>=0&&x.skinIndex>=0&&x.skinWeight>=0&&(e.enableVertexAttribArray(x.skinVertexA),e.enableVertexAttribArray(x.skinVertexB),e.enableVertexAttribArray(x.skinIndex),e.enableVertexAttribArray(x.skinWeight));if(b.attributes)for(i in b.attributes)x[i]!==void 0&&x[i]>=0&&e.enableVertexAttribArray(x[i]);if(b.morphTargets)for(i=b.numSupportedMorphTargets=0;i<this.maxMorphTargets;i++)w="morphTarget"+i,x[w]>=0&&(e.enableVertexAttribArray(x[w]),b.numSupportedMorphTargets++);
|
|
|
|
|
b.uniformsList=[];for(h in b.uniforms)b.uniformsList.push([b.uniforms[h],h])};this.clearTarget=function(b,c,d,e){S(b);this.clear(c,d,e)};this.updateShadowMap=function(b,c){F(b,c)};this.render=function(b,c,o,u){var K,Ia,ra,s,p,D,B,Pa,Qa=b.lights,x=b.fog;W=-1;this.shadowMapEnabled&&this.shadowMapAutoUpdate&&F(b,c);J.info.render.calls=0;J.info.render.vertices=0;J.info.render.faces=0;if(c.matrixAutoUpdate){for(p=c;p.parent;)p=p.parent;p.update(void 0,!0)}b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(Wa);
|
|
|
|
|
c.projectionMatrix.flattenToArray(Va);Ea.multiply(c.projectionMatrix,c.matrixWorldInverse);m(Ea);this.initWebGLObjects(b);S(o);(this.autoClear||u)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);p=b.__webglObjects.length;for(u=0;u<p;u++)if(K=b.__webglObjects[u],B=K.object,B.visible)if(!(B instanceof THREE.Mesh)||!B.frustumCulled||r(B)){if(B.matrixWorld.flattenToArray(B._objectMatrixArray),H(B,c,!0),w(K),K.render=!0,this.sortObjects)K.object.renderDepth?K.z=K.object.renderDepth:
|
|
|
|
|
(Ja.copy(B.position),Ea.multiplyVector3(Ja),K.z=Ja.z)}else K.render=!1;else K.render=!1;this.sortObjects&&b.__webglObjects.sort(A);D=b.__webglObjectsImmediate.length;for(u=0;u<D;u++)K=b.__webglObjectsImmediate[u],B=K.object,B.visible&&(B.matrixAutoUpdate&&B.matrixWorld.flattenToArray(B._objectMatrixArray),H(B,c,!0),v(K));if(b.overrideMaterial){j(b.overrideMaterial.depthTest);O(b.overrideMaterial.blending);for(u=0;u<p;u++)if(K=b.__webglObjects[u],K.render)B=K.object,Pa=K.buffer,i(B),f(c,Qa,x,b.overrideMaterial,
|
|
|
|
|
Pa,B);for(u=0;u<D;u++)K=b.__webglObjectsImmediate[u],B=K.object,B.visible&&(G=-1,i(B),Ia=d(c,Qa,x,b.overrideMaterial,B),B.immediateRenderCallback?B.immediateRenderCallback(Ia,e,wa):B.render(function(c){h(c,Ia,b.overrideMaterial.shading)}))}else{O(THREE.NormalBlending);for(u=p-1;u>=0;u--)if(K=b.__webglObjects[u],K.render){B=K.object;Pa=K.buffer;ra=K.opaque;i(B);for(K=0;K<ra.count;K++)s=ra.list[K],j(s.depthTest),k(s.depthWrite),n(s.polygonOffset,s.polygonOffsetFactor,s.polygonOffsetUnits),f(c,Qa,x,
|
|
|
|
|
s,Pa,B)}for(u=0;u<D;u++)if(K=b.__webglObjectsImmediate[u],B=K.object,B.visible){G=-1;ra=K.opaque;i(B);for(K=0;K<ra.count;K++)s=ra.list[K],j(s.depthTest),k(s.depthWrite),n(s.polygonOffset,s.polygonOffsetFactor,s.polygonOffsetUnits),Ia=d(c,Qa,x,s,B),B.immediateRenderCallback?B.immediateRenderCallback(Ia,e,wa):B.render(function(b){h(b,Ia,s.shading)})}for(u=0;u<p;u++)if(K=b.__webglObjects[u],K.render){B=K.object;Pa=K.buffer;ra=K.transparent;i(B);for(K=0;K<ra.count;K++)s=ra.list[K],O(s.blending),j(s.depthTest),
|
|
|
|
|
k(s.depthWrite),n(s.polygonOffset,s.polygonOffsetFactor,s.polygonOffsetUnits),f(c,Qa,x,s,Pa,B)}for(u=0;u<D;u++)if(K=b.__webglObjectsImmediate[u],B=K.object,B.visible){G=-1;ra=K.transparent;i(B);for(K=0;K<ra.count;K++)s=ra.list[K],O(s.blending),j(s.depthTest),k(s.depthWrite),n(s.polygonOffset,s.polygonOffsetFactor,s.polygonOffsetUnits),Ia=d(c,Qa,x,s,B),B.immediateRenderCallback?B.immediateRenderCallback(Ia,e,wa):B.render(function(b){h(b,Ia,s.shading)})}}b.__webglSprites.length&&L(b,c);o&&o.minFilter!==
|
|
|
|
|
THREE.NearestFilter&&o.minFilter!==THREE.LinearFilter&&la(o)};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var d=b.__objectsAdded[0],f=b,h=void 0,i=void 0,j=void 0;if(!d.__webglInit)if(d.__webglInit=!0,d._modelViewMatrix=new THREE.Matrix4,d._normalMatrixArray=new Float32Array(9),d._modelViewMatrixArray=new Float32Array(16),d._objectMatrixArray=new Float32Array(16),d.matrixWorld.flattenToArray(d._objectMatrixArray),
|
|
|
|
|
d instanceof THREE.Mesh)for(h in i=d.geometry,i.geometryGroups==void 0&&sa(i),i.geometryGroups){if(j=i.geometryGroups[h],!j.__webglVertexBuffer){var k=j;k.__webglVertexBuffer=e.createBuffer();k.__webglNormalBuffer=e.createBuffer();k.__webglTangentBuffer=e.createBuffer();k.__webglColorBuffer=e.createBuffer();k.__webglUVBuffer=e.createBuffer();k.__webglUV2Buffer=e.createBuffer();k.__webglSkinVertexABuffer=e.createBuffer();k.__webglSkinVertexBBuffer=e.createBuffer();k.__webglSkinIndicesBuffer=e.createBuffer();
|
|
|
|
|
k.__webglSkinWeightsBuffer=e.createBuffer();k.__webglFaceBuffer=e.createBuffer();k.__webglLineBuffer=e.createBuffer();if(k.numMorphTargets){var m=void 0,p=void 0;k.__webglMorphTargetsBuffers=[];m=0;for(p=k.numMorphTargets;m<p;m++)k.__webglMorphTargetsBuffers.push(e.createBuffer())}J.info.memory.geometries++;for(var k=d,n=void 0,o=void 0,r=void 0,v=r=void 0,x=void 0,u=void 0,w=u=m=0,E=r=o=void 0,r=p=E=o=n=void 0,v=k.geometry,x=v.faces,E=j.faces,n=0,o=E.length;n<o;n++)r=E[n],r=x[r],r instanceof THREE.Face3?
|
|
|
|
|
(m+=3,u+=1,w+=3):r instanceof THREE.Face4&&(m+=4,u+=2,w+=4);for(var n=j,o=k,D=E=x=void 0,A=void 0,D=void 0,r=[],x=0,E=o.materials.length;x<E;x++)if(D=o.materials[x],D instanceof THREE.MeshFaceMaterial){D=0;for(l=n.materials.length;D<l;D++)(A=n.materials[D])&&r.push(A)}else(A=D)&&r.push(A);n=r;j.__materials=n;a:{x=o=void 0;E=n.length;for(o=0;o<E;o++)if(x=n[o],x.map||x.lightMap||x instanceof THREE.ShaderMaterial){o=!0;break a}o=!1}a:{E=x=void 0;r=n.length;for(x=0;x<r;x++)if(E=n[x],!(E instanceof THREE.MeshBasicMaterial&&
|
|
|
|
|
!E.envMap||E instanceof THREE.MeshDepthMaterial)){E=E&&E.shading!=void 0&&E.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}E=!1}a:{r=x=void 0;D=n.length;for(x=0;x<D;x++)if(r=n[x],r.vertexColors){r=r.vertexColors;break a}r=!1}j.__vertexArray=new Float32Array(m*3);if(E)j.__normalArray=new Float32Array(m*3);if(v.hasTangents)j.__tangentArray=new Float32Array(m*4);if(r)j.__colorArray=new Float32Array(m*3);if(o){if(v.faceUvs.length>0||v.faceVertexUvs.length>0)j.__uvArray=new Float32Array(m*
|
|
|
|
|
2);if(v.faceUvs.length>1||v.faceVertexUvs.length>1)j.__uv2Array=new Float32Array(m*2)}if(k.geometry.skinWeights.length&&k.geometry.skinIndices.length)j.__skinVertexAArray=new Float32Array(m*4),j.__skinVertexBArray=new Float32Array(m*4),j.__skinIndexArray=new Float32Array(m*4),j.__skinWeightArray=new Float32Array(m*4);j.__faceArray=new Uint16Array(u*3+(k.geometry.edgeFaces?k.geometry.edgeFaces.length*6:0));j.__lineArray=new Uint16Array(w*2);if(j.numMorphTargets){j.__morphTargetsArrays=[];v=0;for(x=
|
|
|
|
|
j.numMorphTargets;v<x;v++)j.__morphTargetsArrays.push(new Float32Array(m*3))}j.__needsSmoothNormals=E==THREE.SmoothShading;j.__uvType=o;j.__vertexColorType=r;j.__normalType=E;j.__webglFaceCount=u*3+(k.geometry.edgeFaces?k.geometry.edgeFaces.length*6:0);j.__webglLineCount=w*2;v=0;for(x=n.length;v<x;v++)if(o=n[v],o.attributes){if(j.__webglCustomAttributesList===void 0)j.__webglCustomAttributesList=[];for(a in o.attributes){r=o.attributes[a];E={};for(p in r)E[p]=r[p];if(!E.__webglInitialized||E.createUniqueBuffers)E.__webglInitialized=
|
|
|
|
|
!0,u=1,E.type==="v2"?u=2:E.type==="v3"?u=3:E.type==="v4"?u=4:E.type==="c"&&(u=3),E.size=u,E.array=new Float32Array(m*u),E.buffer=e.createBuffer(),E.buffer.belongsToAttribute=a,r.needsUpdate=!0,E.__original=r;j.__webglCustomAttributesList.push(E)}}j.__inittedArrays=!0;i.__dirtyVertices=!0;i.__dirtyMorphTargets=!0;i.__dirtyElements=!0;i.__dirtyUvs=!0;i.__dirtyNormals=!0;i.__dirtyTangents=!0;i.__dirtyColors=!0}}else if(d instanceof THREE.Ribbon){if(i=d.geometry,!i.__webglVertexBuffer)j=i,j.__webglVertexBuffer=
|
|
|
|
|
e.createBuffer(),j.__webglColorBuffer=e.createBuffer(),J.info.memory.geometries++,j=i,k=j.vertices.length,j.__vertexArray=new Float32Array(k*3),j.__colorArray=new Float32Array(k*3),j.__webglVertexCount=k,i.__dirtyVertices=!0,i.__dirtyColors=!0}else if(d instanceof THREE.Line){if(i=d.geometry,!i.__webglVertexBuffer)j=i,j.__webglVertexBuffer=e.createBuffer(),j.__webglColorBuffer=e.createBuffer(),J.info.memory.geometries++,j=i,k=j.vertices.length,j.__vertexArray=new Float32Array(k*3),j.__colorArray=
|
|
|
|
|
new Float32Array(k*3),j.__webglLineCount=k,i.__dirtyVertices=!0,i.__dirtyColors=!0}else if(d instanceof THREE.ParticleSystem&&(i=d.geometry,!i.__webglVertexBuffer)){j=i;j.__webglVertexBuffer=e.createBuffer();j.__webglColorBuffer=e.createBuffer();J.info.geometries++;j=i;k=d;m=j.vertices.length;j.__vertexArray=new Float32Array(m*3);j.__colorArray=new Float32Array(m*3);j.__sortArray=[];j.__webglParticleCount=m;j.__materials=k.materials;w=u=p=void 0;p=0;for(u=k.materials.length;p<u;p++)if(w=k.materials[p],
|
|
|
|
|
w.attributes){if(j.__webglCustomAttributesList===void 0)j.__webglCustomAttributesList=[];for(a in w.attributes){originalAttribute=w.attributes[a];attribute={};for(property in originalAttribute)attribute[property]=originalAttribute[property];if(!attribute.__webglInitialized||attribute.createUniqueBuffers)attribute.__webglInitialized=!0,size=1,attribute.type==="v2"?size=2:attribute.type==="v3"?size=3:attribute.type==="v4"?size=4:attribute.type==="c"&&(size=3),attribute.size=size,attribute.array=new Float32Array(m*
|
|
|
|
|
size),attribute.buffer=e.createBuffer(),attribute.buffer.belongsToAttribute=a,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;j.__webglCustomAttributesList.push(attribute)}}i.__dirtyVertices=!0;i.__dirtyColors=!0}if(!d.__webglActive){if(d instanceof THREE.Mesh)for(h in i=d.geometry,i.geometryGroups)j=i.geometryGroups[h],ha(f.__webglObjects,j,d);else d instanceof THREE.Ribbon||d instanceof THREE.Line||d instanceof THREE.ParticleSystem?(i=d.geometry,ha(f.__webglObjects,i,d)):
|
|
|
|
|
THREE.MarchingCubes!==void 0&&d instanceof THREE.MarchingCubes||d.immediateRenderCallback?f.__webglObjectsImmediate.push({object:d,opaque:{list:[],count:0},transparent:{list:[],count:0}}):d instanceof THREE.Sprite&&f.__webglSprites.push(d);d.__webglActive=!0}b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;){d=b.__objectsRemoved[0];f=b;if(d instanceof THREE.Mesh||d instanceof THREE.ParticleSystem||d instanceof THREE.Ribbon||d instanceof THREE.Line)ja(f.__webglObjects,d);else if(d instanceof
|
|
|
|
|
THREE.Sprite){f=f.__webglSprites;h=d;i=void 0;for(i=f.length-1;i>=0;i--)f[i]==h&&f.splice(i,1)}else(d instanceof THREE.MarchingCubes||d.immediateRenderCallback)&&ja(f.__webglObjectsImmediate,d);d.__webglActive=!1;b.__objectsRemoved.splice(0,1)}d=0;for(f=b.__webglObjects.length;d<f;d++)if(i=b.__webglObjects[d].object,p=j=h=void 0,i instanceof THREE.Mesh){h=i.geometry;k=0;for(m=h.geometryGroupsList.length;k<m;k++)if(j=h.geometryGroupsList[k],p=xa(j),h.__dirtyVertices||h.__dirtyMorphTargets||h.__dirtyElements||
|
|
|
|
|
h.__dirtyUvs||h.__dirtyNormals||h.__dirtyColors||h.__dirtyTangents||p)if(p=j,u=e.DYNAMIC_DRAW,w=!h.dynamic,p.__inittedArrays){var F=n=v=void 0,C=void 0,H=F=void 0,G=void 0,L=void 0,O=void 0,Q=A=D=r=E=x=o=void 0,R=void 0,N=void 0,y=C=O=C=L=G=void 0,I=void 0,t=I=y=G=void 0,q=void 0,t=I=y=F=F=H=I=y=C=t=I=y=q=t=I=y=q=t=I=y=void 0,M=0,P=0,X=0,aa=0,U=0,S=0,$=0,T=0,ma=0,z=0,na=0,V=t=0,V=void 0,oa=p.__vertexArray,ka=p.__uvArray,la=p.__uv2Array,W=p.__normalArray,ca=p.__tangentArray,pa=p.__colorArray,da=p.__skinVertexAArray,
|
|
|
|
|
ea=p.__skinVertexBArray,fa=p.__skinIndexArray,ga=p.__skinWeightArray,qa=p.__morphTargetsArrays,Z=p.__webglCustomAttributesList,q=void 0,ia=p.__faceArray,Y=p.__lineArray,wa=p.__needsSmoothNormals,x=p.__vertexColorType,o=p.__uvType,E=p.__normalType,ua=i.geometry,ta=ua.__dirtyVertices,za=ua.__dirtyElements,va=ua.__dirtyUvs,Aa=ua.__dirtyNormals,Ca=ua.__dirtyTangents,Da=ua.__dirtyColors,Ea=ua.__dirtyMorphTargets,Ba=ua.vertices,Fa=p.faces,La=ua.faces,Ha=ua.faceVertexUvs[0],Ja=ua.faceVertexUvs[1],Ma=ua.skinVerticesA,
|
|
|
|
|
Na=ua.skinVerticesB,Oa=ua.skinIndices,Ka=ua.skinWeights,Ga=ua.morphTargets;if(Z){y=0;for(I=Z.length;y<I;y++)Z[y].offset=0,Z[y].offsetSrc=0}v=0;for(n=Fa.length;v<n;v++)if(F=Fa[v],C=La[F],Ha&&(r=Ha[F]),Ja&&(D=Ja[F]),F=C.vertexNormals,H=C.normal,G=C.vertexColors,L=C.color,O=C.vertexTangents,C instanceof THREE.Face3){if(ta)A=Ba[C.a].position,Q=Ba[C.b].position,R=Ba[C.c].position,oa[P]=A.x,oa[P+1]=A.y,oa[P+2]=A.z,oa[P+3]=Q.x,oa[P+4]=Q.y,oa[P+5]=Q.z,oa[P+6]=R.x,oa[P+7]=R.y,oa[P+8]=R.z,P+=9;if(Z){y=0;for(I=
|
|
|
|
|
Z.length;y<I;y++)if(q=Z[y],q.__original.needsUpdate)t=q.offset,V=q.offsetSrc,q.size===1?(q.boundTo===void 0||q.boundTo==="vertices"?(q.array[t]=q.value[C.a],q.array[t+1]=q.value[C.b],q.array[t+2]=q.value[C.c]):q.boundTo==="faces"?(V=q.value[V],q.array[t]=V,q.array[t+1]=V,q.array[t+2]=V,q.offsetSrc++):q.boundTo==="faceVertices"&&(q.array[t]=q.value[V],q.array[t+1]=q.value[V+1],q.array[t+2]=q.value[V+2],q.offsetSrc+=3),q.offset+=3):(q.boundTo===void 0||q.boundTo==="vertices"?(A=q.value[C.a],Q=q.value[C.b],
|
|
|
|
|
R=q.value[C.c]):q.boundTo==="faces"?(R=Q=A=V=q.value[V],q.offsetSrc++):q.boundTo==="faceVertices"&&(A=q.value[V],Q=q.value[V+1],R=q.value[V+2],q.offsetSrc+=3),q.size===2?(q.array[t]=A.x,q.array[t+1]=A.y,q.array[t+2]=Q.x,q.array[t+3]=Q.y,q.array[t+4]=R.x,q.array[t+5]=R.y,q.offset+=6):q.size===3?(q.type==="c"?(q.array[t]=A.r,q.array[t+1]=A.g,q.array[t+2]=A.b,q.array[t+3]=Q.r,q.array[t+4]=Q.g,q.array[t+5]=Q.b,q.array[t+6]=R.r,q.array[t+7]=R.g,q.array[t+8]=R.b):(q.array[t]=A.x,q.array[t+1]=A.y,q.array[t+
|
|
|
|
|
2]=A.z,q.array[t+3]=Q.x,q.array[t+4]=Q.y,q.array[t+5]=Q.z,q.array[t+6]=R.x,q.array[t+7]=R.y,q.array[t+8]=R.z),q.offset+=9):(q.array[t]=A.x,q.array[t+1]=A.y,q.array[t+2]=A.z,q.array[t+3]=A.w,q.array[t+4]=Q.x,q.array[t+5]=Q.y,q.array[t+6]=Q.z,q.array[t+7]=Q.w,q.array[t+8]=R.x,q.array[t+9]=R.y,q.array[t+10]=R.z,q.array[t+11]=R.w,q.offset+=12))}if(Ea){y=0;for(I=Ga.length;y<I;y++)A=Ga[y].vertices[C.a].position,Q=Ga[y].vertices[C.b].position,R=Ga[y].vertices[C.c].position,t=qa[y],t[na]=A.x,t[na+1]=A.y,
|
|
|
|
|
t[na+2]=A.z,t[na+3]=Q.x,t[na+4]=Q.y,t[na+5]=Q.z,t[na+6]=R.x,t[na+7]=R.y,t[na+8]=R.z;na+=9}if(Ka.length)y=Ka[C.a],I=Ka[C.b],t=Ka[C.c],ga[z]=y.x,ga[z+1]=y.y,ga[z+2]=y.z,ga[z+3]=y.w,ga[z+4]=I.x,ga[z+5]=I.y,ga[z+6]=I.z,ga[z+7]=I.w,ga[z+8]=t.x,ga[z+9]=t.y,ga[z+10]=t.z,ga[z+11]=t.w,y=Oa[C.a],I=Oa[C.b],t=Oa[C.c],fa[z]=y.x,fa[z+1]=y.y,fa[z+2]=y.z,fa[z+3]=y.w,fa[z+4]=I.x,fa[z+5]=I.y,fa[z+6]=I.z,fa[z+7]=I.w,fa[z+8]=t.x,fa[z+9]=t.y,fa[z+10]=t.z,fa[z+11]=t.w,y=Ma[C.a],I=Ma[C.b],t=Ma[C.c],da[z]=y.x,da[z+1]=y.y,
|
|
|
|
|
da[z+2]=y.z,da[z+3]=1,da[z+4]=I.x,da[z+5]=I.y,da[z+6]=I.z,da[z+7]=1,da[z+8]=t.x,da[z+9]=t.y,da[z+10]=t.z,da[z+11]=1,y=Na[C.a],I=Na[C.b],t=Na[C.c],ea[z]=y.x,ea[z+1]=y.y,ea[z+2]=y.z,ea[z+3]=1,ea[z+4]=I.x,ea[z+5]=I.y,ea[z+6]=I.z,ea[z+7]=1,ea[z+8]=t.x,ea[z+9]=t.y,ea[z+10]=t.z,ea[z+11]=1,z+=12;if(Da&&x)G.length==3&&x==THREE.VertexColors?(C=G[0],y=G[1],I=G[2]):I=y=C=L,pa[ma]=C.r,pa[ma+1]=C.g,pa[ma+2]=C.b,pa[ma+3]=y.r,pa[ma+4]=y.g,pa[ma+5]=y.b,pa[ma+6]=I.r,pa[ma+7]=I.g,pa[ma+8]=I.b,ma+=9;if(Ca&&ua.hasTangents)G=
|
|
|
|
|
O[0],L=O[1],C=O[2],ca[$]=G.x,ca[$+1]=G.y,ca[$+2]=G.z,ca[$+3]=G.w,ca[$+4]=L.x,ca[$+5]=L.y,ca[$+6]=L.z,ca[$+7]=L.w,ca[$+8]=C.x,ca[$+9]=C.y,ca[$+10]=C.z,ca[$+11]=C.w,$+=12;if(Aa&&E)if(F.length==3&&wa)for(y=0;y<3;y++)H=F[y],W[S]=H.x,W[S+1]=H.y,W[S+2]=H.z,S+=3;else for(y=0;y<3;y++)W[S]=H.x,W[S+1]=H.y,W[S+2]=H.z,S+=3;if(va&&r!==void 0&&o)for(y=0;y<3;y++)F=r[y],ka[X]=F.u,ka[X+1]=F.v,X+=2;if(va&&D!==void 0&&o)for(y=0;y<3;y++)F=D[y],la[aa]=F.u,la[aa+1]=F.v,aa+=2;za&&(ia[U]=M,ia[U+1]=M+1,ia[U+2]=M+2,U+=3,Y[T]=
|
|
|
|
|
M,Y[T+1]=M+1,Y[T+2]=M,Y[T+3]=M+2,Y[T+4]=M+1,Y[T+5]=M+2,T+=6,M+=3)}else if(C instanceof THREE.Face4){if(ta)A=Ba[C.a].position,Q=Ba[C.b].position,R=Ba[C.c].position,N=Ba[C.d].position,oa[P]=A.x,oa[P+1]=A.y,oa[P+2]=A.z,oa[P+3]=Q.x,oa[P+4]=Q.y,oa[P+5]=Q.z,oa[P+6]=R.x,oa[P+7]=R.y,oa[P+8]=R.z,oa[P+9]=N.x,oa[P+10]=N.y,oa[P+11]=N.z,P+=12;if(Z){y=0;for(I=Z.length;y<I;y++)if(q=Z[y],q.__original.needsUpdate)t=q.offset,V=q.offsetSrc,q.size===1?(q.boundTo===void 0||q.boundTo==="vertices"?(q.array[t]=q.value[C.a],
|
|
|
|
|
q.array[t+1]=q.value[C.b],q.array[t+2]=q.value[C.c],q.array[t+3]=q.value[C.d]):q.boundTo==="faces"?(V=q.value[V],q.array[t]=V,q.array[t+1]=V,q.array[t+2]=V,q.array[t+3]=V,q.offsetSrc++):q.boundTo==="faceVertices"&&(q.array[t]=q.value[V],q.array[t+1]=q.value[V+1],q.array[t+2]=q.value[V+2],q.array[t+3]=q.value[V+3],q.offsetSrc+=4),q.offset+=4):(q.boundTo===void 0||q.boundTo==="vertices"?(A=q.value[C.a],Q=q.value[C.b],R=q.value[C.c],N=q.value[C.d]):q.boundTo==="faces"?(N=R=Q=A=V=q.value[V],q.offsetSrc++):
|
|
|
|
|
q.boundTo==="faceVertices"&&(A=q.value[V],Q=q.value[V+1],R=q.value[V+2],N=q.value[V+3],q.offsetSrc+=4),q.size===2?(q.array[t]=A.x,q.array[t+1]=A.y,q.array[t+2]=Q.x,q.array[t+3]=Q.y,q.array[t+4]=R.x,q.array[t+5]=R.y,q.array[t+6]=N.x,q.array[t+7]=N.y,q.offset+=8):q.size===3?(q.type==="c"?(q.array[t]=A.r,q.array[t+1]=A.g,q.array[t+2]=A.b,q.array[t+3]=Q.r,q.array[t+4]=Q.g,q.array[t+5]=Q.b,q.array[t+6]=R.r,q.array[t+7]=R.g,q.array[t+8]=R.b,q.array[t+9]=N.r,q.array[t+10]=N.g,q.array[t+11]=N.b):(q.array[t]=
|
|
|
|
|
A.x,q.array[t+1]=A.y,q.array[t+2]=A.z,q.array[t+3]=Q.x,q.array[t+4]=Q.y,q.array[t+5]=Q.z,q.array[t+6]=R.x,q.array[t+7]=R.y,q.array[t+8]=R.z,q.array[t+9]=N.x,q.array[t+10]=N.y,q.array[t+11]=N.z),q.offset+=12):(q.array[t]=A.x,q.array[t+1]=A.y,q.array[t+2]=A.z,q.array[t+3]=A.w,q.array[t+4]=Q.x,q.array[t+5]=Q.y,q.array[t+6]=Q.z,q.array[t+7]=Q.w,q.array[t+8]=R.x,q.array[t+9]=R.y,q.array[t+10]=R.z,q.array[t+11]=R.w,q.array[t+12]=N.x,q.array[t+13]=N.y,q.array[t+14]=N.z,q.array[t+15]=N.w,q.offset+=16))}if(Ea){y=
|
|
|
|
|
0;for(I=Ga.length;y<I;y++)A=Ga[y].vertices[C.a].position,Q=Ga[y].vertices[C.b].position,R=Ga[y].vertices[C.c].position,N=Ga[y].vertices[C.d].position,t=qa[y],t[na]=A.x,t[na+1]=A.y,t[na+2]=A.z,t[na+3]=Q.x,t[na+4]=Q.y,t[na+5]=Q.z,t[na+6]=R.x,t[na+7]=R.y,t[na+8]=R.z,t[na+9]=N.x,t[na+10]=N.y,t[na+11]=N.z;na+=12}if(Ka.length)y=Ka[C.a],I=Ka[C.b],t=Ka[C.c],q=Ka[C.d],ga[z]=y.x,ga[z+1]=y.y,ga[z+2]=y.z,ga[z+3]=y.w,ga[z+4]=I.x,ga[z+5]=I.y,ga[z+6]=I.z,ga[z+7]=I.w,ga[z+8]=t.x,ga[z+9]=t.y,ga[z+10]=t.z,ga[z+11]=
|
|
|
|
|
t.w,ga[z+12]=q.x,ga[z+13]=q.y,ga[z+14]=q.z,ga[z+15]=q.w,y=Oa[C.a],I=Oa[C.b],t=Oa[C.c],q=Oa[C.d],fa[z]=y.x,fa[z+1]=y.y,fa[z+2]=y.z,fa[z+3]=y.w,fa[z+4]=I.x,fa[z+5]=I.y,fa[z+6]=I.z,fa[z+7]=I.w,fa[z+8]=t.x,fa[z+9]=t.y,fa[z+10]=t.z,fa[z+11]=t.w,fa[z+12]=q.x,fa[z+13]=q.y,fa[z+14]=q.z,fa[z+15]=q.w,y=Ma[C.a],I=Ma[C.b],t=Ma[C.c],q=Ma[C.d],da[z]=y.x,da[z+1]=y.y,da[z+2]=y.z,da[z+3]=1,da[z+4]=I.x,da[z+5]=I.y,da[z+6]=I.z,da[z+7]=1,da[z+8]=t.x,da[z+9]=t.y,da[z+10]=t.z,da[z+11]=1,da[z+12]=q.x,da[z+13]=q.y,da[z+
|
|
|
|
|
14]=q.z,da[z+15]=1,y=Na[C.a],I=Na[C.b],t=Na[C.c],C=Na[C.d],ea[z]=y.x,ea[z+1]=y.y,ea[z+2]=y.z,ea[z+3]=1,ea[z+4]=I.x,ea[z+5]=I.y,ea[z+6]=I.z,ea[z+7]=1,ea[z+8]=t.x,ea[z+9]=t.y,ea[z+10]=t.z,ea[z+11]=1,ea[z+12]=C.x,ea[z+13]=C.y,ea[z+14]=C.z,ea[z+15]=1,z+=16;if(Da&&x)G.length==4&&x==THREE.VertexColors?(C=G[0],y=G[1],I=G[2],G=G[3]):G=I=y=C=L,pa[ma]=C.r,pa[ma+1]=C.g,pa[ma+2]=C.b,pa[ma+3]=y.r,pa[ma+4]=y.g,pa[ma+5]=y.b,pa[ma+6]=I.r,pa[ma+7]=I.g,pa[ma+8]=I.b,pa[ma+9]=G.r,pa[ma+10]=G.g,pa[ma+11]=G.b,ma+=12;if(Ca&&
|
|
|
|
|
ua.hasTangents)G=O[0],L=O[1],C=O[2],O=O[3],ca[$]=G.x,ca[$+1]=G.y,ca[$+2]=G.z,ca[$+3]=G.w,ca[$+4]=L.x,ca[$+5]=L.y,ca[$+6]=L.z,ca[$+7]=L.w,ca[$+8]=C.x,ca[$+9]=C.y,ca[$+10]=C.z,ca[$+11]=C.w,ca[$+12]=O.x,ca[$+13]=O.y,ca[$+14]=O.z,ca[$+15]=O.w,$+=16;if(Aa&&E)if(F.length==4&&wa)for(y=0;y<4;y++)H=F[y],W[S]=H.x,W[S+1]=H.y,W[S+2]=H.z,S+=3;else for(y=0;y<4;y++)W[S]=H.x,W[S+1]=H.y,W[S+2]=H.z,S+=3;if(va&&r!==void 0&&o)for(y=0;y<4;y++)F=r[y],ka[X]=F.u,ka[X+1]=F.v,X+=2;if(va&&D!==void 0&&o)for(y=0;y<4;y++)F=D[y],
|
|
|
|
|
la[aa]=F.u,la[aa+1]=F.v,aa+=2;za&&(ia[U]=M,ia[U+1]=M+1,ia[U+2]=M+3,ia[U+3]=M+1,ia[U+4]=M+2,ia[U+5]=M+3,U+=6,Y[T]=M,Y[T+1]=M+1,Y[T+2]=M,Y[T+3]=M+3,Y[T+4]=M+1,Y[T+5]=M+2,Y[T+6]=M+2,Y[T+7]=M+3,T+=8,M+=4)}ta&&(e.bindBuffer(e.ARRAY_BUFFER,p.__webglVertexBuffer),e.bufferData(e.ARRAY_BUFFER,oa,u));if(Z){y=0;for(I=Z.length;y<I;y++)q=Z[y],q.__original.needsUpdate&&(e.bindBuffer(e.ARRAY_BUFFER,q.buffer),e.bufferData(e.ARRAY_BUFFER,q.array,u))}if(Ea){y=0;for(I=Ga.length;y<I;y++)e.bindBuffer(e.ARRAY_BUFFER,p.__webglMorphTargetsBuffers[y]),
|
|
|
|
|
e.bufferData(e.ARRAY_BUFFER,qa[y],u)}Da&&ma>0&&(e.bindBuffer(e.ARRAY_BUFFER,p.__webglColorBuffer),e.bufferData(e.ARRAY_BUFFER,pa,u));Aa&&(e.bindBuffer(e.ARRAY_BUFFER,p.__webglNormalBuffer),e.bufferData(e.ARRAY_BUFFER,W,u));Ca&&ua.hasTangents&&(e.bindBuffer(e.ARRAY_BUFFER,p.__webglTangentBuffer),e.bufferData(e.ARRAY_BUFFER,ca,u));va&&X>0&&(e.bindBuffer(e.ARRAY_BUFFER,p.__webglUVBuffer),e.bufferData(e.ARRAY_BUFFER,ka,u));va&&aa>0&&(e.bindBuffer(e.ARRAY_BUFFER,p.__webglUV2Buffer),e.bufferData(e.ARRAY_BUFFER,
|
|
|
|
|
la,u));za&&(e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,p.__webglFaceBuffer),e.bufferData(e.ELEMENT_ARRAY_BUFFER,ia,u),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,p.__webglLineBuffer),e.bufferData(e.ELEMENT_ARRAY_BUFFER,Y,u));z>0&&(e.bindBuffer(e.ARRAY_BUFFER,p.__webglSkinVertexABuffer),e.bufferData(e.ARRAY_BUFFER,da,u),e.bindBuffer(e.ARRAY_BUFFER,p.__webglSkinVertexBBuffer),e.bufferData(e.ARRAY_BUFFER,ea,u),e.bindBuffer(e.ARRAY_BUFFER,p.__webglSkinIndicesBuffer),e.bufferData(e.ARRAY_BUFFER,fa,u),e.bindBuffer(e.ARRAY_BUFFER,
|
|
|
|
|
p.__webglSkinWeightsBuffer),e.bufferData(e.ARRAY_BUFFER,ga,u));w&&(delete p.__inittedArrays,delete p.__colorArray,delete p.__normalArray,delete p.__tangentArray,delete p.__uvArray,delete p.__uv2Array,delete p.__faceArray,delete p.__vertexArray,delete p.__lineArray,delete p.__skinVertexAArray,delete p.__skinVertexBArray,delete p.__skinIndexArray,delete p.__skinWeightArray)}h.__dirtyVertices=!1;h.__dirtyMorphTargets=!1;h.__dirtyElements=!1;h.__dirtyUvs=!1;h.__dirtyNormals=!1;h.__dirtyTangents=!1;h.__dirtyColors=
|
|
|
|
|
!1;ya(j)}else if(i instanceof THREE.Ribbon){h=i.geometry;if(h.__dirtyVertices||h.__dirtyColors){i=h;j=e.DYNAMIC_DRAW;k=v=w=w=void 0;n=i.vertices;m=i.colors;o=n.length;p=m.length;x=i.__vertexArray;u=i.__colorArray;E=i.__dirtyColors;if(i.__dirtyVertices){for(w=0;w<o;w++)v=n[w].position,k=w*3,x[k]=v.x,x[k+1]=v.y,x[k+2]=v.z;e.bindBuffer(e.ARRAY_BUFFER,i.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,x,j)}if(E){for(w=0;w<p;w++)color=m[w],k=w*3,u[k]=color.r,u[k+1]=color.g,u[k+2]=color.b;e.bindBuffer(e.ARRAY_BUFFER,
|
|
|
|
|
i.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,u,j)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(i instanceof THREE.Line){h=i.geometry;if(h.__dirtyVertices||h.__dirtyColors){i=h;j=e.DYNAMIC_DRAW;k=v=w=w=void 0;n=i.vertices;m=i.colors;o=n.length;p=m.length;x=i.__vertexArray;u=i.__colorArray;E=i.__dirtyColors;if(i.__dirtyVertices){for(w=0;w<o;w++)v=n[w].position,k=w*3,x[k]=v.x,x[k+1]=v.y,x[k+2]=v.z;e.bindBuffer(e.ARRAY_BUFFER,i.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,x,j)}if(E){for(w=
|
|
|
|
|
0;w<p;w++)color=m[w],k=w*3,u[k]=color.r,u[k+1]=color.g,u[k+2]=color.b;e.bindBuffer(e.ARRAY_BUFFER,i.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,u,j)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(i instanceof THREE.ParticleSystem)h=i.geometry,p=xa(h),(h.__dirtyVertices||h.__dirtyColors||i.sortParticles||p)&&c(h,e.DYNAMIC_DRAW,i),h.__dirtyVertices=!1,h.__dirtyColors=!1,ya(h)};this.setFaceCulling=function(b,c){b?(!c||c=="ccw"?e.frontFace(e.CCW):e.frontFace(e.CW),b=="back"?e.cullFace(e.BACK):b==
|
|
|
|
|
"front"?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK),e.enable(e.CULL_FACE)):e.disable(e.CULL_FACE)};this.supportsVertexTextures=function(){return db}};
|
|
|
|
|
"",d.lightMap?"#define USE_LIGHTMAP":"",d.vertexColors?"#define USE_COLOR":"",d.metal?"#define METAL":"",d.shadowMapEnabled?"#define USE_SHADOWMAP":"",d.shadowMapSoft?"#define SHADOWMAP_SOFT":"",d.shadowMapSoft?"#define SHADOWMAP_WIDTH "+d.shadowMapWidth.toFixed(1):"",d.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+d.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");e.attachShader(v,ia("fragment",j+m));e.attachShader(v,ia("vertex",f+n));e.linkProgram(v);
|
|
|
|
|
e.getProgramParameter(v,e.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+e.getProgramParameter(v,e.VALIDATE_STATUS)+", gl error ["+e.getError()+"]");v.uniforms={};v.attributes={};var w,f=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(w in p)f.push(w);w=f;f=0;for(p=w.length;f<p;f++)m=w[f],v.uniforms[m]=e.getUniformLocation(v,m);f=["position","normal",
|
|
|
|
|
"uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(w=0;w<d.maxMorphTargets;w++)f.push("morphTarget"+w);for(x in c)f.push(x);x=f;w=0;for(c=x.length;w<c;w++)d=x[w],v.attributes[d]=e.getAttribLocation(v,d);v.id=La.length;La.push({program:v,code:k});J.info.memory.programs=La.length;x=v}b.program=x;x=b.program.attributes;x.position>=0&&e.enableVertexAttribArray(x.position);x.color>=0&&e.enableVertexAttribArray(x.color);x.normal>=0&&e.enableVertexAttribArray(x.normal);
|
|
|
|
|
x.tangent>=0&&e.enableVertexAttribArray(x.tangent);b.skinning&&x.skinVertexA>=0&&x.skinVertexB>=0&&x.skinIndex>=0&&x.skinWeight>=0&&(e.enableVertexAttribArray(x.skinVertexA),e.enableVertexAttribArray(x.skinVertexB),e.enableVertexAttribArray(x.skinIndex),e.enableVertexAttribArray(x.skinWeight));if(b.attributes)for(i in b.attributes)x[i]!==void 0&&x[i]>=0&&e.enableVertexAttribArray(x[i]);if(b.morphTargets)for(i=b.numSupportedMorphTargets=0;i<this.maxMorphTargets;i++)w="morphTarget"+i,x[w]>=0&&(e.enableVertexAttribArray(x[w]),
|
|
|
|
|
b.numSupportedMorphTargets++);b.uniformsList=[];for(h in b.uniforms)b.uniformsList.push([b.uniforms[h],h])};this.clearTarget=function(b,c,d,e){S(b);this.clear(c,d,e)};this.updateShadowMap=function(b,c){F(b,c)};this.render=function(b,c,o,u){var K,Ia,ra,s,p,D,B,Pa,Qa=b.lights,x=b.fog;W=-1;this.shadowMapEnabled&&this.shadowMapAutoUpdate&&F(b,c);J.info.render.calls=0;J.info.render.vertices=0;J.info.render.faces=0;if(c.matrixAutoUpdate){for(p=c;p.parent;)p=p.parent;p.update(void 0,!0)}b.update(void 0,
|
|
|
|
|
!1,c);c.matrixWorldInverse.flattenToArray(Wa);c.projectionMatrix.flattenToArray(Va);Ea.multiply(c.projectionMatrix,c.matrixWorldInverse);m(Ea);this.initWebGLObjects(b);S(o);(this.autoClear||u)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);p=b.__webglObjects.length;for(u=0;u<p;u++)if(K=b.__webglObjects[u],B=K.object,B.visible)if(!(B instanceof THREE.Mesh)||!B.frustumCulled||r(B)){if(B.matrixWorld.flattenToArray(B._objectMatrixArray),H(B,c,!0),w(K),K.render=!0,this.sortObjects)K.object.renderDepth?
|
|
|
|
|
K.z=K.object.renderDepth:(Ja.copy(B.position),Ea.multiplyVector3(Ja),K.z=Ja.z)}else K.render=!1;else K.render=!1;this.sortObjects&&b.__webglObjects.sort(A);D=b.__webglObjectsImmediate.length;for(u=0;u<D;u++)K=b.__webglObjectsImmediate[u],B=K.object,B.visible&&(B.matrixAutoUpdate&&B.matrixWorld.flattenToArray(B._objectMatrixArray),H(B,c,!0),v(K));if(b.overrideMaterial){j(b.overrideMaterial.depthTest);O(b.overrideMaterial.blending);for(u=0;u<p;u++)if(K=b.__webglObjects[u],K.render)B=K.object,Pa=K.buffer,
|
|
|
|
|
i(B),f(c,Qa,x,b.overrideMaterial,Pa,B);for(u=0;u<D;u++)K=b.__webglObjectsImmediate[u],B=K.object,B.visible&&(G=-1,i(B),Ia=d(c,Qa,x,b.overrideMaterial,B),B.immediateRenderCallback?B.immediateRenderCallback(Ia,e,wa):B.render(function(c){h(c,Ia,b.overrideMaterial.shading)}))}else{O(THREE.NormalBlending);for(u=p-1;u>=0;u--)if(K=b.__webglObjects[u],K.render){B=K.object;Pa=K.buffer;ra=K.opaque;i(B);for(K=0;K<ra.count;K++)s=ra.list[K],j(s.depthTest),k(s.depthWrite),n(s.polygonOffset,s.polygonOffsetFactor,
|
|
|
|
|
s.polygonOffsetUnits),f(c,Qa,x,s,Pa,B)}for(u=0;u<D;u++)if(K=b.__webglObjectsImmediate[u],B=K.object,B.visible){G=-1;ra=K.opaque;i(B);for(K=0;K<ra.count;K++)s=ra.list[K],j(s.depthTest),k(s.depthWrite),n(s.polygonOffset,s.polygonOffsetFactor,s.polygonOffsetUnits),Ia=d(c,Qa,x,s,B),B.immediateRenderCallback?B.immediateRenderCallback(Ia,e,wa):B.render(function(b){h(b,Ia,s.shading)})}for(u=0;u<p;u++)if(K=b.__webglObjects[u],K.render){B=K.object;Pa=K.buffer;ra=K.transparent;i(B);for(K=0;K<ra.count;K++)s=
|
|
|
|
|
ra.list[K],O(s.blending),j(s.depthTest),k(s.depthWrite),n(s.polygonOffset,s.polygonOffsetFactor,s.polygonOffsetUnits),f(c,Qa,x,s,Pa,B)}for(u=0;u<D;u++)if(K=b.__webglObjectsImmediate[u],B=K.object,B.visible){G=-1;ra=K.transparent;i(B);for(K=0;K<ra.count;K++)s=ra.list[K],O(s.blending),j(s.depthTest),k(s.depthWrite),n(s.polygonOffset,s.polygonOffsetFactor,s.polygonOffsetUnits),Ia=d(c,Qa,x,s,B),B.immediateRenderCallback?B.immediateRenderCallback(Ia,e,wa):B.render(function(b){h(b,Ia,s.shading)})}}b.__webglSprites.length&&
|
|
|
|
|
L(b,c);o&&o.minFilter!==THREE.NearestFilter&&o.minFilter!==THREE.LinearFilter&&la(o)};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var d=b.__objectsAdded[0],f=b,h=void 0,i=void 0,j=void 0;if(!d.__webglInit)if(d.__webglInit=!0,d._modelViewMatrix=new THREE.Matrix4,d._normalMatrixArray=new Float32Array(9),d._modelViewMatrixArray=new Float32Array(16),d._objectMatrixArray=new Float32Array(16),
|
|
|
|
|
d.matrixWorld.flattenToArray(d._objectMatrixArray),d instanceof THREE.Mesh)for(h in i=d.geometry,i.geometryGroups==void 0&&sa(i),i.geometryGroups){if(j=i.geometryGroups[h],!j.__webglVertexBuffer){var k=j;k.__webglVertexBuffer=e.createBuffer();k.__webglNormalBuffer=e.createBuffer();k.__webglTangentBuffer=e.createBuffer();k.__webglColorBuffer=e.createBuffer();k.__webglUVBuffer=e.createBuffer();k.__webglUV2Buffer=e.createBuffer();k.__webglSkinVertexABuffer=e.createBuffer();k.__webglSkinVertexBBuffer=
|
|
|
|
|
e.createBuffer();k.__webglSkinIndicesBuffer=e.createBuffer();k.__webglSkinWeightsBuffer=e.createBuffer();k.__webglFaceBuffer=e.createBuffer();k.__webglLineBuffer=e.createBuffer();if(k.numMorphTargets){var m=void 0,p=void 0;k.__webglMorphTargetsBuffers=[];m=0;for(p=k.numMorphTargets;m<p;m++)k.__webglMorphTargetsBuffers.push(e.createBuffer())}J.info.memory.geometries++;for(var k=d,n=void 0,o=void 0,r=void 0,v=r=void 0,x=void 0,u=void 0,w=u=m=0,E=r=o=void 0,r=p=E=o=n=void 0,v=k.geometry,x=v.faces,E=
|
|
|
|
|
j.faces,n=0,o=E.length;n<o;n++)r=E[n],r=x[r],r instanceof THREE.Face3?(m+=3,u+=1,w+=3):r instanceof THREE.Face4&&(m+=4,u+=2,w+=4);for(var n=j,o=k,D=E=x=void 0,A=void 0,D=void 0,r=[],x=0,E=o.materials.length;x<E;x++)if(D=o.materials[x],D instanceof THREE.MeshFaceMaterial){D=0;for(l=n.materials.length;D<l;D++)(A=n.materials[D])&&r.push(A)}else(A=D)&&r.push(A);n=r;j.__materials=n;a:{x=o=void 0;E=n.length;for(o=0;o<E;o++)if(x=n[o],x.map||x.lightMap||x instanceof THREE.ShaderMaterial){o=!0;break a}o=!1}a:{E=
|
|
|
|
|
x=void 0;r=n.length;for(x=0;x<r;x++)if(E=n[x],!(E instanceof THREE.MeshBasicMaterial&&!E.envMap||E instanceof THREE.MeshDepthMaterial)){E=E&&E.shading!=void 0&&E.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}E=!1}a:{r=x=void 0;D=n.length;for(x=0;x<D;x++)if(r=n[x],r.vertexColors){r=r.vertexColors;break a}r=!1}j.__vertexArray=new Float32Array(m*3);if(E)j.__normalArray=new Float32Array(m*3);if(v.hasTangents)j.__tangentArray=new Float32Array(m*4);if(r)j.__colorArray=new Float32Array(m*
|
|
|
|
|
3);if(o){if(v.faceUvs.length>0||v.faceVertexUvs.length>0)j.__uvArray=new Float32Array(m*2);if(v.faceUvs.length>1||v.faceVertexUvs.length>1)j.__uv2Array=new Float32Array(m*2)}if(k.geometry.skinWeights.length&&k.geometry.skinIndices.length)j.__skinVertexAArray=new Float32Array(m*4),j.__skinVertexBArray=new Float32Array(m*4),j.__skinIndexArray=new Float32Array(m*4),j.__skinWeightArray=new Float32Array(m*4);j.__faceArray=new Uint16Array(u*3+(k.geometry.edgeFaces?k.geometry.edgeFaces.length*6:0));j.__lineArray=
|
|
|
|
|
new Uint16Array(w*2);if(j.numMorphTargets){j.__morphTargetsArrays=[];v=0;for(x=j.numMorphTargets;v<x;v++)j.__morphTargetsArrays.push(new Float32Array(m*3))}j.__needsSmoothNormals=E==THREE.SmoothShading;j.__uvType=o;j.__vertexColorType=r;j.__normalType=E;j.__webglFaceCount=u*3+(k.geometry.edgeFaces?k.geometry.edgeFaces.length*6:0);j.__webglLineCount=w*2;v=0;for(x=n.length;v<x;v++)if(o=n[v],o.attributes){if(j.__webglCustomAttributesList===void 0)j.__webglCustomAttributesList=[];for(a in o.attributes){r=
|
|
|
|
|
o.attributes[a];E={};for(p in r)E[p]=r[p];if(!E.__webglInitialized||E.createUniqueBuffers)E.__webglInitialized=!0,u=1,E.type==="v2"?u=2:E.type==="v3"?u=3:E.type==="v4"?u=4:E.type==="c"&&(u=3),E.size=u,E.array=new Float32Array(m*u),E.buffer=e.createBuffer(),E.buffer.belongsToAttribute=a,r.needsUpdate=!0,E.__original=r;j.__webglCustomAttributesList.push(E)}}j.__inittedArrays=!0;i.__dirtyVertices=!0;i.__dirtyMorphTargets=!0;i.__dirtyElements=!0;i.__dirtyUvs=!0;i.__dirtyNormals=!0;i.__dirtyTangents=!0;
|
|
|
|
|
i.__dirtyColors=!0}}else if(d instanceof THREE.Ribbon){if(i=d.geometry,!i.__webglVertexBuffer)j=i,j.__webglVertexBuffer=e.createBuffer(),j.__webglColorBuffer=e.createBuffer(),J.info.memory.geometries++,j=i,k=j.vertices.length,j.__vertexArray=new Float32Array(k*3),j.__colorArray=new Float32Array(k*3),j.__webglVertexCount=k,i.__dirtyVertices=!0,i.__dirtyColors=!0}else if(d instanceof THREE.Line){if(i=d.geometry,!i.__webglVertexBuffer)j=i,j.__webglVertexBuffer=e.createBuffer(),j.__webglColorBuffer=e.createBuffer(),
|
|
|
|
|
J.info.memory.geometries++,j=i,k=j.vertices.length,j.__vertexArray=new Float32Array(k*3),j.__colorArray=new Float32Array(k*3),j.__webglLineCount=k,i.__dirtyVertices=!0,i.__dirtyColors=!0}else if(d instanceof THREE.ParticleSystem&&(i=d.geometry,!i.__webglVertexBuffer)){j=i;j.__webglVertexBuffer=e.createBuffer();j.__webglColorBuffer=e.createBuffer();J.info.geometries++;j=i;k=d;m=j.vertices.length;j.__vertexArray=new Float32Array(m*3);j.__colorArray=new Float32Array(m*3);j.__sortArray=[];j.__webglParticleCount=
|
|
|
|
|
m;j.__materials=k.materials;w=u=p=void 0;p=0;for(u=k.materials.length;p<u;p++)if(w=k.materials[p],w.attributes){if(j.__webglCustomAttributesList===void 0)j.__webglCustomAttributesList=[];for(a in w.attributes){originalAttribute=w.attributes[a];attribute={};for(property in originalAttribute)attribute[property]=originalAttribute[property];if(!attribute.__webglInitialized||attribute.createUniqueBuffers)attribute.__webglInitialized=!0,size=1,attribute.type==="v2"?size=2:attribute.type==="v3"?size=3:attribute.type===
|
|
|
|
|
"v4"?size=4:attribute.type==="c"&&(size=3),attribute.size=size,attribute.array=new Float32Array(m*size),attribute.buffer=e.createBuffer(),attribute.buffer.belongsToAttribute=a,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;j.__webglCustomAttributesList.push(attribute)}}i.__dirtyVertices=!0;i.__dirtyColors=!0}if(!d.__webglActive){if(d instanceof THREE.Mesh)for(h in i=d.geometry,i.geometryGroups)j=i.geometryGroups[h],ha(f.__webglObjects,j,d);else d instanceof THREE.Ribbon||
|
|
|
|
|
d instanceof THREE.Line||d instanceof THREE.ParticleSystem?(i=d.geometry,ha(f.__webglObjects,i,d)):THREE.MarchingCubes!==void 0&&d instanceof THREE.MarchingCubes||d.immediateRenderCallback?f.__webglObjectsImmediate.push({object:d,opaque:{list:[],count:0},transparent:{list:[],count:0}}):d instanceof THREE.Sprite&&f.__webglSprites.push(d);d.__webglActive=!0}b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;){d=b.__objectsRemoved[0];f=b;if(d instanceof THREE.Mesh||d instanceof THREE.ParticleSystem||
|
|
|
|
|
d instanceof THREE.Ribbon||d instanceof THREE.Line)ja(f.__webglObjects,d);else if(d instanceof THREE.Sprite){f=f.__webglSprites;h=d;i=void 0;for(i=f.length-1;i>=0;i--)f[i]==h&&f.splice(i,1)}else(d instanceof THREE.MarchingCubes||d.immediateRenderCallback)&&ja(f.__webglObjectsImmediate,d);d.__webglActive=!1;b.__objectsRemoved.splice(0,1)}d=0;for(f=b.__webglObjects.length;d<f;d++)if(i=b.__webglObjects[d].object,p=j=h=void 0,i instanceof THREE.Mesh){h=i.geometry;k=0;for(m=h.geometryGroupsList.length;k<
|
|
|
|
|
m;k++)if(j=h.geometryGroupsList[k],p=xa(j),h.__dirtyVertices||h.__dirtyMorphTargets||h.__dirtyElements||h.__dirtyUvs||h.__dirtyNormals||h.__dirtyColors||h.__dirtyTangents||p)if(p=j,u=e.DYNAMIC_DRAW,w=!h.dynamic,p.__inittedArrays){var F=n=v=void 0,C=void 0,H=F=void 0,G=void 0,L=void 0,O=void 0,Q=A=D=r=E=x=o=void 0,R=void 0,N=void 0,y=C=O=C=L=G=void 0,I=void 0,t=I=y=G=void 0,q=void 0,t=I=y=F=F=H=I=y=C=t=I=y=q=t=I=y=q=t=I=y=void 0,M=0,P=0,X=0,aa=0,U=0,S=0,$=0,T=0,ma=0,z=0,na=0,V=t=0,V=void 0,oa=p.__vertexArray,
|
|
|
|
|
ka=p.__uvArray,la=p.__uv2Array,W=p.__normalArray,ca=p.__tangentArray,pa=p.__colorArray,da=p.__skinVertexAArray,ea=p.__skinVertexBArray,fa=p.__skinIndexArray,ga=p.__skinWeightArray,qa=p.__morphTargetsArrays,Z=p.__webglCustomAttributesList,q=void 0,ia=p.__faceArray,Y=p.__lineArray,wa=p.__needsSmoothNormals,x=p.__vertexColorType,o=p.__uvType,E=p.__normalType,ua=i.geometry,ta=ua.__dirtyVertices,za=ua.__dirtyElements,va=ua.__dirtyUvs,Aa=ua.__dirtyNormals,Ca=ua.__dirtyTangents,Da=ua.__dirtyColors,Ea=ua.__dirtyMorphTargets,
|
|
|
|
|
Ba=ua.vertices,Fa=p.faces,La=ua.faces,Ha=ua.faceVertexUvs[0],Ja=ua.faceVertexUvs[1],Ma=ua.skinVerticesA,Na=ua.skinVerticesB,Oa=ua.skinIndices,Ka=ua.skinWeights,Ga=ua.morphTargets;if(Z){y=0;for(I=Z.length;y<I;y++)Z[y].offset=0,Z[y].offsetSrc=0}v=0;for(n=Fa.length;v<n;v++)if(F=Fa[v],C=La[F],Ha&&(r=Ha[F]),Ja&&(D=Ja[F]),F=C.vertexNormals,H=C.normal,G=C.vertexColors,L=C.color,O=C.vertexTangents,C instanceof THREE.Face3){if(ta)A=Ba[C.a].position,Q=Ba[C.b].position,R=Ba[C.c].position,oa[P]=A.x,oa[P+1]=A.y,
|
|
|
|
|
oa[P+2]=A.z,oa[P+3]=Q.x,oa[P+4]=Q.y,oa[P+5]=Q.z,oa[P+6]=R.x,oa[P+7]=R.y,oa[P+8]=R.z,P+=9;if(Z){y=0;for(I=Z.length;y<I;y++)if(q=Z[y],q.__original.needsUpdate)t=q.offset,V=q.offsetSrc,q.size===1?(q.boundTo===void 0||q.boundTo==="vertices"?(q.array[t]=q.value[C.a],q.array[t+1]=q.value[C.b],q.array[t+2]=q.value[C.c]):q.boundTo==="faces"?(V=q.value[V],q.array[t]=V,q.array[t+1]=V,q.array[t+2]=V,q.offsetSrc++):q.boundTo==="faceVertices"&&(q.array[t]=q.value[V],q.array[t+1]=q.value[V+1],q.array[t+2]=q.value[V+
|
|
|
|
|
2],q.offsetSrc+=3),q.offset+=3):(q.boundTo===void 0||q.boundTo==="vertices"?(A=q.value[C.a],Q=q.value[C.b],R=q.value[C.c]):q.boundTo==="faces"?(R=Q=A=V=q.value[V],q.offsetSrc++):q.boundTo==="faceVertices"&&(A=q.value[V],Q=q.value[V+1],R=q.value[V+2],q.offsetSrc+=3),q.size===2?(q.array[t]=A.x,q.array[t+1]=A.y,q.array[t+2]=Q.x,q.array[t+3]=Q.y,q.array[t+4]=R.x,q.array[t+5]=R.y,q.offset+=6):q.size===3?(q.type==="c"?(q.array[t]=A.r,q.array[t+1]=A.g,q.array[t+2]=A.b,q.array[t+3]=Q.r,q.array[t+4]=Q.g,q.array[t+
|
|
|
|
|
5]=Q.b,q.array[t+6]=R.r,q.array[t+7]=R.g,q.array[t+8]=R.b):(q.array[t]=A.x,q.array[t+1]=A.y,q.array[t+2]=A.z,q.array[t+3]=Q.x,q.array[t+4]=Q.y,q.array[t+5]=Q.z,q.array[t+6]=R.x,q.array[t+7]=R.y,q.array[t+8]=R.z),q.offset+=9):(q.array[t]=A.x,q.array[t+1]=A.y,q.array[t+2]=A.z,q.array[t+3]=A.w,q.array[t+4]=Q.x,q.array[t+5]=Q.y,q.array[t+6]=Q.z,q.array[t+7]=Q.w,q.array[t+8]=R.x,q.array[t+9]=R.y,q.array[t+10]=R.z,q.array[t+11]=R.w,q.offset+=12))}if(Ea){y=0;for(I=Ga.length;y<I;y++)A=Ga[y].vertices[C.a].position,
|
|
|
|
|
Q=Ga[y].vertices[C.b].position,R=Ga[y].vertices[C.c].position,t=qa[y],t[na]=A.x,t[na+1]=A.y,t[na+2]=A.z,t[na+3]=Q.x,t[na+4]=Q.y,t[na+5]=Q.z,t[na+6]=R.x,t[na+7]=R.y,t[na+8]=R.z;na+=9}if(Ka.length)y=Ka[C.a],I=Ka[C.b],t=Ka[C.c],ga[z]=y.x,ga[z+1]=y.y,ga[z+2]=y.z,ga[z+3]=y.w,ga[z+4]=I.x,ga[z+5]=I.y,ga[z+6]=I.z,ga[z+7]=I.w,ga[z+8]=t.x,ga[z+9]=t.y,ga[z+10]=t.z,ga[z+11]=t.w,y=Oa[C.a],I=Oa[C.b],t=Oa[C.c],fa[z]=y.x,fa[z+1]=y.y,fa[z+2]=y.z,fa[z+3]=y.w,fa[z+4]=I.x,fa[z+5]=I.y,fa[z+6]=I.z,fa[z+7]=I.w,fa[z+8]=
|
|
|
|
|
t.x,fa[z+9]=t.y,fa[z+10]=t.z,fa[z+11]=t.w,y=Ma[C.a],I=Ma[C.b],t=Ma[C.c],da[z]=y.x,da[z+1]=y.y,da[z+2]=y.z,da[z+3]=1,da[z+4]=I.x,da[z+5]=I.y,da[z+6]=I.z,da[z+7]=1,da[z+8]=t.x,da[z+9]=t.y,da[z+10]=t.z,da[z+11]=1,y=Na[C.a],I=Na[C.b],t=Na[C.c],ea[z]=y.x,ea[z+1]=y.y,ea[z+2]=y.z,ea[z+3]=1,ea[z+4]=I.x,ea[z+5]=I.y,ea[z+6]=I.z,ea[z+7]=1,ea[z+8]=t.x,ea[z+9]=t.y,ea[z+10]=t.z,ea[z+11]=1,z+=12;if(Da&&x)G.length==3&&x==THREE.VertexColors?(C=G[0],y=G[1],I=G[2]):I=y=C=L,pa[ma]=C.r,pa[ma+1]=C.g,pa[ma+2]=C.b,pa[ma+
|
|
|
|
|
3]=y.r,pa[ma+4]=y.g,pa[ma+5]=y.b,pa[ma+6]=I.r,pa[ma+7]=I.g,pa[ma+8]=I.b,ma+=9;if(Ca&&ua.hasTangents)G=O[0],L=O[1],C=O[2],ca[$]=G.x,ca[$+1]=G.y,ca[$+2]=G.z,ca[$+3]=G.w,ca[$+4]=L.x,ca[$+5]=L.y,ca[$+6]=L.z,ca[$+7]=L.w,ca[$+8]=C.x,ca[$+9]=C.y,ca[$+10]=C.z,ca[$+11]=C.w,$+=12;if(Aa&&E)if(F.length==3&&wa)for(y=0;y<3;y++)H=F[y],W[S]=H.x,W[S+1]=H.y,W[S+2]=H.z,S+=3;else for(y=0;y<3;y++)W[S]=H.x,W[S+1]=H.y,W[S+2]=H.z,S+=3;if(va&&r!==void 0&&o)for(y=0;y<3;y++)F=r[y],ka[X]=F.u,ka[X+1]=F.v,X+=2;if(va&&D!==void 0&&
|
|
|
|
|
o)for(y=0;y<3;y++)F=D[y],la[aa]=F.u,la[aa+1]=F.v,aa+=2;za&&(ia[U]=M,ia[U+1]=M+1,ia[U+2]=M+2,U+=3,Y[T]=M,Y[T+1]=M+1,Y[T+2]=M,Y[T+3]=M+2,Y[T+4]=M+1,Y[T+5]=M+2,T+=6,M+=3)}else if(C instanceof THREE.Face4){if(ta)A=Ba[C.a].position,Q=Ba[C.b].position,R=Ba[C.c].position,N=Ba[C.d].position,oa[P]=A.x,oa[P+1]=A.y,oa[P+2]=A.z,oa[P+3]=Q.x,oa[P+4]=Q.y,oa[P+5]=Q.z,oa[P+6]=R.x,oa[P+7]=R.y,oa[P+8]=R.z,oa[P+9]=N.x,oa[P+10]=N.y,oa[P+11]=N.z,P+=12;if(Z){y=0;for(I=Z.length;y<I;y++)if(q=Z[y],q.__original.needsUpdate)t=
|
|
|
|
|
q.offset,V=q.offsetSrc,q.size===1?(q.boundTo===void 0||q.boundTo==="vertices"?(q.array[t]=q.value[C.a],q.array[t+1]=q.value[C.b],q.array[t+2]=q.value[C.c],q.array[t+3]=q.value[C.d]):q.boundTo==="faces"?(V=q.value[V],q.array[t]=V,q.array[t+1]=V,q.array[t+2]=V,q.array[t+3]=V,q.offsetSrc++):q.boundTo==="faceVertices"&&(q.array[t]=q.value[V],q.array[t+1]=q.value[V+1],q.array[t+2]=q.value[V+2],q.array[t+3]=q.value[V+3],q.offsetSrc+=4),q.offset+=4):(q.boundTo===void 0||q.boundTo==="vertices"?(A=q.value[C.a],
|
|
|
|
|
Q=q.value[C.b],R=q.value[C.c],N=q.value[C.d]):q.boundTo==="faces"?(N=R=Q=A=V=q.value[V],q.offsetSrc++):q.boundTo==="faceVertices"&&(A=q.value[V],Q=q.value[V+1],R=q.value[V+2],N=q.value[V+3],q.offsetSrc+=4),q.size===2?(q.array[t]=A.x,q.array[t+1]=A.y,q.array[t+2]=Q.x,q.array[t+3]=Q.y,q.array[t+4]=R.x,q.array[t+5]=R.y,q.array[t+6]=N.x,q.array[t+7]=N.y,q.offset+=8):q.size===3?(q.type==="c"?(q.array[t]=A.r,q.array[t+1]=A.g,q.array[t+2]=A.b,q.array[t+3]=Q.r,q.array[t+4]=Q.g,q.array[t+5]=Q.b,q.array[t+
|
|
|
|
|
6]=R.r,q.array[t+7]=R.g,q.array[t+8]=R.b,q.array[t+9]=N.r,q.array[t+10]=N.g,q.array[t+11]=N.b):(q.array[t]=A.x,q.array[t+1]=A.y,q.array[t+2]=A.z,q.array[t+3]=Q.x,q.array[t+4]=Q.y,q.array[t+5]=Q.z,q.array[t+6]=R.x,q.array[t+7]=R.y,q.array[t+8]=R.z,q.array[t+9]=N.x,q.array[t+10]=N.y,q.array[t+11]=N.z),q.offset+=12):(q.array[t]=A.x,q.array[t+1]=A.y,q.array[t+2]=A.z,q.array[t+3]=A.w,q.array[t+4]=Q.x,q.array[t+5]=Q.y,q.array[t+6]=Q.z,q.array[t+7]=Q.w,q.array[t+8]=R.x,q.array[t+9]=R.y,q.array[t+10]=R.z,
|
|
|
|
|
q.array[t+11]=R.w,q.array[t+12]=N.x,q.array[t+13]=N.y,q.array[t+14]=N.z,q.array[t+15]=N.w,q.offset+=16))}if(Ea){y=0;for(I=Ga.length;y<I;y++)A=Ga[y].vertices[C.a].position,Q=Ga[y].vertices[C.b].position,R=Ga[y].vertices[C.c].position,N=Ga[y].vertices[C.d].position,t=qa[y],t[na]=A.x,t[na+1]=A.y,t[na+2]=A.z,t[na+3]=Q.x,t[na+4]=Q.y,t[na+5]=Q.z,t[na+6]=R.x,t[na+7]=R.y,t[na+8]=R.z,t[na+9]=N.x,t[na+10]=N.y,t[na+11]=N.z;na+=12}if(Ka.length)y=Ka[C.a],I=Ka[C.b],t=Ka[C.c],q=Ka[C.d],ga[z]=y.x,ga[z+1]=y.y,ga[z+
|
|
|
|
|
2]=y.z,ga[z+3]=y.w,ga[z+4]=I.x,ga[z+5]=I.y,ga[z+6]=I.z,ga[z+7]=I.w,ga[z+8]=t.x,ga[z+9]=t.y,ga[z+10]=t.z,ga[z+11]=t.w,ga[z+12]=q.x,ga[z+13]=q.y,ga[z+14]=q.z,ga[z+15]=q.w,y=Oa[C.a],I=Oa[C.b],t=Oa[C.c],q=Oa[C.d],fa[z]=y.x,fa[z+1]=y.y,fa[z+2]=y.z,fa[z+3]=y.w,fa[z+4]=I.x,fa[z+5]=I.y,fa[z+6]=I.z,fa[z+7]=I.w,fa[z+8]=t.x,fa[z+9]=t.y,fa[z+10]=t.z,fa[z+11]=t.w,fa[z+12]=q.x,fa[z+13]=q.y,fa[z+14]=q.z,fa[z+15]=q.w,y=Ma[C.a],I=Ma[C.b],t=Ma[C.c],q=Ma[C.d],da[z]=y.x,da[z+1]=y.y,da[z+2]=y.z,da[z+3]=1,da[z+4]=I.x,
|
|
|
|
|
da[z+5]=I.y,da[z+6]=I.z,da[z+7]=1,da[z+8]=t.x,da[z+9]=t.y,da[z+10]=t.z,da[z+11]=1,da[z+12]=q.x,da[z+13]=q.y,da[z+14]=q.z,da[z+15]=1,y=Na[C.a],I=Na[C.b],t=Na[C.c],C=Na[C.d],ea[z]=y.x,ea[z+1]=y.y,ea[z+2]=y.z,ea[z+3]=1,ea[z+4]=I.x,ea[z+5]=I.y,ea[z+6]=I.z,ea[z+7]=1,ea[z+8]=t.x,ea[z+9]=t.y,ea[z+10]=t.z,ea[z+11]=1,ea[z+12]=C.x,ea[z+13]=C.y,ea[z+14]=C.z,ea[z+15]=1,z+=16;if(Da&&x)G.length==4&&x==THREE.VertexColors?(C=G[0],y=G[1],I=G[2],G=G[3]):G=I=y=C=L,pa[ma]=C.r,pa[ma+1]=C.g,pa[ma+2]=C.b,pa[ma+3]=y.r,pa[ma+
|
|
|
|
|
4]=y.g,pa[ma+5]=y.b,pa[ma+6]=I.r,pa[ma+7]=I.g,pa[ma+8]=I.b,pa[ma+9]=G.r,pa[ma+10]=G.g,pa[ma+11]=G.b,ma+=12;if(Ca&&ua.hasTangents)G=O[0],L=O[1],C=O[2],O=O[3],ca[$]=G.x,ca[$+1]=G.y,ca[$+2]=G.z,ca[$+3]=G.w,ca[$+4]=L.x,ca[$+5]=L.y,ca[$+6]=L.z,ca[$+7]=L.w,ca[$+8]=C.x,ca[$+9]=C.y,ca[$+10]=C.z,ca[$+11]=C.w,ca[$+12]=O.x,ca[$+13]=O.y,ca[$+14]=O.z,ca[$+15]=O.w,$+=16;if(Aa&&E)if(F.length==4&&wa)for(y=0;y<4;y++)H=F[y],W[S]=H.x,W[S+1]=H.y,W[S+2]=H.z,S+=3;else for(y=0;y<4;y++)W[S]=H.x,W[S+1]=H.y,W[S+2]=H.z,S+=
|
|
|
|
|
3;if(va&&r!==void 0&&o)for(y=0;y<4;y++)F=r[y],ka[X]=F.u,ka[X+1]=F.v,X+=2;if(va&&D!==void 0&&o)for(y=0;y<4;y++)F=D[y],la[aa]=F.u,la[aa+1]=F.v,aa+=2;za&&(ia[U]=M,ia[U+1]=M+1,ia[U+2]=M+3,ia[U+3]=M+1,ia[U+4]=M+2,ia[U+5]=M+3,U+=6,Y[T]=M,Y[T+1]=M+1,Y[T+2]=M,Y[T+3]=M+3,Y[T+4]=M+1,Y[T+5]=M+2,Y[T+6]=M+2,Y[T+7]=M+3,T+=8,M+=4)}ta&&(e.bindBuffer(e.ARRAY_BUFFER,p.__webglVertexBuffer),e.bufferData(e.ARRAY_BUFFER,oa,u));if(Z){y=0;for(I=Z.length;y<I;y++)q=Z[y],q.__original.needsUpdate&&(e.bindBuffer(e.ARRAY_BUFFER,
|
|
|
|
|
q.buffer),e.bufferData(e.ARRAY_BUFFER,q.array,u))}if(Ea){y=0;for(I=Ga.length;y<I;y++)e.bindBuffer(e.ARRAY_BUFFER,p.__webglMorphTargetsBuffers[y]),e.bufferData(e.ARRAY_BUFFER,qa[y],u)}Da&&ma>0&&(e.bindBuffer(e.ARRAY_BUFFER,p.__webglColorBuffer),e.bufferData(e.ARRAY_BUFFER,pa,u));Aa&&(e.bindBuffer(e.ARRAY_BUFFER,p.__webglNormalBuffer),e.bufferData(e.ARRAY_BUFFER,W,u));Ca&&ua.hasTangents&&(e.bindBuffer(e.ARRAY_BUFFER,p.__webglTangentBuffer),e.bufferData(e.ARRAY_BUFFER,ca,u));va&&X>0&&(e.bindBuffer(e.ARRAY_BUFFER,
|
|
|
|
|
p.__webglUVBuffer),e.bufferData(e.ARRAY_BUFFER,ka,u));va&&aa>0&&(e.bindBuffer(e.ARRAY_BUFFER,p.__webglUV2Buffer),e.bufferData(e.ARRAY_BUFFER,la,u));za&&(e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,p.__webglFaceBuffer),e.bufferData(e.ELEMENT_ARRAY_BUFFER,ia,u),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,p.__webglLineBuffer),e.bufferData(e.ELEMENT_ARRAY_BUFFER,Y,u));z>0&&(e.bindBuffer(e.ARRAY_BUFFER,p.__webglSkinVertexABuffer),e.bufferData(e.ARRAY_BUFFER,da,u),e.bindBuffer(e.ARRAY_BUFFER,p.__webglSkinVertexBBuffer),
|
|
|
|
|
e.bufferData(e.ARRAY_BUFFER,ea,u),e.bindBuffer(e.ARRAY_BUFFER,p.__webglSkinIndicesBuffer),e.bufferData(e.ARRAY_BUFFER,fa,u),e.bindBuffer(e.ARRAY_BUFFER,p.__webglSkinWeightsBuffer),e.bufferData(e.ARRAY_BUFFER,ga,u));w&&(delete p.__inittedArrays,delete p.__colorArray,delete p.__normalArray,delete p.__tangentArray,delete p.__uvArray,delete p.__uv2Array,delete p.__faceArray,delete p.__vertexArray,delete p.__lineArray,delete p.__skinVertexAArray,delete p.__skinVertexBArray,delete p.__skinIndexArray,delete p.__skinWeightArray)}h.__dirtyVertices=
|
|
|
|
|
!1;h.__dirtyMorphTargets=!1;h.__dirtyElements=!1;h.__dirtyUvs=!1;h.__dirtyNormals=!1;h.__dirtyTangents=!1;h.__dirtyColors=!1;ya(j)}else if(i instanceof THREE.Ribbon){h=i.geometry;if(h.__dirtyVertices||h.__dirtyColors){i=h;j=e.DYNAMIC_DRAW;k=v=w=w=void 0;n=i.vertices;m=i.colors;o=n.length;p=m.length;x=i.__vertexArray;u=i.__colorArray;E=i.__dirtyColors;if(i.__dirtyVertices){for(w=0;w<o;w++)v=n[w].position,k=w*3,x[k]=v.x,x[k+1]=v.y,x[k+2]=v.z;e.bindBuffer(e.ARRAY_BUFFER,i.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,
|
|
|
|
|
x,j)}if(E){for(w=0;w<p;w++)color=m[w],k=w*3,u[k]=color.r,u[k+1]=color.g,u[k+2]=color.b;e.bindBuffer(e.ARRAY_BUFFER,i.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,u,j)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(i instanceof THREE.Line){h=i.geometry;if(h.__dirtyVertices||h.__dirtyColors){i=h;j=e.DYNAMIC_DRAW;k=v=w=w=void 0;n=i.vertices;m=i.colors;o=n.length;p=m.length;x=i.__vertexArray;u=i.__colorArray;E=i.__dirtyColors;if(i.__dirtyVertices){for(w=0;w<o;w++)v=n[w].position,k=w*3,x[k]=v.x,x[k+
|
|
|
|
|
1]=v.y,x[k+2]=v.z;e.bindBuffer(e.ARRAY_BUFFER,i.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,x,j)}if(E){for(w=0;w<p;w++)color=m[w],k=w*3,u[k]=color.r,u[k+1]=color.g,u[k+2]=color.b;e.bindBuffer(e.ARRAY_BUFFER,i.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,u,j)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(i instanceof THREE.ParticleSystem)h=i.geometry,p=xa(h),(h.__dirtyVertices||h.__dirtyColors||i.sortParticles||p)&&c(h,e.DYNAMIC_DRAW,i),h.__dirtyVertices=!1,h.__dirtyColors=!1,ya(h)};this.setFaceCulling=
|
|
|
|
|
function(b,c){b?(!c||c=="ccw"?e.frontFace(e.CCW):e.frontFace(e.CW),b=="back"?e.cullFace(e.BACK):b=="front"?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK),e.enable(e.CULL_FACE)):e.disable(e.CULL_FACE)};this.supportsVertexTextures=function(){return db}};
|
|
|
|
|
THREE.WebGLRenderTarget=function(b,c,d){this.width=b;this.height=c;d=d||{};this.wrapS=d.wrapS!==void 0?d.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=d.wrapT!==void 0?d.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=d.magFilter!==void 0?d.magFilter:THREE.LinearFilter;this.minFilter=d.minFilter!==void 0?d.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=d.format!==void 0?d.format:THREE.RGBAFormat;this.type=d.type!==void 0?d.type:
|
|
|
|
|
THREE.UnsignedByteType;this.depthBuffer=d.depthBuffer!==void 0?d.depthBuffer:!0;this.stencilBuffer=d.stencilBuffer!==void 0?d.stencilBuffer:!0};
|
|
|
|
|
THREE.WebGLRenderTarget.prototype.clone=function(){var b=new THREE.WebGLRenderTarget(this.width,this.height);b.wrapS=this.wrapS;b.wrapT=this.wrapT;b.magFilter=this.magFilter;b.minFilter=this.minFilter;b.offset.copy(this.offset);b.repeat.copy(this.repeat);b.format=this.format;b.type=this.type;b.depthBuffer=this.depthBuffer;b.stencilBuffer=this.stencilBuffer;return b};THREE.WebGLRenderTargetCube=function(b,c,d){THREE.WebGLRenderTarget.call(this,b,c,d);this.activeCubeFace=0};
|
|
|
|
|