Class: Stagecraft::Lights::ShadowConfig

Inherits:
Data
  • Object
show all
Defined in:
lib/stagecraft/lights/directional_light.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(map_size: 2_048, near: 0.1, far: 100.0, extent: 20.0) ⇒ ShadowConfig

Returns a new instance of ShadowConfig.

Raises:

  • (ArgumentError)


6
7
8
9
10
11
12
13
14
15
16
# File 'lib/stagecraft/lights/directional_light.rb', line 6

def initialize(map_size: 2_048, near: 0.1, far: 100.0, extent: 20.0)
  super(
    map_size: Integer(map_size),
    near: Float(near),
    far: Float(far),
    extent: Float(extent)
  )
  raise ArgumentError, "shadow map_size must be positive" unless self.map_size.positive?
  raise ArgumentError, "shadow far must exceed near" unless self.far > self.near
  raise ArgumentError, "shadow extent must be positive" unless self.extent.positive?
end

Instance Attribute Details

#extentObject (readonly)

Returns the value of attribute extent

Returns:

  • (Object)

    the current value of extent



5
6
7
# File 'lib/stagecraft/lights/directional_light.rb', line 5

def extent
  @extent
end

#farObject (readonly)

Returns the value of attribute far

Returns:

  • (Object)

    the current value of far



5
6
7
# File 'lib/stagecraft/lights/directional_light.rb', line 5

def far
  @far
end

#map_sizeObject (readonly)

Returns the value of attribute map_size

Returns:

  • (Object)

    the current value of map_size



5
6
7
# File 'lib/stagecraft/lights/directional_light.rb', line 5

def map_size
  @map_size
end

#nearObject (readonly)

Returns the value of attribute near

Returns:

  • (Object)

    the current value of near



5
6
7
# File 'lib/stagecraft/lights/directional_light.rb', line 5

def near
  @near
end