|
@@ -5100,7 +5100,7 @@ var linedashed_frag = "uniform vec3 diffuse;\nuniform float opacity;\nuniform fl
|
|
|
|
|
|
var linedashed_vert = "uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\tvLineDistance = scale * lineDistance;\n\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n}\n";
|
|
|
|
|
|
-var meshbasic_frag = "uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight;\n\treflectedLight.directDiffuse = vec3( 0.0 );\n\treflectedLight.directSpecular = vec3( 0.0 );\n\treflectedLight.indirectDiffuse = diffuseColor.rgb;\n\treflectedLight.indirectSpecular = vec3( 0.0 );\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <normal_flip>\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n";
|
|
|
+var meshbasic_frag = "uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\treflectedLight.indirectDiffuse += texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <normal_flip>\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n";
|
|
|
|
|
|
var meshbasic_vert = "#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_ENVMAP\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <envmap_vertex>\n}\n";
|
|
|
|
|
@@ -5929,6 +5929,7 @@ var ShaderLib = {
|
|
|
uniforms: Object.assign( {},
|
|
|
UniformsLib.common,
|
|
|
UniformsLib.aomap,
|
|
|
+ UniformsLib.lightmap,
|
|
|
UniformsLib.fog
|
|
|
),
|
|
|
|
|
@@ -11587,6 +11588,9 @@ Face3.prototype = {
|
|
|
* opacity: <float>,
|
|
|
* map: new THREE.Texture( <Image> ),
|
|
|
*
|
|
|
+ * lightMap: new THREE.Texture( <Image> ),
|
|
|
+ * lightMapIntensity: <float>
|
|
|
+ *
|
|
|
* aoMap: new THREE.Texture( <Image> ),
|
|
|
* aoMapIntensity: <float>
|
|
|
*
|
|
@@ -11621,6 +11625,9 @@ function MeshBasicMaterial( parameters ) {
|
|
|
|
|
|
this.map = null;
|
|
|
|
|
|
+ this.lightMap = null;
|
|
|
+ this.lightMapIntensity = 1.0;
|
|
|
+
|
|
|
this.aoMap = null;
|
|
|
this.aoMapIntensity = 1.0;
|
|
|
|
|
@@ -11660,6 +11667,9 @@ MeshBasicMaterial.prototype.copy = function ( source ) {
|
|
|
|
|
|
this.map = source.map;
|
|
|
|
|
|
+ this.lightMap = source.lightMap;
|
|
|
+ this.lightMapIntensity = source.lightMapIntensity;
|
|
|
+
|
|
|
this.aoMap = source.aoMap;
|
|
|
this.aoMapIntensity = source.aoMapIntensity;
|
|
|
|
|
@@ -21349,6 +21359,13 @@ function WebGLRenderer( parameters ) {
|
|
|
uniforms.specularMap.value = material.specularMap;
|
|
|
uniforms.alphaMap.value = material.alphaMap;
|
|
|
|
|
|
+ if ( material.lightMap ) {
|
|
|
+
|
|
|
+ uniforms.lightMap.value = material.lightMap;
|
|
|
+ uniforms.lightMapIntensity.value = material.lightMapIntensity;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
if ( material.aoMap ) {
|
|
|
|
|
|
uniforms.aoMap.value = material.aoMap;
|
|
@@ -21487,13 +21504,6 @@ function WebGLRenderer( parameters ) {
|
|
|
|
|
|
function refreshUniformsLambert( uniforms, material ) {
|
|
|
|
|
|
- if ( material.lightMap ) {
|
|
|
-
|
|
|
- uniforms.lightMap.value = material.lightMap;
|
|
|
- uniforms.lightMapIntensity.value = material.lightMapIntensity;
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
if ( material.emissiveMap ) {
|
|
|
|
|
|
uniforms.emissiveMap.value = material.emissiveMap;
|
|
@@ -21507,13 +21517,6 @@ function WebGLRenderer( parameters ) {
|
|
|
uniforms.specular.value = material.specular;
|
|
|
uniforms.shininess.value = Math.max( material.shininess, 1e-4 ); // to prevent pow( 0.0, 0.0 )
|
|
|
|
|
|
- if ( material.lightMap ) {
|
|
|
-
|
|
|
- uniforms.lightMap.value = material.lightMap;
|
|
|
- uniforms.lightMapIntensity.value = material.lightMapIntensity;
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
if ( material.emissiveMap ) {
|
|
|
|
|
|
uniforms.emissiveMap.value = material.emissiveMap;
|
|
@@ -21561,13 +21564,6 @@ function WebGLRenderer( parameters ) {
|
|
|
|
|
|
}
|
|
|
|
|
|
- if ( material.lightMap ) {
|
|
|
-
|
|
|
- uniforms.lightMap.value = material.lightMap;
|
|
|
- uniforms.lightMapIntensity.value = material.lightMapIntensity;
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
if ( material.emissiveMap ) {
|
|
|
|
|
|
uniforms.emissiveMap.value = material.emissiveMap;
|