X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=scene.h;h=63b351d3e320fd74b5527a0b5532b786a5231c0c;hb=343d594b37f42a94f220a5089c9db36da9da3ab4;hp=902aedbff9924a8e4f2b7301d3e85bf6014dff4b;hpb=aa4c26eae2208872824e0eb5b71bc05c16d43242;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/scene.h b/scene.h index 902aedb..63b351d 100644 --- a/scene.h +++ b/scene.h @@ -183,15 +183,14 @@ VG_STATIC scene *scene_fix( void *lin_alloc, scene *pscene ) { /* FIXME: Why is this disabled? */ - return pscene; u32 vertex_count = pscene->vertex_count, indice_count = pscene->indice_count, vertex_length = vertex_count * sizeof(scene_vert), index_length = indice_count * sizeof(u32), - tot_size = sizeof(scene) + vertex_length + index_length; + tot_size = sizeof(scene) + vertex_length + index_length; /* copy down index data */ - void *dst_indices = pscene->arrvertices + vertex_length; + void *dst_indices = pscene->arrvertices + vertex_count; memmove( dst_indices, pscene->arrindices, index_length ); /* realloc */ @@ -298,7 +297,20 @@ VG_STATIC float scene_bh_centroid( void *user, u32 item_index, int axis ) *pb = &s->arrvertices[ s->arrindices[item_index*3+1] ], *pc = &s->arrvertices[ s->arrindices[item_index*3+2] ]; + #if 0 + + float min, max; + + min = vg_minf( pa->co[axis], pb->co[axis] ); + max = vg_maxf( pa->co[axis], pb->co[axis] ); + min = vg_minf( min, pc->co[axis] ); + max = vg_maxf( max, pc->co[axis] ); + + return (min+max) * 0.5f; + + #else return (pa->co[axis] + pb->co[axis] + pc->co[axis]) * (1.0f/3.0f); + #endif } VG_STATIC void scene_bh_swap( void *user, u32 ia, u32 ib )