|
@@ -74,9 +74,9 @@ f.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",f.logarithmicDepthBuffer&&
|
|
|
"#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(Qd).join("\n"),b=[v,"precision "+f.precision+" float;","precision "+f.precision+" int;","#define SHADER_NAME "+e.name,y,f.alphaTest?"#define ALPHATEST "+f.alphaTest+(f.alphaTest%1?"":".0"):"","#define GAMMA_FACTOR "+n,f.useFog&&f.fog?"#define USE_FOG":"",f.useFog&&f.fogExp?"#define FOG_EXP2":"",f.map?"#define USE_MAP":"",f.matcap?"#define USE_MATCAP":"",f.envMap?"#define USE_ENVMAP":"",f.envMap?
|
|
|
"#define "+k:"",f.envMap?"#define "+r:"",f.envMap?"#define "+q:"",f.lightMap?"#define USE_LIGHTMAP":"",f.aoMap?"#define USE_AOMAP":"",f.emissiveMap?"#define USE_EMISSIVEMAP":"",f.bumpMap?"#define USE_BUMPMAP":"",f.normalMap?"#define USE_NORMALMAP":"",f.normalMap&&f.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",f.clearCoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",f.specularMap?"#define USE_SPECULARMAP":"",f.roughnessMap?"#define USE_ROUGHNESSMAP":"",f.metalnessMap?"#define USE_METALNESSMAP":
|
|
|
"",f.alphaMap?"#define USE_ALPHAMAP":"",f.vertexTangents?"#define USE_TANGENT":"",f.vertexColors?"#define USE_COLOR":"",f.gradientMap?"#define USE_GRADIENTMAP":"",f.flatShading?"#define FLAT_SHADED":"",f.doubleSided?"#define DOUBLE_SIDED":"",f.flipSided?"#define FLIP_SIDED":"",f.shadowMapEnabled?"#define USE_SHADOWMAP":"",f.shadowMapEnabled?"#define "+t:"",f.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",f.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",f.logarithmicDepthBuffer?
|
|
|
-"#define USE_LOGDEPTHBUF":"",f.logarithmicDepthBuffer&&(g.isWebGL2||b.get("EXT_frag_depth"))?"#define USE_LOGDEPTHBUF_EXT":"",f.envMap&&(g.isWebGL2||b.get("EXT_shader_texture_lod"))?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",0!==f.toneMapping?"#define TONE_MAPPING":"",0!==f.toneMapping?L.tonemapping_pars_fragment:"",0!==f.toneMapping?yj("toneMapping",f.toneMapping):"",f.dithering?"#define DITHERING":"",f.outputEncoding||f.mapEncoding||f.matcapEncoding||
|
|
|
-f.envMapEncoding||f.emissiveMapEncoding?L.encodings_pars_fragment:"",f.mapEncoding?cf("mapTexelToLinear",f.mapEncoding):"",f.matcapEncoding?cf("matcapTexelToLinear",f.matcapEncoding):"",f.envMapEncoding?cf("envMapTexelToLinear",f.envMapEncoding):"",f.emissiveMapEncoding?cf("emissiveMapTexelToLinear",f.emissiveMapEncoding):"",f.outputEncoding?xj("linearToOutputTexel",f.outputEncoding):"",f.depthPacking?"#define DEPTH_PACKING "+d.depthPacking:"","\n"].filter(Qd).join("\n"));m=pg(m);m=Jh(m,f);m=Kh(m,
|
|
|
-f);p=pg(p);p=Jh(p,f);p=Kh(p,f);m=Lh(m);p=Lh(p);g.isWebGL2&&!d.isRawShaderMaterial&&(g=!1,t=/^\s*#version\s+300\s+es\s*\n/,d.isShaderMaterial&&null!==m.match(t)&&null!==p.match(t)&&(g=!0,m=m.replace(t,""),p=p.replace(t,"")),l="#version 300 es\n\n#define attribute in\n#define varying out\n#define texture2D texture\n"+l,b=["#version 300 es\n\n#define varying in",g?"":"out highp vec4 pc_fragColor;",g?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth\n#define texture2D texture\n#define textureCube texture\n#define texture2DProj textureProj\n#define texture2DLodEXT textureLod\n#define texture2DProjLodEXT textureProjLod\n#define textureCubeLodEXT textureLod\n#define texture2DGradEXT textureGrad\n#define texture2DProjGradEXT textureProjGrad\n#define textureCubeGradEXT textureGrad"].join("\n")+
|
|
|
+"#define USE_LOGDEPTHBUF":"",f.logarithmicDepthBuffer&&(g.isWebGL2||b.get("EXT_frag_depth"))?"#define USE_LOGDEPTHBUF_EXT":"",(d.extensions&&d.extensions.shaderTextureLOD||f.envMap)&&(g.isWebGL2||b.get("EXT_shader_texture_lod"))?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",0!==f.toneMapping?"#define TONE_MAPPING":"",0!==f.toneMapping?L.tonemapping_pars_fragment:"",0!==f.toneMapping?yj("toneMapping",f.toneMapping):"",f.dithering?"#define DITHERING":"",f.outputEncoding||
|
|
|
+f.mapEncoding||f.matcapEncoding||f.envMapEncoding||f.emissiveMapEncoding?L.encodings_pars_fragment:"",f.mapEncoding?cf("mapTexelToLinear",f.mapEncoding):"",f.matcapEncoding?cf("matcapTexelToLinear",f.matcapEncoding):"",f.envMapEncoding?cf("envMapTexelToLinear",f.envMapEncoding):"",f.emissiveMapEncoding?cf("emissiveMapTexelToLinear",f.emissiveMapEncoding):"",f.outputEncoding?xj("linearToOutputTexel",f.outputEncoding):"",f.depthPacking?"#define DEPTH_PACKING "+d.depthPacking:"","\n"].filter(Qd).join("\n"));
|
|
|
+m=pg(m);m=Jh(m,f);m=Kh(m,f);p=pg(p);p=Jh(p,f);p=Kh(p,f);m=Lh(m);p=Lh(p);g.isWebGL2&&!d.isRawShaderMaterial&&(g=!1,t=/^\s*#version\s+300\s+es\s*\n/,d.isShaderMaterial&&null!==m.match(t)&&null!==p.match(t)&&(g=!0,m=m.replace(t,""),p=p.replace(t,"")),l="#version 300 es\n\n#define attribute in\n#define varying out\n#define texture2D texture\n"+l,b=["#version 300 es\n\n#define varying in",g?"":"out highp vec4 pc_fragColor;",g?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth\n#define texture2D texture\n#define textureCube texture\n#define texture2DProj textureProj\n#define texture2DLodEXT textureLod\n#define texture2DProjLodEXT textureProjLod\n#define textureCubeLodEXT textureLod\n#define texture2DGradEXT textureGrad\n#define texture2DProjGradEXT textureProjGrad\n#define textureCubeGradEXT textureGrad"].join("\n")+
|
|
|
"\n"+b);p=b+p;m=Gh(h,35633,l+m);p=Gh(h,35632,p);h.attachShader(w,m);h.attachShader(w,p);void 0!==d.index0AttributeName?h.bindAttribLocation(w,0,d.index0AttributeName):!0===f.morphTargets&&h.bindAttribLocation(w,0,"position");h.linkProgram(w);if(a.debug.checkShaderErrors){a=h.getProgramInfoLog(w).trim();f=h.getShaderInfoLog(m).trim();g=h.getShaderInfoLog(p).trim();k=t=!0;if(!1===h.getProgramParameter(w,35714))t=!1,r=Ih(h,m,"vertex"),q=Ih(h,p,"fragment"),console.error("THREE.WebGLProgram: shader error: ",
|
|
|
h.getError(),"35715",h.getProgramParameter(w,35715),"gl.getProgramInfoLog",a,r,q);else if(""!==a)console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",a);else if(""===f||""===g)k=!1;k&&(this.diagnostics={runnable:t,material:d,programLog:a,vertexShader:{log:f,prefix:l},fragmentShader:{log:g,prefix:b}})}h.deleteShader(m);h.deleteShader(p);var I;this.getUniforms=function(){void 0===I&&(I=new Mb(h,w));return I};var G;this.getAttributes=function(){if(void 0===G){for(var a={},b=h.getProgramParameter(w,
|
|
|
35721),c=0;c<b;c++){var d=h.getActiveAttrib(w,c).name;a[d]=h.getAttribLocation(w,d)}G=a}return G};this.destroy=function(){h.deleteProgram(w);this.program=void 0};this.name=e.name;this.id=Cj++;this.code=c;this.usedTimes=1;this.program=w;this.vertexShader=m;this.fragmentShader=p;return this}function Dj(a,b,c){function d(a,b){if(a)a.isTexture?c=a.encoding:a.isWebGLRenderTarget&&(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),
|