mittsu 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +2 -1
  3. data/README.md +1 -1
  4. data/lib/mittsu/cameras/orthographic_camera.rb +13 -0
  5. data/lib/mittsu/cameras/perspective_camera.rb +11 -0
  6. data/lib/mittsu/core/geometry.rb +12 -9
  7. data/lib/mittsu/core/object_3d.rb +33 -66
  8. data/lib/mittsu/lights/ambient_light.rb +8 -0
  9. data/lib/mittsu/lights/directional_light.rb +9 -0
  10. data/lib/mittsu/lights/hemisphere_light.rb +9 -0
  11. data/lib/mittsu/lights/point_light.rb +11 -0
  12. data/lib/mittsu/lights/spot_light.rb +13 -0
  13. data/lib/mittsu/loaders.rb +1 -0
  14. data/lib/mittsu/loaders/mtl_loader.rb +5 -12
  15. data/lib/mittsu/loaders/obj_loader.rb +212 -0
  16. data/lib/mittsu/loaders/obj_mtl_loader.rb +11 -207
  17. data/lib/mittsu/materials/material.rb +5 -2
  18. data/lib/mittsu/materials/mesh_basic_material.rb +0 -9
  19. data/lib/mittsu/math/color.rb +44 -104
  20. data/lib/mittsu/math/matrix3.rb +8 -1
  21. data/lib/mittsu/math/matrix4.rb +6 -0
  22. data/lib/mittsu/math/vector.rb +251 -0
  23. data/lib/mittsu/math/vector2.rb +14 -213
  24. data/lib/mittsu/math/vector3.rb +61 -351
  25. data/lib/mittsu/math/vector4.rb +45 -295
  26. data/lib/mittsu/objects/line.rb +12 -2
  27. data/lib/mittsu/objects/mesh.rb +18 -9
  28. data/lib/mittsu/renderers/glfw_window.rb +15 -13
  29. data/lib/mittsu/renderers/opengl/core/opengl_geometry.rb +253 -0
  30. data/lib/mittsu/renderers/opengl/core/opengl_object_3d.rb +131 -0
  31. data/lib/mittsu/renderers/opengl/lights/opengl_ambient_light.rb +26 -0
  32. data/lib/mittsu/renderers/opengl/lights/opengl_directional_light.rb +35 -0
  33. data/lib/mittsu/renderers/opengl/lights/opengl_hemisphere_light.rb +42 -0
  34. data/lib/mittsu/renderers/opengl/lights/opengl_light.rb +52 -0
  35. data/lib/mittsu/renderers/opengl/lights/opengl_point_light.rb +36 -0
  36. data/lib/mittsu/renderers/opengl/lights/opengl_spot_light.rb +47 -0
  37. data/lib/mittsu/renderers/opengl/materials/opengl_line_basic_material.rb +16 -0
  38. data/lib/mittsu/renderers/opengl/materials/opengl_material.rb +275 -0
  39. data/lib/mittsu/renderers/opengl/materials/opengl_mesh_basic_material.rb +69 -0
  40. data/lib/mittsu/renderers/opengl/materials/opengl_mesh_lambert_material.rb +29 -0
  41. data/lib/mittsu/renderers/opengl/materials/opengl_mesh_phong_material.rb +40 -0
  42. data/lib/mittsu/renderers/opengl/materials/opengl_shader_material.rb +11 -0
  43. data/lib/mittsu/renderers/opengl/objects/opengl_group.rb +8 -0
  44. data/lib/mittsu/renderers/opengl/objects/opengl_line.rb +54 -0
  45. data/lib/mittsu/renderers/opengl/objects/opengl_mesh.rb +77 -0
  46. data/lib/mittsu/renderers/opengl/opengl_buffer.rb +5 -0
  47. data/lib/mittsu/renderers/opengl/opengl_debug.rb +49 -7
  48. data/lib/mittsu/renderers/opengl/opengl_default_target.rb +54 -0
  49. data/lib/mittsu/renderers/opengl/opengl_geometry_group.rb +763 -0
  50. data/lib/mittsu/renderers/opengl/opengl_geometry_like.rb +130 -0
  51. data/lib/mittsu/renderers/opengl/opengl_helper.rb +161 -0
  52. data/lib/mittsu/renderers/opengl/opengl_implementations.rb +61 -0
  53. data/lib/mittsu/renderers/opengl/opengl_light_renderer.rb +43 -0
  54. data/lib/mittsu/renderers/opengl/opengl_mittsu_params.rb +53 -0
  55. data/lib/mittsu/renderers/opengl/opengl_program.rb +147 -296
  56. data/lib/mittsu/renderers/opengl/opengl_state.rb +3 -5
  57. data/lib/mittsu/renderers/opengl/plugins/shadow_map_plugin.rb +12 -10
  58. data/lib/mittsu/renderers/opengl/scenes/opengl_scene.rb +8 -0
  59. data/lib/mittsu/renderers/opengl/textures/opengl_compressed_texture.rb +21 -0
  60. data/lib/mittsu/renderers/opengl/textures/opengl_cube_texture.rb +75 -0
  61. data/lib/mittsu/renderers/opengl/textures/opengl_data_texture.rb +23 -0
  62. data/lib/mittsu/renderers/opengl/textures/opengl_texture.rb +111 -0
  63. data/lib/mittsu/renderers/opengl_render_target.rb +117 -2
  64. data/lib/mittsu/renderers/opengl_renderer.rb +653 -2978
  65. data/lib/mittsu/renderers/shaders/rbsl_loader.rb +166 -0
  66. data/lib/mittsu/renderers/shaders/shader_chunk.rb +6 -9
  67. data/lib/mittsu/renderers/shaders/shader_chunk/shadowmap_fragment.glsl +36 -37
  68. data/lib/mittsu/renderers/shaders/shader_lib.rb +26 -403
  69. data/lib/mittsu/renderers/shaders/shader_lib/basic/basic_fragment.rbsl +37 -0
  70. data/lib/mittsu/renderers/shaders/shader_lib/basic/basic_uniforms.rbslu +3 -0
  71. data/lib/mittsu/renderers/shaders/shader_lib/basic/basic_vertex.rbsl +33 -0
  72. data/lib/mittsu/renderers/shaders/shader_lib/cube/cube_fragment.rbsl +12 -0
  73. data/lib/mittsu/renderers/shaders/shader_lib/cube/cube_uniforms.rbslu +2 -0
  74. data/lib/mittsu/renderers/shaders/shader_lib/cube/cube_vertex.rbsl +12 -0
  75. data/lib/mittsu/renderers/shaders/shader_lib/depth_rgba/depth_rgba_fragment.rbsl +26 -0
  76. data/lib/mittsu/renderers/shaders/shader_lib/depth_rgba/depth_rgba_uniforms.rbslu +0 -0
  77. data/lib/mittsu/renderers/shaders/shader_lib/depth_rgba/depth_rgba_vertex.rbsl +12 -0
  78. data/lib/mittsu/renderers/shaders/shader_lib/lambert/lambert_fragment.rbsl +56 -0
  79. data/lib/mittsu/renderers/shaders/shader_lib/lambert/lambert_uniforms.rbslu +7 -0
  80. data/lib/mittsu/renderers/shaders/shader_lib/lambert/lambert_vertex.rbsl +37 -0
  81. data/lib/mittsu/renderers/shaders/shader_lib/phong/phong_fragment.rbsl +45 -0
  82. data/lib/mittsu/renderers/shaders/shader_lib/phong/phong_uniforms.rbslu +11 -0
  83. data/lib/mittsu/renderers/shaders/shader_lib/phong/phong_vertex.rbsl +43 -0
  84. data/lib/mittsu/renderers/shaders/shader_templates/fragment.glsl.erb +105 -0
  85. data/lib/mittsu/renderers/shaders/shader_templates/vertex.glsl.erb +143 -0
  86. data/lib/mittsu/renderers/shaders/uniforms_lib.rb +54 -55
  87. data/lib/mittsu/textures/texture.rb +5 -2
  88. data/lib/mittsu/version.rb +1 -1
  89. data/run_all_examples.sh +7 -0
  90. metadata +77 -28
  91. data/.ruby-version +0 -1
  92. data/lib/mittsu/core/hash_object.rb +0 -19
@@ -0,0 +1,37 @@
1
+ uniform vec3 diffuse;
2
+ uniform float opacity;
3
+
4
+ #include common
5
+ #include color_pars_fragment
6
+ #include map_pars_fragment
7
+ #include alphamap_pars_fragment
8
+ #include lightmap_pars_fragment
9
+ #include envmap_pars_fragment
10
+ #include fog_pars_fragment
11
+ #include shadowmap_pars_fragment
12
+ #include specularmap_pars_fragment
13
+ #include logdepthbuf_pars_fragment
14
+
15
+ void main() {
16
+ vec3 outgoingLight = vec3( 0.0 ); // outgoing light does not have an alpha, the surface does
17
+ vec4 diffuseColor = vec4( diffuse, opacity );
18
+
19
+ #include logdepthbuf_fragment
20
+ #include map_fragment
21
+ #include color_fragment
22
+ #include alphamap_fragment
23
+ #include alphatest_fragment
24
+ #include specularmap_fragment
25
+
26
+ outgoingLight = diffuseColor.rgb; // simple shader
27
+
28
+ #include lightmap_fragment // TODO: Light map on an otherwise unlit surface doesn't make sense.
29
+ #include envmap_fragment
30
+ #include shadowmap_fragment // TODO: Shadows on an otherwise unlit surface doesn't make sense.
31
+
32
+ #include linear_to_gamma_fragment
33
+
34
+ #include fog_fragment
35
+
36
+ fragColor = vec4( outgoingLight, diffuseColor.a ); // TODO, this should be pre-multiplied to allow for bright highlights on very transparent objects
37
+ }
@@ -0,0 +1,3 @@
1
+ #include common
2
+ #include fog
3
+ #include shadow_map
@@ -0,0 +1,33 @@
1
+ #include common
2
+ #include map_pars_vertex
3
+ #include lightmap_pars_vertex
4
+ #include envmap_pars_vertex
5
+ #include color_pars_vertex
6
+ #include morphtarget_pars_vertex
7
+ #include skinning_pars_vertex
8
+ #include shadowmap_pars_vertex
9
+ #include logdepthbuf_pars_vertex
10
+
11
+ void main() {
12
+ #include map_vertex
13
+ #include lightmap_vertex
14
+ #include color_vertex
15
+ #include skinbase_vertex
16
+
17
+ #ifdef USE_ENVMAP
18
+
19
+ #include morphnormal_vertex
20
+ #include skinnormal_vertex
21
+ #include defaultnormal_vertex
22
+
23
+ #endif
24
+
25
+ #include morphtarget_vertex
26
+ #include skinning_vertex
27
+ #include default_vertex
28
+ #include logdepthbuf_vertex
29
+
30
+ #include worldpos_vertex
31
+ #include envmap_vertex
32
+ #include shadowmap_vertex
33
+ }
@@ -0,0 +1,12 @@
1
+ uniform samplerCube tCube;
2
+ uniform float tFlip;
3
+
4
+ in vec3 vWorldPosition;
5
+
6
+ #include common
7
+ #include logdepthbuf_pars_fragment
8
+
9
+ void main() {
10
+ fragColor = texture( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );
11
+ #include logdepthbuf_fragment
12
+ }
@@ -0,0 +1,2 @@
1
+ uniform texture tCube;
2
+ uniform float tFlip = -1.0;
@@ -0,0 +1,12 @@
1
+ out vec3 vWorldPosition;
2
+
3
+ #include common
4
+
5
+ #include logdepthbuf_pars_vertex
6
+
7
+ void main() {
8
+ vWorldPosition = transformDirection( position, modelMatrix );
9
+ gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
10
+
11
+ #include logdepthbuf_vertex
12
+ }
@@ -0,0 +1,26 @@
1
+ #include common
2
+ #include logdepthbuf_pars_fragment
3
+
4
+ vec4 pack_depth( const in float depth ) {
5
+ const vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );
6
+ const vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );
7
+ vec4 res = mod( depth * bit_shift * vec4( 255 ), vec4( 256 ) ) / vec4( 255 );
8
+ // vec4 res = fract( depth * bit_shift );
9
+ res -= res.xxyz * bit_mask;
10
+ return res;
11
+ }
12
+
13
+ void main() {
14
+ #include logdepthbuf_fragment
15
+
16
+ #ifdef USE_LOGDEPTHBUF_EXT
17
+ fragColor = pack_depth( gl_FragDepthEXT );
18
+ #else
19
+ fragColor = pack_depth( gl_FragCoord.z );
20
+ #endif
21
+
22
+ // fragColor = pack_depth( gl_FragCoord.z / gl_FragCoord.w );
23
+ // float z = ( ( gl_FragCoord.z / gl_FragCoord.w ) - 3.0 ) / ( 4000.0 - 3.0 );
24
+ // fragColor = pack_depth( z );
25
+ // fragColor = vec4( z, z, z, 1.0 );
26
+ }
@@ -0,0 +1,12 @@
1
+ #include common
2
+ #include morphtarget_pars_vertex
3
+ #include skinning_pars_vertex
4
+ #include logdepthbuf_pars_vertex
5
+
6
+ void main() {
7
+ #include skinbase_vertex
8
+ #include morphtarget_vertex
9
+ #include skinning_vertex
10
+ #include default_vertex
11
+ #include logdepthbuf_vertex
12
+ }
@@ -0,0 +1,56 @@
1
+ uniform vec3 diffuse;
2
+ uniform vec3 emissive;
3
+ uniform float opacity;
4
+
5
+ in vec3 vLightFront;
6
+
7
+ #ifdef DOUBLE_SIDED
8
+ in vec3 vLightBack;
9
+ #endif
10
+
11
+ #include common
12
+ #include color_pars_fragment
13
+ #include map_pars_fragment
14
+ #include alphamap_pars_fragment
15
+ #include lightmap_pars_fragment
16
+ #include envmap_pars_fragment
17
+ #include fog_pars_fragment
18
+ #include shadowmap_pars_fragment
19
+ #include specularmap_pars_fragment
20
+ #include logdepthbuf_pars_fragment
21
+
22
+ void main() {
23
+ vec3 outgoingLight = vec3( 0.0 ); // outgoing light does not have an alpha, the surface does
24
+ vec4 diffuseColor = vec4( diffuse, opacity );
25
+
26
+ #include logdepthbuf_fragment
27
+ #include map_fragment
28
+ #include color_fragment
29
+ #include alphamap_fragment
30
+ #include alphatest_fragment
31
+ #include specularmap_fragment
32
+
33
+ #ifdef DOUBLE_SIDED
34
+ float isFront = float( gl_FrontFacing );
35
+ fragColor.xyz *= isFront * vLightFront + ( 1.0 - isFront ) * vLightBack;
36
+
37
+ if ( gl_FrontFacing )
38
+ outgoingLight += diffuseColor.rgb * vLightFront + emissive;
39
+ else
40
+ outgoingLight += diffuseColor.rgb * vLightBack + emissive;
41
+ #else
42
+ outgoingLight += diffuseColor.rgb * vLightFront + emissive;
43
+ #endif
44
+
45
+ #include lightmap_fragment
46
+ #include envmap_fragment
47
+ #include shadowmap_fragment
48
+
49
+ #include linear_to_gamma_fragment
50
+
51
+ #include fog_fragment
52
+
53
+ // fragColor = vec4( outgoingLight, diffuseColor.a ); // TODO, this should be pre-multiplied to allow for bright highlights on very transparent objects
54
+
55
+ fragColor = vec4(outgoingLight, diffuseColor.a);
56
+ }
@@ -0,0 +1,7 @@
1
+ #include common
2
+ #include fog
3
+ #include lights
4
+ #include shadow_map
5
+
6
+ uniform color emissive = color(0.0, 0.0, 0.0);
7
+ uniform vec3 wrapRGB = vec3(1.0, 1.0, 1.0);
@@ -0,0 +1,37 @@
1
+ #define LAMBERT
2
+ out vec3 vLightFront;
3
+ #ifdef DOUBLE_SIDED
4
+ out vec3 vLightBack;
5
+ #endif
6
+
7
+ #include common
8
+ #include map_pars_vertex
9
+ #include lightmap_pars_vertex
10
+ #include envmap_pars_vertex
11
+ #include lights_lambert_pars_vertex
12
+ #include color_pars_vertex
13
+ #include morphtarget_pars_vertex
14
+ #include skinning_pars_vertex
15
+ #include shadowmap_pars_vertex
16
+ #include logdepthbuf_pars_vertex
17
+
18
+ void main() {
19
+ #include map_vertex
20
+ #include lightmap_vertex
21
+ #include color_vertex
22
+
23
+ #include morphnormal_vertex
24
+ #include skinbase_vertex
25
+ #include skinnormal_vertex
26
+ #include defaultnormal_vertex
27
+
28
+ #include morphtarget_vertex
29
+ #include skinning_vertex
30
+ #include default_vertex
31
+ #include logdepthbuf_vertex
32
+
33
+ #include worldpos_vertex
34
+ #include envmap_vertex
35
+ #include lights_lambert_vertex
36
+ #include shadowmap_vertex
37
+ }
@@ -0,0 +1,45 @@
1
+ #define PHONG
2
+
3
+ uniform vec3 diffuse;
4
+ uniform vec3 emissive;
5
+ uniform vec3 specular;
6
+ uniform float shininess;
7
+ uniform float opacity;
8
+
9
+ #include common
10
+ #include color_pars_fragment
11
+ #include map_pars_fragment
12
+ #include alphamap_pars_fragment
13
+ #include lightmap_pars_fragment
14
+ #include envmap_pars_fragment
15
+ #include fog_pars_fragment
16
+ #include lights_phong_pars_fragment
17
+ #include shadowmap_pars_fragment
18
+ #include bumpmap_pars_fragment
19
+ #include normalmap_pars_fragment
20
+ #include specularmap_pars_fragment
21
+ #include logdepthbuf_pars_fragment
22
+
23
+ void main() {
24
+ vec3 outgoingLight = vec3( 0.0 ); // outgoing light does not have an alpha, the surface does
25
+ vec4 diffuseColor = vec4( diffuse, opacity );
26
+
27
+ #include logdepthbuf_fragment
28
+ #include map_fragment
29
+ #include color_fragment
30
+ #include alphamap_fragment
31
+ #include alphatest_fragment
32
+ #include specularmap_fragment
33
+
34
+ #include lights_phong_fragment
35
+
36
+ #include lightmap_fragment
37
+ #include envmap_fragment
38
+ #include shadowmap_fragment
39
+
40
+ #include linear_to_gamma_fragment
41
+
42
+ #include fog_fragment
43
+
44
+ fragColor = vec4( outgoingLight, diffuseColor.a ); // TODO, this should be pre-multiplied to allow for bright highlights on very transparent objects
45
+ }
@@ -0,0 +1,11 @@
1
+ #include common
2
+ #include bump
3
+ #include normal_map
4
+ #include fog
5
+ #include lights
6
+ #include shadow_map
7
+
8
+ uniform color emissive = color(0.0, 0.0, 0.0);
9
+ uniform color specular = color(0.667, 0.667, 0.667);
10
+ uniform float shininess = 30.0;
11
+ uniform vec3 wrapRGB = vec3(1.0, 1.0, 1.0);
@@ -0,0 +1,43 @@
1
+ #define PHONG
2
+ out vec3 vViewPosition;
3
+ #ifndef FLAT_SHADED
4
+ out vec3 vNormal;
5
+ #endif
6
+
7
+ #include common
8
+ #include map_pars_vertex
9
+ #include lightmap_pars_vertex
10
+ #include envmap_pars_vertex
11
+ #include lights_phong_pars_vertex
12
+ #include color_pars_vertex
13
+ #include morphtarget_pars_vertex
14
+ #include skinning_pars_vertex
15
+ #include shadowmap_pars_vertex
16
+ #include logdepthbuf_pars_vertex
17
+
18
+ void main() {
19
+ #include map_vertex
20
+ #include lightmap_vertex
21
+ #include color_vertex
22
+
23
+ #include morphnormal_vertex
24
+ #include skinbase_vertex
25
+ #include skinnormal_vertex
26
+ #include defaultnormal_vertex
27
+
28
+ #ifndef FLAT_SHADED // Normal computed with derivatives when FLAT_SHADED
29
+ vNormal = normalize( transformedNormal );
30
+ #endif
31
+
32
+ #include morphtarget_vertex
33
+ #include skinning_vertex
34
+ #include default_vertex
35
+ #include logdepthbuf_vertex
36
+
37
+ vViewPosition = -mvPosition.xyz;
38
+
39
+ #include worldpos_vertex
40
+ #include envmap_vertex
41
+ #include lights_phong_vertex
42
+ #include shadowmap_vertex
43
+ }
@@ -0,0 +1,105 @@
1
+ #version 330
2
+
3
+ // (parameters[:bump_map] || parameters[:normal_map] || parameters[:flat_shading]) ? '#extension GL_OES_standard_derivatives : enable' : '', # TODO: does extension exist in OpenGL?
4
+
5
+ <%= custom_defines %>
6
+
7
+ #define MAX_DIR_LIGHTS <%= parameters[:max_dir_lights] %>
8
+ #define MAX_POINT_LIGHTS <%= parameters[:max_point_lights] %>
9
+ #define MAX_SPOT_LIGHTS <%= parameters[:max_spot_lights] %>
10
+ #define MAX_HEMI_LIGHTS <%= parameters[:max_hemi_lights] %>
11
+
12
+ #define MAX_SHADOWS <%= parameters[:max_shadows] %>
13
+
14
+ <% if parameters[:alpha_test] %>
15
+ #define ALPHATEST <%= parameters[:alpha_test].to_f %>
16
+ <% end %>
17
+
18
+ <% if @renderer.gamma_input %>
19
+ #define GAMMA_INPUT
20
+ <% end %>
21
+ <% if @renderer.gamma_output %>
22
+ #define GAMMA_OUTPUT
23
+ <% end %>
24
+ #define GAMMA_FACTOR <%= gamma_factor_define %>
25
+
26
+ <% if parameters[:use_fog] && parameters[:fog] %>
27
+ #define USE_FOG
28
+ <% end %>
29
+ <% if parameters[:use_fog] && parameters[:fog_exp] %>
30
+ #define FOG_EXP2
31
+ <% end %>
32
+
33
+ <% if parameters[:map] %>
34
+ #define USE_MAP
35
+ <% end %>
36
+ <% if parameters[:env_map] %>
37
+ #define USE_ENVMAP
38
+ <% end %>
39
+ <% if parameters[:env_map] %>
40
+ #define <%= env_map_type_define %>
41
+ <% end %>
42
+ <% if parameters[:env_map] %>
43
+ #define <%= env_map_mode_define %>
44
+ <% end %>
45
+ <% if parameters[:env_map] %>
46
+ #define <%= env_map_blending_define %>
47
+ <% end %>
48
+ <% if parameters[:light_map] %>
49
+ #define USE_LIGHTMAP
50
+ <% end %>
51
+ <% if parameters[:bump_map] %>
52
+ #define USE_BUMPMAP
53
+ <% end %>
54
+ <% if parameters[:normal_map] %>
55
+ #define USE_NORMALMAP
56
+ <% end %>
57
+ <% if parameters[:specular_map] %>
58
+ #define USE_SPECULARMAP
59
+ <% end %>
60
+ <% if parameters[:alpha_map] %>
61
+ #define USE_ALPHAMAP
62
+ <% end %>
63
+ <% if parameters[:vertex_colors] %>
64
+ #define USE_COLOR
65
+ <% end %>
66
+
67
+ <% if parameters[:flat_shading] %>
68
+ #define FLAT_SHADED
69
+ <% end %>
70
+
71
+ <% if parameters[:metal] %>
72
+ #define METAL
73
+ <% end %>
74
+ <% if parameters[:wrap_around] %>
75
+ #define WRAP_AROUND
76
+ <% end %>
77
+ <% if parameters[:double_sided] %>
78
+ #define DOUBLE_SIDED
79
+ <% end %>
80
+ <% if parameters[:flip_sided] %>
81
+ #define FLIP_SIDED
82
+ <% end %>
83
+
84
+ <% if parameters[:shadow_map_enabled] %>
85
+ #define USE_SHADOWMAP
86
+ <% end %>
87
+ <% if parameters[:shadow_map_enabled] %>
88
+ #define <%= shadow_map_type_define %>
89
+ <% end %>
90
+ <% if parameters[:shadow_map_debug] %>
91
+ #define SHADOWMAP_DEBUG
92
+ <% end %>
93
+ <% if parameters[:'shadow_map_cascade'] %>
94
+ #define SHADOWMAP_CASCADE
95
+ <% end %>
96
+
97
+ <% if parameters[:logarithmic_depth_buffer] %>
98
+ #define USE_LOGDEPTHBUF
99
+ <% end %>
100
+ // @renderer._glExtensionFragDepth ? '#define USE_LOGDEPTHBUF_EXT' : '',
101
+
102
+ uniform mat4 viewMatrix;
103
+ uniform vec3 cameraPosition;
104
+
105
+ layout(location = 0) out vec4 fragColor;