Skip to content

Commit

Permalink
EC World fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
OVOAOVO committed Mar 1, 2024
1 parent 8651b1d commit 88e3e9c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 17 deletions.
30 changes: 15 additions & 15 deletions Engine/Source/Editor/ECWorld/ECWorldConsumer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,11 @@ void ECWorldConsumer::Execute(const cd::SceneDatabase* pSceneDatabase)

auto ParseMeshWithParticles= [&](cd::MeshID meshID, const cd::ParticleEmitter& emitter)
{
engine::Entity meshEntity = m_pSceneWorld->GetWorld()->CreateEntity();

engine::Entity emitterEntity = m_pSceneWorld->GetWorld()->CreateEntity();
engine::MaterialType* pMaterialType = m_pSceneWorld->GetParticleMaterialType();

const auto& mesh = pSceneDatabase->GetMesh(meshID.Data());
AddParticleEmitter(meshEntity, mesh, pMaterialType->GetRequiredVertexFormat(),emitter);
AddParticleEmitter(emitterEntity, mesh, pMaterialType->GetRequiredVertexFormat(), emitter);
};

// There are multiple kinds of cases in the SceneDatabase:
Expand All @@ -90,22 +89,23 @@ void ECWorldConsumer::Execute(const cd::SceneDatabase* pSceneDatabase)
// 3. Node hierarchy.
// Another case is that we want to skip Node/Mesh which alreay parsed previously.
std::set<uint32_t> parsedMeshIDs;
m_particleMinID = 0;
for (const auto& mesh : pSceneDatabase->GetMeshes())
if (pSceneDatabase->GetParticleEmitterCount())
{
if (m_meshMinID > mesh.GetID().Data())
{
continue;
}

if (pSceneDatabase->GetParticleEmitterCount())
for (auto& particleEmitter : pSceneDatabase->GetParticleEmitters())
{
ParseMeshWithParticles(mesh.GetID(), pSceneDatabase->GetParticleEmitter(m_particleMinID));
parsedMeshIDs.insert(mesh.GetID().Data());
++m_particleMinID;
ParseMeshWithParticles(particleEmitter.GetMeshID(), particleEmitter);
parsedMeshIDs.insert(particleEmitter.GetID().Data());
}
else
}
else
{
for (const auto& mesh : pSceneDatabase->GetMeshes())
{
if (m_meshMinID > mesh.GetID().Data())
{
continue;
}

ParseMesh(mesh.GetID(), cd::Transform::Identity());
parsedMeshIDs.insert(mesh.GetID().Data());
}
Expand Down
1 change: 0 additions & 1 deletion Engine/Source/Editor/ECWorld/ECWorldConsumer.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ class ECWorldConsumer final : public cdtools::IConsumer

uint32_t m_nodeMinID;
uint32_t m_meshMinID;
uint32_t m_particleMinID = 0;
};

}

0 comments on commit 88e3e9c

Please sign in to comment.