mittsu 0.4.1 → 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 +3 -38
- 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/uniform.rb +23 -0
- data/lib/mittsu/core.rb +1 -0
- data/lib/mittsu/loaders/stl_loader.rb +186 -0
- data/lib/mittsu/loaders.rb +1 -0
- 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 +28 -199
- data/install-glfw.ps1 +0 -13
- data/lib/mittsu/renderers/generic_lib.rb +0 -125
- data/lib/mittsu/renderers/glfw_lib.rb +0 -64
- 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,25 +0,0 @@
|
|
1
|
-
uniform float size;
|
2
|
-
// uniform float scale; // TODO
|
3
|
-
|
4
|
-
#include common
|
5
|
-
#include color_pars_vertex
|
6
|
-
#include shadowmap_pars_vertex
|
7
|
-
#include logdepthbuf_pars_vertex
|
8
|
-
|
9
|
-
void main() {
|
10
|
-
#include color_vertex
|
11
|
-
|
12
|
-
vec4 mvPosition = modelViewMatrix * vec4(position, 1.0);
|
13
|
-
|
14
|
-
// #ifdef USE_SIZEATTENUATION
|
15
|
-
// gl_PointSize = size * (scale / length(mvPosition.xyz));
|
16
|
-
// #else
|
17
|
-
gl_PointSize = size;
|
18
|
-
// #endif
|
19
|
-
|
20
|
-
gl_Position = projectionMatrix * mvPosition;
|
21
|
-
|
22
|
-
#include logdepthbuf_vertex
|
23
|
-
#include worldpos_vertex
|
24
|
-
#include shadowmap_vertex
|
25
|
-
}
|
@@ -1,45 +0,0 @@
|
|
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
|
-
}
|
@@ -1,11 +0,0 @@
|
|
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);
|
@@ -1,43 +0,0 @@
|
|
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
|
-
}
|
@@ -1,43 +0,0 @@
|
|
1
|
-
require 'mittsu/renderers/shaders/uniforms_utils'
|
2
|
-
require 'mittsu/renderers/shaders/uniforms_lib'
|
3
|
-
require 'mittsu/renderers/shaders/shader_chunk'
|
4
|
-
require 'mittsu/renderers/shaders/rbsl_loader'
|
5
|
-
|
6
|
-
module Mittsu
|
7
|
-
class ShaderLib_Instance
|
8
|
-
attr_accessor :uniforms, :vertex_shader, :fragment_shader
|
9
|
-
def initialize(options = {})
|
10
|
-
@uniforms = options.fetch(:uniforms)
|
11
|
-
@vertex_shader = options.fetch(:vertex_shader)
|
12
|
-
@fragment_shader = options.fetch(:fragment_shader)
|
13
|
-
end
|
14
|
-
|
15
|
-
def self.load_from_file(name)
|
16
|
-
ShaderLib_Instance.new(
|
17
|
-
uniforms: RBSLLoader.load_uniforms(File.read(File.join(__dir__, 'shader_lib', name, "#{name}_uniforms.rbslu")), UniformsLib),
|
18
|
-
vertex_shader: RBSLLoader.load_shader(File.read(File.join(__dir__, 'shader_lib', name, "#{name}_vertex.rbsl")), ShaderChunk),
|
19
|
-
fragment_shader: RBSLLoader.load_shader(File.read(File.join(__dir__, 'shader_lib', name, "#{name}_fragment.rbsl")), ShaderChunk)
|
20
|
-
)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
private_constant :ShaderLib_Instance
|
24
|
-
|
25
|
-
SHADER_LIB_HASH = Hash.new { |h, k|
|
26
|
-
h[k] = ShaderLib_Instance.load_from_file(k.to_s)
|
27
|
-
}
|
28
|
-
|
29
|
-
class ShaderLib
|
30
|
-
def self.create_shader(id, options={})
|
31
|
-
shader = self[id]
|
32
|
-
{
|
33
|
-
uniforms: UniformsUtils.clone(shader.uniforms),
|
34
|
-
vertex_shader: shader.vertex_shader,
|
35
|
-
fragment_shader: shader.fragment_shader
|
36
|
-
}.merge(options)
|
37
|
-
end
|
38
|
-
|
39
|
-
def self.[](id)
|
40
|
-
SHADER_LIB_HASH[id]
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
@@ -1,105 +0,0 @@
|
|
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;
|
@@ -1,143 +0,0 @@
|
|
1
|
-
#version 330
|
2
|
-
|
3
|
-
<%= custom_defines %>
|
4
|
-
|
5
|
-
<% if parameters[:supports_vertex_textures] %>
|
6
|
-
#define VERTEX_TEXTURES
|
7
|
-
<% end %>
|
8
|
-
|
9
|
-
<% if @renderer.gamma_input %>
|
10
|
-
#define GAMMA_INPUT
|
11
|
-
<% end %>
|
12
|
-
<% if @renderer.gamma_output %>
|
13
|
-
#define GAMMA_OUTPUT
|
14
|
-
<% end %>
|
15
|
-
#define GAMMA_FACTOR <%= gamma_factor_define %>
|
16
|
-
|
17
|
-
#define MAX_DIR_LIGHTS <%= parameters[:max_dir_lights] %>
|
18
|
-
#define MAX_POINT_LIGHTS <%= parameters[:max_point_lights] %>
|
19
|
-
#define MAX_SPOT_LIGHTS <%= parameters[:max_spot_lights] %>
|
20
|
-
#define MAX_HEMI_LIGHTS <%= parameters[:max_hemi_lights] %>
|
21
|
-
|
22
|
-
#define MAX_SHADOWS <%= parameters[:max_shadows] %>
|
23
|
-
|
24
|
-
#define MAX_BONES <%= parameters[:max_bones] %>
|
25
|
-
|
26
|
-
<% if parameters[:map] %>
|
27
|
-
#define USE_MAP
|
28
|
-
<% end %>
|
29
|
-
<% if parameters[:env_map] %>
|
30
|
-
#define USE_ENVMAP
|
31
|
-
<% end %>
|
32
|
-
<% if parameters[:env_map] %>
|
33
|
-
#define <%= env_map_mode_define %>
|
34
|
-
<% end %>
|
35
|
-
<% if parameters[:light_map] %>
|
36
|
-
#define USE_LIGHTMAP
|
37
|
-
<% end %>
|
38
|
-
<% if parameters[:bump_map] %>
|
39
|
-
#define USE_BUMPMAP
|
40
|
-
<% end %>
|
41
|
-
<% if parameters[:normal_map] %>
|
42
|
-
#define USE_NORMALMAP
|
43
|
-
<% end %>
|
44
|
-
<% if parameters[:specular_map] %>
|
45
|
-
#define USE_SPECULARMAP
|
46
|
-
<% end %>
|
47
|
-
<% if parameters[:alpha_map] %>
|
48
|
-
#define USE_ALPHAMAP
|
49
|
-
<% end %>
|
50
|
-
<% if parameters[:vertex_colors] %>
|
51
|
-
#define USE_COLOR
|
52
|
-
<% end %>
|
53
|
-
|
54
|
-
<% if parameters[:flat_shading] %>
|
55
|
-
#define FLAT_SHADED
|
56
|
-
<% end %>
|
57
|
-
|
58
|
-
<% if parameters[:skinning] %>
|
59
|
-
#define USE_SKINNING
|
60
|
-
<% end %>
|
61
|
-
<% if parameters[:use_vertex_texture] %>
|
62
|
-
#define BONE_TEXTURE
|
63
|
-
<% end %>
|
64
|
-
|
65
|
-
<% if parameters[:morph_targets] %>
|
66
|
-
#define USE_MORPHTARGETS
|
67
|
-
<% end %>
|
68
|
-
<% if parameters[:morph_normals] %>
|
69
|
-
#define USE_MORPHNORMALS
|
70
|
-
<% end %>
|
71
|
-
<% if parameters[:wrap_around] %>
|
72
|
-
#define WRAP_AROUND
|
73
|
-
<% end %>
|
74
|
-
<% if parameters[:double_sided] %>
|
75
|
-
#define DOUBLE_SIDED
|
76
|
-
<% end %>
|
77
|
-
<% if parameters[:flip_sided] %>
|
78
|
-
#define FLIP_SIDED
|
79
|
-
<% end %>
|
80
|
-
|
81
|
-
<% if parameters[:shadow_map_enabled] %>
|
82
|
-
#define USE_SHADOWMAP
|
83
|
-
<% end %>
|
84
|
-
<% if parameters[:shadow_map_enabled] %>
|
85
|
-
#define <%= shadow_map_type_define %>
|
86
|
-
<% end %>
|
87
|
-
<% if parameters[:shadow_map_debug] %>
|
88
|
-
#define SHADOWMAP_DEBUG
|
89
|
-
<% end %>
|
90
|
-
<% if parameters[:shadow_map_cascade] %>
|
91
|
-
#define SHADOWMAP_CASCADE
|
92
|
-
<% end %>
|
93
|
-
|
94
|
-
<% if parameters[:size_attenuation] %>
|
95
|
-
#define USE_SIZEATTENUATION
|
96
|
-
<% end %>
|
97
|
-
|
98
|
-
<% if parameters[:logarithmic_depth_buffer] %>
|
99
|
-
#define USE_LOGDEPTHBUF
|
100
|
-
<% end %>
|
101
|
-
// @renderer._glExtensionFragDepth ? '#define USE_LOGDEPTHBUF_EXT' : '',
|
102
|
-
|
103
|
-
|
104
|
-
uniform mat4 modelMatrix;
|
105
|
-
uniform mat4 modelViewMatrix;
|
106
|
-
uniform mat4 projectionMatrix;
|
107
|
-
uniform mat4 viewMatrix;
|
108
|
-
uniform mat3 normalMatrix;
|
109
|
-
uniform vec3 cameraPosition;
|
110
|
-
|
111
|
-
in vec3 position;
|
112
|
-
in vec3 normal;
|
113
|
-
in vec2 uv;
|
114
|
-
in vec2 uv2;
|
115
|
-
|
116
|
-
#ifdef USE_COLOR
|
117
|
-
in vec3 color;
|
118
|
-
#endif
|
119
|
-
|
120
|
-
#ifdef USE_MORPHTARGETS
|
121
|
-
in vec3 morphTarget0;
|
122
|
-
in vec3 morphTarget1;
|
123
|
-
in vec3 morphTarget2;
|
124
|
-
in vec3 morphTarget3;
|
125
|
-
|
126
|
-
#ifdef USE_MORPHNORMALS
|
127
|
-
in vec3 morphNormal0;
|
128
|
-
in vec3 morphNormal1;
|
129
|
-
in vec3 morphNormal2;
|
130
|
-
in vec3 morphNormal3;
|
131
|
-
#else
|
132
|
-
in vec3 morphTarget4;
|
133
|
-
in vec3 morphTarget5;
|
134
|
-
in vec3 morphTarget6;
|
135
|
-
in vec3 morphTarget7;
|
136
|
-
#endif
|
137
|
-
|
138
|
-
#endif
|
139
|
-
|
140
|
-
#ifdef USE_SKINNING
|
141
|
-
in vec4 skinIndex;
|
142
|
-
in vec4 skinWeight;
|
143
|
-
#endif
|
@@ -1,106 +0,0 @@
|
|
1
|
-
require 'mittsu/math'
|
2
|
-
|
3
|
-
module Mittsu
|
4
|
-
class Uniform
|
5
|
-
attr_accessor :type, :value, :needs_update, :array
|
6
|
-
|
7
|
-
def initialize(type, value)
|
8
|
-
super()
|
9
|
-
@type, @value = type, value
|
10
|
-
@needs_update = nil
|
11
|
-
end
|
12
|
-
|
13
|
-
def clone
|
14
|
-
new_value = case self.value
|
15
|
-
when Color, Vector2, Vector3, Vector4, Matrix4#, Texture # TODO: when Texture exists
|
16
|
-
self.value.clone
|
17
|
-
when Array
|
18
|
-
self.value.dup
|
19
|
-
else
|
20
|
-
self.value
|
21
|
-
end
|
22
|
-
Uniform.new(self.type, new_value)
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
UniformsLib = {
|
27
|
-
common: {
|
28
|
-
'diffuse' => Uniform.new(:color, Color.new(0xeeeeee)),
|
29
|
-
'opacity' => Uniform.new(:float, 1.0),
|
30
|
-
|
31
|
-
'map' => Uniform.new(:texture, nil),
|
32
|
-
'offsetRepeat' => Uniform.new(:vec4, Vector4.new(0.0, 0.0, 1.0, 1.0)),
|
33
|
-
|
34
|
-
'lightMap' => Uniform.new(:texture, nil),
|
35
|
-
'specularMap' => Uniform.new(:texture, nil),
|
36
|
-
'alphaMap' => Uniform.new(:texture, nil),
|
37
|
-
|
38
|
-
'envMap' => Uniform.new(:texture, nil),
|
39
|
-
'flipEnvMap' => Uniform.new(:float, -1.0),
|
40
|
-
'reflectivity' => Uniform.new(:float, 1.0),
|
41
|
-
'refractionRatio' => Uniform.new(:float, 0.98),
|
42
|
-
|
43
|
-
'morphTargetInfluences' => Uniform.new(:float, 0.0)
|
44
|
-
},
|
45
|
-
|
46
|
-
bump: {
|
47
|
-
'bumpMap' => Uniform.new(:texture, nil),
|
48
|
-
'bumpScale' => Uniform.new(:float, 1.0)
|
49
|
-
},
|
50
|
-
|
51
|
-
normal_map: {
|
52
|
-
'normalMap' => Uniform.new(:texture, nil),
|
53
|
-
'normalScale' => Uniform.new(:vec2, Vector2.new(1.0, 1.0))
|
54
|
-
},
|
55
|
-
|
56
|
-
fog: {
|
57
|
-
'fogDensity' => Uniform.new(:float, 0.00025),
|
58
|
-
'fogNear' => Uniform.new(:float, 1.0),
|
59
|
-
'fogFar' => Uniform.new(:float, 2000.0),
|
60
|
-
'fogColor' => Uniform.new(:color, Color.new(0xffffff))
|
61
|
-
},
|
62
|
-
|
63
|
-
lights: {
|
64
|
-
'ambientLightColor' => Uniform.new(:color, Color.new(0xffffff)),
|
65
|
-
|
66
|
-
'directionalLightDirection' => Uniform.new(:'vec3[]', []),
|
67
|
-
'directionalLightColor' => Uniform.new(:'color[]', []),
|
68
|
-
|
69
|
-
'hemisphereLightDirection' => Uniform.new(:'vec3[]', []),
|
70
|
-
'hemisphereLightSkyColor' => Uniform.new(:'color[]', []),
|
71
|
-
'hemisphereLightGroundColor' => Uniform.new(:'color[]', []),
|
72
|
-
|
73
|
-
'pointLightColor' => Uniform.new(:'color[]', []),
|
74
|
-
'pointLightPosition' => Uniform.new(:'vec3[]', []),
|
75
|
-
'pointLightDistance' => Uniform.new(:'float[]', []),
|
76
|
-
'pointLightDecay' => Uniform.new(:'float[]', []),
|
77
|
-
|
78
|
-
'spotLightColor' => Uniform.new(:'color[]', []),
|
79
|
-
'spotLightPosition' => Uniform.new(:'vec3[]', []),
|
80
|
-
'spotLightDirection' => Uniform.new(:'vec3[]', []),
|
81
|
-
'spotLightDistance' => Uniform.new(:'float[]', []),
|
82
|
-
'spotLightAngleCos' => Uniform.new(:'float[]', []),
|
83
|
-
'spotLightExponent' => Uniform.new(:'float[]', []),
|
84
|
-
'spotLightDecay' => Uniform.new(:'float[]', [])
|
85
|
-
},
|
86
|
-
|
87
|
-
particle: {
|
88
|
-
'psColor' => Uniform.new(:color, Color.new(0xeeeeee)),
|
89
|
-
'opacity' => Uniform.new(:float, 1.0),
|
90
|
-
'size' => Uniform.new(:float, 1.0),
|
91
|
-
'scale' => Uniform.new(:float, 1.0),
|
92
|
-
'map' => Uniform.new(:texture, nil),
|
93
|
-
'offsetRepeat' => Uniform.new(:vec4, Vector4.new(0.0, 0.0, 1.0, 1.0))
|
94
|
-
},
|
95
|
-
|
96
|
-
shadow_map: {
|
97
|
-
'shadowMap' => Uniform.new(:'texture[]', []),
|
98
|
-
'shadowMapSize' => Uniform.new(:'vec2[]', []),
|
99
|
-
|
100
|
-
'shadowBias' => Uniform.new(:'float[]', []),
|
101
|
-
'shadowDarkness' => Uniform.new(:'float[]', []),
|
102
|
-
|
103
|
-
'shadowMatrix' => Uniform.new(:'mat4[]', [])
|
104
|
-
}
|
105
|
-
}
|
106
|
-
end
|
@@ -1,31 +0,0 @@
|
|
1
|
-
module Mittsu
|
2
|
-
module UniformsUtils
|
3
|
-
def self.merge(uniforms)
|
4
|
-
merged = {}
|
5
|
-
|
6
|
-
uniforms.each do |uniform|
|
7
|
-
tmp = UniformsUtils.clone(uniform)
|
8
|
-
|
9
|
-
next if tmp.nil?
|
10
|
-
|
11
|
-
tmp.each do |(p, tmp_p)|
|
12
|
-
merged[p] = tmp_p
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
merged
|
17
|
-
end
|
18
|
-
|
19
|
-
def self.clone(uniforms_src)
|
20
|
-
return if uniforms_src.nil?
|
21
|
-
|
22
|
-
uniforms_dst = {}
|
23
|
-
|
24
|
-
uniforms_src.each do |(u, uniform_src)|
|
25
|
-
uniforms_dst[u] = uniform_src.clone
|
26
|
-
end
|
27
|
-
|
28
|
-
uniforms_dst
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
data/lib/mittsu/renderers.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
require 'mittsu/renderers/opengl_renderer'
|