From c6096a028d57da1026aa86ac215ea2f07461cd96 Mon Sep 17 00:00:00 2001 From: nathan Date: Sat, 27 Dec 2025 13:23:04 -0700 Subject: cubemap thingy working --- src/entities/johnsStore.c | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) (limited to 'src/entities') diff --git a/src/entities/johnsStore.c b/src/entities/johnsStore.c index 3a96afc..5a38bd7 100644 --- a/src/entities/johnsStore.c +++ b/src/entities/johnsStore.c @@ -2,31 +2,36 @@ void initJohnsStore(Entity* entity) { - /* bool cubemap[8][8] = { */ - /* {true, true, true, true, true, true, true, true}, */ - /* {true, false, false, false, false, false, false, true}, */ - /* {true, false, false, false, false, false, false, true}, */ - /* {true, false, false, false, false, false, false, true}, */ - /* {true, false, false, false, false, false, false, true}, */ - /* {true, false, false, false, false, false, false, true}, */ - /* {true, false, false, false, false, false, false, true}, */ - /* {true, true, true, false, false, true, true, true} */ - /* }; */ + Color colors[] = { + WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, + WHITE, BLACK, BLACK, BLACK, BLACK, WHITE, + WHITE, BLACK, BLACK, BLACK, BLACK, WHITE, + WHITE, BLACK, BLACK, BLACK, BLACK, WHITE, + WHITE, BLACK, BLACK, BLACK, BLACK, WHITE, + WHITE, WHITE, BLACK, BLACK, WHITE, WHITE + }; - /* Image heightmap = generateCubemapImage((const bool**)cubemap, 8, 8); */ - /* entity->data = (void*)createEntityBuilding(heightmap); */ - /* UnloadImage(heightmap); */ + int width = 6; + int height = 6; - entity->box = (BoundingBox){ - .min = (Vector3){-1.0, -1.0, -1.0}, - .max = (Vector3){1.0, 1.0, 1.0} + Image cubemap = (Image){ + .data = colors, + .width = width, + .height = height, + .format = PIXELFORMAT_UNCOMPRESSED_R8G8B8A8, + .mipmaps = 1 }; + + entity->data = (void*)createEntityBuilding(cubemap); + EntityBuilding* building = (EntityBuilding*)entity->data; + entity->box = GetModelBoundingBox(building->model); } void updateJohnsStore(Entity* entity, Game* game) { EntityBuilding* building = (EntityBuilding*)entity->data; DrawModel(building->model, entity->position, 1.0, WHITE); + DrawBoundingBox(entity->box, RED); } void closeJohnsStore(Entity* entity) -- cgit v1.2.3