-void solidgen_to_obj( vmf_solid *ctx, const char *path )
-{
- FILE *fp = fopen( path, "w" );
-
- if( fp )
- {
- fprintf( fp, "o vmf_export\n" );
-
- vmf_vert *vert;
-
- // Write vertex block
- for( int i = 0; i < csr_sb_count( ctx->verts ); i ++ )
- {
- vert = &ctx->verts[i];
- fprintf( fp, "v %f %f %f\n", vert->co[0], vert->co[1], vert->co[2] );
- }
-
- // Write normals block
- for( int i = 0; i < csr_sb_count( ctx->verts ); i ++ )
- {
- vert = &ctx->verts[i];
- fprintf( fp, "vn %f %f %f\n", vert->nrm[0], vert->nrm[1], vert->nrm[2] );
- }
-
- fprintf( fp, "s off\n" );
-
- // Indices
- for( int i = 0; i < csr_sb_count( ctx->indices )/3; i ++ )
- {
- u32 * base = ctx->indices + i*3;
- fprintf( fp, "f %u//%u %u//%u %u//%u\n",
- base[2]+1, base[2]+1,
- base[1]+1, base[1]+1,
- base[0]+1, base[0]+1
- );
- }
-
- fclose( fp );
- }
- else
- {
- fprintf( stderr, "Could not open %s for writing\n", path );
- }
-}
-