Class: Collada::Conversion::Skeleton
- Inherits:
-
Object
- Object
- Collada::Conversion::Skeleton
- Defined in:
- lib/collada/conversion/skeleton.rb
Instance Attribute Summary collapse
-
#bones ⇒ Object
readonly
Returns the value of attribute bones.
-
#controller ⇒ Object
readonly
Returns the value of attribute controller.
-
#indexed ⇒ Object
readonly
Returns the value of attribute indexed.
-
#library ⇒ Object
readonly
Returns the value of attribute library.
-
#node ⇒ Object
readonly
Returns the value of attribute node.
-
#scene ⇒ Object
readonly
Returns the value of attribute scene.
-
#top ⇒ Object
readonly
Returns the value of attribute top.
Instance Method Summary collapse
- #indexed_weights ⇒ Object
-
#initialize(library, scene, node, controller) ⇒ Skeleton
constructor
A new instance of Skeleton.
Constructor Details
#initialize(library, scene, node, controller) ⇒ Skeleton
Returns a new instance of Skeleton.
27 28 29 30 31 32 33 34 35 |
# File 'lib/collada/conversion/skeleton.rb', line 27 def initialize(library, scene, node, controller) @library = library @scene = scene @node = node @controller = controller extract_skeleton(node) end |
Instance Attribute Details
#bones ⇒ Object (readonly)
Returns the value of attribute bones.
43 44 45 |
# File 'lib/collada/conversion/skeleton.rb', line 43 def bones @bones end |
#controller ⇒ Object (readonly)
Returns the value of attribute controller.
40 41 42 |
# File 'lib/collada/conversion/skeleton.rb', line 40 def controller @controller end |
#indexed ⇒ Object (readonly)
Returns the value of attribute indexed.
44 45 46 |
# File 'lib/collada/conversion/skeleton.rb', line 44 def indexed @indexed end |
#library ⇒ Object (readonly)
Returns the value of attribute library.
37 38 39 |
# File 'lib/collada/conversion/skeleton.rb', line 37 def library @library end |
#node ⇒ Object (readonly)
Returns the value of attribute node.
39 40 41 |
# File 'lib/collada/conversion/skeleton.rb', line 39 def node @node end |
#scene ⇒ Object (readonly)
Returns the value of attribute scene.
38 39 40 |
# File 'lib/collada/conversion/skeleton.rb', line 38 def scene @scene end |
#top ⇒ Object (readonly)
Returns the value of attribute top.
42 43 44 |
# File 'lib/collada/conversion/skeleton.rb', line 42 def top @top end |
Instance Method Details
#indexed_weights ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/collada/conversion/skeleton.rb', line 46 def indexed_weights result = [] @controller.weights.each do |vertex| output = [] vertex.each do |weight| weight = Parser::Attribute.merge(weight) output << [@indexed[weight[:JOINT]], weight[:WEIGHT]] end # Sort bone weights in descending order: result << output.sort{|a,b| b[1] <=> a[1]} end return result end |