X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=scene.h;h=cd1a8ea10689b5eb0c9303209b43dfa0b2c35ff3;hb=a1056ed8198f0f5be0e0f341da8bd49aa6c47198;hp=fa1ce4dbc8bc782a23953c22889aa20d7c27d384;hpb=409edea2cf6271956137918e4e0b4f1c2addf620;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/scene.h b/scene.h index fa1ce4d..cd1a8ea 100644 --- a/scene.h +++ b/scene.h @@ -17,7 +17,7 @@ struct scene_vert v3f co; /* 3*32 */ v2f uv; /* 2*32 */ i8 norm[4]; /* 4*8 */ - u16 lights[4]; /* 4*16 */ + u16 unused[4]; }; #pragma pack(pop) @@ -78,8 +78,7 @@ VG_STATIC void scene_vert_pack_norm( scene_vert *vert, v3f norm ) VG_STATIC void scene_add_mdl_submesh( scene *pscene, mdl_context *mdl, mdl_submesh *sm, m4x3f transform ) { - if( pscene->vertex_count + sm->vertex_count > pscene->max_vertices ) - { + if( pscene->vertex_count + sm->vertex_count > pscene->max_vertices ){ vg_error( "%u(current) + %u > %u\n", pscene->vertex_count, sm->vertex_count, pscene->max_vertices ); @@ -88,8 +87,7 @@ VG_STATIC void scene_add_mdl_submesh( scene *pscene, mdl_context *mdl, vg_fatal_exit_loop( "Scene vertex buffer overflow" ); } - if( pscene->indice_count + sm->indice_count > pscene->max_indices ) - { + if( pscene->indice_count + sm->indice_count > pscene->max_indices ){ vg_error( "%u(current) + %u > %u\n", pscene->indice_count, sm->indice_count, pscene->max_indices ); @@ -98,10 +96,10 @@ VG_STATIC void scene_add_mdl_submesh( scene *pscene, mdl_context *mdl, vg_fatal_exit_loop( "Scene index buffer overflow" ); } - mdl_vert *src_verts = mdl_submesh_vertices( mdl, sm ); + mdl_vert *src_verts = mdl_arritm( &mdl->verts, sm->vertex_start ); scene_vert *dst_verts = &pscene->arrvertices[ pscene->vertex_count ]; - u32 *src_indices = mdl_submesh_indices( mdl, sm ), + u32 *src_indices = mdl_arritm( &mdl->indices, sm->indice_start ), *dst_indices = &pscene->arrindices[ pscene->indice_count ]; /* Transform and place vertices */ @@ -116,8 +114,7 @@ VG_STATIC void scene_add_mdl_submesh( scene *pscene, mdl_context *mdl, v3_normalize( normal_matrix[1] ); v3_normalize( normal_matrix[2] ); - for( u32 i=0; ivertex_count; i++ ) - { + for( u32 i=0; ivertex_count; i++ ){ mdl_vert *src = &src_verts[ i ]; scene_vert *pvert = &dst_verts[ i ]; @@ -259,10 +256,12 @@ VG_STATIC void scene_upload( scene *pscene, glmesh *mesh ) stride, (void *)offsetof(scene_vert, uv) ); glEnableVertexAttribArray( 2 ); +#if 0 /* 3: light cluster */ glVertexAttribIPointer( 3, 4, GL_UNSIGNED_SHORT, stride, (void *)offsetof(scene_vert, lights) ); glEnableVertexAttribArray( 3 ); +#endif VG_CHECK_GL_ERR();