+ else if( pnode->classtype == k_classtype_car_path )
+ {
+ struct classtype_car_path *p = mdl_get_entdata( mworld, pnode );
+ traffic_node *tn = &world.traffic[ world.traffic_count ];
+ tn->mn_next = NULL;
+ tn->mn_next1 = NULL;
+
+ if( p->target ) tn->mn_next = mdl_node_from_id( mworld, p->target );
+ if( p->target1 ) tn->mn_next1 = mdl_node_from_id( mworld, p->target1 );
+
+ m4x3f transform;
+ mdl_node_transform( pnode, transform );
+ m3x3_mulv( transform, (v3f){1.0f,0.0f,0.0f}, tn->h );
+ v3_copy( transform[3], tn->co );
+
+ pnode->sub_uid = world.traffic_count ++;
+ }
+ else if( pnode->classtype == k_classtype_instance )
+ {
+ struct classtype_instance *inst = mdl_get_entdata( mworld, pnode );
+ pnode->sub_uid = 0;
+
+ int cached = 0;
+ for( int i=0; i<world.instance_cache_count; i++ )
+ {
+ struct instance_cache *cache = &world.instance_cache[i];
+ if( inst->pstr_file == cache->pstr_file )
+ {
+ cached = 1;
+ pnode->sub_uid = i+1;
+ break;
+ }
+ }
+
+ if( !cached )
+ {
+ world.instance_cache = buffer_reserve(
+ world.instance_cache, world.instance_cache_count,
+ &world.instance_cache_cap, 1,
+ sizeof(struct instance_cache) );
+
+ struct instance_cache *cache =
+ &world.instance_cache[world.instance_cache_count];
+
+ const char *filename = mdl_pstr(mworld, inst->pstr_file);
+
+ cache->pstr_file = inst->pstr_file;
+ cache->mdl = mdl_load( filename );
+
+ if( cache->mdl )
+ {
+ world.instance_cache_count ++;
+ pnode->sub_uid = world.instance_cache_count;
+ mdl_link_materials( mworld, cache->mdl );
+ vg_success( "Cached %s\n", filename );
+ }
+ else
+ {
+ vg_warn( "Failed to cache %s\n", filename );
+ }
+ }
+ }