Class: Collada::Parser::Input
- Inherits:
-
Object
- Object
- Collada::Parser::Input
- Defined in:
- lib/collada/parser/support.rb
Instance Attribute Summary collapse
-
#offset ⇒ Object
readonly
Returns the value of attribute offset.
-
#semantic ⇒ Object
readonly
Returns the value of attribute semantic.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
Class Method Summary collapse
Instance Method Summary collapse
- #[](index) ⇒ Object
-
#initialize(semantic, source, offset = 0) ⇒ Input
constructor
‘Vertices` or `Source` are both okay for source.
- #size ⇒ Object
Constructor Details
#initialize(semantic, source, offset = 0) ⇒ Input
‘Vertices` or `Source` are both okay for source.
325 326 327 328 329 |
# File 'lib/collada/parser/support.rb', line 325 def initialize(semantic, source, offset = 0) @semantic = semantic @source = source @offset = offset end |
Instance Attribute Details
#offset ⇒ Object (readonly)
Returns the value of attribute offset.
333 334 335 |
# File 'lib/collada/parser/support.rb', line 333 def offset @offset end |
#semantic ⇒ Object (readonly)
Returns the value of attribute semantic.
331 332 333 |
# File 'lib/collada/parser/support.rb', line 331 def semantic @semantic end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
332 333 334 |
# File 'lib/collada/parser/support.rb', line 332 def source @source end |
Class Method Details
.parse(doc, element, sources = {}) ⇒ Object
343 344 345 346 347 348 349 350 351 352 353 354 355 356 |
# File 'lib/collada/parser/support.rb', line 343 def self.parse(doc, element, sources = {}) semantic = element.attributes['semantic'] if (source_id = element.attributes['source']) source_id.sub!(/^#/, '') source = sources[source_id] end raise UnsupportedFeature.new("Can't instantiate input with nil source (#{source_id})!") unless source offset = element.attributes['offset'] || 0 self.new(semantic.downcase.to_sym, source, offset.to_i) end |