|
@@ -451,139 +451,13 @@ THREE.ShaderLib = {
|
|
|
|
|
|
vertexShader: [
|
|
|
|
|
|
- "#define STANDARD",
|
|
|
-
|
|
|
- "varying vec3 vViewPosition;",
|
|
|
-
|
|
|
- "#ifndef FLAT_SHADED",
|
|
|
-
|
|
|
- " varying vec3 vNormal;",
|
|
|
-
|
|
|
- "#endif",
|
|
|
-
|
|
|
- '#include <common>',
|
|
|
- '#include <uv_pars_vertex>',
|
|
|
- '#include <uv2_pars_vertex>',
|
|
|
- '#include <displacementmap_pars_vertex>',
|
|
|
- '#include <envmap_pars_vertex>',
|
|
|
- '#include <color_pars_vertex>',
|
|
|
- '#include <morphtarget_pars_vertex>',
|
|
|
- '#include <skinning_pars_vertex>',
|
|
|
- '#include <shadowmap_pars_vertex>',
|
|
|
- '#include <specularmap_pars_fragment>',
|
|
|
- '#include <logdepthbuf_pars_vertex>',
|
|
|
-
|
|
|
- "void main() {", // STANDARD
|
|
|
-
|
|
|
- '#include <uv_vertex>',
|
|
|
- '#include <uv2_vertex>',
|
|
|
- '#include <color_vertex>',
|
|
|
-
|
|
|
- '#include <beginnormal_vertex>',
|
|
|
- '#include <morphnormal_vertex>',
|
|
|
- '#include <skinbase_vertex>',
|
|
|
- '#include <skinnormal_vertex>',
|
|
|
- '#include <defaultnormal_vertex>',
|
|
|
-
|
|
|
- "#ifndef FLAT_SHADED", // Normal computed with derivatives when FLAT_SHADED
|
|
|
-
|
|
|
- " vNormal = normalize( transformedNormal );",
|
|
|
-
|
|
|
- "#endif",
|
|
|
-
|
|
|
- '#include <begin_vertex>',
|
|
|
- '#include <displacementmap_vertex>',
|
|
|
- '#include <morphtarget_vertex>',
|
|
|
- '#include <skinning_vertex>',
|
|
|
- '#include <project_vertex>',
|
|
|
- '#include <logdepthbuf_vertex>',
|
|
|
-
|
|
|
- " vViewPosition = - mvPosition.xyz;",
|
|
|
-
|
|
|
- '#include <worldpos_vertex>',
|
|
|
- '#include <envmap_vertex>',
|
|
|
- '#include <shadowmap_vertex>',
|
|
|
-
|
|
|
- "}"
|
|
|
+ "#include <meshstandard_vert>"
|
|
|
|
|
|
].join( "\n" ),
|
|
|
|
|
|
fragmentShader: [
|
|
|
|
|
|
- "#define STANDARD",
|
|
|
-
|
|
|
- "uniform vec3 diffuse;",
|
|
|
- "uniform vec3 emissive;",
|
|
|
- "uniform float roughness;",
|
|
|
- "uniform float metalness;",
|
|
|
- "uniform float opacity;",
|
|
|
-
|
|
|
- "uniform float envMapIntensity;", // temporary
|
|
|
-
|
|
|
- "varying vec3 vViewPosition;",
|
|
|
-
|
|
|
- "#ifndef FLAT_SHADED",
|
|
|
-
|
|
|
- " varying vec3 vNormal;",
|
|
|
-
|
|
|
- "#endif",
|
|
|
-
|
|
|
- '#include <common>',
|
|
|
- '#include <encodings>',
|
|
|
- '#include <color_pars_fragment>',
|
|
|
- '#include <uv_pars_fragment>',
|
|
|
- '#include <uv2_pars_fragment>',
|
|
|
- '#include <map_pars_fragment>',
|
|
|
- '#include <alphamap_pars_fragment>',
|
|
|
- '#include <aomap_pars_fragment>',
|
|
|
- '#include <lightmap_pars_fragment>',
|
|
|
- '#include <emissivemap_pars_fragment>',
|
|
|
- '#include <envmap_pars_fragment>',
|
|
|
- '#include <fog_pars_fragment>',
|
|
|
- '#include <bsdfs>',
|
|
|
- '#include <ambient_pars>',
|
|
|
- '#include <lights_pars>',
|
|
|
- '#include <lights_standard_pars_fragment>',
|
|
|
- '#include <shadowmap_pars_fragment>',
|
|
|
- '#include <bumpmap_pars_fragment>',
|
|
|
- '#include <normalmap_pars_fragment>',
|
|
|
- '#include <roughnessmap_pars_fragment>',
|
|
|
- '#include <metalnessmap_pars_fragment>',
|
|
|
- '#include <logdepthbuf_pars_fragment>',
|
|
|
-
|
|
|
- "void main() {",
|
|
|
-
|
|
|
- " vec4 diffuseColor = vec4( diffuse, opacity );",
|
|
|
- " ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );",
|
|
|
- " vec3 totalEmissiveLight = emissive;",
|
|
|
-
|
|
|
- '#include <logdepthbuf_fragment>',
|
|
|
- '#include <map_fragment>',
|
|
|
- '#include <color_fragment>',
|
|
|
- '#include <alphamap_fragment>',
|
|
|
- '#include <alphatest_fragment>',
|
|
|
- '#include <specularmap_fragment>',
|
|
|
- '#include <roughnessmap_fragment>',
|
|
|
- '#include <metalnessmap_fragment>',
|
|
|
- '#include <normal_fragment>',
|
|
|
- '#include <emissivemap_fragment>',
|
|
|
-
|
|
|
- // accumulation
|
|
|
- '#include <lights_standard_fragment>',
|
|
|
- '#include <lights_template>',
|
|
|
-
|
|
|
- // modulation
|
|
|
- '#include <aomap_fragment>',
|
|
|
-
|
|
|
- "vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveLight;",
|
|
|
-
|
|
|
- '#include <linear_to_gamma_fragment>',
|
|
|
-
|
|
|
- '#include <fog_fragment>',
|
|
|
-
|
|
|
- " gl_FragColor = vec4( outgoingLight, diffuseColor.a );",
|
|
|
-
|
|
|
- "}"
|
|
|
+ "#include <meshstandard_frag>"
|
|
|
|
|
|
].join( "\n" )
|
|
|
|