mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
update entities render to use rigs
This commit is contained in:
parent
8e08f79b54
commit
56ef207b7d
4 changed files with 63 additions and 24 deletions
|
|
@ -195,18 +195,13 @@ void Entities::renderDebug(LineBatch& batch, const Frustum& frustum) {
|
|||
}
|
||||
|
||||
void Entities::render(Assets* assets, ModelBatch& batch, const Frustum& frustum) {
|
||||
auto view = registry.view<Transform>();
|
||||
auto model = assets->get<model::Model>("cube");
|
||||
if (model == nullptr) {
|
||||
return;
|
||||
}
|
||||
for (auto [entity, transform] : view.each()) {
|
||||
auto view = registry.view<Transform, rigging::Rig>();
|
||||
for (auto [entity, transform, rig] : view.each()) {
|
||||
const auto& pos = transform.pos;
|
||||
const auto& size = transform.size;
|
||||
if (frustum.isBoxVisible(pos-size, pos+size)) {
|
||||
batch.pushMatrix(transform.combined);
|
||||
batch.draw(model);
|
||||
batch.popMatrix();
|
||||
const auto* rigConfig = rig.config;
|
||||
rigConfig->render(assets, batch, rig, transform.combined);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue