add debug hitboxes render
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user