Class: Disp3D::NodeLeaf

Inherits:
Node
  • Object
show all
Defined in:
lib/node/node_leaf.rb

Instance Attribute Summary

Attributes inherited from Node

#instance_id, #name, #parents

Instance Method Summary collapse

Methods inherited from Node

#ancestors, #post_draw, #pre_draw

Constructor Details

#initialize(geometry = nil, name = nil) ⇒ NodeLeaf

Returns a new instance of NodeLeaf.



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/node/node_leaf.rb', line 11

def initialize(geometry = nil, name = nil)
  Util3D.check_arg_type(Symbol, name, true)
  Util3D.check_arg_type(GMath3D::Geom, geometry, true, true)
  super(name)
  @geom = geometry

  @material_color = [1,1,1,1]
  @shininess = nil
  @shininess_default = 32.0

  @dislay_list_created = nil
end

Instance Method Details

#boxObject



28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/node/node_leaf.rb', line 28

def box
  return nil if @geom == nil
  if(@geom.kind_of?(Array))
    return nil if @geom.size == 0
    rtn_box = @geom[0].box
    @geom.each do |element|
      rtn_box += element.box
    end
  else
    rtn_box = @geom.box
  end
  return box_transform(rtn_box)
end

#draw(currnet_view) ⇒ Object



24
25
26
# File 'lib/node/node_leaf.rb', line 24

def draw currnet_view
  draw_inner(self.method(:draw_element), currnet_view)
end

#update_for_displayObject



42
43
44
# File 'lib/node/node_leaf.rb', line 42

def update_for_display
  @dislay_list_created = nil
end