Class: Collada::Parser::Sampler

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, inputs) ⇒ Sampler

Returns a new instance of Sampler.



362
363
364
365
# File 'lib/collada/parser/support.rb', line 362

def initialize(id, inputs)
	@id = id
	@inputs = inputs
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



367
368
369
# File 'lib/collada/parser/support.rb', line 367

def id
  @id
end

#inputsObject (readonly)

Returns the value of attribute inputs.



368
369
370
# File 'lib/collada/parser/support.rb', line 368

def inputs
  @inputs
end

Class Method Details

.parse(doc, element, sources = {}) ⇒ Object



383
384
385
386
387
# File 'lib/collada/parser/support.rb', line 383

def self.parse(doc, element, sources = {})
	inputs = parse_inputs(doc, element, sources)
	
	self.new(element.attributes['id'], inputs)
end

.parse_inputs(doc, element, sources = {}) ⇒ Object



377
378
379
380
381
# File 'lib/collada/parser/support.rb', line 377

def self.parse_inputs(doc, element, sources = {})
	OrderedMap.parse(element, 'input') do |input_element|
		Input.parse(doc, input_element, sources)
	end
end

Instance Method Details

#[](index) ⇒ Object

Vertices by index, same interface as Input.



371
372
373
374
375
# File 'lib/collada/parser/support.rb', line 371

def [] index
	@inputs.collect do |input|
		input[index]
	end
end

#eachObject



393
394
395
396
397
# File 'lib/collada/parser/support.rb', line 393

def each
	size.times do |i|
		yield self[i]
	end
end

#sizeObject



389
390
391
# File 'lib/collada/parser/support.rb', line 389

def size
	@inputs.collect{|input| input.size}.max
end