vg_info( "%d foliage models added\n", count );
}
-#if 0
-VG_STATIC void world_ents_allocate( world_instance *world )
-{
- vg_info( "Allocating entities\n" );
-
- /* --count entites to allocate buffers for them.--
- * --maybe in the future we just store these numbers in the model file...--
- *
- * ... 16.03.23: I HOPE YOUR FUCKING HAPPY
- * ... 22.03.23: incomprehensible pain
- *
- * -- use this in world_routes too --
- *
- */
-
- struct countable
- {
- enum classtype ct, ct1;
- void **to_allocate;
- u32 item_size;
- int count;
- }
- entity_counts[] =
- {
- {
- k_classtype_spawn,
- k_classtype_none,
- (void*)&world->spawns,
- sizeof(struct respawn_point)
- },
- {
- k_classtype_audio,
- k_classtype_none,
- (void*)&world->audio_things,
- sizeof(struct world_audio_thing)
- },
- {
- k_classtype_world_light,
- k_classtype_none,
- (void*)&world->lights,
- sizeof(struct world_light)
- },
- {
- k_classtype_nonlocal_gate,
- k_classtype_none,
- (void*)&world->nonlocal_gates,
- sizeof(struct nonlocal_gate)
- },
- };
-
- for( int i=0; i<vg_list_size(entity_counts); i++ )
- entity_counts[i].count = 0;
-
- for( int i=0; i<world->meta->info.node_count; i++ )
- {
- mdl_node *pnode = mdl_node_from_id( world->meta, i );
-
- for( int j=0; j<vg_list_size(entity_counts); j ++ )
- {
- if( (pnode->classtype == entity_counts[j].ct) ||
- (pnode->classtype == entity_counts[j].ct1) )
- {
- pnode->sub_uid = entity_counts[j].count;
- entity_counts[j].count ++;
- break;
- }
- }
- }
-
- for( int i=0; i<vg_list_size(entity_counts); i++ )
- {
- struct countable *counter = &entity_counts[i];
-
- u32 bufsize = counter->item_size*counter->count;
- *counter->to_allocate = vg_linear_alloc( world_global.generic_heap,
- bufsize );
- memset( *counter->to_allocate, 0, bufsize );
- }
-
- world->volume_bh = bh_create( world_global.generic_heap,
- &bh_system_volumes,
- world,
- world->volume_count,
- 1 );
-}
-#endif
#if 0
VG_STATIC void world_pct_spawn( world_instance *world, mdl_node *pnode )
rp->name = mdl_pstr( world->meta, pnode->pstr_name );
}
-VG_STATIC void world_pct_water( world_instance *world, mdl_node *pnode )
-{
- if( world->water.enabled )
- {
- vg_warn( "Multiple water surfaces in level! ('%s')\n",
- mdl_pstr( world->meta, pnode->pstr_name ));
- return;
- }
-
- world->water.enabled = 1;
- water_set_surface( world, pnode->co[1] );
-}
-
VG_STATIC void world_pct_audio( world_instance *world, mdl_node *pnode )
{
struct world_audio_thing *thing = &world->audio_things[
mesh_free( &world->mesh_route_lines );
mesh_free( &world->mesh_geo );
mesh_free( &world->mesh_no_collide );
-
+
+ /* glDeleteBuffers silently ignores 0's and names that do not correspond to
+ * existing buffer objects.
+ * */
glDeleteBuffers( 1, &world->tbo_light_entities );
glDeleteTextures( 1, &world->tex_light_entities );
glDeleteTextures( 1, &world->tex_light_cubes );
/* FIXME: CANT DO THIS HERE */
/* whynot? */
+ /* oh this should be moved to a global function */
world_global.time = 0.0;
world_global.rewind_from = 0.0;
world_global.rewind_to = 0.0;
vg_linear_clear( world->audio_vgl );
#endif
-
vg_release_thread_sync();
}
memset( &world->meta, 0, sizeof(mdl_context) );
/*
- * TODO: Theres probably a better way to do this?
- */
+ * TODO: Theres probably a better way to do this? */
+ /* yep, find all members that can be memsetted to 0. this is probably
+ * every member anyway, given the below is just setting to 0
+ *
+ * also: rename clean to init? */
world->textures = NULL;
world->texture_count = 0;
world->geo_bh = NULL;
world->volume_bh = NULL;
world->audio_bh = NULL;
+ world->rendering_gate = NULL;
world->water.enabled = 0;
ent_gate *gate = mdl_arritm( &world->ent_gate, j );
gate_transform_update( gate );
}
+
+ /* water */
+ for( u32 j=0; j<mdl_arrcount(&world->ent_water); j++ ){
+ ent_water *water = mdl_arritm( &world->ent_water, j );
+ if( world->water.enabled ){
+ vg_warn( "Multiple water surfaces in level!\n" );
+ break;
+ }
+
+ world->water.enabled = 1;
+ water_set_surface( world, water->transform.co[1] );
+ }
}
VG_STATIC void world_load( world_instance *world, const char *path )
"ent_checkpoint", world_global.generic_heap );
mdl_load_array( &world->meta, &world->ent_route,
"ent_route", world_global.generic_heap );
+ mdl_load_array( &world->meta, &world->ent_water,
+ "ent_water", world_global.generic_heap );
mdl_close( &world->meta );