Class: Rendering::SkyboxRenderer
- Inherits:
-
Object
- Object
- Rendering::SkyboxRenderer
- Defined in:
- lib/engine/rendering/skybox_renderer.rb
Class Method Summary collapse
- .cubemap ⇒ Object
- .draw(input_rt, alternate_rt, screen_quad) ⇒ Object
- .render_cubemap ⇒ Object
- .set_colors(ground:, horizon:, sky:, ground_y: -0.3,, horizon_y: 0.0, sky_y: 1.0) ⇒ Object
Class Method Details
.cubemap ⇒ Object
47 48 49 |
# File 'lib/engine/rendering/skybox_renderer.rb', line 47 def cubemap @skybox_cubemap end |
.draw(input_rt, alternate_rt, screen_quad) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/engine/rendering/skybox_renderer.rb', line 28 def draw(input_rt, alternate_rt, screen_quad) output_rt = alternate_rt output_rt.bind Engine::GL.Clear(Engine::GL::COLOR_BUFFER_BIT) Engine::GL.Disable(Engine::GL::DEPTH_TEST) camera = Engine::Camera.instance return input_rt unless camera material.set_mat4("inverseVP", camera.inverse_vp_matrix) material.set_vec3("cameraPos", camera.position) material.set_cubemap("skyboxCubemap", @skybox_cubemap&.texture) material.set_runtime_texture("depthTexture", input_rt.depth_texture) screen_quad.draw(material, input_rt.color_texture) output_rt end |
.render_cubemap ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/engine/rendering/skybox_renderer.rb', line 16 def render_cubemap @skybox_cubemap ||= SkyboxCubemap.new @skybox_cubemap.render_if_needed( @ground_color, @horizon_color, @sky_color, @ground_y, @horizon_y, @sky_y ) end |
.set_colors(ground:, horizon:, sky:, ground_y: -0.3,, horizon_y: 0.0, sky_y: 1.0) ⇒ Object
6 7 8 9 10 11 12 13 14 |
# File 'lib/engine/rendering/skybox_renderer.rb', line 6 def set_colors(ground:, horizon:, sky:, ground_y: -0.3, horizon_y: 0.0, sky_y: 1.0) @ground_color = ground @horizon_color = horizon @sky_color = sky @ground_y = ground_y @horizon_y = horizon_y @sky_y = sky_y @skybox_cubemap&.invalidate end |