Class: Disp3D::Node

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

Direct Known Subclasses

NodeCollection, NodeLeaf

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name = nil) ⇒ Node

Returns a new instance of Node.



27
28
29
30
31
32
33
# File 'lib/node/node.rb', line 27

def initialize(name = nil)
  Util3D.check_arg_type(Symbol, name, true)
  @parents = []
  @instance_id = gen_instance_id()
  @name = name
  NodeDB.add(self)
end

Instance Attribute Details

#instance_idObject (readonly)

Returns the value of attribute instance_id.



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

def instance_id
  @instance_id
end

#nameObject (readonly)

Returns the value of attribute name.



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

def name
  @name
end

#parentsObject (readonly)

Array of Node



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

def parents
  @parents
end

Instance Method Details

#ancestorsObject



46
47
48
49
# File 'lib/node/node.rb', line 46

def ancestors
  rtn_ancestors_ary = []
  return ancestors_inner(rtn_ancestors_ary)
end

#post_drawObject



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

def post_draw
  GL.PopMatrix()
end

#pre_drawObject



35
36
37
38
39
40
# File 'lib/node/node.rb', line 35

def pre_draw
  GL.PushMatrix()
  GL.Translate(pre_translate.x, pre_translate.y, pre_translate.z) if(@pre_translate)
  GL.MultMatrix(@rotate.to_array) if(@rotate)
  GL.Translate(post_translate.x, post_translate.y, post_translate.z) if(@post_translate)
end