refactor: decouple sim from framework, remove voxel geometry
This commit is contained in:
parent
c538641ec8
commit
5a565844dd
41 changed files with 477 additions and 2407 deletions
|
|
@ -4,7 +4,6 @@
|
|||
#include "pxl8_math.h"
|
||||
#include "pxl8_protocol.h"
|
||||
#include "pxl8_types.h"
|
||||
#include "pxl8_vxl.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
@ -14,15 +13,18 @@ extern "C" {
|
|||
#define PXL8_SIM_FLAG_PLAYER (1 << 1)
|
||||
#define PXL8_SIM_FLAG_GROUNDED (1 << 2)
|
||||
|
||||
#define PXL8_SIM_MOVE_SPEED 180.0f
|
||||
#define PXL8_SIM_GROUND_ACCEL 10.0f
|
||||
#define PXL8_SIM_AIR_ACCEL 1.0f
|
||||
#define PXL8_SIM_STOP_SPEED 100.0f
|
||||
#define PXL8_SIM_FRICTION 6.0f
|
||||
#define PXL8_SIM_GRAVITY 800.0f
|
||||
#define PXL8_SIM_JUMP_VELOCITY 200.0f
|
||||
#define PXL8_SIM_PLAYER_RADIUS 16.0f
|
||||
#define PXL8_SIM_MAX_PITCH 1.5f
|
||||
typedef struct pxl8_sim_config {
|
||||
f32 move_speed;
|
||||
f32 ground_accel;
|
||||
f32 air_accel;
|
||||
f32 stop_speed;
|
||||
f32 friction;
|
||||
f32 gravity;
|
||||
f32 jump_velocity;
|
||||
f32 player_radius;
|
||||
f32 player_height;
|
||||
f32 max_pitch;
|
||||
} pxl8_sim_config;
|
||||
|
||||
typedef struct pxl8_sim_entity {
|
||||
pxl8_vec3 pos;
|
||||
|
|
@ -36,20 +38,15 @@ typedef struct pxl8_sim_entity {
|
|||
|
||||
typedef struct pxl8_sim_world {
|
||||
const pxl8_bsp* bsp;
|
||||
const pxl8_vxl_chunk* vxl;
|
||||
i32 vxl_cx, vxl_cy, vxl_cz;
|
||||
} pxl8_sim_world;
|
||||
|
||||
bool pxl8_bsp_point_solid(const pxl8_bsp* bsp, pxl8_vec3 pos);
|
||||
pxl8_vec3 pxl8_bsp_trace(const pxl8_bsp* bsp, pxl8_vec3 from, pxl8_vec3 to, f32 radius);
|
||||
|
||||
bool pxl8_vxl_point_solid(const pxl8_vxl_chunk* chunk, i32 cx, i32 cy, i32 cz, f32 x, f32 y, f32 z);
|
||||
pxl8_vec3 pxl8_vxl_trace(const pxl8_vxl_chunk* chunk, i32 cx, i32 cy, i32 cz, pxl8_vec3 from, pxl8_vec3 to, f32 radius);
|
||||
|
||||
pxl8_vec3 pxl8_sim_trace(const pxl8_sim_world* world, pxl8_vec3 from, pxl8_vec3 to, f32 radius);
|
||||
pxl8_vec3 pxl8_sim_trace(const pxl8_sim_world* world, pxl8_vec3 from, pxl8_vec3 to, f32 radius, f32 height);
|
||||
bool pxl8_sim_check_ground(const pxl8_sim_world* world, pxl8_vec3 pos, f32 radius);
|
||||
void pxl8_sim_move_player(pxl8_sim_entity* ent, const pxl8_input_msg* input, const pxl8_sim_world* world, f32 dt);
|
||||
void pxl8_sim_integrate(pxl8_sim_entity* ent, const pxl8_sim_world* world, f32 dt);
|
||||
void pxl8_sim_move_player(pxl8_sim_entity* ent, const pxl8_input_msg* input, const pxl8_sim_world* world, const pxl8_sim_config* cfg, f32 dt);
|
||||
void pxl8_sim_integrate(pxl8_sim_entity* ent, const pxl8_sim_world* world, const pxl8_sim_config* cfg, f32 dt);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue