Class: Rugl::State::PolygonOffset

Inherits:
Object
  • Object
show all
Defined in:
lib/rugl/state/polygon_offset.rb

Class Method Summary collapse

Class Method Details

.apply(gl:, params:) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/rugl/state/polygon_offset.rb', line 7

def apply(gl:, params:)
  state = normalize(params)

  if state[:enable]
    Util.gl_call(gl, :Enable, Util.gl_const(:POLYGON_OFFSET_FILL, gl: gl))
    offset = state[:offset]
    Util.gl_call(gl, :PolygonOffset, offset[:factor].to_f, offset[:units].to_f)
  else
    Util.gl_call(gl, :Disable, Util.gl_const(:POLYGON_OFFSET_FILL, gl: gl))
  end
end

.defaultObject



19
20
21
22
23
24
# File 'lib/rugl/state/polygon_offset.rb', line 19

def default
  {
    enable: false,
    offset: { factor: 0.0, units: 0.0 }
  }
end