refactor separate framework from game code, add demo3d
This commit is contained in:
parent
19ae869769
commit
40f5cdcaa5
92 changed files with 2665 additions and 6547 deletions
56
demo3d/client/sim/demo3d_sim.h
Normal file
56
demo3d/client/sim/demo3d_sim.h
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
#pragma once
|
||||
|
||||
#include "demo3d_bsp.h"
|
||||
#include "pxl8_math.h"
|
||||
#include "demo3d_protocol.h"
|
||||
#include "pxl8_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define DEMO3D_SIM_FLAG_ALIVE (1 << 0)
|
||||
#define DEMO3D_SIM_FLAG_PLAYER (1 << 1)
|
||||
#define DEMO3D_SIM_FLAG_GROUNDED (1 << 2)
|
||||
|
||||
typedef struct demo3d_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;
|
||||
} demo3d_sim_config;
|
||||
|
||||
typedef struct demo3d_sim_entity {
|
||||
pxl8_vec3 pos;
|
||||
pxl8_vec3 vel;
|
||||
f32 yaw;
|
||||
f32 pitch;
|
||||
u32 flags;
|
||||
u16 kind;
|
||||
u16 _pad;
|
||||
} demo3d_sim_entity;
|
||||
|
||||
typedef struct demo3d_sim_world {
|
||||
const demo3d_bsp* chunks[9];
|
||||
i32 center_cx;
|
||||
i32 center_cz;
|
||||
f32 chunk_size;
|
||||
} demo3d_sim_world;
|
||||
|
||||
bool demo3d_bsp_point_solid(const demo3d_bsp* bsp, pxl8_vec3 pos);
|
||||
pxl8_vec3 demo3d_bsp_trace(const demo3d_bsp* bsp, pxl8_vec3 from, pxl8_vec3 to, f32 radius);
|
||||
|
||||
pxl8_vec3 demo3d_sim_trace(const demo3d_sim_world* world, pxl8_vec3 from, pxl8_vec3 to, f32 radius, f32 height);
|
||||
bool demo3d_sim_check_ground(const demo3d_sim_world* world, pxl8_vec3 pos, f32 radius);
|
||||
void demo3d_sim_move_player(demo3d_sim_entity* ent, const demo3d_input_msg* input, const demo3d_sim_world* world, const demo3d_sim_config* cfg, f32 dt);
|
||||
void demo3d_sim_integrate(demo3d_sim_entity* ent, const demo3d_sim_world* world, const demo3d_sim_config* cfg, f32 dt);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue