Class: Ra::Lighting

Inherits:
Object
  • Object
show all
Defined in:
lib/ra/lighting.rb

Overview

Lighting encaspulates a [Phong Reflection Model](en.wikipedia.org/wiki/phong_reflection_model).

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(light:, surface:, shadowed:) ⇒ Lighting

Returns a new instance of Lighting.

Parameters:



21
22
23
24
25
# File 'lib/ra/lighting.rb', line 21

def initialize(light:, surface:, shadowed:)
  @surface = surface
  @shadowed = shadowed
  @light = light
end

Instance Attribute Details

#lightRa::Light

Returns:



16
17
18
# File 'lib/ra/lighting.rb', line 16

def light
  @light
end

#shadowedBoolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/ra/lighting.rb', line 12

def shadowed
  @shadowed
end

#surfaceRa::Surface

Returns:



8
9
10
# File 'lib/ra/lighting.rb', line 8

def surface
  @surface
end

Instance Method Details

#colorRa::Color

Returns:



28
29
30
# File 'lib/ra/lighting.rb', line 28

def color
  ambient_color + diffuse_color + specular_color
end