class Assimp::Node
Public Class Methods
new(ptr = nil)
click to toggle source
Calls superclass method
# File lib/assimp/scene.rb, line 24 def initialize(ptr = nil) if ptr super else ptr = FFI::MemoryPointer::new(self.class.size, 1, true) super(ptr) transformation.identity! end end
Public Instance Methods
ancestors()
click to toggle source
# File lib/assimp/scene.rb, line 40 def ancestors return parent ? [parent] + parent.ancestors : [] end
each_node(&block)
click to toggle source
# File lib/assimp/scene.rb, line 63 def each_node(&block) if block then block.call self children.each { |c| c.each_node(&block) } return self else to_enum(:each_node) end end
each_node_with_depth(depth=nil, &block)
click to toggle source
# File lib/assimp/scene.rb, line 75 def each_node_with_depth(depth=nil, &block) depth = (depth ? depth + 1 : 0) if block then block.call self, depth children.each { |c| c.each_node_with_depth(depth, &block) } else to_enum(:each_node_with_depth) end end
meta_data()
click to toggle source
# File lib/assimp/scene.rb, line 87 def meta_data p = self[:meta_data] return nil if p.null? Metadata::new(p) end
parent()
click to toggle source
# File lib/assimp/scene.rb, line 34 def parent ptr = self[:parent] return nil if ptr.null? Node::new(ptr) end
parent=(other)
click to toggle source
# File lib/assimp/scene.rb, line 52 def parent=(other) if other.kind_of? FFI::Pointer self[:parent] = other elsif other.kind_of? Node self[:parent] = other.pointer else raise ArgumentError::new("Argument should be a Node!") end other end
world_transformation()
click to toggle source
# File lib/assimp/scene.rb, line 44 def world_transformation if parent ancestors.reverse.collect(&:transformation).reduce(:*) * transformation else transformation end end