X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=trail.h;fp=trail.h;h=dc90fc9438414e45c598a161c3774bd5d56887fd;hb=6538d63bbe4c4d5efb08bd207498ef57a6657e4d;hp=0000000000000000000000000000000000000000;hpb=ec3a96fde91385417ffc20e0f7745d7d8e2889ca;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/trail.h b/trail.h new file mode 100644 index 0000000..dc90fc9 --- /dev/null +++ b/trail.h @@ -0,0 +1,43 @@ +#ifndef TRAIL_H +#define TRAIL_H + +#include "skaterift.h" + +typedef struct trail_system trail_system; +typedef struct trail_point trail_point; +typedef struct trail_vert trail_vert; + +struct trail_system { + struct trail_point { + v3f co, normal, right; + f32 alpha; + } + *array; + +#pragma pack(push,1) + struct trail_vert { + v4f co; /* xyz: position, w: alpha */ + } + *vertices; +#pragma pack(pop) + + i32 head, count, max; + GLuint vao, vbo; + + /* render settings */ + f32 width, lifetime, min_dist; +} +static trails_test = { + .width = 0.25f, + .lifetime = 5.0f, + .min_dist = 0.5f +}; + +static void trail_alloc( trail_system *sys, u32 max ); +static void trail_system_update( trail_system *sys, f32 dt, + v3f co, v3f normal, f32 alpha ); +static void trail_system_debug( trail_system *sys ); +static void trail_system_prerender( trail_system *sys ); +static void trail_system_render( trail_system *sys, camera *cam ); + +#endif /* TRAIL_H */