Class: Collada::Document

Inherits:
Nokogiri::XML::Document
  • Object
show all
Defined in:
lib/collada/document.rb

Constant Summary collapse

COLLADA_NS =
"http://www.collada.org/2005/11/COLLADASchema"
COLLADA_VERSION =
"1.4.1"
ASSET =
'asset'
LIBRARY_MATERIALS =
'library_materials'
LIBRARY_EFFECTS =
'library_effects'
LIBRARY_GEOMETRIES =
'library_geometries'
LIBRARY_VISUAL_SCENES =
'library_visual_scenes'
SCENE =
'scene'
VISUAL_SCENE =
'visual_scene'
INSTANCE_VISUAL_SCENE =
'instance_visual_scene'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeDocument

Returns a new instance of Document.



19
20
21
22
23
24
25
26
27
# File 'lib/collada/document.rb', line 19

def initialize
  super
  root = create_element 'COLLADA'
  root.namespace = COLLADA_NS
  root.attr['version'] = COLLADA_VERSION

  create_structure
  assets_libraries = []
end

Instance Attribute Details

#assets_librariesObject

Returns the value of attribute assets_libraries.



17
18
19
# File 'lib/collada/document.rb', line 17

def assets_libraries
  @assets_libraries
end

Instance Method Details

#<<(node) ⇒ Object



29
30
31
# File 'lib/collada/document.rb', line 29

def << node
  root << node
end

#place(doc, position, rotation, scale) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/collada/document.rb', line 33

def place(doc,position,rotation,scale)
  unless materials_and_effects_included?(doc.name)
    doc.library_materials.each do |material|
      library_materials_node << imported(material)
    end
    doc.library_effects.each do |effect|
      library_effects_node << imported(effect)
    end
    materials_and_effects_added(doc.name)
  end

  doc.library_geometries.each do |geometry|
    library_geometries_node << imported(geometry)
  end
  library_visual_scenes_node << imported(doc.library_visual_scenes)
end