feat(physics): added physics_world_query
This commit is contained in:
parent
73cd7c5f96
commit
67b138741b
|
@ -29,6 +29,13 @@ void physics_world_remove_entity(PhysicsEntity entity) {
|
||||||
ASSERT_RETURN(0,, "Physics entity with data at %p is not registered in physics world", entity.data);
|
ASSERT_RETURN(0,, "Physics entity with data at %p is not registered in physics world", entity.data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PhysicsEntity physics_world_query(PhysicsQuery query) {
|
||||||
|
list_foreach(PhysicsEntity*, entity, &_world_bodies) {
|
||||||
|
if(overlap_check(query, *entity))
|
||||||
|
return *entity;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static inline
|
static inline
|
||||||
void _internal_physics_narrow_collision() {
|
void _internal_physics_narrow_collision() {
|
||||||
size_t half_end = _world_bodies.len/2;
|
size_t half_end = _world_bodies.len/2;
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#define _fencer_physics_world_h
|
#define _fencer_physics_world_h
|
||||||
|
|
||||||
#include "physics_entity.h"
|
#include "physics_entity.h"
|
||||||
|
#include "collision.h"
|
||||||
|
|
||||||
extern void physics_world_init();
|
extern void physics_world_init();
|
||||||
extern void physics_world_clean();
|
extern void physics_world_clean();
|
||||||
|
@ -9,6 +10,8 @@ extern void physics_world_clean();
|
||||||
extern void physics_world_add_entity(PhysicsEntity entity);
|
extern void physics_world_add_entity(PhysicsEntity entity);
|
||||||
extern void physics_world_remove_entity(PhysicsEntity entity);
|
extern void physics_world_remove_entity(PhysicsEntity entity);
|
||||||
|
|
||||||
|
extern PhysicsEntity physics_world_query(PhysicsQuery query);
|
||||||
|
|
||||||
extern void physics_world_tick();
|
extern void physics_world_tick();
|
||||||
|
|
||||||
#endif // !_fencer_physics_world_h
|
#endif // !_fencer_physics_world_h
|
||||||
|
|
Loading…
Reference in a new issue