Class: Collada::Parser::Sampler
- Inherits:
-
Object
- Object
- Collada::Parser::Sampler
- Includes:
- Enumerable
- Defined in:
- lib/collada/parser/support.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#inputs ⇒ Object
readonly
Returns the value of attribute inputs.
Class Method Summary collapse
Instance Method Summary collapse
-
#[](index) ⇒ Object
Vertices by index, same interface as Input.
- #each ⇒ Object
-
#initialize(id, inputs) ⇒ Sampler
constructor
A new instance of Sampler.
- #size ⇒ Object
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
#id ⇒ Object (readonly)
Returns the value of attribute id.
367 368 369 |
# File 'lib/collada/parser/support.rb', line 367 def id @id end |
#inputs ⇒ Object (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 |
#each ⇒ Object
393 394 395 396 397 |
# File 'lib/collada/parser/support.rb', line 393 def each size.times do |i| yield self[i] end end |
#size ⇒ Object
389 390 391 |
# File 'lib/collada/parser/support.rb', line 389 def size @inputs.collect{|input| input.size}.max end |