Class: GlStuff::Lighting
- Inherits:
-
Object
- Object
- GlStuff::Lighting
- Defined in:
- lib/examples/GlStuff/lighting.rb
Instance Attribute Summary collapse
-
#ambient ⇒ Object
Returns the value of attribute ambient.
-
#diffuse ⇒ Object
Returns the value of attribute diffuse.
-
#high_shininess ⇒ Object
Returns the value of attribute high_shininess.
-
#lmodel_ambient ⇒ Object
Returns the value of attribute lmodel_ambient.
-
#local_view ⇒ Object
Returns the value of attribute local_view.
-
#low_shininess ⇒ Object
Returns the value of attribute low_shininess.
-
#mat_ambient ⇒ Object
Returns the value of attribute mat_ambient.
-
#mat_ambient_color ⇒ Object
Returns the value of attribute mat_ambient_color.
-
#mat_diffuse ⇒ Object
Returns the value of attribute mat_diffuse.
-
#mat_emission ⇒ Object
Returns the value of attribute mat_emission.
-
#mat_specular ⇒ Object
Returns the value of attribute mat_specular.
-
#no_mat ⇒ Object
Returns the value of attribute no_mat.
-
#no_shininess ⇒ Object
Returns the value of attribute no_shininess.
-
#position ⇒ Object
Returns the value of attribute position.
Instance Method Summary collapse
-
#initialize ⇒ Lighting
constructor
A new instance of Lighting.
- #setup ⇒ Object
Constructor Details
#initialize ⇒ Lighting
Returns a new instance of Lighting.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/examples/GlStuff/lighting.rb', line 9 def initialize @ambient = [ 0.0, 1.0, 0.0, 1.0 ] @diffuse = [ 1.0, 1.0, 1.0, 1.0 ] @position = MemoryPointer.new(:float, 4).put_array_of_float(0, [1.0, 5.0, 1.0, 1.0]) @lmodel_ambient = [ 0.4, 0.4, 0.4, 1.0 ] @no_mat = [ 0.0, 0.0, 0.0, 1.0 ] @mat_ambient = [ 0.7, 0.7, 0.7, 1.0 ] @mat_ambient_color = [ 0.8, 0.8, 0.2, 1.0 ] @mat_diffuse = [ 0.1, 0.5, 0.0, 1.0 ] @mat_specular = [ 1.0, 1.0, 1.0, 1.0 ] @no_shininess = [ 0.0 ] @low_shininess = [ 5.0 ] @high_shininess = [ 100.0 ] @mat_emission = [0.3, 0.2, 0.2, 0.0] @local_view = [ 0.0 ] end |
Instance Attribute Details
#ambient ⇒ Object
Returns the value of attribute ambient.
5 6 7 |
# File 'lib/examples/GlStuff/lighting.rb', line 5 def ambient @ambient end |
#diffuse ⇒ Object
Returns the value of attribute diffuse.
5 6 7 |
# File 'lib/examples/GlStuff/lighting.rb', line 5 def diffuse @diffuse end |
#high_shininess ⇒ Object
Returns the value of attribute high_shininess.
5 6 7 |
# File 'lib/examples/GlStuff/lighting.rb', line 5 def high_shininess @high_shininess end |
#lmodel_ambient ⇒ Object
Returns the value of attribute lmodel_ambient.
5 6 7 |
# File 'lib/examples/GlStuff/lighting.rb', line 5 def lmodel_ambient @lmodel_ambient end |
#local_view ⇒ Object
Returns the value of attribute local_view.
5 6 7 |
# File 'lib/examples/GlStuff/lighting.rb', line 5 def local_view @local_view end |
#low_shininess ⇒ Object
Returns the value of attribute low_shininess.
5 6 7 |
# File 'lib/examples/GlStuff/lighting.rb', line 5 def low_shininess @low_shininess end |
#mat_ambient ⇒ Object
Returns the value of attribute mat_ambient.
5 6 7 |
# File 'lib/examples/GlStuff/lighting.rb', line 5 def mat_ambient @mat_ambient end |
#mat_ambient_color ⇒ Object
Returns the value of attribute mat_ambient_color.
5 6 7 |
# File 'lib/examples/GlStuff/lighting.rb', line 5 def mat_ambient_color @mat_ambient_color end |
#mat_diffuse ⇒ Object
Returns the value of attribute mat_diffuse.
5 6 7 |
# File 'lib/examples/GlStuff/lighting.rb', line 5 def mat_diffuse @mat_diffuse end |
#mat_emission ⇒ Object
Returns the value of attribute mat_emission.
5 6 7 |
# File 'lib/examples/GlStuff/lighting.rb', line 5 def mat_emission @mat_emission end |
#mat_specular ⇒ Object
Returns the value of attribute mat_specular.
5 6 7 |
# File 'lib/examples/GlStuff/lighting.rb', line 5 def mat_specular @mat_specular end |
#no_mat ⇒ Object
Returns the value of attribute no_mat.
5 6 7 |
# File 'lib/examples/GlStuff/lighting.rb', line 5 def no_mat @no_mat end |
#no_shininess ⇒ Object
Returns the value of attribute no_shininess.
5 6 7 |
# File 'lib/examples/GlStuff/lighting.rb', line 5 def no_shininess @no_shininess end |
#position ⇒ Object
Returns the value of attribute position.
5 6 7 |
# File 'lib/examples/GlStuff/lighting.rb', line 5 def position @position end |
Instance Method Details
#setup ⇒ Object
26 27 28 29 30 31 |
# File 'lib/examples/GlStuff/lighting.rb', line 26 def setup glEnable(GL_LIGHTING) glEnable(GL_LIGHT0) glShadeModel(GL_SMOOTH); glLightfv(GL_LIGHT0, GL_POSITION, @position) end |