X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=scene.h;h=d8fac1ad524a05672feabee916237ddfbeac8acf;hb=refs%2Fheads%2Frigidbody;hp=f448bbc2f8b719c5dd0651d0632408f758df874b;hpb=22f62f001f21d1b91fefd9fc495c122d9ddf205a;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/scene.h b/scene.h index f448bbc..d8fac1a 100644 --- a/scene.h +++ b/scene.h @@ -73,8 +73,7 @@ void scene_supply_buffer( scene_context *ctx, void *buffer ) ctx->arrindices = (u32*)(((u8*)buffer) + vertex_length); } -static void scene_vert_pack_norm( scene_vert *vert, v3f norm ) -{ +static void scene_vert_pack_norm( scene_vert *vert, v3f norm, f32 blend ){ v3f n; v3_muls( norm, 127.0f, n ); v3_minv( n, (v3f){ 127.0f, 127.0f, 127.0f }, n ); @@ -82,7 +81,7 @@ static void scene_vert_pack_norm( scene_vert *vert, v3f norm ) vert->norm[0] = n[0]; vert->norm[1] = n[1]; vert->norm[2] = n[2]; - vert->norm[3] = 0; /* free byte :D */ + vert->norm[3] = blend * 127.0f; } /* @@ -129,7 +128,7 @@ static void scene_add_mdl_submesh( scene_context *ctx, mdl_context *mdl, v3f normal; m3x3_mulv( normal_matrix, src->norm, normal ); - scene_vert_pack_norm( pvert, normal ); + scene_vert_pack_norm( pvert, normal, src->colour[0]*(1.0f/255.0f) ); v2_copy( src->uv, pvert->uv ); } @@ -390,6 +389,7 @@ static bh_system bh_system_scene = .item_closest = scene_bh_closest, .item_swap = scene_bh_swap, .item_debug = scene_bh_debug, + .system_type = 0x1 }; /* @@ -414,7 +414,7 @@ static int scene_raycast( scene_context *s, bh_tree *bh, v3_copy( s->arrvertices[tri[i]].co, vs[i] ); f32 t; - if( ray_tri( vs, co, dir, &t ) ){ + if( ray_tri( vs, co, dir, &t, 0 ) ){ if( t < hit->dist ){ hit->dist = t; hit->tri = tri;