Class: Rendering::SkyboxCubemap

Inherits:
Object
  • Object
show all
Defined in:
lib/engine/rendering/skybox_cubemap.rb

Constant Summary collapse

CUBEMAP_SIZE =
512

Instance Method Summary collapse

Constructor Details

#initializeSkyboxCubemap

Returns a new instance of SkyboxCubemap.



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/engine/rendering/skybox_cubemap.rb', line 7

def initialize
  @rendered = false
  @ground_color = nil
  @horizon_color = nil
  @sky_color = nil
  @ground_y = nil
  @horizon_y = nil
  @sky_y = nil
  create_cubemap_texture
  create_framebuffer
end

Instance Method Details

#invalidateObject



38
39
40
# File 'lib/engine/rendering/skybox_cubemap.rb', line 38

def invalidate
  @rendered = false
end

#render_if_needed(ground_color, horizon_color, sky_color, ground_y, horizon_y, sky_y) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/engine/rendering/skybox_cubemap.rb', line 19

def render_if_needed(ground_color, horizon_color, sky_color, ground_y, horizon_y, sky_y)
  return if @rendered &&
            @ground_color == ground_color &&
            @horizon_color == horizon_color &&
            @sky_color == sky_color &&
            @ground_y == ground_y &&
            @horizon_y == horizon_y &&
            @sky_y == sky_y

  @ground_color = ground_color
  @horizon_color = horizon_color
  @sky_color = sky_color
  @ground_y = ground_y
  @horizon_y = horizon_y
  @sky_y = sky_y
  render_all_faces
  @rendered = true
end

#textureObject



42
43
44
# File 'lib/engine/rendering/skybox_cubemap.rb', line 42

def texture
  @cubemap_texture
end