mittsu 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/build-workflow.yml +5 -44
- data/Gemfile +0 -4
- data/README.md +16 -130
- data/bin/console +0 -4
- data/lib/mittsu/cameras/cube_camera.rb +1 -1
- data/lib/mittsu/core/geometry.rb +3 -3
- data/lib/mittsu/core/object_3d.rb +29 -47
- data/lib/mittsu/core/uniform.rb +23 -0
- data/lib/mittsu/core.rb +1 -0
- data/lib/mittsu/loaders/obj_loader.rb +11 -5
- data/lib/mittsu/loaders/stl_loader.rb +186 -0
- data/lib/mittsu/loaders.rb +1 -0
- data/lib/mittsu/math/box3.rb +4 -4
- data/lib/mittsu/objects/line.rb +1 -3
- data/lib/mittsu/objects/mesh.rb +9 -12
- data/lib/mittsu/objects/point_cloud.rb +3 -3
- data/lib/mittsu/textures/render_target.rb +93 -0
- data/lib/mittsu/textures/render_target_cube.rb +8 -0
- data/lib/mittsu/textures/texture.rb +1 -1
- data/lib/mittsu/textures.rb +2 -0
- data/lib/mittsu/version.rb +1 -1
- data/lib/mittsu.rb +0 -1
- data/mittsu.gemspec +8 -12
- metadata +33 -204
- data/install-glfw.ps1 +0 -13
- data/lib/mittsu/renderers/generic_lib.rb +0 -122
- data/lib/mittsu/renderers/glfw_lib.rb +0 -62
- data/lib/mittsu/renderers/glfw_window.rb +0 -233
- data/lib/mittsu/renderers/opengl/core/buffer_geometry.rb +0 -11
- data/lib/mittsu/renderers/opengl/core/geometry.rb +0 -346
- data/lib/mittsu/renderers/opengl/core/object_3d.rb +0 -134
- data/lib/mittsu/renderers/opengl/lights/ambient_light.rb +0 -26
- data/lib/mittsu/renderers/opengl/lights/directional_light.rb +0 -35
- data/lib/mittsu/renderers/opengl/lights/hemisphere_light.rb +0 -39
- data/lib/mittsu/renderers/opengl/lights/light.rb +0 -55
- data/lib/mittsu/renderers/opengl/lights/point_light.rb +0 -36
- data/lib/mittsu/renderers/opengl/lights/spot_light.rb +0 -47
- data/lib/mittsu/renderers/opengl/materials/line_basic_material.rb +0 -16
- data/lib/mittsu/renderers/opengl/materials/material.rb +0 -274
- data/lib/mittsu/renderers/opengl/materials/mesh_basic_material.rb +0 -21
- data/lib/mittsu/renderers/opengl/materials/mesh_lambert_material.rb +0 -33
- data/lib/mittsu/renderers/opengl/materials/mesh_phong_material.rb +0 -44
- data/lib/mittsu/renderers/opengl/materials/opengl_material_basics.rb +0 -57
- data/lib/mittsu/renderers/opengl/materials/point_cloud_material.rb +0 -27
- data/lib/mittsu/renderers/opengl/materials/shader_material.rb +0 -11
- data/lib/mittsu/renderers/opengl/objects/group.rb +0 -9
- data/lib/mittsu/renderers/opengl/objects/line.rb +0 -45
- data/lib/mittsu/renderers/opengl/objects/mesh.rb +0 -70
- data/lib/mittsu/renderers/opengl/objects/point_cloud.rb +0 -39
- data/lib/mittsu/renderers/opengl/objects/sprite.rb +0 -12
- data/lib/mittsu/renderers/opengl/opengl_buffer.rb +0 -13
- data/lib/mittsu/renderers/opengl/opengl_debug.rb +0 -81
- data/lib/mittsu/renderers/opengl/opengl_default_target.rb +0 -50
- data/lib/mittsu/renderers/opengl/opengl_geometry_group.rb +0 -758
- data/lib/mittsu/renderers/opengl/opengl_geometry_like.rb +0 -132
- data/lib/mittsu/renderers/opengl/opengl_helper.rb +0 -161
- data/lib/mittsu/renderers/opengl/opengl_implementations.rb +0 -37
- data/lib/mittsu/renderers/opengl/opengl_lib.rb +0 -19
- data/lib/mittsu/renderers/opengl/opengl_light_renderer.rb +0 -43
- data/lib/mittsu/renderers/opengl/opengl_mittsu_params.rb +0 -53
- data/lib/mittsu/renderers/opengl/opengl_program.rb +0 -250
- data/lib/mittsu/renderers/opengl/opengl_shader.rb +0 -58
- data/lib/mittsu/renderers/opengl/opengl_state.rb +0 -205
- data/lib/mittsu/renderers/opengl/plugins/shadow_map_plugin.rb +0 -417
- data/lib/mittsu/renderers/opengl/plugins/sprite_fragment.glsl +0 -38
- data/lib/mittsu/renderers/opengl/plugins/sprite_plugin.rb +0 -250
- data/lib/mittsu/renderers/opengl/plugins/sprite_vertex.glsl +0 -31
- data/lib/mittsu/renderers/opengl/scenes/scene.rb +0 -9
- data/lib/mittsu/renderers/opengl/textures/compressed_texture.rb +0 -20
- data/lib/mittsu/renderers/opengl/textures/cube_texture.rb +0 -77
- data/lib/mittsu/renderers/opengl/textures/data_texture.rb +0 -21
- data/lib/mittsu/renderers/opengl/textures/texture.rb +0 -107
- data/lib/mittsu/renderers/opengl_render_target.rb +0 -201
- data/lib/mittsu/renderers/opengl_renderer.rb +0 -1028
- data/lib/mittsu/renderers/shaders/rbsl_loader.rb +0 -166
- data/lib/mittsu/renderers/shaders/shader_chunk/alphamap_fragment.glsl +0 -5
- data/lib/mittsu/renderers/shaders/shader_chunk/alphamap_pars_fragment.glsl +0 -5
- data/lib/mittsu/renderers/shaders/shader_chunk/alphatest_fragment.glsl +0 -5
- data/lib/mittsu/renderers/shaders/shader_chunk/bumpmap_pars_fragment.glsl +0 -40
- data/lib/mittsu/renderers/shaders/shader_chunk/color_fragment.glsl +0 -5
- data/lib/mittsu/renderers/shaders/shader_chunk/color_pars_fragment.glsl +0 -5
- data/lib/mittsu/renderers/shaders/shader_chunk/color_pars_vertex.glsl +0 -5
- data/lib/mittsu/renderers/shaders/shader_chunk/color_vertex.glsl +0 -5
- data/lib/mittsu/renderers/shaders/shader_chunk/common.glsl +0 -60
- data/lib/mittsu/renderers/shaders/shader_chunk/default_vertex.glsl +0 -15
- data/lib/mittsu/renderers/shaders/shader_chunk/defaultnormal_vertex.glsl +0 -21
- data/lib/mittsu/renderers/shaders/shader_chunk/envmap_fragment.glsl +0 -62
- data/lib/mittsu/renderers/shaders/shader_chunk/envmap_pars_fragment.glsl +0 -21
- data/lib/mittsu/renderers/shaders/shader_chunk/envmap_pars_vertex.glsl +0 -7
- data/lib/mittsu/renderers/shaders/shader_chunk/envmap_vertex.glsl +0 -17
- data/lib/mittsu/renderers/shaders/shader_chunk/fog_fragment.glsl +0 -26
- data/lib/mittsu/renderers/shaders/shader_chunk/fog_pars_fragment.glsl +0 -15
- data/lib/mittsu/renderers/shaders/shader_chunk/lightmap_fragment.glsl +0 -5
- data/lib/mittsu/renderers/shaders/shader_chunk/lightmap_pars_fragment.glsl +0 -6
- data/lib/mittsu/renderers/shaders/shader_chunk/lightmap_pars_vertex.glsl +0 -5
- data/lib/mittsu/renderers/shaders/shader_chunk/lightmap_vertex.glsl +0 -5
- data/lib/mittsu/renderers/shaders/shader_chunk/lights_lambert_pars_vertex.glsl +0 -43
- data/lib/mittsu/renderers/shaders/shader_chunk/lights_lambert_vertex.glsl +0 -196
- data/lib/mittsu/renderers/shaders/shader_chunk/lights_phong_fragment.glsl +0 -243
- data/lib/mittsu/renderers/shaders/shader_chunk/lights_phong_pars_fragment.glsl +0 -58
- data/lib/mittsu/renderers/shaders/shader_chunk/lights_phong_pars_vertex.glsl +0 -5
- data/lib/mittsu/renderers/shaders/shader_chunk/lights_phong_vertex.glsl +0 -5
- data/lib/mittsu/renderers/shaders/shader_chunk/linear_to_gamma_fragment.glsl +0 -2
- data/lib/mittsu/renderers/shaders/shader_chunk/logdepthbuf_fragment.glsl +0 -5
- data/lib/mittsu/renderers/shaders/shader_chunk/logdepthbuf_pars_fragment.glsl +0 -12
- data/lib/mittsu/renderers/shaders/shader_chunk/logdepthbuf_pars_vertex.glsl +0 -11
- data/lib/mittsu/renderers/shaders/shader_chunk/logdepthbuf_vertex.glsl +0 -15
- data/lib/mittsu/renderers/shaders/shader_chunk/map_fragment.glsl +0 -9
- data/lib/mittsu/renderers/shaders/shader_chunk/map_pars_fragment.glsl +0 -11
- data/lib/mittsu/renderers/shaders/shader_chunk/map_pars_vertex.glsl +0 -6
- data/lib/mittsu/renderers/shaders/shader_chunk/map_particle_fragment.glsl +0 -5
- data/lib/mittsu/renderers/shaders/shader_chunk/map_particle_pars_fragment.glsl +0 -6
- data/lib/mittsu/renderers/shaders/shader_chunk/map_vertex.glsl +0 -5
- data/lib/mittsu/renderers/shaders/shader_chunk/morphnormal_vertex.glsl +0 -12
- data/lib/mittsu/renderers/shaders/shader_chunk/morphtarget_pars_vertex.glsl +0 -13
- data/lib/mittsu/renderers/shaders/shader_chunk/morphtarget_vertex.glsl +0 -20
- data/lib/mittsu/renderers/shaders/shader_chunk/normalmap_pars_fragment.glsl +0 -27
- data/lib/mittsu/renderers/shaders/shader_chunk/shadowmap_fragment.glsl +0 -216
- data/lib/mittsu/renderers/shaders/shader_chunk/shadowmap_pars_fragment.glsl +0 -19
- data/lib/mittsu/renderers/shaders/shader_chunk/shadowmap_pars_vertex.glsl +0 -6
- data/lib/mittsu/renderers/shaders/shader_chunk/shadowmap_vertex.glsl +0 -9
- data/lib/mittsu/renderers/shaders/shader_chunk/skinbase_vertex.glsl +0 -8
- data/lib/mittsu/renderers/shaders/shader_chunk/skinning_pars_vertex.glsl +0 -47
- data/lib/mittsu/renderers/shaders/shader_chunk/skinning_vertex.glsl +0 -20
- data/lib/mittsu/renderers/shaders/shader_chunk/skinnormal_vertex.glsl +0 -20
- data/lib/mittsu/renderers/shaders/shader_chunk/specularmap_fragment.glsl +0 -12
- data/lib/mittsu/renderers/shaders/shader_chunk/specularmap_pars_fragment.glsl +0 -5
- data/lib/mittsu/renderers/shaders/shader_chunk/worldpos_vertex.glsl +0 -17
- data/lib/mittsu/renderers/shaders/shader_chunk.rb +0 -9
- data/lib/mittsu/renderers/shaders/shader_lib/basic/basic_fragment.rbsl +0 -37
- data/lib/mittsu/renderers/shaders/shader_lib/basic/basic_uniforms.rbslu +0 -3
- data/lib/mittsu/renderers/shaders/shader_lib/basic/basic_vertex.rbsl +0 -33
- data/lib/mittsu/renderers/shaders/shader_lib/cube/cube_fragment.rbsl +0 -12
- data/lib/mittsu/renderers/shaders/shader_lib/cube/cube_uniforms.rbslu +0 -2
- data/lib/mittsu/renderers/shaders/shader_lib/cube/cube_vertex.rbsl +0 -12
- data/lib/mittsu/renderers/shaders/shader_lib/depth_rgba/depth_rgba_fragment.rbsl +0 -26
- data/lib/mittsu/renderers/shaders/shader_lib/depth_rgba/depth_rgba_uniforms.rbslu +0 -0
- data/lib/mittsu/renderers/shaders/shader_lib/depth_rgba/depth_rgba_vertex.rbsl +0 -12
- data/lib/mittsu/renderers/shaders/shader_lib/lambert/lambert_fragment.rbsl +0 -56
- data/lib/mittsu/renderers/shaders/shader_lib/lambert/lambert_uniforms.rbslu +0 -7
- data/lib/mittsu/renderers/shaders/shader_lib/lambert/lambert_vertex.rbsl +0 -37
- data/lib/mittsu/renderers/shaders/shader_lib/particle_basic/particle_basic_fragment.rbsl +0 -27
- data/lib/mittsu/renderers/shaders/shader_lib/particle_basic/particle_basic_uniforms.rbslu +0 -2
- data/lib/mittsu/renderers/shaders/shader_lib/particle_basic/particle_basic_vertex.rbsl +0 -25
- data/lib/mittsu/renderers/shaders/shader_lib/phong/phong_fragment.rbsl +0 -45
- data/lib/mittsu/renderers/shaders/shader_lib/phong/phong_uniforms.rbslu +0 -11
- data/lib/mittsu/renderers/shaders/shader_lib/phong/phong_vertex.rbsl +0 -43
- data/lib/mittsu/renderers/shaders/shader_lib.rb +0 -43
- data/lib/mittsu/renderers/shaders/shader_templates/fragment.glsl.erb +0 -105
- data/lib/mittsu/renderers/shaders/shader_templates/vertex.glsl.erb +0 -143
- data/lib/mittsu/renderers/shaders/uniforms_lib.rb +0 -106
- data/lib/mittsu/renderers/shaders/uniforms_utils.rb +0 -31
- data/lib/mittsu/renderers.rb +0 -1
@@ -1,216 +0,0 @@
|
|
1
|
-
#ifdef USE_SHADOWMAP
|
2
|
-
|
3
|
-
#ifdef SHADOWMAP_DEBUG
|
4
|
-
|
5
|
-
vec3 frustumColors[3];
|
6
|
-
frustumColors[0] = vec3( 1.0, 0.5, 0.0 );
|
7
|
-
frustumColors[1] = vec3( 0.0, 1.0, 0.8 );
|
8
|
-
frustumColors[2] = vec3( 0.0, 0.5, 1.0 );
|
9
|
-
|
10
|
-
#endif
|
11
|
-
|
12
|
-
#ifdef SHADOWMAP_CASCADE
|
13
|
-
|
14
|
-
int inFrustumCount = 0;
|
15
|
-
|
16
|
-
#endif
|
17
|
-
|
18
|
-
float fDepth;
|
19
|
-
vec3 shadowColor = vec3( 1.0 );
|
20
|
-
|
21
|
-
<% parameters[:max_shadows].times do |i| %>
|
22
|
-
vec3 shadowCoord = vShadowCoord[ <%= i %> ].xyz / vShadowCoord[ <%= i %> ].w;
|
23
|
-
|
24
|
-
// if ( something && something ) breaks ATI OpenGL shader compiler
|
25
|
-
// if ( all( something, something ) ) using this instead
|
26
|
-
|
27
|
-
bvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );
|
28
|
-
bool inFrustum = all( inFrustumVec );
|
29
|
-
|
30
|
-
// don't shadow pixels outside of light frustum
|
31
|
-
// use just first frustum (for cascades)
|
32
|
-
// don't shadow pixels behind far plane of light frustum
|
33
|
-
|
34
|
-
#ifdef SHADOWMAP_CASCADE
|
35
|
-
|
36
|
-
inFrustumCount += int( inFrustum );
|
37
|
-
bvec3 frustumTestVec = bvec3( inFrustum, inFrustumCount == 1, shadowCoord.z <= 1.0 );
|
38
|
-
|
39
|
-
#else
|
40
|
-
|
41
|
-
bvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );
|
42
|
-
|
43
|
-
#endif
|
44
|
-
|
45
|
-
bool frustumTest = all( frustumTestVec );
|
46
|
-
|
47
|
-
if ( frustumTest ) {
|
48
|
-
|
49
|
-
shadowCoord.z += shadowBias[ <%= i %> ];
|
50
|
-
|
51
|
-
#if defined( SHADOWMAP_TYPE_PCF )
|
52
|
-
|
53
|
-
// Percentage-close filtering
|
54
|
-
// (9 pixel kernel)
|
55
|
-
// http://fabiensanglard.net/shadowmappingPCF/
|
56
|
-
|
57
|
-
float shadow = 0.0;
|
58
|
-
|
59
|
-
/*
|
60
|
-
// nested loops breaks shader compiler / validator on some ATI cards when using OpenGL
|
61
|
-
// must enroll loop manually
|
62
|
-
|
63
|
-
for ( float y = -1.25; y <= 1.25; y += 1.25 )
|
64
|
-
for ( float x = -1.25; x <= 1.25; x += 1.25 ) {
|
65
|
-
|
66
|
-
vec4 rgbaDepth = texture( shadowMap[ <%= i %> ], vec2( x * xPixelOffset, y * yPixelOffset ) + shadowCoord.xy );
|
67
|
-
|
68
|
-
// doesn't seem to produce any noticeable visual difference compared to simple texture lookup
|
69
|
-
//vec4 rgbaDepth = textureProj( shadowMap[ <%= i %> ], vec4( vShadowCoord[ <%= i %> ].w * ( vec2( x * xPixelOffset, y * yPixelOffset ) + shadowCoord.xy ), 0.05, vShadowCoord[ <%= i %> ].w ) );
|
70
|
-
|
71
|
-
float fDepth = unpackDepth( rgbaDepth );
|
72
|
-
|
73
|
-
if ( fDepth < shadowCoord.z )
|
74
|
-
shadow += 1.0;
|
75
|
-
|
76
|
-
}
|
77
|
-
|
78
|
-
shadow /= 9.0;
|
79
|
-
|
80
|
-
*/
|
81
|
-
|
82
|
-
const float shadowDelta = 1.0 / 9.0;
|
83
|
-
|
84
|
-
float xPixelOffset = 1.0 / shadowMapSize[ <%= i %> ].x;
|
85
|
-
float yPixelOffset = 1.0 / shadowMapSize[ <%= i %> ].y;
|
86
|
-
|
87
|
-
float dx0 = -1.25 * xPixelOffset;
|
88
|
-
float dy0 = -1.25 * yPixelOffset;
|
89
|
-
float dx1 = 1.25 * xPixelOffset;
|
90
|
-
float dy1 = 1.25 * yPixelOffset;
|
91
|
-
|
92
|
-
fDepth = unpackDepth( texture( shadowMap[ <%= i %> ], shadowCoord.xy + vec2( dx0, dy0 ) ) );
|
93
|
-
if ( fDepth < shadowCoord.z ) shadow += shadowDelta;
|
94
|
-
|
95
|
-
fDepth = unpackDepth( texture( shadowMap[ <%= i %> ], shadowCoord.xy + vec2( 0.0, dy0 ) ) );
|
96
|
-
if ( fDepth < shadowCoord.z ) shadow += shadowDelta;
|
97
|
-
|
98
|
-
fDepth = unpackDepth( texture( shadowMap[ <%= i %> ], shadowCoord.xy + vec2( dx1, dy0 ) ) );
|
99
|
-
if ( fDepth < shadowCoord.z ) shadow += shadowDelta;
|
100
|
-
|
101
|
-
fDepth = unpackDepth( texture( shadowMap[ <%= i %> ], shadowCoord.xy + vec2( dx0, 0.0 ) ) );
|
102
|
-
if ( fDepth < shadowCoord.z ) shadow += shadowDelta;
|
103
|
-
|
104
|
-
fDepth = unpackDepth( texture( shadowMap[ <%= i %> ], shadowCoord.xy ) );
|
105
|
-
if ( fDepth < shadowCoord.z ) shadow += shadowDelta;
|
106
|
-
|
107
|
-
fDepth = unpackDepth( texture( shadowMap[ <%= i %> ], shadowCoord.xy + vec2( dx1, 0.0 ) ) );
|
108
|
-
if ( fDepth < shadowCoord.z ) shadow += shadowDelta;
|
109
|
-
|
110
|
-
fDepth = unpackDepth( texture( shadowMap[ <%= i %> ], shadowCoord.xy + vec2( dx0, dy1 ) ) );
|
111
|
-
if ( fDepth < shadowCoord.z ) shadow += shadowDelta;
|
112
|
-
|
113
|
-
fDepth = unpackDepth( texture( shadowMap[ <%= i %> ], shadowCoord.xy + vec2( 0.0, dy1 ) ) );
|
114
|
-
if ( fDepth < shadowCoord.z ) shadow += shadowDelta;
|
115
|
-
|
116
|
-
fDepth = unpackDepth( texture( shadowMap[ <%= i %> ], shadowCoord.xy + vec2( dx1, dy1 ) ) );
|
117
|
-
if ( fDepth < shadowCoord.z ) shadow += shadowDelta;
|
118
|
-
|
119
|
-
shadowColor = shadowColor * vec3( ( 1.0 - shadowDarkness[ <%= i %> ] * shadow ) );
|
120
|
-
|
121
|
-
#elif defined( SHADOWMAP_TYPE_PCF_SOFT )
|
122
|
-
|
123
|
-
// Percentage-close filtering
|
124
|
-
// (9 pixel kernel)
|
125
|
-
// http://fabiensanglard.net/shadowmappingPCF/
|
126
|
-
|
127
|
-
float shadow = 0.0;
|
128
|
-
|
129
|
-
float xPixelOffset = 1.0 / shadowMapSize[ <%= i %> ].x;
|
130
|
-
float yPixelOffset = 1.0 / shadowMapSize[ <%= i %> ].y;
|
131
|
-
|
132
|
-
float dx0 = -1.0 * xPixelOffset;
|
133
|
-
float dy0 = -1.0 * yPixelOffset;
|
134
|
-
float dx1 = 1.0 * xPixelOffset;
|
135
|
-
float dy1 = 1.0 * yPixelOffset;
|
136
|
-
|
137
|
-
mat3 shadowKernel;
|
138
|
-
mat3 depthKernel;
|
139
|
-
|
140
|
-
depthKernel[0][0] = unpackDepth( texture( shadowMap[ <%= i %> ], shadowCoord.xy + vec2( dx0, dy0 ) ) );
|
141
|
-
depthKernel[0][1] = unpackDepth( texture( shadowMap[ <%= i %> ], shadowCoord.xy + vec2( dx0, 0.0 ) ) );
|
142
|
-
depthKernel[0][2] = unpackDepth( texture( shadowMap[ <%= i %> ], shadowCoord.xy + vec2( dx0, dy1 ) ) );
|
143
|
-
depthKernel[1][0] = unpackDepth( texture( shadowMap[ <%= i %> ], shadowCoord.xy + vec2( 0.0, dy0 ) ) );
|
144
|
-
depthKernel[1][1] = unpackDepth( texture( shadowMap[ <%= i %> ], shadowCoord.xy ) );
|
145
|
-
depthKernel[1][2] = unpackDepth( texture( shadowMap[ <%= i %> ], shadowCoord.xy + vec2( 0.0, dy1 ) ) );
|
146
|
-
depthKernel[2][0] = unpackDepth( texture( shadowMap[ <%= i %> ], shadowCoord.xy + vec2( dx1, dy0 ) ) );
|
147
|
-
depthKernel[2][1] = unpackDepth( texture( shadowMap[ <%= i %> ], shadowCoord.xy + vec2( dx1, 0.0 ) ) );
|
148
|
-
depthKernel[2][2] = unpackDepth( texture( shadowMap[ <%= i %> ], shadowCoord.xy + vec2( dx1, dy1 ) ) );
|
149
|
-
|
150
|
-
vec3 shadowZ = vec3( shadowCoord.z );
|
151
|
-
shadowKernel[0] = vec3(lessThan(depthKernel[0], shadowZ ));
|
152
|
-
shadowKernel[0] *= vec3(0.25);
|
153
|
-
|
154
|
-
shadowKernel[1] = vec3(lessThan(depthKernel[1], shadowZ ));
|
155
|
-
shadowKernel[1] *= vec3(0.25);
|
156
|
-
|
157
|
-
shadowKernel[2] = vec3(lessThan(depthKernel[2], shadowZ ));
|
158
|
-
shadowKernel[2] *= vec3(0.25);
|
159
|
-
|
160
|
-
vec2 fractionalCoord = 1.0 - fract( shadowCoord.xy * shadowMapSize[<%= i %>].xy );
|
161
|
-
|
162
|
-
shadowKernel[0] = mix( shadowKernel[1], shadowKernel[0], fractionalCoord.x );
|
163
|
-
shadowKernel[1] = mix( shadowKernel[2], shadowKernel[1], fractionalCoord.x );
|
164
|
-
|
165
|
-
vec4 shadowValues;
|
166
|
-
shadowValues.x = mix( shadowKernel[0][1], shadowKernel[0][0], fractionalCoord.y );
|
167
|
-
shadowValues.y = mix( shadowKernel[0][2], shadowKernel[0][1], fractionalCoord.y );
|
168
|
-
shadowValues.z = mix( shadowKernel[1][1], shadowKernel[1][0], fractionalCoord.y );
|
169
|
-
shadowValues.w = mix( shadowKernel[1][2], shadowKernel[1][1], fractionalCoord.y );
|
170
|
-
|
171
|
-
shadow = dot( shadowValues, vec4( 1.0 ) );
|
172
|
-
|
173
|
-
shadowColor = shadowColor * vec3( ( 1.0 - shadowDarkness[ <%= i %> ] * shadow ) );
|
174
|
-
|
175
|
-
#else
|
176
|
-
|
177
|
-
vec4 rgbaDepth = texture( shadowMap[ <%= i %> ], shadowCoord.xy );
|
178
|
-
float fDepth = unpackDepth( rgbaDepth );
|
179
|
-
|
180
|
-
if ( fDepth < shadowCoord.z )
|
181
|
-
|
182
|
-
// spot with multiple shadows is darker
|
183
|
-
|
184
|
-
shadowColor = shadowColor * vec3( 1.0 - shadowDarkness[ <%= i %> ] );
|
185
|
-
|
186
|
-
// spot with multiple shadows has the same color as single shadow spot
|
187
|
-
|
188
|
-
// shadowColor = min( shadowColor, vec3( shadowDarkness[ <%= i %> ] ) );
|
189
|
-
|
190
|
-
#endif
|
191
|
-
|
192
|
-
}
|
193
|
-
|
194
|
-
|
195
|
-
#ifdef SHADOWMAP_DEBUG
|
196
|
-
|
197
|
-
#ifdef SHADOWMAP_CASCADE
|
198
|
-
|
199
|
-
if ( inFrustum && inFrustumCount == 1 ) outgoingLight *= frustumColors[ <%= i %> ];
|
200
|
-
|
201
|
-
#else
|
202
|
-
|
203
|
-
if ( inFrustum ) outgoingLight *= frustumColors[ <%= i %> ];
|
204
|
-
|
205
|
-
#endif
|
206
|
-
|
207
|
-
#endif
|
208
|
-
|
209
|
-
<% end %>
|
210
|
-
|
211
|
-
// NOTE: I am unsure if this is correct in linear space. -bhouston, Dec 29, 2014
|
212
|
-
shadowColor = inputToLinear( shadowColor );
|
213
|
-
|
214
|
-
outgoingLight = outgoingLight * shadowColor;
|
215
|
-
|
216
|
-
#endif
|
@@ -1,19 +0,0 @@
|
|
1
|
-
#ifdef USE_SHADOWMAP
|
2
|
-
|
3
|
-
uniform sampler2D shadowMap[ MAX_SHADOWS ];
|
4
|
-
uniform vec2 shadowMapSize[ MAX_SHADOWS ];
|
5
|
-
|
6
|
-
uniform float shadowDarkness[ MAX_SHADOWS ];
|
7
|
-
uniform float shadowBias[ MAX_SHADOWS ];
|
8
|
-
|
9
|
-
in vec4 vShadowCoord[ MAX_SHADOWS ];
|
10
|
-
|
11
|
-
float unpackDepth( const in vec4 rgba_depth ) {
|
12
|
-
|
13
|
-
const vec4 bit_shift = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );
|
14
|
-
float depth = dot( rgba_depth, bit_shift );
|
15
|
-
return depth;
|
16
|
-
|
17
|
-
}
|
18
|
-
|
19
|
-
#endif
|
@@ -1,47 +0,0 @@
|
|
1
|
-
#ifdef USE_SKINNING
|
2
|
-
|
3
|
-
uniform mat4 bindMatrix;
|
4
|
-
uniform mat4 bindMatrixInverse;
|
5
|
-
|
6
|
-
#ifdef BONE_TEXTURE
|
7
|
-
|
8
|
-
uniform sampler2D boneTexture;
|
9
|
-
uniform int boneTextureWidth;
|
10
|
-
uniform int boneTextureHeight;
|
11
|
-
|
12
|
-
mat4 getBoneMatrix( const in float i ) {
|
13
|
-
|
14
|
-
float j = i * 4.0;
|
15
|
-
float x = mod( j, float( boneTextureWidth ) );
|
16
|
-
float y = floor( j / float( boneTextureWidth ) );
|
17
|
-
|
18
|
-
float dx = 1.0 / float( boneTextureWidth );
|
19
|
-
float dy = 1.0 / float( boneTextureHeight );
|
20
|
-
|
21
|
-
y = dy * ( y + 0.5 );
|
22
|
-
|
23
|
-
vec4 v1 = texture( boneTexture, vec2( dx * ( x + 0.5 ), y ) );
|
24
|
-
vec4 v2 = texture( boneTexture, vec2( dx * ( x + 1.5 ), y ) );
|
25
|
-
vec4 v3 = texture( boneTexture, vec2( dx * ( x + 2.5 ), y ) );
|
26
|
-
vec4 v4 = texture( boneTexture, vec2( dx * ( x + 3.5 ), y ) );
|
27
|
-
|
28
|
-
mat4 bone = mat4( v1, v2, v3, v4 );
|
29
|
-
|
30
|
-
return bone;
|
31
|
-
|
32
|
-
}
|
33
|
-
|
34
|
-
#else
|
35
|
-
|
36
|
-
uniform mat4 boneGlobalMatrices[ MAX_BONES ];
|
37
|
-
|
38
|
-
mat4 getBoneMatrix( const in float i ) {
|
39
|
-
|
40
|
-
mat4 bone = boneGlobalMatrices[ int(i) ];
|
41
|
-
return bone;
|
42
|
-
|
43
|
-
}
|
44
|
-
|
45
|
-
#endif
|
46
|
-
|
47
|
-
#endif
|
@@ -1,20 +0,0 @@
|
|
1
|
-
#ifdef USE_SKINNING
|
2
|
-
|
3
|
-
#ifdef USE_MORPHTARGETS
|
4
|
-
|
5
|
-
vec4 skinVertex = bindMatrix * vec4( morphed, 1.0 );
|
6
|
-
|
7
|
-
#else
|
8
|
-
|
9
|
-
vec4 skinVertex = bindMatrix * vec4( position, 1.0 );
|
10
|
-
|
11
|
-
#endif
|
12
|
-
|
13
|
-
vec4 skinned = vec4( 0.0 );
|
14
|
-
skinned += boneMatX * skinVertex * skinWeight.x;
|
15
|
-
skinned += boneMatY * skinVertex * skinWeight.y;
|
16
|
-
skinned += boneMatZ * skinVertex * skinWeight.z;
|
17
|
-
skinned += boneMatW * skinVertex * skinWeight.w;
|
18
|
-
skinned = bindMatrixInverse * skinned;
|
19
|
-
|
20
|
-
#endif
|
@@ -1,20 +0,0 @@
|
|
1
|
-
#ifdef USE_SKINNING
|
2
|
-
|
3
|
-
mat4 skinMatrix = mat4( 0.0 );
|
4
|
-
skinMatrix += skinWeight.x * boneMatX;
|
5
|
-
skinMatrix += skinWeight.y * boneMatY;
|
6
|
-
skinMatrix += skinWeight.z * boneMatZ;
|
7
|
-
skinMatrix += skinWeight.w * boneMatW;
|
8
|
-
skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
|
9
|
-
|
10
|
-
#ifdef USE_MORPHNORMALS
|
11
|
-
|
12
|
-
vec4 skinnedNormal = skinMatrix * vec4( morphedNormal, 0.0 );
|
13
|
-
|
14
|
-
#else
|
15
|
-
|
16
|
-
vec4 skinnedNormal = skinMatrix * vec4( normal, 0.0 );
|
17
|
-
|
18
|
-
#endif
|
19
|
-
|
20
|
-
#endif
|
@@ -1,17 +0,0 @@
|
|
1
|
-
#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )
|
2
|
-
|
3
|
-
#ifdef USE_SKINNING
|
4
|
-
|
5
|
-
vec4 worldPosition = modelMatrix * skinned;
|
6
|
-
|
7
|
-
#elif defined( USE_MORPHTARGETS )
|
8
|
-
|
9
|
-
vec4 worldPosition = modelMatrix * vec4( morphed, 1.0 );
|
10
|
-
|
11
|
-
#else
|
12
|
-
|
13
|
-
vec4 worldPosition = modelMatrix * vec4( position, 1.0 );
|
14
|
-
|
15
|
-
#endif
|
16
|
-
|
17
|
-
#endif
|
@@ -1,37 +0,0 @@
|
|
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
|
-
}
|
@@ -1,33 +0,0 @@
|
|
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
|
-
}
|
@@ -1,12 +0,0 @@
|
|
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
|
-
}
|
@@ -1,12 +0,0 @@
|
|
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
|
-
}
|
@@ -1,26 +0,0 @@
|
|
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
|
-
}
|
File without changes
|
@@ -1,12 +0,0 @@
|
|
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
|
-
}
|
@@ -1,56 +0,0 @@
|
|
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
|
-
}
|
@@ -1,37 +0,0 @@
|
|
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
|
-
}
|
@@ -1,27 +0,0 @@
|
|
1
|
-
uniform vec3 psColor;
|
2
|
-
uniform float opacity;
|
3
|
-
|
4
|
-
#include common
|
5
|
-
#include color_pars_fragment
|
6
|
-
#include map_particle_pars_fragment
|
7
|
-
#include fog_pars_fragment
|
8
|
-
#include shadowmap_pars_fragment
|
9
|
-
#include logdepthbuf_pars_fragment
|
10
|
-
|
11
|
-
void main() {
|
12
|
-
vec3 outgoingLight = vec3( 0.0 ); // outgoing light does not have an alpha, the surface does
|
13
|
-
vec4 diffuseColor = vec4( psColor, opacity );
|
14
|
-
|
15
|
-
#include logdepthbuf_fragment
|
16
|
-
#include map_particle_fragment
|
17
|
-
#include color_fragment
|
18
|
-
#include alphatest_fragment
|
19
|
-
|
20
|
-
outgoingLight = diffuseColor.rgb; // simple shader
|
21
|
-
|
22
|
-
#include shadowmap_fragment
|
23
|
-
#include fog_fragment
|
24
|
-
|
25
|
-
|
26
|
-
fragColor = vec4( outgoingLight, diffuseColor.a ); // TODO, this should be pre-multiplied to allow for bright highlights on very transparent objects
|
27
|
-
}
|