Class: Rugl::State::Cull

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

Class Method Summary collapse

Class Method Details

.apply(gl:, params:) ⇒ Object



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

def apply(gl:, params:)
  state = default.merge(params || {})

  if state[:enable]
    Util.gl_call(gl, :Enable, Util.gl_const(:CULL_FACE, gl: gl))
    Util.gl_call(gl, :CullFace, Util.to_gl_cull_face(state[:face], gl: gl))
  else
    Util.gl_call(gl, :Disable, Util.gl_const(:CULL_FACE, gl: gl))
  end
end

.defaultObject



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

def default
  {
    enable: false,
    face: :back
  }
end