Class: Collada::Geometry

Inherits:
Geom::TriangleMesh show all
Defined in:
lib/collada/geometry.rb

Constant Summary collapse

SCENE_QUERY =
'/COLLADA/scene/instance_visual_scene'
VISUAL_SCENE_QUERY =
'/COLLADA/library_visual_scenes/visual_scene[@id="%s"]'
GEOMETRY_QUERY =
'/COLLADA/library_geometries/geometry[@id="%s"]'
NODE_QUERY =
'/COLLADA/library_nodes//node[@id="%s"]'

Instance Attribute Summary

Attributes inherited from Geom::TriangleMesh

#data, #faces, #meshes, #tess, #texcoord, #vertices

Class Method Summary collapse

Methods inherited from Geom::TriangleMesh

#<<, #bounding_box, #initialize, #merge, #reverse, #transform_vertices, #update

Constructor Details

This class inherits a constructor from Geom::TriangleMesh

Class Method Details

.doc(doc) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/collada/geometry.rb', line 9

def self.doc doc
  result = Geometry.new
  result.instance_eval do
    @doc   = doc
    @cache = {}

    scene_id = @doc.xpath(SCENE_QUERY).first.attribute('url').value[1..-1]
    scene = @doc.xpath(VISUAL_SCENE_QUERY % scene_id).first
    scene.children.each do |child|
      eval_node(child) if child.name == "node"
    end
  end
  result
end