X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=scene.h;h=fb758eb5a3e47edb0a6396db06886d1c1a99628e;hb=0ca7f5ca2560908de1a03db112df67e52b476107;hp=bf69a632b0aab6cd46e6937357391c0ec7c8708b;hpb=34a8df54eb962f3ad2e036355041f5bc5cabe5a0;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/scene.h b/scene.h index bf69a63..fb758eb 100644 --- a/scene.h +++ b/scene.h @@ -10,14 +10,14 @@ typedef struct scene_vert scene_vert; #pragma pack(push,1) -/* 28 byte vertexs, we don't care about the normals too much, +/* 32 byte vertexs, we don't care about the normals too much, * maybe possible to bring down uv to i16s too */ struct scene_vert { v3f co; /* 3*32 */ v2f uv; /* 2*32 */ i8 norm[4]; /* 4*8 */ - u8 lights[4]; /* 4*8 */ + u16 unused[4]; }; #pragma pack(pop) @@ -259,10 +259,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_BYTE, + glVertexAttribIPointer( 3, 4, GL_UNSIGNED_SHORT, stride, (void *)offsetof(scene_vert, lights) ); glEnableVertexAttribArray( 3 ); +#endif VG_CHECK_GL_ERR(); @@ -297,7 +299,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 )