Class: Collada::Parser::Controller::Skin

Inherits:
Collada::Parser::Controller show all
Defined in:
lib/collada/parser/controller.rb

Defined Under Namespace

Classes: Joints, VertexWeights

Instance Attribute Summary collapse

Attributes inherited from Collada::Parser::Controller

#id, #name

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, name, source, bind_pose_transform, sources, joints, weights) ⇒ Skin

Returns a new instance of Skin.



86
87
88
89
90
91
92
93
94
95
96
# File 'lib/collada/parser/controller.rb', line 86

def initialize(id, name, source, bind_pose_transform, sources, joints, weights)
	super id, name
	
	@bind_pose_transform = bind_pose_transform
	
	@source = source
	@sources = sources
	@joints = joints
	
	@weights = weights
end

Instance Attribute Details

#bind_pose_transformObject (readonly)

Returns the value of attribute bind_pose_transform.



100
101
102
# File 'lib/collada/parser/controller.rb', line 100

def bind_pose_transform
  @bind_pose_transform
end

#jointsObject (readonly)

Returns the value of attribute joints.



103
104
105
# File 'lib/collada/parser/controller.rb', line 103

def joints
  @joints
end

#sourceObject (readonly)

Returns the value of attribute source.



98
99
100
# File 'lib/collada/parser/controller.rb', line 98

def source
  @source
end

#sourcesObject (readonly)

Returns the value of attribute sources.



102
103
104
# File 'lib/collada/parser/controller.rb', line 102

def sources
  @sources
end

#weightsObject (readonly)

May contain multiple weights per vertex.



106
107
108
# File 'lib/collada/parser/controller.rb', line 106

def weights
  @weights
end

Class Method Details

.parse(doc, controller_element, element) ⇒ Object



108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/collada/parser/controller.rb', line 108

def self.parse(doc, controller_element, element)
	id = controller_element.attributes['id']
	name = controller_element.attributes['name']
	source = Reference.new(:geometries, element.attributes['source'])
	
	bind_pose_transform = extract_float4x4_matrix(element.elements['bind_shape_matrix'].text)
	
	arrays = Source.parse_arrays(doc, element)

	sources = OrderedMap.parse(element, 'source') do |source_element|
		Source.parse(doc, source_element, arrays)
	end
	
	joints = Joints.parse(doc, element.elements['joints'], sources)
	
	vertex_weights = VertexWeights.parse(doc, element.elements['vertex_weights'], sources)
	
	self.new(id, name, source, bind_pose_transform, sources, joints, vertex_weights)
end