Class: Doom::Render::Visplane
- Inherits:
-
Struct
- Object
- Struct
- Doom::Render::Visplane
- Defined in:
- lib/doom/render/renderer.rb
Overview
Visplane stores floor/ceiling rendering info for a sector Matches Chocolate Doom’s visplane_t structure from r_plane.c
Instance Attribute Summary collapse
-
#bottom ⇒ Object
Returns the value of attribute bottom.
-
#height ⇒ Object
Returns the value of attribute height.
-
#is_ceiling ⇒ Object
Returns the value of attribute is_ceiling.
-
#light_level ⇒ Object
Returns the value of attribute light_level.
-
#maxx ⇒ Object
Returns the value of attribute maxx.
-
#minx ⇒ Object
Returns the value of attribute minx.
-
#sector ⇒ Object
Returns the value of attribute sector.
-
#texture ⇒ Object
Returns the value of attribute texture.
-
#top ⇒ Object
Returns the value of attribute top.
Instance Method Summary collapse
-
#initialize(sector, height, texture, light_level, is_ceiling) ⇒ Visplane
constructor
A new instance of Visplane.
- #mark(x, y1, y2) ⇒ Object
- #valid? ⇒ Boolean
Constructor Details
#initialize(sector, height, texture, light_level, is_ceiling) ⇒ Visplane
Returns a new instance of Visplane.
27 28 29 30 31 32 33 |
# File 'lib/doom/render/renderer.rb', line 27 def initialize(sector, height, texture, light_level, is_ceiling) super(sector, height, texture, light_level, is_ceiling, Array.new(SCREEN_WIDTH, SCREEN_HEIGHT), # top (initially invalid) Array.new(SCREEN_WIDTH, -1), # bottom (initially invalid) SCREEN_WIDTH, # minx (no columns marked yet) -1) # maxx (no columns marked yet) end |
Instance Attribute Details
#bottom ⇒ Object
Returns the value of attribute bottom
25 26 27 |
# File 'lib/doom/render/renderer.rb', line 25 def bottom @bottom end |
#height ⇒ Object
Returns the value of attribute height
25 26 27 |
# File 'lib/doom/render/renderer.rb', line 25 def height @height end |
#is_ceiling ⇒ Object
Returns the value of attribute is_ceiling
25 26 27 |
# File 'lib/doom/render/renderer.rb', line 25 def is_ceiling @is_ceiling end |
#light_level ⇒ Object
Returns the value of attribute light_level
25 26 27 |
# File 'lib/doom/render/renderer.rb', line 25 def light_level @light_level end |
#maxx ⇒ Object
Returns the value of attribute maxx
25 26 27 |
# File 'lib/doom/render/renderer.rb', line 25 def maxx @maxx end |
#minx ⇒ Object
Returns the value of attribute minx
25 26 27 |
# File 'lib/doom/render/renderer.rb', line 25 def minx @minx end |
#sector ⇒ Object
Returns the value of attribute sector
25 26 27 |
# File 'lib/doom/render/renderer.rb', line 25 def sector @sector end |
#texture ⇒ Object
Returns the value of attribute texture
25 26 27 |
# File 'lib/doom/render/renderer.rb', line 25 def texture @texture end |
#top ⇒ Object
Returns the value of attribute top
25 26 27 |
# File 'lib/doom/render/renderer.rb', line 25 def top @top end |
Instance Method Details
#mark(x, y1, y2) ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/doom/render/renderer.rb', line 35 def mark(x, y1, y2) return if y1 > y2 top[x] = [top[x], y1].min bottom[x] = [bottom[x], y2].max self.minx = [minx, x].min self.maxx = [maxx, x].max end |
#valid? ⇒ Boolean
43 44 45 |
# File 'lib/doom/render/renderer.rb', line 43 def valid? minx <= maxx end |