Class: Collada::Parser::Library

Inherits:
Object
  • Object
show all
Defined in:
lib/collada/parser/scene.rb,
lib/collada/parser/library.rb

Constant Summary collapse

SECTIONS =
{
	:visual_scenes => ['COLLADA/library_visual_scenes/visual_scene', VisualScene],
	:geometries => ['COLLADA/library_geometries/geometry', Geometry],
	:animations => ['COLLADA/library_animations/animation', Animation],
	:controllers => ['COLLADA/library_controllers/controller', Controller],
}

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(doc, sections = {}) ⇒ Library

Returns a new instance of Library.



244
245
246
# File 'lib/collada/parser/scene.rb', line 244

def initialize(sections = {})
	@sections = sections
end

Class Method Details

.parse(doc) ⇒ Object



252
253
254
255
256
257
258
259
260
261
262
# File 'lib/collada/parser/scene.rb', line 252

def self.parse(doc)
	sections = {}
	
	SECTIONS.each do |key, (path, klass)|
		sections[key] = OrderedMap.parse(doc, path) do |element|
			klass.parse(doc, element)
		end
	end
	
	return Library.new(sections)
end

Instance Method Details

#[](key) ⇒ Object



248
249
250
# File 'lib/collada/parser/scene.rb', line 248

def [] key
	@sections[key]
end