Somewhat working version
This commit is contained in:
@@ -1,32 +1,22 @@
|
||||
#include "MeshUpdater.h"
|
||||
#include "Component/Mesh.h"
|
||||
|
||||
using namespace Seele;
|
||||
using namespace Seele::System;
|
||||
|
||||
MeshUpdater::MeshUpdater(PScene scene)
|
||||
: SystemBase(scene)
|
||||
: ComponentSystem<Component::Transform, Component::Mesh>(scene)
|
||||
{
|
||||
scene->view<Component::Mesh>([&](entt::entity id, Component::Mesh& mesh) {
|
||||
meshEntities.add(id);
|
||||
});
|
||||
scene->constructCallback<Component::Mesh>().connect<&MeshUpdater::on_construct>(this);
|
||||
scene->destroyCallback<Component::Mesh>().connect<&MeshUpdater::on_destroy>(this);
|
||||
}
|
||||
|
||||
MeshUpdater::~MeshUpdater()
|
||||
{
|
||||
}
|
||||
|
||||
void MeshUpdater::update()
|
||||
void MeshUpdater::update(Component::Transform& transform, Component::Mesh& comp)
|
||||
{
|
||||
}
|
||||
|
||||
void MeshUpdater::on_construct(entt::registry& reg, entt::entity id)
|
||||
{
|
||||
meshEntities.add(id);
|
||||
}
|
||||
|
||||
void MeshUpdater::on_destroy(entt::registry& reg, entt::entity id)
|
||||
{
|
||||
meshEntities.remove(id, false);
|
||||
for (auto& mesh : comp.asset->meshes)
|
||||
{
|
||||
mesh->vertexData->updateMesh(mesh, transform);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user