diff options
author | bitsawer <sawerduster@gmail.com> | 2023-09-13 17:13:32 +0300 |
---|---|---|
committer | bitsawer <sawerduster@gmail.com> | 2023-10-25 16:37:47 +0300 |
commit | cbb39f4b6e6c058928350c75e44c34fa9f9f7b48 (patch) | |
tree | b265684c40befce68570db8c5ec65bd3885e5275 /scene/3d/multimesh_instance_3d.cpp | |
parent | 06d51891678e3abf360d6fcd2e8bd1ba96704fcc (diff) | |
download | redot-engine-cbb39f4b6e6c058928350c75e44c34fa9f9f7b48.tar.gz |
Fix VoxelGI MultiMesh and CSG mesh baking
Diffstat (limited to 'scene/3d/multimesh_instance_3d.cpp')
-rw-r--r-- | scene/3d/multimesh_instance_3d.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/scene/3d/multimesh_instance_3d.cpp b/scene/3d/multimesh_instance_3d.cpp index 2158005f5f..55d6e49e6c 100644 --- a/scene/3d/multimesh_instance_3d.cpp +++ b/scene/3d/multimesh_instance_3d.cpp @@ -49,6 +49,26 @@ Ref<MultiMesh> MultiMeshInstance3D::get_multimesh() const { return multimesh; } +Array MultiMeshInstance3D::get_meshes() const { + if (multimesh.is_null() || multimesh->get_mesh().is_null() || multimesh->get_transform_format() != MultiMesh::TransformFormat::TRANSFORM_3D) { + return Array(); + } + + int count = multimesh->get_visible_instance_count(); + if (count == -1) { + count = multimesh->get_instance_count(); + } + + Ref<Mesh> mesh = multimesh->get_mesh(); + + Array results; + for (int i = 0; i < count; i++) { + results.push_back(multimesh->get_instance_transform(i)); + results.push_back(mesh); + } + return results; +} + AABB MultiMeshInstance3D::get_aabb() const { if (multimesh.is_null()) { return AABB(); |