Class: Collada::Parser::Geometry::Mesh::Vertices
- Inherits:
-
Object
- Object
- Collada::Parser::Geometry::Mesh::Vertices
- Includes:
- Enumerable
- Defined in:
- lib/collada/parser/geometry.rb
Overview
A source that provides individual vertices:
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#inputs ⇒ Object
readonly
Returns the value of attribute inputs.
Class Method Summary collapse
Instance Method Summary collapse
-
#[](index) ⇒ Object
Vertices by index, same interface as Input.
-
#initialize(id, inputs) ⇒ Vertices
constructor
A new instance of Vertices.
- #size ⇒ Object
Constructor Details
#initialize(id, inputs) ⇒ Vertices
Returns a new instance of Vertices.
31 32 33 34 |
# File 'lib/collada/parser/geometry.rb', line 31 def initialize(id, inputs) @id = id @inputs = inputs end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
36 37 38 |
# File 'lib/collada/parser/geometry.rb', line 36 def id @id end |
#inputs ⇒ Object (readonly)
Returns the value of attribute inputs.
37 38 39 |
# File 'lib/collada/parser/geometry.rb', line 37 def inputs @inputs end |
Class Method Details
.parse(doc, element, sources = {}) ⇒ Object
56 57 58 59 60 |
# File 'lib/collada/parser/geometry.rb', line 56 def self.parse(doc, element, sources = {}) inputs = parse_inputs(doc, element, sources) self.new(element.attributes['id'], inputs) end |
.parse_inputs(doc, element, sources = {}) ⇒ Object
50 51 52 53 54 |
# File 'lib/collada/parser/geometry.rb', line 50 def self.parse_inputs(doc, element, sources = {}) OrderedMap.parse(element, 'input') do |input_element| Input.parse(doc, input_element, sources) end end |
Instance Method Details
#[](index) ⇒ Object
Vertices by index, same interface as Input.
44 45 46 47 48 |
# File 'lib/collada/parser/geometry.rb', line 44 def [] index @inputs.collect do |input| input[index] end + [Attribute.new(:vertex, :index => index)] end |
#size ⇒ Object
39 40 41 |
# File 'lib/collada/parser/geometry.rb', line 39 def size @inputs.collect{|input| input.size}.max end |