Class: Disp3D::SceneGraph
- Inherits:
-
Object
- Object
- Disp3D::SceneGraph
- Defined in:
- lib/scene_graph.rb
Instance Attribute Summary collapse
-
#root_node ⇒ Object
Returns the value of attribute root_node.
Instance Method Summary collapse
- #add(node) ⇒ Object
- #bounding_box ⇒ Object
- #center ⇒ Object
- #gl_display(current_view) ⇒ Object
-
#initialize ⇒ SceneGraph
constructor
A new instance of SceneGraph.
- #open(&block) ⇒ Object
- #radius ⇒ Object
Constructor Details
#initialize ⇒ SceneGraph
Returns a new instance of SceneGraph.
7 8 9 |
# File 'lib/scene_graph.rb', line 7 def initialize() @root_node = NodeCollection.new() end |
Instance Attribute Details
#root_node ⇒ Object
Returns the value of attribute root_node.
5 6 7 |
# File 'lib/scene_graph.rb', line 5 def root_node @root_node end |
Instance Method Details
#add(node) ⇒ Object
16 17 18 |
# File 'lib/scene_graph.rb', line 16 def add(node) @root_node.add(node) end |
#bounding_box ⇒ Object
24 25 26 |
# File 'lib/scene_graph.rb', line 24 def bounding_box return @root_node.box end |
#center ⇒ Object
28 29 30 31 32 |
# File 'lib/scene_graph.rb', line 28 def center bb = self.bounding_box return nil if bb.nil? return bb.center end |
#gl_display(current_view) ⇒ Object
11 12 13 14 |
# File 'lib/scene_graph.rb', line 11 def gl_display(current_view) NodePathDB.init @root_node.draw(current_view) end |
#open(&block) ⇒ Object
20 21 22 |
# File 'lib/scene_graph.rb', line 20 def open(&block) @root_node.open(&block) end |
#radius ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/scene_graph.rb', line 34 def radius bb = self.bounding_box return 0 if bb.nil? length = bb.length orth_length = Math.sqrt( length[0]*length[0] + length[1]*length[1] + length[2]*length[2] ) orth_length/2.0 end |