-
- route->start = inf->id_start;
- route->active = 0;
- route->factive = 0.0f;
- mdl_node_transform( pnode, route->scoreboard_transform );
-
- /* OpenGL strips */
- glGenVertexArrays( 1, &route->ui.vao );
- glGenBuffers( 1, &route->ui.vbo );
- glGenBuffers( 1, &route->ui.ebo );
- glBindVertexArray( route->ui.vao );
-
- size_t stride = sizeof(v2f);
-
- glBindBuffer( GL_ARRAY_BUFFER, route->ui.vbo );
- glBufferData( GL_ARRAY_BUFFER, k_route_ui_max_verts*stride,
- NULL, GL_DYNAMIC_DRAW );
- glBindVertexArray( route->ui.vao );
- glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, route->ui.ebo );
- glBufferData( GL_ELEMENT_ARRAY_BUFFER,
- k_route_ui_max_indices*sizeof(u16), NULL,
- GL_DYNAMIC_DRAW );
-
- glVertexAttribPointer( 0, 2, GL_FLOAT, GL_FALSE, stride, (void *)0 );
- glEnableVertexAttribArray( 0 );
- VG_CHECK_GL();
-
- route->ui.indices_head = k_route_ui_max_indices - 9;
- route->ui.vertex_head = k_route_ui_max_verts - 200;
- route->ui.segment_start = 0;
- route->ui.segment_count = 0;
- route->ui.last_notch = 0.0;
- route->ui.fade_start = 0;
- route->ui.fade_count = 0;
- route->ui.fade_timer_start = 0.0;
-
- r->route_count ++;
- }
- }
-
- /*
- * Apply correct system-local ids
- */
- for( int i=0; i<r->node_count; i++ )
- {
- struct route_node *rn = &r->nodes[i];
-
- for( int j=0; j<2; j++ )
- world_id_fixup( &rn->next[j], mdl );
- }
-
- for( int i=0; i<r->route_count; i++ )
- {
- struct route *route = &r->routes[i];
- world_id_fixup( &route->start, mdl );
- }
-
- /*
- * Gather references
- */
- for( int i=0; i<r->route_count; i++ )
- {
- struct route *route = &r->routes[i];
-
- u32 stack[64];
- u32 si = world_routes_get_path( route->start, stack );
-
- for( int sj=0; sj<si; sj++ )
- {
- struct route_node *rn = &r->nodes[ stack[sj] ];
- rn->route_ids[ rn->ref_count ++ ] = i;
-
- if( rn->ref_count > 4 )
- vg_warn( "Too many references on route node %i\n", i );