Module: Mittsu::UniformsUtils

Defined in:
lib/mittsu/renderers/shaders/uniforms_utils.rb

Class Method Summary collapse

Class Method Details

.clone(uniforms_src) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/mittsu/renderers/shaders/uniforms_utils.rb', line 19

def self.clone(uniforms_src)
  return if uniforms_src.nil?

  uniforms_dst = {}

  uniforms_src.each do |(u, uniform_src)|
    uniforms_dst[u] = uniform_src.clone
  end

  uniforms_dst
end

.merge(uniforms) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/mittsu/renderers/shaders/uniforms_utils.rb', line 3

def self.merge(uniforms)
  merged = {}

  uniforms.each do |uniform|
    tmp = UniformsUtils.clone(uniform)

    next if tmp.nil?

    tmp.each do |(p, tmp_p)|
      merged[p] = tmp_p
    end
  end

  merged
end