mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
add debug hitboxes render
This commit is contained in:
parent
ee7328dcad
commit
f3c5afa1ab
5 changed files with 33 additions and 6 deletions
|
|
@ -5,6 +5,7 @@
|
|||
#include "../physics/Hitbox.hpp"
|
||||
#include "../physics/PhysicsSolver.hpp"
|
||||
#include "../graphics/render/ModelBatch.hpp"
|
||||
#include "../graphics/core/LineBatch.hpp"
|
||||
#include "../graphics/core/Model.hpp"
|
||||
#include "../maths/FrustumCulling.hpp"
|
||||
|
||||
|
|
@ -54,6 +55,14 @@ void Entities::updatePhysics(float delta){
|
|||
}
|
||||
}
|
||||
|
||||
void Entities::renderDebug(LineBatch& batch) {
|
||||
batch.lineWidth(1.0f);
|
||||
auto view = registry.view<Transform, Hitbox>();
|
||||
for (auto [entity, transform, hitbox] : view.each()) {
|
||||
batch.box(hitbox.position, hitbox.halfsize * 2.0f, glm::vec4(1.0f));
|
||||
}
|
||||
}
|
||||
|
||||
void Entities::render(Assets* assets, ModelBatch& batch, Frustum& frustum) {
|
||||
auto view = registry.view<Transform>();
|
||||
auto model = assets->get<model::Model>("cube");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue