Class: Mittsu::Uniform

Inherits:
Object
  • Object
show all
Defined in:
lib/mittsu/renderers/shaders/uniforms_lib.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, value) ⇒ Uniform

Returns a new instance of Uniform.



7
8
9
10
11
# File 'lib/mittsu/renderers/shaders/uniforms_lib.rb', line 7

def initialize(type, value)
  super()
  @type, @value = type, value
  @needs_update = nil
end

Instance Attribute Details

#arrayObject

Returns the value of attribute array.



5
6
7
# File 'lib/mittsu/renderers/shaders/uniforms_lib.rb', line 5

def array
  @array
end

#needs_updateObject

Returns the value of attribute needs_update.



5
6
7
# File 'lib/mittsu/renderers/shaders/uniforms_lib.rb', line 5

def needs_update
  @needs_update
end

#typeObject

Returns the value of attribute type.



5
6
7
# File 'lib/mittsu/renderers/shaders/uniforms_lib.rb', line 5

def type
  @type
end

#valueObject

Returns the value of attribute value.



5
6
7
# File 'lib/mittsu/renderers/shaders/uniforms_lib.rb', line 5

def value
  @value
end

Instance Method Details

#cloneObject



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/mittsu/renderers/shaders/uniforms_lib.rb', line 13

def clone
  new_value = case self.value
  when Color, Vector2, Vector3, Vector4, Matrix4#, Texture # TODO: when Texture exists
    self.value.clone
  when Array
    self.value.dup
  else
    self.value
  end
  Uniform.new(self.type, new_value)
end