Class: Assimp::Scene
- Inherits:
-
Object
- Object
- Assimp::Scene
- Defined in:
- lib/assimp/scene.rb
Constant Summary collapse
- INCOMPLETE_FLAG =
0x1
Instance Attribute Summary collapse
-
#animations ⇒ Object
readonly
Returns the value of attribute animations.
-
#flags ⇒ Object
readonly
Returns the value of attribute flags.
-
#materials ⇒ Object
readonly
Returns the value of attribute materials.
-
#meshes ⇒ Object
readonly
Returns the value of attribute meshes.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#root ⇒ Object
readonly
Returns the value of attribute root.
-
#textures ⇒ Object
readonly
Returns the value of attribute textures.
Instance Method Summary collapse
- #each_mesh_instance ⇒ Object
- #find_node(name) ⇒ Object
- #incomplete? ⇒ Boolean
-
#initialize(name:, meshes:, materials:, root:, animations:, textures:, flags:) ⇒ Scene
constructor
A new instance of Scene.
Constructor Details
#initialize(name:, meshes:, materials:, root:, animations:, textures:, flags:) ⇒ Scene
Returns a new instance of Scene.
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/assimp/scene.rb', line 9 def initialize(name:, meshes:, materials:, root:, animations:, textures:, flags:) @name = String(name).dup.freeze @meshes = meshes.freeze @materials = materials.freeze @root = root @animations = animations.freeze @textures = textures.freeze @flags = Integer(flags) freeze end |
Instance Attribute Details
#animations ⇒ Object (readonly)
Returns the value of attribute animations.
7 8 9 |
# File 'lib/assimp/scene.rb', line 7 def animations @animations end |
#flags ⇒ Object (readonly)
Returns the value of attribute flags.
7 8 9 |
# File 'lib/assimp/scene.rb', line 7 def flags @flags end |
#materials ⇒ Object (readonly)
Returns the value of attribute materials.
7 8 9 |
# File 'lib/assimp/scene.rb', line 7 def materials @materials end |
#meshes ⇒ Object (readonly)
Returns the value of attribute meshes.
7 8 9 |
# File 'lib/assimp/scene.rb', line 7 def meshes @meshes end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/assimp/scene.rb', line 7 def name @name end |
#root ⇒ Object (readonly)
Returns the value of attribute root.
7 8 9 |
# File 'lib/assimp/scene.rb', line 7 def root @root end |
#textures ⇒ Object (readonly)
Returns the value of attribute textures.
7 8 9 |
# File 'lib/assimp/scene.rb', line 7 def textures @textures end |
Instance Method Details
#each_mesh_instance ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/assimp/scene.rb', line 28 def each_mesh_instance return enum_for(__method__) unless block_given? return self unless root stack = [[root, Matrix::IDENTITY]] until stack.empty? node, parent_matrix = stack.pop world_matrix = Matrix.multiply(parent_matrix, node.matrix) node.mesh_indices.each { |index| yield meshes.fetch(index), world_matrix } node.children.reverse_each { |child| stack << [child, world_matrix] } end self end |
#find_node(name) ⇒ Object
24 25 26 |
# File 'lib/assimp/scene.rb', line 24 def find_node(name) root&.find(name) end |
#incomplete? ⇒ Boolean
20 21 22 |
# File 'lib/assimp/scene.rb', line 20 def incomplete? (flags & INCOMPLETE_FLAG) != 0 end |