mittsu-opengl 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.codeclimate.yml +18 -0
- data/.github/workflows/build-workflow.yml +67 -0
- data/.gitignore +12 -0
- data/.rubocop.yml +1158 -0
- data/CODE_OF_CONDUCT.md +13 -0
- data/Gemfile +9 -0
- data/LICENSE.txt +21 -0
- data/README.md +195 -0
- data/Rakefile +8 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/install-glfw.ps1 +13 -0
- data/lib/mittsu/generic_lib.rb +116 -0
- data/lib/mittsu/glfw/lib.rb +58 -0
- data/lib/mittsu/glfw/window.rb +231 -0
- data/lib/mittsu/opengl/buffer.rb +13 -0
- data/lib/mittsu/opengl/default_target.rb +50 -0
- data/lib/mittsu/opengl/geometry_group.rb +758 -0
- data/lib/mittsu/opengl/geometry_like.rb +132 -0
- data/lib/mittsu/opengl/gl_debug.rb +85 -0
- data/lib/mittsu/opengl/gl_extensions.rb +42 -0
- data/lib/mittsu/opengl/gl_mittsu_params.rb +53 -0
- data/lib/mittsu/opengl/helper.rb +120 -0
- data/lib/mittsu/opengl/implementation.rb +31 -0
- data/lib/mittsu/opengl/lib.rb +19 -0
- data/lib/mittsu/opengl/light_renderer.rb +43 -0
- data/lib/mittsu/opengl/material_basics.rb +57 -0
- data/lib/mittsu/opengl/plugins/shadow_map_plugin.rb +416 -0
- data/lib/mittsu/opengl/plugins/sprite_fragment.glsl +38 -0
- data/lib/mittsu/opengl/plugins/sprite_plugin.rb +250 -0
- data/lib/mittsu/opengl/plugins/sprite_vertex.glsl +31 -0
- data/lib/mittsu/opengl/program.rb +250 -0
- data/lib/mittsu/opengl/renderer.rb +1028 -0
- data/lib/mittsu/opengl/shader/chunk.rb +11 -0
- data/lib/mittsu/opengl/shader/chunks/alphamap_fragment.glsl +5 -0
- data/lib/mittsu/opengl/shader/chunks/alphamap_pars_fragment.glsl +5 -0
- data/lib/mittsu/opengl/shader/chunks/alphatest_fragment.glsl +5 -0
- data/lib/mittsu/opengl/shader/chunks/bumpmap_pars_fragment.glsl +40 -0
- data/lib/mittsu/opengl/shader/chunks/color_fragment.glsl +5 -0
- data/lib/mittsu/opengl/shader/chunks/color_pars_fragment.glsl +5 -0
- data/lib/mittsu/opengl/shader/chunks/color_pars_vertex.glsl +5 -0
- data/lib/mittsu/opengl/shader/chunks/color_vertex.glsl +5 -0
- data/lib/mittsu/opengl/shader/chunks/common.glsl +60 -0
- data/lib/mittsu/opengl/shader/chunks/default_vertex.glsl +15 -0
- data/lib/mittsu/opengl/shader/chunks/defaultnormal_vertex.glsl +21 -0
- data/lib/mittsu/opengl/shader/chunks/envmap_fragment.glsl +62 -0
- data/lib/mittsu/opengl/shader/chunks/envmap_pars_fragment.glsl +21 -0
- data/lib/mittsu/opengl/shader/chunks/envmap_pars_vertex.glsl +7 -0
- data/lib/mittsu/opengl/shader/chunks/envmap_vertex.glsl +17 -0
- data/lib/mittsu/opengl/shader/chunks/fog_fragment.glsl +26 -0
- data/lib/mittsu/opengl/shader/chunks/fog_pars_fragment.glsl +15 -0
- data/lib/mittsu/opengl/shader/chunks/lightmap_fragment.glsl +5 -0
- data/lib/mittsu/opengl/shader/chunks/lightmap_pars_fragment.glsl +6 -0
- data/lib/mittsu/opengl/shader/chunks/lightmap_pars_vertex.glsl +5 -0
- data/lib/mittsu/opengl/shader/chunks/lightmap_vertex.glsl +5 -0
- data/lib/mittsu/opengl/shader/chunks/lights_lambert_pars_vertex.glsl +43 -0
- data/lib/mittsu/opengl/shader/chunks/lights_lambert_vertex.glsl +196 -0
- data/lib/mittsu/opengl/shader/chunks/lights_phong_fragment.glsl +243 -0
- data/lib/mittsu/opengl/shader/chunks/lights_phong_pars_fragment.glsl +58 -0
- data/lib/mittsu/opengl/shader/chunks/lights_phong_pars_vertex.glsl +5 -0
- data/lib/mittsu/opengl/shader/chunks/lights_phong_vertex.glsl +5 -0
- data/lib/mittsu/opengl/shader/chunks/linear_to_gamma_fragment.glsl +2 -0
- data/lib/mittsu/opengl/shader/chunks/logdepthbuf_fragment.glsl +5 -0
- data/lib/mittsu/opengl/shader/chunks/logdepthbuf_pars_fragment.glsl +12 -0
- data/lib/mittsu/opengl/shader/chunks/logdepthbuf_pars_vertex.glsl +11 -0
- data/lib/mittsu/opengl/shader/chunks/logdepthbuf_vertex.glsl +15 -0
- data/lib/mittsu/opengl/shader/chunks/map_fragment.glsl +9 -0
- data/lib/mittsu/opengl/shader/chunks/map_pars_fragment.glsl +11 -0
- data/lib/mittsu/opengl/shader/chunks/map_pars_vertex.glsl +6 -0
- data/lib/mittsu/opengl/shader/chunks/map_particle_fragment.glsl +5 -0
- data/lib/mittsu/opengl/shader/chunks/map_particle_pars_fragment.glsl +6 -0
- data/lib/mittsu/opengl/shader/chunks/map_vertex.glsl +5 -0
- data/lib/mittsu/opengl/shader/chunks/morphnormal_vertex.glsl +12 -0
- data/lib/mittsu/opengl/shader/chunks/morphtarget_pars_vertex.glsl +13 -0
- data/lib/mittsu/opengl/shader/chunks/morphtarget_vertex.glsl +20 -0
- data/lib/mittsu/opengl/shader/chunks/normalmap_pars_fragment.glsl +27 -0
- data/lib/mittsu/opengl/shader/chunks/shadowmap_fragment.glsl +216 -0
- data/lib/mittsu/opengl/shader/chunks/shadowmap_pars_fragment.glsl +19 -0
- data/lib/mittsu/opengl/shader/chunks/shadowmap_pars_vertex.glsl +6 -0
- data/lib/mittsu/opengl/shader/chunks/shadowmap_vertex.glsl +9 -0
- data/lib/mittsu/opengl/shader/chunks/skinbase_vertex.glsl +8 -0
- data/lib/mittsu/opengl/shader/chunks/skinning_pars_vertex.glsl +47 -0
- data/lib/mittsu/opengl/shader/chunks/skinning_vertex.glsl +20 -0
- data/lib/mittsu/opengl/shader/chunks/skinnormal_vertex.glsl +20 -0
- data/lib/mittsu/opengl/shader/chunks/specularmap_fragment.glsl +12 -0
- data/lib/mittsu/opengl/shader/chunks/specularmap_pars_fragment.glsl +5 -0
- data/lib/mittsu/opengl/shader/chunks/worldpos_vertex.glsl +17 -0
- data/lib/mittsu/opengl/shader/lib/basic/basic_fragment.rbsl +37 -0
- data/lib/mittsu/opengl/shader/lib/basic/basic_uniforms.rbslu +3 -0
- data/lib/mittsu/opengl/shader/lib/basic/basic_vertex.rbsl +33 -0
- data/lib/mittsu/opengl/shader/lib/cube/cube_fragment.rbsl +12 -0
- data/lib/mittsu/opengl/shader/lib/cube/cube_uniforms.rbslu +2 -0
- data/lib/mittsu/opengl/shader/lib/cube/cube_vertex.rbsl +12 -0
- data/lib/mittsu/opengl/shader/lib/depth_rgba/depth_rgba_fragment.rbsl +26 -0
- data/lib/mittsu/opengl/shader/lib/depth_rgba/depth_rgba_uniforms.rbslu +0 -0
- data/lib/mittsu/opengl/shader/lib/depth_rgba/depth_rgba_vertex.rbsl +12 -0
- data/lib/mittsu/opengl/shader/lib/lambert/lambert_fragment.rbsl +56 -0
- data/lib/mittsu/opengl/shader/lib/lambert/lambert_uniforms.rbslu +7 -0
- data/lib/mittsu/opengl/shader/lib/lambert/lambert_vertex.rbsl +37 -0
- data/lib/mittsu/opengl/shader/lib/particle_basic/particle_basic_fragment.rbsl +27 -0
- data/lib/mittsu/opengl/shader/lib/particle_basic/particle_basic_uniforms.rbslu +2 -0
- data/lib/mittsu/opengl/shader/lib/particle_basic/particle_basic_vertex.rbsl +25 -0
- data/lib/mittsu/opengl/shader/lib/phong/phong_fragment.rbsl +45 -0
- data/lib/mittsu/opengl/shader/lib/phong/phong_uniforms.rbslu +11 -0
- data/lib/mittsu/opengl/shader/lib/phong/phong_vertex.rbsl +43 -0
- data/lib/mittsu/opengl/shader/lib.rb +45 -0
- data/lib/mittsu/opengl/shader/rbsl_loader.rb +168 -0
- data/lib/mittsu/opengl/shader/templates/fragment.glsl.erb +105 -0
- data/lib/mittsu/opengl/shader/templates/vertex.glsl.erb +143 -0
- data/lib/mittsu/opengl/shader/uniforms_lib.rb +86 -0
- data/lib/mittsu/opengl/shader/uniforms_utils.rb +31 -0
- data/lib/mittsu/opengl/shader.rb +56 -0
- data/lib/mittsu/opengl/state.rb +205 -0
- data/lib/mittsu/opengl/version.rb +5 -0
- data/lib/mittsu/opengl.rb +2 -0
- data/lib/mittsu/opengl_implementation/core/buffer_geometry.rb +11 -0
- data/lib/mittsu/opengl_implementation/core/geometry.rb +346 -0
- data/lib/mittsu/opengl_implementation/core/object_3d.rb +134 -0
- data/lib/mittsu/opengl_implementation/lights/ambient_light.rb +26 -0
- data/lib/mittsu/opengl_implementation/lights/directional_light.rb +35 -0
- data/lib/mittsu/opengl_implementation/lights/hemisphere_light.rb +39 -0
- data/lib/mittsu/opengl_implementation/lights/light.rb +55 -0
- data/lib/mittsu/opengl_implementation/lights/point_light.rb +36 -0
- data/lib/mittsu/opengl_implementation/lights/spot_light.rb +47 -0
- data/lib/mittsu/opengl_implementation/materials/line_basic_material.rb +16 -0
- data/lib/mittsu/opengl_implementation/materials/material.rb +274 -0
- data/lib/mittsu/opengl_implementation/materials/mesh_basic_material.rb +21 -0
- data/lib/mittsu/opengl_implementation/materials/mesh_lambert_material.rb +33 -0
- data/lib/mittsu/opengl_implementation/materials/mesh_phong_material.rb +44 -0
- data/lib/mittsu/opengl_implementation/materials/point_cloud_material.rb +27 -0
- data/lib/mittsu/opengl_implementation/materials/shader_material.rb +11 -0
- data/lib/mittsu/opengl_implementation/objects/group.rb +9 -0
- data/lib/mittsu/opengl_implementation/objects/line.rb +45 -0
- data/lib/mittsu/opengl_implementation/objects/mesh.rb +70 -0
- data/lib/mittsu/opengl_implementation/objects/point_cloud.rb +39 -0
- data/lib/mittsu/opengl_implementation/objects/sprite.rb +12 -0
- data/lib/mittsu/opengl_implementation/scenes/scene.rb +9 -0
- data/lib/mittsu/opengl_implementation/textures/compressed_texture.rb +20 -0
- data/lib/mittsu/opengl_implementation/textures/cube_texture.rb +77 -0
- data/lib/mittsu/opengl_implementation/textures/data_texture.rb +21 -0
- data/lib/mittsu/opengl_implementation/textures/render_target.rb +124 -0
- data/lib/mittsu/opengl_implementation/textures/texture.rb +107 -0
- data/mittsu-opengl.gemspec +36 -0
- metadata +314 -0
@@ -0,0 +1,50 @@
|
|
1
|
+
module Mittsu
|
2
|
+
class OpenGL::DefaultTarget
|
3
|
+
attr_accessor :viewport_width, :viewport_height, :viewport_x, :viewport_y
|
4
|
+
alias :width :viewport_width
|
5
|
+
alias :height :viewport_height
|
6
|
+
|
7
|
+
def initialize renderer
|
8
|
+
@renderer = renderer
|
9
|
+
@viewport_width = 0
|
10
|
+
@viewport_height = 0
|
11
|
+
@viewport_x = 0
|
12
|
+
@viewport_y = 0
|
13
|
+
end
|
14
|
+
|
15
|
+
def framebuffer
|
16
|
+
0
|
17
|
+
end
|
18
|
+
|
19
|
+
def update_mipmap
|
20
|
+
# NOOP
|
21
|
+
end
|
22
|
+
|
23
|
+
def setup_buffers
|
24
|
+
# NOOP
|
25
|
+
end
|
26
|
+
|
27
|
+
def use
|
28
|
+
GL.BindFramebuffer(GL::FRAMEBUFFER, 0)
|
29
|
+
use_viewport
|
30
|
+
end
|
31
|
+
|
32
|
+
def use_viewport
|
33
|
+
GL.Viewport(@viewport_x, @viewport_y, @viewport_width, @viewport_height)
|
34
|
+
end
|
35
|
+
|
36
|
+
def set_and_use_viewport(x, y, width, height)
|
37
|
+
set_viewport(x, y, width, height)
|
38
|
+
use_viewport
|
39
|
+
end
|
40
|
+
|
41
|
+
def set_viewport(x, y, width, height)
|
42
|
+
@viewport_x, @viewport_y = x, y
|
43
|
+
set_viewport_size(width, height)
|
44
|
+
end
|
45
|
+
|
46
|
+
def set_viewport_size(width, height)
|
47
|
+
@viewport_width, @viewport_height = width, height
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|