Class: Collada::Parser::Animation

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, sources, samples, channels) ⇒ Animation

Returns a new instance of Animation.



26
27
28
29
30
31
# File 'lib/collada/parser/animation.rb', line 26

def initialize(id, sources, samples, channels)
	@id = id
	@sources = sources
	@samples = samplers
	@channels = channels
end

Instance Attribute Details

#channelsObject (readonly)

Returns the value of attribute channels.



36
37
38
# File 'lib/collada/parser/animation.rb', line 36

def channels
  @channels
end

#idObject (readonly)

Returns the value of attribute id.



33
34
35
# File 'lib/collada/parser/animation.rb', line 33

def id
  @id
end

#samplersObject (readonly)

Returns the value of attribute samplers.



35
36
37
# File 'lib/collada/parser/animation.rb', line 35

def samplers
  @samplers
end

#sourcesObject (readonly)

Returns the value of attribute sources.



34
35
36
# File 'lib/collada/parser/animation.rb', line 34

def sources
  @sources
end

Class Method Details

.parse(doc, element) ⇒ Object



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/collada/parser/animation.rb', line 38

def self.parse(doc, element)
	arrays = Source.parse_arrays(doc, element)
	
	sources = OrderedMap.parse(element, 'source') do |source_element|
		Source.parse(doc, source_element, arrays)
	end
	
	samplers = OrderedMap.parse(element, 'sampler') do |sampler_element|
		Sampler.parse(doc, sampler_element, sources)
	end
	
	channels = OrderedMap.parse(element, 'channel', 'target') do |channel_element|
		Channel.parse(doc, channel_element, samplers)
	end
	
	self.new(element.attributes['id'], sources, samplers, channels)
end