*.old
*.bin
*.swp
-*.c0
+*.generated
*.gc
# soft links
#include "vg/vg_msg.h"
#include "addon_types.h"
-#define C0_STOPGAP
#include "vg/vg_m.h"
#include "model.h"
#include "model.c"
-#include "c0_stopgap.c"
/*
* Addon metadata utilities
vg_syscall( "mkdir -p bin/%s/tools", proj->uid.buffer );
vg_syscall( "cp bin/skaterift_blender.zip bin/%s/tools/", proj->uid.buffer );
}
+
+#include "build_control_overlay.c"
void build_game_bin( struct vg_project *proj, struct vg_compiler_env *env )
{
build_game_metadata();
vg_low( "\n\n" );
}
-
-#include "control_overlay.h"
+
+ build_control_overlay();
struct vg_compiler_conf conf = {0};
--- /dev/null
+/*
+ * Script to load the overlay model and generate an enum referencing each
+ * submesh by its name.
+ */
+void build_control_overlay(void)
+{
+ FILE *hdr = fopen( "control_overlay.h.generated", "w" );
+ mdl_context ctx;
+ mdl_open( &ctx, "content_skaterift/models/rs_overlay.mdl", NULL );
+ mdl_load_metadata_block( &ctx, NULL );
+ mdl_close( &ctx );
+
+ for( u32 i=0; i<mdl_arrcount( &ctx.meshs ); i ++ )
+ {
+ mdl_mesh *mesh = mdl_arritm( &ctx.meshs, i );
+ fprintf( hdr, " %s = %u,\n",
+ mdl_pstr( &ctx, mesh->pstr_name ), mesh->submesh_start );
+ }
+
+ fclose( hdr );
+}
+++ /dev/null
-#include <stdio.h>
-#include <stdarg.h>
-FILE *c0_file = NULL;
-static void c0_start( const char *fn )
-{
- c0_file = fopen( fn, "w" );
-}
-
-static void c0_end(void)
-{
- fclose( c0_file );
- c0_file = NULL;
-}
-
-static void c0_echof( const char *fmt, ... )
-{
- va_list args;
- va_start( args, fmt );
- vfprintf( c0_file, fmt, args );
- va_end( args );
-}
#pragma once
-#ifdef C0_STOPGAP /* -> control_overlay.h.c0 */
-
-c0_start( "control_overlay.h.c0" );
-mdl_context ctx;
-mdl_open( &ctx, "content_skaterift/models/rs_overlay.mdl", NULL );
-mdl_load_metadata_block( &ctx, NULL );
-mdl_close( &ctx );
-
-for( u32 i=0; i<mdl_arrcount( &ctx.meshs ); i ++ )
-{
- mdl_mesh *mesh = mdl_arritm( &ctx.meshs, i );
- c0_echof( " %s = %u,\n",
- mdl_pstr( &ctx, mesh->pstr_name ), mesh->submesh_start );
-}
-c0_end();
-
-#else
-
enum control_overlay_mesh
{
- #include "control_overlay.h.c0"
+ #include "control_overlay.h.generated"
};
struct control_overlay
void control_overlay_render(void);
void control_overlay_init(void);
-
-#endif
#include "vg/vg_io.h"
-#ifndef C0_STOPGAP
+#ifdef VG_3D
#include "vg/vg_async.h"
#include "vg/vg_tex.h"
#endif
+
#include "vg/vg_msg.h"
#include "vg/vg_string.h"
#include <string.h>
* ----------------------------------------------------------------------------
*/
-#ifndef C0_STOPGAP
+#ifdef VG_3D
static void mesh_upload( glmesh *mesh,
mdl_vert *verts, u32 vert_count,
u32 *indices, u32 indice_count )
return mdl_arritm( &mdl->submeshs, mesh->submesh_start );
}
-#ifndef C0_STOPGAP
+#ifdef VG_3D
struct payload_glmesh_load
{
mdl_vert *verts;