#pragma once
+#include "vg/vg_engine.h"
+#include "vg/vg_platform.h"
+#include "vg/vg_m.h"
+#include "vg/vg_lines.h"
+#include "vg/vg_async.h"
+#include "vg/vg_camera.h"
#include "trail.h"
#include "shaders/particle.h"
#include "shaders/trail.h"
sys->count ++;
}
-static void trail_system_update( trail_system *sys, f32 dt,
- v3f co, v3f normal, f32 alpha ){
+void trail_system_update( trail_system *sys, f32 dt,
+ v3f co, v3f normal, f32 alpha )
+{
/* update existing points and clip dead ones */
bool clip_allowed = 1;
for( i32 i=0; i<sys->count; i ++ ){
pdest->alpha = alpha;
}
-static void trail_system_debug( trail_system *sys ){
+void trail_system_debug( trail_system *sys )
+{
for( i32 i=0; i<sys->count; i ++ ){
i32 i0 = sys->head - sys->count + i;
if( i0 < 0 ) i0 += sys->max;
trail_system *sys;
};
-static void async_trail_init( void *payload, u32 size ){
+void async_trail_init( void *payload, u32 size )
+{
struct trail_init_args *args = payload;
trail_system *sys = args->sys;
VG_CHECK_GL_ERR();
}
-static void trail_alloc( trail_system *sys, u32 max ){
+void trail_alloc( trail_system *sys, u32 max )
+{
size_t stride = sizeof(trail_vert);
sys->max = max;
sys->array = vg_linear_alloc( vg_mem.rtmemory, max*sizeof(trail_point) );
vg_async_dispatch( call, async_trail_init );
}
-static void trail_system_prerender( trail_system *sys ){
+void trail_system_prerender( trail_system *sys )
+{
if( sys->count < 2 ) return;
for( i32 i=0; i<sys->count; i ++ ){
glBufferSubData( GL_ARRAY_BUFFER, 0, sys->count*stride*2, sys->vertices );
}
-static void trail_system_render( trail_system *sys, camera *cam ){
+void trail_system_render( trail_system *sys, vg_camera *cam )
+{
if( sys->count < 2 ) return;
glDisable( GL_CULL_FACE );
glEnable( GL_DEPTH_TEST );
glBindVertexArray( sys->vao );
glDrawArrays( GL_TRIANGLE_STRIP, 0, sys->count*2 );
}
-
-static void trail_init( void ){
- shader_trail_register();
-}