Class: Assimp::Mesh
- Inherits:
-
Object
- Object
- Assimp::Mesh
- Defined in:
- lib/assimp/mesh.rb
Instance Attribute Summary collapse
-
#aabb ⇒ Object
readonly
Returns the value of attribute aabb.
-
#bones ⇒ Object
readonly
Returns the value of attribute bones.
-
#colors ⇒ Object
readonly
Returns the value of attribute colors.
-
#indices ⇒ Object
readonly
Returns the value of attribute indices.
-
#material_index ⇒ Object
readonly
Returns the value of attribute material_index.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#normals ⇒ Object
readonly
Returns the value of attribute normals.
-
#positions ⇒ Object
readonly
Returns the value of attribute positions.
-
#primitive ⇒ Object
readonly
Returns the value of attribute primitive.
-
#tangents ⇒ Object
readonly
Returns the value of attribute tangents.
-
#uv_sets ⇒ Object
readonly
Returns the value of attribute uv_sets.
-
#vertex_count ⇒ Object
readonly
Returns the value of attribute vertex_count.
Instance Method Summary collapse
- #index_count ⇒ Object
-
#initialize(name:, material_index:, primitive:, positions:, normals:, tangents:, uv_sets:, colors:, indices:, bones:, vertex_count:, aabb:) ⇒ Mesh
constructor
A new instance of Mesh.
Constructor Details
#initialize(name:, material_index:, primitive:, positions:, normals:, tangents:, uv_sets:, colors:, indices:, bones:, vertex_count:, aabb:) ⇒ Mesh
Returns a new instance of Mesh.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/assimp/mesh.rb', line 10 def initialize(name:, material_index:, primitive:, positions:, normals:, tangents:, uv_sets:, colors:, indices:, bones:, vertex_count:, aabb:) @name = String(name).dup.freeze @material_index = Integer(material_index) @primitive = primitive.to_sym @vertex_count = Integer(vertex_count) @positions = packed(positions, @vertex_count * 12, :positions) @normals = optional_packed(normals, @vertex_count * 12, :normals) @tangents = optional_packed(tangents, @vertex_count * 16, :tangents) @uv_sets = uv_sets.map.with_index { |data, index| packed(data, @vertex_count * 8, :"uv#{index}") }.freeze @colors = optional_packed(colors, @vertex_count * 16, :colors) @indices = packed_multiple(indices, 4, :indices) @bones = bones.freeze @aabb = aabb freeze end |
Instance Attribute Details
#aabb ⇒ Object (readonly)
Returns the value of attribute aabb.
7 8 9 |
# File 'lib/assimp/mesh.rb', line 7 def aabb @aabb end |
#bones ⇒ Object (readonly)
Returns the value of attribute bones.
7 8 9 |
# File 'lib/assimp/mesh.rb', line 7 def bones @bones end |
#colors ⇒ Object (readonly)
Returns the value of attribute colors.
7 8 9 |
# File 'lib/assimp/mesh.rb', line 7 def colors @colors end |
#indices ⇒ Object (readonly)
Returns the value of attribute indices.
7 8 9 |
# File 'lib/assimp/mesh.rb', line 7 def indices @indices end |
#material_index ⇒ Object (readonly)
Returns the value of attribute material_index.
7 8 9 |
# File 'lib/assimp/mesh.rb', line 7 def material_index @material_index end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/assimp/mesh.rb', line 7 def name @name end |
#normals ⇒ Object (readonly)
Returns the value of attribute normals.
7 8 9 |
# File 'lib/assimp/mesh.rb', line 7 def normals @normals end |
#positions ⇒ Object (readonly)
Returns the value of attribute positions.
7 8 9 |
# File 'lib/assimp/mesh.rb', line 7 def positions @positions end |
#primitive ⇒ Object (readonly)
Returns the value of attribute primitive.
7 8 9 |
# File 'lib/assimp/mesh.rb', line 7 def primitive @primitive end |
#tangents ⇒ Object (readonly)
Returns the value of attribute tangents.
7 8 9 |
# File 'lib/assimp/mesh.rb', line 7 def tangents @tangents end |
#uv_sets ⇒ Object (readonly)
Returns the value of attribute uv_sets.
7 8 9 |
# File 'lib/assimp/mesh.rb', line 7 def uv_sets @uv_sets end |
#vertex_count ⇒ Object (readonly)
Returns the value of attribute vertex_count.
7 8 9 |
# File 'lib/assimp/mesh.rb', line 7 def vertex_count @vertex_count end |
Instance Method Details
#index_count ⇒ Object
27 28 29 |
# File 'lib/assimp/mesh.rb', line 27 def index_count indices.bytesize / 4 end |