- pscene->verts = buffer_reserve( pscene->verts, pscene->vertex_count,
- &pscene->vertex_cap, submodel->vertex_count, sizeof(model_vert) );
- pscene->indices = buffer_reserve( pscene->indices, pscene->indice_count,
- &pscene->indice_cap, submodel->indice_count, sizeof(u32) );
-
- /* Transform and place vertices */
- model_vert *src_verts = submodel_vert_data( mdl, submodel );
- u32 *src_indices = submodel_indice_data( mdl, submodel );
-
- m4x3f mtx;
- m4x3_identity( mtx );
- m4x3_translate( mtx, pos );
- m4x3_rotate_y( mtx, yaw );
- m4x3_scale( mtx, scale );
-
- boxf bbxnew;
- box_copy( submodel->bbx, bbxnew );
- m4x3_transform_aabb( mtx, bbxnew );
- box_concat( pscene->bbx, bbxnew );
-
- m3x3f rotation;
- m4x3_to_3x3( mtx, rotation );
-
- float rand_hue = vg_randf();
-
- for( u32 i=0; i<submodel->vertex_count; i++ )
- {
- model_vert *pvert = &pscene->verts[ pscene->vertex_count+i ],
- *src = &src_verts[ i ];
-
- m4x3_mulv( mtx, src->co, pvert->co );
- m3x3_mulv( rotation, src->norm, pvert->norm );
-
- v4_copy( src->colour, pvert->colour );
- v2_copy( src->uv, pvert->uv );
-
- float rel_y = src->co[1] / submodel->bbx[1][1];
- pvert->colour[0] = rel_y;
- pvert->colour[2] = rand_hue;