trail rendering basics
[carveJwlIkooP6JGAAIwe30JlM.git] / trail.h
diff --git a/trail.h b/trail.h
new file mode 100644 (file)
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 */