mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 02:51:49 +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");
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ struct Transform {
|
|||
|
||||
class Level;
|
||||
class Assets;
|
||||
class LineBatch;
|
||||
class ModelBatch;
|
||||
class Frustum;
|
||||
class Rig;
|
||||
|
|
@ -60,6 +61,8 @@ class Entities {
|
|||
public:
|
||||
Entities(Level* level);
|
||||
void updatePhysics(float delta);
|
||||
|
||||
void renderDebug(LineBatch& batch);
|
||||
void render(Assets* assets, ModelBatch& batch, Frustum& frustum);
|
||||
|
||||
entityid_t drop(glm::vec3 pos);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue