Class: Collada::Parser::MatrixParameter

Inherits:
Parameter
  • Object
show all
Defined in:
lib/collada/parser/support.rb

Instance Attribute Summary collapse

Attributes inherited from Parameter

#name, #type

Instance Method Summary collapse

Methods inherited from Parameter

parse

Constructor Details

#initialize(name, type, dimensions) ⇒ MatrixParameter

Returns a new instance of MatrixParameter.



190
191
192
193
194
195
# File 'lib/collada/parser/support.rb', line 190

def initialize(name, type, dimensions)
	super name, type
	
	@rows = dimensions[1]
	@size = dimensions[0] * dimensions[1]
end

Instance Attribute Details

#sizeObject (readonly)

Returns the value of attribute size.



197
198
199
# File 'lib/collada/parser/support.rb', line 197

def size
  @size
end

Instance Method Details

#read(value) ⇒ Object



199
200
201
# File 'lib/collada/parser/support.rb', line 199

def read(value)
	Matrix[*(value.each_slice(@rows).to_a)]
end