Merge more code together for meshes

This commit is contained in:
Wojtek Figat
2024-12-23 23:28:01 +01:00
parent 9f648caac8
commit 723a882824
8 changed files with 299 additions and 316 deletions

View File

@@ -79,9 +79,9 @@ Model::Model(const SpawnParams& params, const AssetInfo* info)
}
}
Model::~Model()
bool Model::HasAnyLODInitialized() const
{
ASSERT(_streamingTask == nullptr);
return LODs.HasItems() && LODs.Last().HasAnyMeshInitialized();
}
bool Model::Intersects(const Ray& ray, const Matrix& world, Real& distance, Vector3& normal, Mesh** mesh, int32 lodIndex)
@@ -890,6 +890,12 @@ AssetChunksFlag Model::getChunksToPreload() const
return GET_CHUNK_FLAG(0) | GET_CHUNK_FLAG(15);
}
bool ModelLOD::HasAnyMeshInitialized() const
{
// Note: we initialize all meshes at once so the last one can be used to check it.
return Meshes.HasItems() && Meshes.Last().IsInitialized();
}
bool ModelLOD::Intersects(const Ray& ray, const Matrix& world, Real& distance, Vector3& normal, Mesh** mesh)
{
bool result = false;