From aa0fe8457cfff9c47c0c9fa4a1c86a79c7cbf9c5 Mon Sep 17 00:00:00 2001 From: omniscient <17525998+omnisci3nce@users.noreply.github.com> Date: Sat, 27 Jul 2024 14:01:16 +1000 Subject: add a pool insert function. move RenderEnt to use handles --- examples/game_demo/game_demo.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'examples/game_demo/game_demo.c') diff --git a/examples/game_demo/game_demo.c b/examples/game_demo/game_demo.c index 7b746d3..5b69251 100644 --- a/examples/game_demo/game_demo.c +++ b/examples/game_demo/game_demo.c @@ -60,6 +60,7 @@ int main() { // gltf file Geometry cube_geo = Geo_CreateCuboid(f32x3(2.0, 2.0, 2.0)); Mesh crate_mesh = Mesh_Create(&cube_geo, false); // dont free as we may use later + MeshHandle crate_mesh_handle = Mesh_pool_insert(Render_GetMeshPool(), &crate_mesh); // TextureHandle albedo_map = // TextureLoadFromFile("assets/demo/crate/Wood_Crate_001_basecolor.jpg"); TextureHandle roughness_map = @@ -75,6 +76,7 @@ int main() { crate_mat.ambient_occlusion_map = ao_map; crate_mat.base_colour = vec3(1.0, 1.0, 1.0); crate_mat.metallic = 0.0; + MaterialHandle crate_mat_handle = Material_pool_insert(Render_GetMaterialPool(), &crate_mat); // ModelHandle cube_handle = ModelLoad_gltf("assets/models/gltf/Cube/glTF/Cube.gltf", false); // ModelHandle cube_handle = ModelLoad_gltf("../../assets/prototyper/prototyper_m.gltf", false); @@ -84,9 +86,10 @@ int main() { // .affine = mat4_ident(), // .casts_shadows = true }; - RenderEnt crate_renderable = { - .mesh = &crate_mesh, .material = &crate_mat, .affine = mat4_scale(3.0), .casts_shadows = true - }; + RenderEnt crate_renderable = { .mesh = crate_mesh_handle, + .material = crate_mat_handle, + .affine = mat4_scale(3.0), + .flags = (REND_ENT_CASTS_SHADOWS | REND_ENT_VISIBLE) }; RenderEnt entities[] = { crate_renderable }; size_t entity_count = 1; -- cgit v1.2.3-70-g09d2