trail rendering basics
[carveJwlIkooP6JGAAIwe30JlM.git] / trail.h
1 #ifndef TRAIL_H
2 #define TRAIL_H
3
4 #include "skaterift.h"
5
6 typedef struct trail_system trail_system;
7 typedef struct trail_point trail_point;
8 typedef struct trail_vert trail_vert;
9
10 struct trail_system {
11 struct trail_point {
12 v3f co, normal, right;
13 f32 alpha;
14 }
15 *array;
16
17 #pragma pack(push,1)
18 struct trail_vert {
19 v4f co; /* xyz: position, w: alpha */
20 }
21 *vertices;
22 #pragma pack(pop)
23
24 i32 head, count, max;
25 GLuint vao, vbo;
26
27 /* render settings */
28 f32 width, lifetime, min_dist;
29 }
30 static trails_test = {
31 .width = 0.25f,
32 .lifetime = 5.0f,
33 .min_dist = 0.5f
34 };
35
36 static void trail_alloc( trail_system *sys, u32 max );
37 static void trail_system_update( trail_system *sys, f32 dt,
38 v3f co, v3f normal, f32 alpha );
39 static void trail_system_debug( trail_system *sys );
40 static void trail_system_prerender( trail_system *sys );
41 static void trail_system_render( trail_system *sys, camera *cam );
42
43 #endif /* TRAIL_H */