Class: Rugl::State::Blend

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

Class Method Summary collapse

Class Method Details

.apply(gl:, params:) ⇒ Object



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

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

  if state[:enable]
    Util.gl_call(gl, :Enable, Util.gl_const(:BLEND, gl: gl))
    apply_func(gl, state[:func])
    apply_equation(gl, state[:equation])
    apply_color(gl, state[:color])
  else
    Util.gl_call(gl, :Disable, Util.gl_const(:BLEND, gl: gl))
  end
end

.defaultObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/rugl/state/blend.rb', line 20

def default
  {
    enable: false,
    func: {
      src_rgb: :one,
      dst_rgb: :zero,
      src_alpha: :one,
      dst_alpha: :zero
    },
    equation: {
      rgb: :add,
      alpha: :add
    },
    color: [0.0, 0.0, 0.0, 0.0]
  }
end