Class: Doom::Render::Visplane

Inherits:
Struct
  • Object
show all
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

Instance Method Summary collapse

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

#bottomObject

Returns the value of attribute bottom

Returns:

  • (Object)

    the current value of bottom



25
26
27
# File 'lib/doom/render/renderer.rb', line 25

def bottom
  @bottom
end

#heightObject

Returns the value of attribute height

Returns:

  • (Object)

    the current value of height



25
26
27
# File 'lib/doom/render/renderer.rb', line 25

def height
  @height
end

#is_ceilingObject

Returns the value of attribute is_ceiling

Returns:

  • (Object)

    the current value of is_ceiling



25
26
27
# File 'lib/doom/render/renderer.rb', line 25

def is_ceiling
  @is_ceiling
end

#light_levelObject

Returns the value of attribute light_level

Returns:

  • (Object)

    the current value of light_level



25
26
27
# File 'lib/doom/render/renderer.rb', line 25

def light_level
  @light_level
end

#maxxObject

Returns the value of attribute maxx

Returns:

  • (Object)

    the current value of maxx



25
26
27
# File 'lib/doom/render/renderer.rb', line 25

def maxx
  @maxx
end

#minxObject

Returns the value of attribute minx

Returns:

  • (Object)

    the current value of minx



25
26
27
# File 'lib/doom/render/renderer.rb', line 25

def minx
  @minx
end

#sectorObject

Returns the value of attribute sector

Returns:

  • (Object)

    the current value of sector



25
26
27
# File 'lib/doom/render/renderer.rb', line 25

def sector
  @sector
end

#textureObject

Returns the value of attribute texture

Returns:

  • (Object)

    the current value of texture



25
26
27
# File 'lib/doom/render/renderer.rb', line 25

def texture
  @texture
end

#topObject

Returns the value of attribute top

Returns:

  • (Object)

    the current value of 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

Returns:

  • (Boolean)


43
44
45
# File 'lib/doom/render/renderer.rb', line 43

def valid?
  minx <= maxx
end