Browse Source

ShaderLib: Unified glsl.js files. (#22493)

Mr.doob 3 years ago
parent
commit
be57bd9b3f
40 changed files with 747 additions and 748 deletions
  1. 48 64
      src/renderers/shaders/ShaderChunk.js
  2. 29 0
      src/renderers/shaders/ShaderLib/background.glsl.js
  3. 0 16
      src/renderers/shaders/ShaderLib/background_frag.glsl.js
  4. 0 12
      src/renderers/shaders/ShaderLib/background_vert.glsl.js
  5. 18 1
      src/renderers/shaders/ShaderLib/cube.glsl.js
  6. 0 16
      src/renderers/shaders/ShaderLib/cube_vert.glsl.js
  7. 92 0
      src/renderers/shaders/ShaderLib/depth.glsl.js
  8. 0 51
      src/renderers/shaders/ShaderLib/depth_frag.glsl.js
  9. 0 40
      src/renderers/shaders/ShaderLib/depth_vert.glsl.js
  10. 73 0
      src/renderers/shaders/ShaderLib/distanceRGBA.glsl.js
  11. 0 34
      src/renderers/shaders/ShaderLib/distanceRGBA_frag.glsl.js
  12. 0 38
      src/renderers/shaders/ShaderLib/distanceRGBA_vert.glsl.js
  13. 16 1
      src/renderers/shaders/ShaderLib/equirect.glsl.js
  14. 0 14
      src/renderers/shaders/ShaderLib/equirect_vert.glsl.js
  15. 29 1
      src/renderers/shaders/ShaderLib/linedashed.glsl.js
  16. 0 27
      src/renderers/shaders/ShaderLib/linedashed_vert.glsl.js
  17. 43 1
      src/renderers/shaders/ShaderLib/meshbasic.glsl.js
  18. 0 41
      src/renderers/shaders/ShaderLib/meshbasic_vert.glsl.js
  19. 53 1
      src/renderers/shaders/ShaderLib/meshlambert.glsl.js
  20. 0 51
      src/renderers/shaders/ShaderLib/meshlambert_vert.glsl.js
  21. 44 1
      src/renderers/shaders/ShaderLib/meshmatcap.glsl.js
  22. 0 42
      src/renderers/shaders/ShaderLib/meshmatcap_vert.glsl.js
  23. 32 1
      src/renderers/shaders/ShaderLib/meshnormal.glsl.js
  24. 0 30
      src/renderers/shaders/ShaderLib/meshnormal_frag.glsl.js
  25. 51 1
      src/renderers/shaders/ShaderLib/meshphong.glsl.js
  26. 0 49
      src/renderers/shaders/ShaderLib/meshphong_vert.glsl.js
  27. 60 1
      src/renderers/shaders/ShaderLib/meshphysical.glsl.js
  28. 0 58
      src/renderers/shaders/ShaderLib/meshphysical_vert.glsl.js
  29. 49 1
      src/renderers/shaders/ShaderLib/meshtoon.glsl.js
  30. 0 47
      src/renderers/shaders/ShaderLib/meshtoon_vert.glsl.js
  31. 37 1
      src/renderers/shaders/ShaderLib/points.glsl.js
  32. 0 35
      src/renderers/shaders/ShaderLib/points_vert.glsl.js
  33. 24 1
      src/renderers/shaders/ShaderLib/shadow.glsl.js
  34. 0 22
      src/renderers/shaders/ShaderLib/shadow_frag.glsl.js
  35. 36 1
      src/renderers/shaders/ShaderLib/sprite.glsl.js
  36. 0 34
      src/renderers/shaders/ShaderLib/sprite_frag.glsl.js
  37. 9 1
      src/renderers/shaders/ShaderLib/vsm.glsl.js
  38. 0 7
      src/renderers/shaders/ShaderLib/vsm_vert.glsl.js
  39. 3 5
      src/renderers/webgl/WebGLShadowMap.js
  40. 1 1
      utils/build/rollup.config.js

+ 48 - 64
src/renderers/shaders/ShaderChunk.js

@@ -101,38 +101,22 @@ import uv2_pars_vertex from './ShaderChunk/uv2_pars_vertex.glsl.js';
 import uv2_vertex from './ShaderChunk/uv2_vertex.glsl.js';
 import worldpos_vertex from './ShaderChunk/worldpos_vertex.glsl.js';
 
-import background_frag from './ShaderLib/background_frag.glsl.js';
-import background_vert from './ShaderLib/background_vert.glsl.js';
-import cube_frag from './ShaderLib/cube_frag.glsl.js';
-import cube_vert from './ShaderLib/cube_vert.glsl.js';
-import depth_frag from './ShaderLib/depth_frag.glsl.js';
-import depth_vert from './ShaderLib/depth_vert.glsl.js';
-import distanceRGBA_frag from './ShaderLib/distanceRGBA_frag.glsl.js';
-import distanceRGBA_vert from './ShaderLib/distanceRGBA_vert.glsl.js';
-import equirect_frag from './ShaderLib/equirect_frag.glsl.js';
-import equirect_vert from './ShaderLib/equirect_vert.glsl.js';
-import linedashed_frag from './ShaderLib/linedashed_frag.glsl.js';
-import linedashed_vert from './ShaderLib/linedashed_vert.glsl.js';
-import meshbasic_frag from './ShaderLib/meshbasic_frag.glsl.js';
-import meshbasic_vert from './ShaderLib/meshbasic_vert.glsl.js';
-import meshlambert_frag from './ShaderLib/meshlambert_frag.glsl.js';
-import meshlambert_vert from './ShaderLib/meshlambert_vert.glsl.js';
-import meshmatcap_frag from './ShaderLib/meshmatcap_frag.glsl.js';
-import meshmatcap_vert from './ShaderLib/meshmatcap_vert.glsl.js';
-import meshnormal_frag from './ShaderLib/meshnormal_frag.glsl.js';
-import meshnormal_vert from './ShaderLib/meshnormal_vert.glsl.js';
-import meshphong_frag from './ShaderLib/meshphong_frag.glsl.js';
-import meshphong_vert from './ShaderLib/meshphong_vert.glsl.js';
-import meshphysical_frag from './ShaderLib/meshphysical_frag.glsl.js';
-import meshphysical_vert from './ShaderLib/meshphysical_vert.glsl.js';
-import meshtoon_frag from './ShaderLib/meshtoon_frag.glsl.js';
-import meshtoon_vert from './ShaderLib/meshtoon_vert.glsl.js';
-import points_frag from './ShaderLib/points_frag.glsl.js';
-import points_vert from './ShaderLib/points_vert.glsl.js';
-import shadow_frag from './ShaderLib/shadow_frag.glsl.js';
-import shadow_vert from './ShaderLib/shadow_vert.glsl.js';
-import sprite_frag from './ShaderLib/sprite_frag.glsl.js';
-import sprite_vert from './ShaderLib/sprite_vert.glsl.js';
+import * as background from './ShaderLib/background.glsl.js';
+import * as cube from './ShaderLib/cube.glsl.js';
+import * as depth from './ShaderLib/depth.glsl.js';
+import * as distanceRGBA from './ShaderLib/distanceRGBA.glsl.js';
+import * as equirect from './ShaderLib/equirect.glsl.js';
+import * as linedashed from './ShaderLib/linedashed.glsl.js';
+import * as meshbasic from './ShaderLib/meshbasic.glsl.js';
+import * as meshlambert from './ShaderLib/meshlambert.glsl.js';
+import * as meshmatcap from './ShaderLib/meshmatcap.glsl.js';
+import * as meshnormal from './ShaderLib/meshnormal.glsl.js';
+import * as meshphong from './ShaderLib/meshphong.glsl.js';
+import * as meshphysical from './ShaderLib/meshphysical.glsl.js';
+import * as meshtoon from './ShaderLib/meshtoon.glsl.js';
+import * as points from './ShaderLib/points.glsl.js';
+import * as shadow from './ShaderLib/shadow.glsl.js';
+import * as sprite from './ShaderLib/sprite.glsl.js';
 
 export const ShaderChunk = {
 	alphamap_fragment: alphamap_fragment,
@@ -238,36 +222,36 @@ export const ShaderChunk = {
 	uv2_vertex: uv2_vertex,
 	worldpos_vertex: worldpos_vertex,
 
-	background_frag: background_frag,
-	background_vert: background_vert,
-	cube_frag: cube_frag,
-	cube_vert: cube_vert,
-	depth_frag: depth_frag,
-	depth_vert: depth_vert,
-	distanceRGBA_frag: distanceRGBA_frag,
-	distanceRGBA_vert: distanceRGBA_vert,
-	equirect_frag: equirect_frag,
-	equirect_vert: equirect_vert,
-	linedashed_frag: linedashed_frag,
-	linedashed_vert: linedashed_vert,
-	meshbasic_frag: meshbasic_frag,
-	meshbasic_vert: meshbasic_vert,
-	meshlambert_frag: meshlambert_frag,
-	meshlambert_vert: meshlambert_vert,
-	meshmatcap_frag: meshmatcap_frag,
-	meshmatcap_vert: meshmatcap_vert,
-	meshnormal_frag: meshnormal_frag,
-	meshnormal_vert: meshnormal_vert,
-	meshphong_frag: meshphong_frag,
-	meshphong_vert: meshphong_vert,
-	meshphysical_frag: meshphysical_frag,
-	meshphysical_vert: meshphysical_vert,
-	meshtoon_frag: meshtoon_frag,
-	meshtoon_vert: meshtoon_vert,
-	points_frag: points_frag,
-	points_vert: points_vert,
-	shadow_frag: shadow_frag,
-	shadow_vert: shadow_vert,
-	sprite_frag: sprite_frag,
-	sprite_vert: sprite_vert
+	background_vert: background.vertex,
+	background_frag: background.fragment,
+	cube_vert: cube.vertex,
+	cube_frag: cube.fragment,
+	depth_vert: depth.vertex,
+	depth_frag: depth.fragment,
+	distanceRGBA_vert: distanceRGBA.vertex,
+	distanceRGBA_frag: distanceRGBA.fragment,
+	equirect_vert: equirect.vertex,
+	equirect_frag: equirect.fragment,
+	linedashed_vert: linedashed.vertex,
+	linedashed_frag: linedashed.fragment,
+	meshbasic_vert: meshbasic.vertex,
+	meshbasic_frag: meshbasic.fragment,
+	meshlambert_vert: meshlambert.vertex,
+	meshlambert_frag: meshlambert.fragment,
+	meshmatcap_vert: meshmatcap.vertex,
+	meshmatcap_frag: meshmatcap.fragment,
+	meshnormal_vert: meshnormal.vertex,
+	meshnormal_frag: meshnormal.fragment,
+	meshphong_vert: meshphong.vertex,
+	meshphong_frag: meshphong.fragment,
+	meshphysical_vert: meshphysical.vertex,
+	meshphysical_frag: meshphysical.fragment,
+	meshtoon_vert: meshtoon.vertex,
+	meshtoon_frag: meshtoon.fragment,
+	points_vert: points.vertex,
+	points_frag: points.fragment,
+	shadow_vert: shadow.vertex,
+	shadow_frag: shadow.fragment,
+	sprite_vert: sprite.vertex,
+	sprite_frag: sprite.fragment
 };

+ 29 - 0
src/renderers/shaders/ShaderLib/background.glsl.js

@@ -0,0 +1,29 @@
+export const vertex = /* glsl */`
+varying vec2 vUv;
+uniform mat3 uvTransform;
+
+void main() {
+
+	vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
+
+	gl_Position = vec4( position.xy, 1.0, 1.0 );
+
+}
+`;
+
+export const fragment = /* glsl */`
+uniform sampler2D t2D;
+
+varying vec2 vUv;
+
+void main() {
+
+	vec4 texColor = texture2D( t2D, vUv );
+
+	gl_FragColor = mapTexelToLinear( texColor );
+
+	#include <tonemapping_fragment>
+	#include <encodings_fragment>
+
+}
+`;

+ 0 - 16
src/renderers/shaders/ShaderLib/background_frag.glsl.js

@@ -1,16 +0,0 @@
-export default /* glsl */`
-uniform sampler2D t2D;
-
-varying vec2 vUv;
-
-void main() {
-
-	vec4 texColor = texture2D( t2D, vUv );
-
-	gl_FragColor = mapTexelToLinear( texColor );
-
-	#include <tonemapping_fragment>
-	#include <encodings_fragment>
-
-}
-`;

+ 0 - 12
src/renderers/shaders/ShaderLib/background_vert.glsl.js

@@ -1,12 +0,0 @@
-export default /* glsl */`
-varying vec2 vUv;
-uniform mat3 uvTransform;
-
-void main() {
-
-	vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
-
-	gl_Position = vec4( position.xy, 1.0, 1.0 );
-
-}
-`;

+ 18 - 1
src/renderers/shaders/ShaderLib/cube_frag.glsl.js → src/renderers/shaders/ShaderLib/cube.glsl.js

@@ -1,4 +1,21 @@
-export default /* glsl */`
+export const vertex = /* glsl */`
+varying vec3 vWorldDirection;
+
+#include <common>
+
+void main() {
+
+	vWorldDirection = transformDirection( position, modelMatrix );
+
+	#include <begin_vertex>
+	#include <project_vertex>
+
+	gl_Position.z = gl_Position.w; // set z to camera.far
+
+}
+`;
+
+export const fragment = /* glsl */`
 #include <envmap_common_pars_fragment>
 uniform float opacity;
 

+ 0 - 16
src/renderers/shaders/ShaderLib/cube_vert.glsl.js

@@ -1,16 +0,0 @@
-export default /* glsl */`
-varying vec3 vWorldDirection;
-
-#include <common>
-
-void main() {
-
-	vWorldDirection = transformDirection( position, modelMatrix );
-
-	#include <begin_vertex>
-	#include <project_vertex>
-
-	gl_Position.z = gl_Position.w; // set z to camera.far
-
-}
-`;

+ 92 - 0
src/renderers/shaders/ShaderLib/depth.glsl.js

@@ -0,0 +1,92 @@
+export const vertex = /* glsl */`
+#include <common>
+#include <uv_pars_vertex>
+#include <displacementmap_pars_vertex>
+#include <morphtarget_pars_vertex>
+#include <skinning_pars_vertex>
+#include <logdepthbuf_pars_vertex>
+#include <clipping_planes_pars_vertex>
+
+// This is used for computing an equivalent of gl_FragCoord.z that is as high precision as possible.
+// Some platforms compute gl_FragCoord at a lower precision which makes the manually computed value better for
+// depth-based postprocessing effects. Reproduced on iPad with A10 processor / iPadOS 13.3.1.
+varying vec2 vHighPrecisionZW;
+
+void main() {
+
+	#include <uv_vertex>
+
+	#include <skinbase_vertex>
+
+	#ifdef USE_DISPLACEMENTMAP
+
+		#include <beginnormal_vertex>
+		#include <morphnormal_vertex>
+		#include <skinnormal_vertex>
+
+	#endif
+
+	#include <begin_vertex>
+	#include <morphtarget_vertex>
+	#include <skinning_vertex>
+	#include <displacementmap_vertex>
+	#include <project_vertex>
+	#include <logdepthbuf_vertex>
+	#include <clipping_planes_vertex>
+
+	vHighPrecisionZW = gl_Position.zw;
+
+}
+`;
+
+export const fragment = /* glsl */`
+#if DEPTH_PACKING == 3200
+
+	uniform float opacity;
+
+#endif
+
+#include <common>
+#include <packing>
+#include <uv_pars_fragment>
+#include <map_pars_fragment>
+#include <alphamap_pars_fragment>
+#include <alphatest_pars_fragment>
+#include <logdepthbuf_pars_fragment>
+#include <clipping_planes_pars_fragment>
+
+varying vec2 vHighPrecisionZW;
+
+void main() {
+
+	#include <clipping_planes_fragment>
+
+	vec4 diffuseColor = vec4( 1.0 );
+
+	#if DEPTH_PACKING == 3200
+
+		diffuseColor.a = opacity;
+
+	#endif
+
+	#include <map_fragment>
+	#include <alphamap_fragment>
+	#include <alphatest_fragment>
+
+	#include <logdepthbuf_fragment>
+
+	// Higher precision equivalent of gl_FragCoord.z. This assumes depthRange has been left to its default values.
+	float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;
+
+	#if DEPTH_PACKING == 3200
+
+		gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
+
+	#elif DEPTH_PACKING == 3201
+
+		gl_FragColor = packDepthToRGBA( fragCoordZ );
+
+	#endif
+
+}
+`;

+ 0 - 51
src/renderers/shaders/ShaderLib/depth_frag.glsl.js

@@ -1,51 +0,0 @@
-export default /* glsl */`
-#if DEPTH_PACKING == 3200
-
-	uniform float opacity;
-
-#endif
-
-#include <common>
-#include <packing>
-#include <uv_pars_fragment>
-#include <map_pars_fragment>
-#include <alphamap_pars_fragment>
-#include <alphatest_pars_fragment>
-#include <logdepthbuf_pars_fragment>
-#include <clipping_planes_pars_fragment>
-
-varying vec2 vHighPrecisionZW;
-
-void main() {
-
-	#include <clipping_planes_fragment>
-
-	vec4 diffuseColor = vec4( 1.0 );
-
-	#if DEPTH_PACKING == 3200
-
-		diffuseColor.a = opacity;
-
-	#endif
-
-	#include <map_fragment>
-	#include <alphamap_fragment>
-	#include <alphatest_fragment>
-
-	#include <logdepthbuf_fragment>
-
-	// Higher precision equivalent of gl_FragCoord.z. This assumes depthRange has been left to its default values.
-	float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;
-
-	#if DEPTH_PACKING == 3200
-
-		gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
-
-	#elif DEPTH_PACKING == 3201
-
-		gl_FragColor = packDepthToRGBA( fragCoordZ );
-
-	#endif
-
-}
-`;

+ 0 - 40
src/renderers/shaders/ShaderLib/depth_vert.glsl.js

@@ -1,40 +0,0 @@
-export default /* glsl */`
-#include <common>
-#include <uv_pars_vertex>
-#include <displacementmap_pars_vertex>
-#include <morphtarget_pars_vertex>
-#include <skinning_pars_vertex>
-#include <logdepthbuf_pars_vertex>
-#include <clipping_planes_pars_vertex>
-
-// This is used for computing an equivalent of gl_FragCoord.z that is as high precision as possible.
-// Some platforms compute gl_FragCoord at a lower precision which makes the manually computed value better for
-// depth-based postprocessing effects. Reproduced on iPad with A10 processor / iPadOS 13.3.1.
-varying vec2 vHighPrecisionZW;
-
-void main() {
-
-	#include <uv_vertex>
-
-	#include <skinbase_vertex>
-
-	#ifdef USE_DISPLACEMENTMAP
-
-		#include <beginnormal_vertex>
-		#include <morphnormal_vertex>
-		#include <skinnormal_vertex>
-
-	#endif
-
-	#include <begin_vertex>
-	#include <morphtarget_vertex>
-	#include <skinning_vertex>
-	#include <displacementmap_vertex>
-	#include <project_vertex>
-	#include <logdepthbuf_vertex>
-	#include <clipping_planes_vertex>
-
-	vHighPrecisionZW = gl_Position.zw;
-
-}
-`;

+ 73 - 0
src/renderers/shaders/ShaderLib/distanceRGBA.glsl.js

@@ -0,0 +1,73 @@
+export const vertex = /* glsl */`
+#define DISTANCE
+
+varying vec3 vWorldPosition;
+
+#include <common>
+#include <uv_pars_vertex>
+#include <displacementmap_pars_vertex>
+#include <morphtarget_pars_vertex>
+#include <skinning_pars_vertex>
+#include <clipping_planes_pars_vertex>
+
+void main() {
+
+	#include <uv_vertex>
+
+	#include <skinbase_vertex>
+
+	#ifdef USE_DISPLACEMENTMAP
+
+		#include <beginnormal_vertex>
+		#include <morphnormal_vertex>
+		#include <skinnormal_vertex>
+
+	#endif
+
+	#include <begin_vertex>
+	#include <morphtarget_vertex>
+	#include <skinning_vertex>
+	#include <displacementmap_vertex>
+	#include <project_vertex>
+	#include <worldpos_vertex>
+	#include <clipping_planes_vertex>
+
+	vWorldPosition = worldPosition.xyz;
+
+}
+`;
+
+export const fragment = /* glsl */`
+#define DISTANCE
+
+uniform vec3 referencePosition;
+uniform float nearDistance;
+uniform float farDistance;
+varying vec3 vWorldPosition;
+
+#include <common>
+#include <packing>
+#include <uv_pars_fragment>
+#include <map_pars_fragment>
+#include <alphamap_pars_fragment>
+#include <alphatest_pars_fragment>
+#include <clipping_planes_pars_fragment>
+
+void main () {
+
+	#include <clipping_planes_fragment>
+
+	vec4 diffuseColor = vec4( 1.0 );
+
+	#include <map_fragment>
+	#include <alphamap_fragment>
+	#include <alphatest_fragment>
+
+	float dist = length( vWorldPosition - referencePosition );
+	dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
+	dist = saturate( dist ); // clamp to [ 0, 1 ]
+
+	gl_FragColor = packDepthToRGBA( dist );
+
+}
+`;

+ 0 - 34
src/renderers/shaders/ShaderLib/distanceRGBA_frag.glsl.js

@@ -1,34 +0,0 @@
-export default /* glsl */`
-#define DISTANCE
-
-uniform vec3 referencePosition;
-uniform float nearDistance;
-uniform float farDistance;
-varying vec3 vWorldPosition;
-
-#include <common>
-#include <packing>
-#include <uv_pars_fragment>
-#include <map_pars_fragment>
-#include <alphamap_pars_fragment>
-#include <alphatest_pars_fragment>
-#include <clipping_planes_pars_fragment>
-
-void main () {
-
-	#include <clipping_planes_fragment>
-
-	vec4 diffuseColor = vec4( 1.0 );
-
-	#include <map_fragment>
-	#include <alphamap_fragment>
-	#include <alphatest_fragment>
-
-	float dist = length( vWorldPosition - referencePosition );
-	dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
-	dist = saturate( dist ); // clamp to [ 0, 1 ]
-
-	gl_FragColor = packDepthToRGBA( dist );
-
-}
-`;

+ 0 - 38
src/renderers/shaders/ShaderLib/distanceRGBA_vert.glsl.js

@@ -1,38 +0,0 @@
-export default /* glsl */`
-#define DISTANCE
-
-varying vec3 vWorldPosition;
-
-#include <common>
-#include <uv_pars_vertex>
-#include <displacementmap_pars_vertex>
-#include <morphtarget_pars_vertex>
-#include <skinning_pars_vertex>
-#include <clipping_planes_pars_vertex>
-
-void main() {
-
-	#include <uv_vertex>
-
-	#include <skinbase_vertex>
-
-	#ifdef USE_DISPLACEMENTMAP
-
-		#include <beginnormal_vertex>
-		#include <morphnormal_vertex>
-		#include <skinnormal_vertex>
-
-	#endif
-
-	#include <begin_vertex>
-	#include <morphtarget_vertex>
-	#include <skinning_vertex>
-	#include <displacementmap_vertex>
-	#include <project_vertex>
-	#include <worldpos_vertex>
-	#include <clipping_planes_vertex>
-
-	vWorldPosition = worldPosition.xyz;
-
-}
-`;

+ 16 - 1
src/renderers/shaders/ShaderLib/equirect_frag.glsl.js → src/renderers/shaders/ShaderLib/equirect.glsl.js

@@ -1,4 +1,19 @@
-export default /* glsl */`
+export const vertex = /* glsl */`
+varying vec3 vWorldDirection;
+
+#include <common>
+
+void main() {
+
+	vWorldDirection = transformDirection( position, modelMatrix );
+
+	#include <begin_vertex>
+	#include <project_vertex>
+
+}
+`;
+
+export const fragment = /* glsl */`
 uniform sampler2D tEquirect;
 
 varying vec3 vWorldDirection;

+ 0 - 14
src/renderers/shaders/ShaderLib/equirect_vert.glsl.js

@@ -1,14 +0,0 @@
-export default /* glsl */`
-varying vec3 vWorldDirection;
-
-#include <common>
-
-void main() {
-
-	vWorldDirection = transformDirection( position, modelMatrix );
-
-	#include <begin_vertex>
-	#include <project_vertex>
-
-}
-`;

+ 29 - 1
src/renderers/shaders/ShaderLib/linedashed_frag.glsl.js → src/renderers/shaders/ShaderLib/linedashed.glsl.js

@@ -1,4 +1,32 @@
-export default /* glsl */`
+export const vertex = /* glsl */`
+uniform float scale;
+attribute float lineDistance;
+
+varying float vLineDistance;
+
+#include <common>
+#include <color_pars_vertex>
+#include <fog_pars_vertex>
+#include <morphtarget_pars_vertex>
+#include <logdepthbuf_pars_vertex>
+#include <clipping_planes_pars_vertex>
+
+void main() {
+
+	vLineDistance = scale * lineDistance;
+
+	#include <color_vertex>
+	#include <begin_vertex>
+	#include <morphtarget_vertex>
+	#include <project_vertex>
+	#include <logdepthbuf_vertex>
+	#include <clipping_planes_vertex>
+	#include <fog_vertex>
+
+}
+`;
+
+export const fragment = /* glsl */`
 uniform vec3 diffuse;
 uniform float opacity;
 

+ 0 - 27
src/renderers/shaders/ShaderLib/linedashed_vert.glsl.js

@@ -1,27 +0,0 @@
-export default /* glsl */`
-uniform float scale;
-attribute float lineDistance;
-
-varying float vLineDistance;
-
-#include <common>
-#include <color_pars_vertex>
-#include <fog_pars_vertex>
-#include <morphtarget_pars_vertex>
-#include <logdepthbuf_pars_vertex>
-#include <clipping_planes_pars_vertex>
-
-void main() {
-
-	vLineDistance = scale * lineDistance;
-
-	#include <color_vertex>
-	#include <begin_vertex>
-	#include <morphtarget_vertex>
-	#include <project_vertex>
-	#include <logdepthbuf_vertex>
-	#include <clipping_planes_vertex>
-	#include <fog_vertex>
-
-}
-`;

+ 43 - 1
src/renderers/shaders/ShaderLib/meshbasic_frag.glsl.js → src/renderers/shaders/ShaderLib/meshbasic.glsl.js

@@ -1,4 +1,46 @@
-export default /* glsl */`
+export const vertex = /* glsl */`
+#include <common>
+#include <uv_pars_vertex>
+#include <uv2_pars_vertex>
+#include <envmap_pars_vertex>
+#include <color_pars_vertex>
+#include <fog_pars_vertex>
+#include <morphtarget_pars_vertex>
+#include <skinning_pars_vertex>
+#include <logdepthbuf_pars_vertex>
+#include <clipping_planes_pars_vertex>
+
+void main() {
+
+	#include <uv_vertex>
+	#include <uv2_vertex>
+	#include <color_vertex>
+
+	#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
+
+		#include <beginnormal_vertex>
+		#include <morphnormal_vertex>
+		#include <skinbase_vertex>
+		#include <skinnormal_vertex>
+		#include <defaultnormal_vertex>
+
+	#endif
+
+	#include <begin_vertex>
+	#include <morphtarget_vertex>
+	#include <skinning_vertex>
+	#include <project_vertex>
+	#include <logdepthbuf_vertex>
+	#include <clipping_planes_vertex>
+
+	#include <worldpos_vertex>
+	#include <envmap_vertex>
+	#include <fog_vertex>
+
+}
+`;
+
+export const fragment = /* glsl */`
 uniform vec3 diffuse;
 uniform float opacity;
 

+ 0 - 41
src/renderers/shaders/ShaderLib/meshbasic_vert.glsl.js

@@ -1,41 +0,0 @@
-export default /* glsl */`
-#include <common>
-#include <uv_pars_vertex>
-#include <uv2_pars_vertex>
-#include <envmap_pars_vertex>
-#include <color_pars_vertex>
-#include <fog_pars_vertex>
-#include <morphtarget_pars_vertex>
-#include <skinning_pars_vertex>
-#include <logdepthbuf_pars_vertex>
-#include <clipping_planes_pars_vertex>
-
-void main() {
-
-	#include <uv_vertex>
-	#include <uv2_vertex>
-	#include <color_vertex>
-
-	#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
-
-		#include <beginnormal_vertex>
-		#include <morphnormal_vertex>
-		#include <skinbase_vertex>
-		#include <skinnormal_vertex>
-		#include <defaultnormal_vertex>
-
-	#endif
-
-	#include <begin_vertex>
-	#include <morphtarget_vertex>
-	#include <skinning_vertex>
-	#include <project_vertex>
-	#include <logdepthbuf_vertex>
-	#include <clipping_planes_vertex>
-
-	#include <worldpos_vertex>
-	#include <envmap_vertex>
-	#include <fog_vertex>
-
-}
-`;

+ 53 - 1
src/renderers/shaders/ShaderLib/meshlambert_frag.glsl.js → src/renderers/shaders/ShaderLib/meshlambert.glsl.js

@@ -1,4 +1,56 @@
-export default /* glsl */`
+export const vertex = /* glsl */`
+#define LAMBERT
+
+varying vec3 vLightFront;
+varying vec3 vIndirectFront;
+
+#ifdef DOUBLE_SIDED
+	varying vec3 vLightBack;
+	varying vec3 vIndirectBack;
+#endif
+
+#include <common>
+#include <uv_pars_vertex>
+#include <uv2_pars_vertex>
+#include <envmap_pars_vertex>
+#include <bsdfs>
+#include <lights_pars_begin>
+#include <color_pars_vertex>
+#include <fog_pars_vertex>
+#include <morphtarget_pars_vertex>
+#include <skinning_pars_vertex>
+#include <shadowmap_pars_vertex>
+#include <logdepthbuf_pars_vertex>
+#include <clipping_planes_pars_vertex>
+
+void main() {
+
+	#include <uv_vertex>
+	#include <uv2_vertex>
+	#include <color_vertex>
+
+	#include <beginnormal_vertex>
+	#include <morphnormal_vertex>
+	#include <skinbase_vertex>
+	#include <skinnormal_vertex>
+	#include <defaultnormal_vertex>
+
+	#include <begin_vertex>
+	#include <morphtarget_vertex>
+	#include <skinning_vertex>
+	#include <project_vertex>
+	#include <logdepthbuf_vertex>
+	#include <clipping_planes_vertex>
+
+	#include <worldpos_vertex>
+	#include <envmap_vertex>
+	#include <lights_lambert_vertex>
+	#include <shadowmap_vertex>
+	#include <fog_vertex>
+}
+`;
+
+export const fragment = /* glsl */`
 uniform vec3 diffuse;
 uniform vec3 emissive;
 uniform float opacity;

+ 0 - 51
src/renderers/shaders/ShaderLib/meshlambert_vert.glsl.js

@@ -1,51 +0,0 @@
-export default /* glsl */`
-#define LAMBERT
-
-varying vec3 vLightFront;
-varying vec3 vIndirectFront;
-
-#ifdef DOUBLE_SIDED
-	varying vec3 vLightBack;
-	varying vec3 vIndirectBack;
-#endif
-
-#include <common>
-#include <uv_pars_vertex>
-#include <uv2_pars_vertex>
-#include <envmap_pars_vertex>
-#include <bsdfs>
-#include <lights_pars_begin>
-#include <color_pars_vertex>
-#include <fog_pars_vertex>
-#include <morphtarget_pars_vertex>
-#include <skinning_pars_vertex>
-#include <shadowmap_pars_vertex>
-#include <logdepthbuf_pars_vertex>
-#include <clipping_planes_pars_vertex>
-
-void main() {
-
-	#include <uv_vertex>
-	#include <uv2_vertex>
-	#include <color_vertex>
-
-	#include <beginnormal_vertex>
-	#include <morphnormal_vertex>
-	#include <skinbase_vertex>
-	#include <skinnormal_vertex>
-	#include <defaultnormal_vertex>
-
-	#include <begin_vertex>
-	#include <morphtarget_vertex>
-	#include <skinning_vertex>
-	#include <project_vertex>
-	#include <logdepthbuf_vertex>
-	#include <clipping_planes_vertex>
-
-	#include <worldpos_vertex>
-	#include <envmap_vertex>
-	#include <lights_lambert_vertex>
-	#include <shadowmap_vertex>
-	#include <fog_vertex>
-}
-`;

+ 44 - 1
src/renderers/shaders/ShaderLib/meshmatcap_frag.glsl.js → src/renderers/shaders/ShaderLib/meshmatcap.glsl.js

@@ -1,4 +1,47 @@
-export default /* glsl */`
+export const vertex = /* glsl */`
+#define MATCAP
+
+varying vec3 vViewPosition;
+
+#include <common>
+#include <uv_pars_vertex>
+#include <color_pars_vertex>
+#include <displacementmap_pars_vertex>
+#include <fog_pars_vertex>
+#include <normal_pars_vertex>
+#include <morphtarget_pars_vertex>
+#include <skinning_pars_vertex>
+
+#include <logdepthbuf_pars_vertex>
+#include <clipping_planes_pars_vertex>
+
+void main() {
+
+	#include <uv_vertex>
+	#include <color_vertex>
+	#include <beginnormal_vertex>
+	#include <morphnormal_vertex>
+	#include <skinbase_vertex>
+	#include <skinnormal_vertex>
+	#include <defaultnormal_vertex>
+	#include <normal_vertex>
+
+	#include <begin_vertex>
+	#include <morphtarget_vertex>
+	#include <skinning_vertex>
+	#include <displacementmap_vertex>
+	#include <project_vertex>
+
+	#include <logdepthbuf_vertex>
+	#include <clipping_planes_vertex>
+	#include <fog_vertex>
+
+	vViewPosition = - mvPosition.xyz;
+
+}
+`;
+
+export const fragment = /* glsl */`
 #define MATCAP
 
 uniform vec3 diffuse;

+ 0 - 42
src/renderers/shaders/ShaderLib/meshmatcap_vert.glsl.js

@@ -1,42 +0,0 @@
-export default /* glsl */`
-#define MATCAP
-
-varying vec3 vViewPosition;
-
-#include <common>
-#include <uv_pars_vertex>
-#include <color_pars_vertex>
-#include <displacementmap_pars_vertex>
-#include <fog_pars_vertex>
-#include <normal_pars_vertex>
-#include <morphtarget_pars_vertex>
-#include <skinning_pars_vertex>
-
-#include <logdepthbuf_pars_vertex>
-#include <clipping_planes_pars_vertex>
-
-void main() {
-
-	#include <uv_vertex>
-	#include <color_vertex>
-	#include <beginnormal_vertex>
-	#include <morphnormal_vertex>
-	#include <skinbase_vertex>
-	#include <skinnormal_vertex>
-	#include <defaultnormal_vertex>
-	#include <normal_vertex>
-
-	#include <begin_vertex>
-	#include <morphtarget_vertex>
-	#include <skinning_vertex>
-	#include <displacementmap_vertex>
-	#include <project_vertex>
-
-	#include <logdepthbuf_vertex>
-	#include <clipping_planes_vertex>
-	#include <fog_vertex>
-
-	vViewPosition = - mvPosition.xyz;
-
-}
-`;

+ 32 - 1
src/renderers/shaders/ShaderLib/meshnormal_vert.glsl.js → src/renderers/shaders/ShaderLib/meshnormal.glsl.js

@@ -1,4 +1,4 @@
-export default /* glsl */`
+export const vertex = /* glsl */`
 #define NORMAL
 
 #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )
@@ -43,3 +43,34 @@ void main() {
 
 }
 `;
+
+export const fragment = /* glsl */`
+#define NORMAL
+
+uniform float opacity;
+
+#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )
+
+	varying vec3 vViewPosition;
+
+#endif
+
+#include <packing>
+#include <uv_pars_fragment>
+#include <normal_pars_fragment>
+#include <bumpmap_pars_fragment>
+#include <normalmap_pars_fragment>
+#include <logdepthbuf_pars_fragment>
+#include <clipping_planes_pars_fragment>
+
+void main() {
+
+	#include <clipping_planes_fragment>
+	#include <logdepthbuf_fragment>
+	#include <normal_fragment_begin>
+	#include <normal_fragment_maps>
+
+	gl_FragColor = vec4( packNormalToRGB( normal ), opacity );
+
+}
+`;

+ 0 - 30
src/renderers/shaders/ShaderLib/meshnormal_frag.glsl.js

@@ -1,30 +0,0 @@
-export default /* glsl */`
-#define NORMAL
-
-uniform float opacity;
-
-#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )
-
-	varying vec3 vViewPosition;
-
-#endif
-
-#include <packing>
-#include <uv_pars_fragment>
-#include <normal_pars_fragment>
-#include <bumpmap_pars_fragment>
-#include <normalmap_pars_fragment>
-#include <logdepthbuf_pars_fragment>
-#include <clipping_planes_pars_fragment>
-
-void main() {
-
-	#include <clipping_planes_fragment>
-	#include <logdepthbuf_fragment>
-	#include <normal_fragment_begin>
-	#include <normal_fragment_maps>
-
-	gl_FragColor = vec4( packNormalToRGB( normal ), opacity );
-
-}
-`;

+ 51 - 1
src/renderers/shaders/ShaderLib/meshphong_frag.glsl.js → src/renderers/shaders/ShaderLib/meshphong.glsl.js

@@ -1,4 +1,54 @@
-export default /* glsl */`
+export const vertex = /* glsl */`
+#define PHONG
+
+varying vec3 vViewPosition;
+
+#include <common>
+#include <uv_pars_vertex>
+#include <uv2_pars_vertex>
+#include <displacementmap_pars_vertex>
+#include <envmap_pars_vertex>
+#include <color_pars_vertex>
+#include <fog_pars_vertex>
+#include <normal_pars_vertex>
+#include <morphtarget_pars_vertex>
+#include <skinning_pars_vertex>
+#include <shadowmap_pars_vertex>
+#include <logdepthbuf_pars_vertex>
+#include <clipping_planes_pars_vertex>
+
+void main() {
+
+	#include <uv_vertex>
+	#include <uv2_vertex>
+	#include <color_vertex>
+
+	#include <beginnormal_vertex>
+	#include <morphnormal_vertex>
+	#include <skinbase_vertex>
+	#include <skinnormal_vertex>
+	#include <defaultnormal_vertex>
+	#include <normal_vertex>
+
+	#include <begin_vertex>
+	#include <morphtarget_vertex>
+	#include <skinning_vertex>
+	#include <displacementmap_vertex>
+	#include <project_vertex>
+	#include <logdepthbuf_vertex>
+	#include <clipping_planes_vertex>
+
+	vViewPosition = - mvPosition.xyz;
+
+	#include <worldpos_vertex>
+	#include <envmap_vertex>
+	#include <shadowmap_vertex>
+	#include <fog_vertex>
+
+}
+`;
+
+export const fragment = /* glsl */`
 #define PHONG
 
 uniform vec3 diffuse;

+ 0 - 49
src/renderers/shaders/ShaderLib/meshphong_vert.glsl.js

@@ -1,49 +0,0 @@
-export default /* glsl */`
-#define PHONG
-
-varying vec3 vViewPosition;
-
-#include <common>
-#include <uv_pars_vertex>
-#include <uv2_pars_vertex>
-#include <displacementmap_pars_vertex>
-#include <envmap_pars_vertex>
-#include <color_pars_vertex>
-#include <fog_pars_vertex>
-#include <normal_pars_vertex>
-#include <morphtarget_pars_vertex>
-#include <skinning_pars_vertex>
-#include <shadowmap_pars_vertex>
-#include <logdepthbuf_pars_vertex>
-#include <clipping_planes_pars_vertex>
-
-void main() {
-
-	#include <uv_vertex>
-	#include <uv2_vertex>
-	#include <color_vertex>
-
-	#include <beginnormal_vertex>
-	#include <morphnormal_vertex>
-	#include <skinbase_vertex>
-	#include <skinnormal_vertex>
-	#include <defaultnormal_vertex>
-	#include <normal_vertex>
-
-	#include <begin_vertex>
-	#include <morphtarget_vertex>
-	#include <skinning_vertex>
-	#include <displacementmap_vertex>
-	#include <project_vertex>
-	#include <logdepthbuf_vertex>
-	#include <clipping_planes_vertex>
-
-	vViewPosition = - mvPosition.xyz;
-
-	#include <worldpos_vertex>
-	#include <envmap_vertex>
-	#include <shadowmap_vertex>
-	#include <fog_vertex>
-
-}
-`;

+ 60 - 1
src/renderers/shaders/ShaderLib/meshphysical_frag.glsl.js → src/renderers/shaders/ShaderLib/meshphysical.glsl.js

@@ -1,4 +1,63 @@
-export default /* glsl */`
+export const vertex = /* glsl */`
+#define STANDARD
+
+varying vec3 vViewPosition;
+
+#ifdef USE_TRANSMISSION
+
+	varying vec3 vWorldPosition;
+
+#endif
+
+#include <common>
+#include <uv_pars_vertex>
+#include <uv2_pars_vertex>
+#include <displacementmap_pars_vertex>
+#include <color_pars_vertex>
+#include <fog_pars_vertex>
+#include <normal_pars_vertex>
+#include <morphtarget_pars_vertex>
+#include <skinning_pars_vertex>
+#include <shadowmap_pars_vertex>
+#include <logdepthbuf_pars_vertex>
+#include <clipping_planes_pars_vertex>
+
+void main() {
+
+	#include <uv_vertex>
+	#include <uv2_vertex>
+	#include <color_vertex>
+
+	#include <beginnormal_vertex>
+	#include <morphnormal_vertex>
+	#include <skinbase_vertex>
+	#include <skinnormal_vertex>
+	#include <defaultnormal_vertex>
+	#include <normal_vertex>
+
+	#include <begin_vertex>
+	#include <morphtarget_vertex>
+	#include <skinning_vertex>
+	#include <displacementmap_vertex>
+	#include <project_vertex>
+	#include <logdepthbuf_vertex>
+	#include <clipping_planes_vertex>
+
+	vViewPosition = - mvPosition.xyz;
+
+	#include <worldpos_vertex>
+	#include <shadowmap_vertex>
+	#include <fog_vertex>
+
+#ifdef USE_TRANSMISSION
+
+	vWorldPosition = worldPosition.xyz;
+
+#endif
+}
+`;
+
+export const fragment = /* glsl */`
 #define STANDARD
 
 #ifdef PHYSICAL

+ 0 - 58
src/renderers/shaders/ShaderLib/meshphysical_vert.glsl.js

@@ -1,58 +0,0 @@
-export default /* glsl */`
-#define STANDARD
-
-varying vec3 vViewPosition;
-
-#ifdef USE_TRANSMISSION
-
-	varying vec3 vWorldPosition;
-
-#endif
-
-#include <common>
-#include <uv_pars_vertex>
-#include <uv2_pars_vertex>
-#include <displacementmap_pars_vertex>
-#include <color_pars_vertex>
-#include <fog_pars_vertex>
-#include <normal_pars_vertex>
-#include <morphtarget_pars_vertex>
-#include <skinning_pars_vertex>
-#include <shadowmap_pars_vertex>
-#include <logdepthbuf_pars_vertex>
-#include <clipping_planes_pars_vertex>
-
-void main() {
-
-	#include <uv_vertex>
-	#include <uv2_vertex>
-	#include <color_vertex>
-
-	#include <beginnormal_vertex>
-	#include <morphnormal_vertex>
-	#include <skinbase_vertex>
-	#include <skinnormal_vertex>
-	#include <defaultnormal_vertex>
-	#include <normal_vertex>
-
-	#include <begin_vertex>
-	#include <morphtarget_vertex>
-	#include <skinning_vertex>
-	#include <displacementmap_vertex>
-	#include <project_vertex>
-	#include <logdepthbuf_vertex>
-	#include <clipping_planes_vertex>
-
-	vViewPosition = - mvPosition.xyz;
-
-	#include <worldpos_vertex>
-	#include <shadowmap_vertex>
-	#include <fog_vertex>
-
-#ifdef USE_TRANSMISSION
-
-	vWorldPosition = worldPosition.xyz;
-
-#endif
-}
-`;

+ 49 - 1
src/renderers/shaders/ShaderLib/meshtoon_frag.glsl.js → src/renderers/shaders/ShaderLib/meshtoon.glsl.js

@@ -1,4 +1,52 @@
-export default /* glsl */`
+export const vertex = /* glsl */`
+#define TOON
+
+varying vec3 vViewPosition;
+
+#include <common>
+#include <uv_pars_vertex>
+#include <uv2_pars_vertex>
+#include <displacementmap_pars_vertex>
+#include <color_pars_vertex>
+#include <fog_pars_vertex>
+#include <normal_pars_vertex>
+#include <morphtarget_pars_vertex>
+#include <skinning_pars_vertex>
+#include <shadowmap_pars_vertex>
+#include <logdepthbuf_pars_vertex>
+#include <clipping_planes_pars_vertex>
+
+void main() {
+
+	#include <uv_vertex>
+	#include <uv2_vertex>
+	#include <color_vertex>
+
+	#include <beginnormal_vertex>
+	#include <morphnormal_vertex>
+	#include <skinbase_vertex>
+	#include <skinnormal_vertex>
+	#include <defaultnormal_vertex>
+	#include <normal_vertex>
+
+	#include <begin_vertex>
+	#include <morphtarget_vertex>
+	#include <skinning_vertex>
+	#include <displacementmap_vertex>
+	#include <project_vertex>
+	#include <logdepthbuf_vertex>
+	#include <clipping_planes_vertex>
+
+	vViewPosition = - mvPosition.xyz;
+
+	#include <worldpos_vertex>
+	#include <shadowmap_vertex>
+	#include <fog_vertex>
+
+}
+`;
+
+export const fragment = /* glsl */`
 #define TOON
 
 uniform vec3 diffuse;

+ 0 - 47
src/renderers/shaders/ShaderLib/meshtoon_vert.glsl.js

@@ -1,47 +0,0 @@
-export default /* glsl */`
-#define TOON
-
-varying vec3 vViewPosition;
-
-#include <common>
-#include <uv_pars_vertex>
-#include <uv2_pars_vertex>
-#include <displacementmap_pars_vertex>
-#include <color_pars_vertex>
-#include <fog_pars_vertex>
-#include <normal_pars_vertex>
-#include <morphtarget_pars_vertex>
-#include <skinning_pars_vertex>
-#include <shadowmap_pars_vertex>
-#include <logdepthbuf_pars_vertex>
-#include <clipping_planes_pars_vertex>
-
-void main() {
-
-	#include <uv_vertex>
-	#include <uv2_vertex>
-	#include <color_vertex>
-
-	#include <beginnormal_vertex>
-	#include <morphnormal_vertex>
-	#include <skinbase_vertex>
-	#include <skinnormal_vertex>
-	#include <defaultnormal_vertex>
-	#include <normal_vertex>
-
-	#include <begin_vertex>
-	#include <morphtarget_vertex>
-	#include <skinning_vertex>
-	#include <displacementmap_vertex>
-	#include <project_vertex>
-	#include <logdepthbuf_vertex>
-	#include <clipping_planes_vertex>
-
-	vViewPosition = - mvPosition.xyz;
-
-	#include <worldpos_vertex>
-	#include <shadowmap_vertex>
-	#include <fog_vertex>
-
-}
-`;

+ 37 - 1
src/renderers/shaders/ShaderLib/points_frag.glsl.js → src/renderers/shaders/ShaderLib/points.glsl.js

@@ -1,4 +1,40 @@
-export default /* glsl */`
+export const vertex = /* glsl */`
+uniform float size;
+uniform float scale;
+
+#include <common>
+#include <color_pars_vertex>
+#include <fog_pars_vertex>
+#include <morphtarget_pars_vertex>
+#include <logdepthbuf_pars_vertex>
+#include <clipping_planes_pars_vertex>
+
+void main() {
+
+	#include <color_vertex>
+	#include <begin_vertex>
+	#include <morphtarget_vertex>
+	#include <project_vertex>
+
+	gl_PointSize = size;
+
+	#ifdef USE_SIZEATTENUATION
+
+		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
+
+		if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
+
+	#endif
+
+	#include <logdepthbuf_vertex>
+	#include <clipping_planes_vertex>
+	#include <worldpos_vertex>
+	#include <fog_vertex>
+
+}
+`;
+
+export const fragment = /* glsl */`
 uniform vec3 diffuse;
 uniform float opacity;
 

+ 0 - 35
src/renderers/shaders/ShaderLib/points_vert.glsl.js

@@ -1,35 +0,0 @@
-export default /* glsl */`
-uniform float size;
-uniform float scale;
-
-#include <common>
-#include <color_pars_vertex>
-#include <fog_pars_vertex>
-#include <morphtarget_pars_vertex>
-#include <logdepthbuf_pars_vertex>
-#include <clipping_planes_pars_vertex>
-
-void main() {
-
-	#include <color_vertex>
-	#include <begin_vertex>
-	#include <morphtarget_vertex>
-	#include <project_vertex>
-
-	gl_PointSize = size;
-
-	#ifdef USE_SIZEATTENUATION
-
-		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
-
-		if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
-
-	#endif
-
-	#include <logdepthbuf_vertex>
-	#include <clipping_planes_vertex>
-	#include <worldpos_vertex>
-	#include <fog_vertex>
-
-}
-`;

+ 24 - 1
src/renderers/shaders/ShaderLib/shadow_vert.glsl.js → src/renderers/shaders/ShaderLib/shadow.glsl.js

@@ -1,4 +1,4 @@
-export default /* glsl */`
+export const vertex = /* glsl */`
 #include <common>
 #include <fog_pars_vertex>
 #include <morphtarget_pars_vertex>
@@ -24,3 +24,26 @@ void main() {
 
 }
 `;
+
+export const fragment = /* glsl */`
+uniform vec3 color;
+uniform float opacity;
+
+#include <common>
+#include <packing>
+#include <fog_pars_fragment>
+#include <bsdfs>
+#include <lights_pars_begin>
+#include <shadowmap_pars_fragment>
+#include <shadowmask_pars_fragment>
+
+void main() {
+
+	gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
+
+	#include <tonemapping_fragment>
+	#include <encodings_fragment>
+	#include <fog_fragment>
+
+}
+`;

+ 0 - 22
src/renderers/shaders/ShaderLib/shadow_frag.glsl.js

@@ -1,22 +0,0 @@
-export default /* glsl */`
-uniform vec3 color;
-uniform float opacity;
-
-#include <common>
-#include <packing>
-#include <fog_pars_fragment>
-#include <bsdfs>
-#include <lights_pars_begin>
-#include <shadowmap_pars_fragment>
-#include <shadowmask_pars_fragment>
-
-void main() {
-
-	gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
-
-	#include <tonemapping_fragment>
-	#include <encodings_fragment>
-	#include <fog_fragment>
-
-}
-`;

+ 36 - 1
src/renderers/shaders/ShaderLib/sprite_vert.glsl.js → src/renderers/shaders/ShaderLib/sprite.glsl.js

@@ -1,4 +1,4 @@
-export default /* glsl */`
+export const vertex = /* glsl */`
 uniform float rotation;
 uniform vec2 center;
 
@@ -42,3 +42,38 @@ void main() {
 
 }
 `;
+
+export const fragment = /* glsl */`
+uniform vec3 diffuse;
+uniform float opacity;
+
+#include <common>
+#include <uv_pars_fragment>
+#include <map_pars_fragment>
+#include <alphamap_pars_fragment>
+#include <alphatest_pars_fragment>
+#include <fog_pars_fragment>
+#include <logdepthbuf_pars_fragment>
+#include <clipping_planes_pars_fragment>
+
+void main() {
+
+	#include <clipping_planes_fragment>
+
+	vec3 outgoingLight = vec3( 0.0 );
+	vec4 diffuseColor = vec4( diffuse, opacity );
+
+	#include <logdepthbuf_fragment>
+	#include <map_fragment>
+	#include <alphamap_fragment>
+	#include <alphatest_fragment>
+
+	outgoingLight = diffuseColor.rgb;
+
+	#include <output_fragment>
+	#include <tonemapping_fragment>
+	#include <encodings_fragment>
+	#include <fog_fragment>
+
+}
+`;

+ 0 - 34
src/renderers/shaders/ShaderLib/sprite_frag.glsl.js

@@ -1,34 +0,0 @@
-export default /* glsl */`
-uniform vec3 diffuse;
-uniform float opacity;
-
-#include <common>
-#include <uv_pars_fragment>
-#include <map_pars_fragment>
-#include <alphamap_pars_fragment>
-#include <alphatest_pars_fragment>
-#include <fog_pars_fragment>
-#include <logdepthbuf_pars_fragment>
-#include <clipping_planes_pars_fragment>
-
-void main() {
-
-	#include <clipping_planes_fragment>
-
-	vec3 outgoingLight = vec3( 0.0 );
-	vec4 diffuseColor = vec4( diffuse, opacity );
-
-	#include <logdepthbuf_fragment>
-	#include <map_fragment>
-	#include <alphamap_fragment>
-	#include <alphatest_fragment>
-
-	outgoingLight = diffuseColor.rgb;
-
-	#include <output_fragment>
-	#include <tonemapping_fragment>
-	#include <encodings_fragment>
-	#include <fog_fragment>
-
-}
-`;

+ 9 - 1
src/renderers/shaders/ShaderLib/vsm_frag.glsl.js → src/renderers/shaders/ShaderLib/vsm.glsl.js

@@ -1,4 +1,12 @@
-export default /* glsl */`
+export const vertex = /* glsl */`
+void main() {
+
+	gl_Position = vec4( position, 1.0 );
+
+}
+`;
+
+export const fragment = /* glsl */`
 uniform sampler2D shadow_pass;
 uniform vec2 resolution;
 uniform float radius;

+ 0 - 7
src/renderers/shaders/ShaderLib/vsm_vert.glsl.js

@@ -1,7 +0,0 @@
-export default /* glsl */`
-void main() {
-
-	gl_Position = vec4( position, 1.0 );
-
-}
-`;

+ 3 - 5
src/renderers/webgl/WebGLShadowMap.js

@@ -10,8 +10,7 @@ import { Vector4 } from '../../math/Vector4.js';
 import { Vector2 } from '../../math/Vector2.js';
 import { Frustum } from '../../math/Frustum.js';
 
-import vsm_frag from '../shaders/ShaderLib/vsm_frag.glsl.js';
-import vsm_vert from '../shaders/ShaderLib/vsm_vert.glsl.js';
+import * as vsm from '../shaders/ShaderLib/vsm.glsl.js';
 
 function WebGLShadowMap( _renderer, _objects, _capabilities ) {
 
@@ -40,9 +39,8 @@ function WebGLShadowMap( _renderer, _objects, _capabilities ) {
 			samples: { value: 8.0 }
 		},
 
-		vertexShader: vsm_vert,
-
-		fragmentShader: vsm_frag
+		vertexShader: vsm.vertex,
+		fragmentShader: vsm.fragment
 
 	} );
 

+ 1 - 1
utils/build/rollup.config.js

@@ -213,7 +213,7 @@ export function glsl() {
 
 			if ( /\.glsl.js$/.test( id ) === false ) return;
 
-			code = code.replace( /\/\* glsl \*\/\`((.|\r|\n)*)\`/, function ( match, p1 ) {
+			code = code.replace( /\/\* glsl \*\/\`(.*?)\`/sg, function ( match, p1 ) {
 
 				return JSON.stringify(
 					p1