diff --git a/include/sk_map.h b/include/sk_map.h index 9ddd7b7..8565b9b 100644 --- a/include/sk_map.h +++ b/include/sk_map.h @@ -31,6 +31,9 @@ typedef struct { sk_map_kind kind; Shader pbr_shader; Model floor; + Model wall1; + Model wall2; + Model wall3; } sk_map; sk_map sk_map_create(sk_map_kind kind); diff --git a/src/sk_map.c b/src/sk_map.c index b348256..5675676 100644 --- a/src/sk_map.c +++ b/src/sk_map.c @@ -32,27 +32,60 @@ sk_map sk_map_create(sk_map_kind kind) { void sk_map_destroy(sk_map *m) { UnloadModel(m->floor); + UnloadModel(m->wall1); + UnloadModel(m->wall2); + UnloadModel(m->wall3); UnloadShader(m->pbr_shader); } void sk_map_load(sk_map *m) { - m->floor = LoadModelFromMesh(GenMeshPlane(32, 32, 1, 1)); - assert(m->floor.meshCount == 1); - assert(m->floor.materialCount == 1); m->pbr_shader.locs[SHADER_LOC_MAP_ALBEDO] = GetShaderLocation(m->pbr_shader, "albedoMap"); m->pbr_shader.locs[SHADER_LOC_MAP_METALNESS] = GetShaderLocation(m->pbr_shader, "mraMap"); m->pbr_shader.locs[SHADER_LOC_MAP_NORMAL] = GetShaderLocation(m->pbr_shader, "normalMap"); m->pbr_shader.locs[SHADER_LOC_MAP_EMISSION] = GetShaderLocation(m->pbr_shader, "emissiveMap"); m->pbr_shader.locs[SHADER_LOC_COLOR_DIFFUSE] = GetShaderLocation(m->pbr_shader, "albedoColor"); m->pbr_shader.locs[SHADER_LOC_VECTOR_VIEW] = GetShaderLocation(m->pbr_shader, "viewPos"); + m->floor = LoadModelFromMesh(GenMeshPlane(32, 32, 1, 1)); + assert(m->floor.meshCount == 1); + assert(m->floor.materialCount == 1); // m->floor.materials[0].shader = m->pbr_shader; m->floor.materials[0].maps[MATERIAL_MAP_ALBEDO].texture = LoadTexture("assets/textures/wood/albedo.png"); m->floor.materials[0].maps[MATERIAL_MAP_NORMAL].texture = LoadTexture("assets/textures/wood/normal.png"); m->floor.materials[0].maps[MATERIAL_MAP_ROUGHNESS].texture = LoadTexture("assets/textures/wood/roughness.png"); m->floor.materials[0].maps[MATERIAL_MAP_HEIGHT].texture = LoadTexture("assets/textures/wood/height.png"); m->floor.materials[0].maps[MATERIAL_MAP_OCCLUSION].texture = LoadTexture("assets/textures/wood/ao.png"); + m->wall1 = LoadModelFromMesh(GenMeshCube(1, 5, 32)); + assert(m->wall1.meshCount == 1); + assert(m->wall1.materialCount == 1); + // m->wall1.materials[0].shader = m->pbr_shader; + m->wall1.materials[0].maps[MATERIAL_MAP_ALBEDO].texture = LoadTexture("assets/textures/stone1/albedo.png"); + m->wall1.materials[0].maps[MATERIAL_MAP_NORMAL].texture = LoadTexture("assets/textures/stone1/normal.png"); + m->wall1.materials[0].maps[MATERIAL_MAP_ROUGHNESS].texture = LoadTexture("assets/textures/stone1/roughness.png"); + m->wall1.materials[0].maps[MATERIAL_MAP_HEIGHT].texture = LoadTexture("assets/textures/stone1/height.png"); + m->wall1.materials[0].maps[MATERIAL_MAP_OCCLUSION].texture = LoadTexture("assets/textures/stone1/ao.png"); + m->wall2 = LoadModelFromMesh(GenMeshCube(1, 5, 32)); + assert(m->wall2.meshCount == 1); + assert(m->wall2.materialCount == 1); + // m->wall2.materials[0].shader = m->pbr_shader; + m->wall2.materials[0].maps[MATERIAL_MAP_ALBEDO].texture = LoadTexture("assets/textures/stone1/albedo.png"); + m->wall2.materials[0].maps[MATERIAL_MAP_NORMAL].texture = LoadTexture("assets/textures/stone1/normal.png"); + m->wall2.materials[0].maps[MATERIAL_MAP_ROUGHNESS].texture = LoadTexture("assets/textures/stone1/roughness.png"); + m->wall2.materials[0].maps[MATERIAL_MAP_HEIGHT].texture = LoadTexture("assets/textures/stone1/height.png"); + m->wall2.materials[0].maps[MATERIAL_MAP_OCCLUSION].texture = LoadTexture("assets/textures/stone1/ao.png"); + m->wall3 = LoadModelFromMesh(GenMeshCube(32, 5, 1)); + assert(m->wall3.meshCount == 1); + assert(m->wall3.materialCount == 1); + // m->wall3.materials[0].shader = m->pbr_shader; + m->wall3.materials[0].maps[MATERIAL_MAP_ALBEDO].texture = LoadTexture("assets/textures/stone1/albedo.png"); + m->wall3.materials[0].maps[MATERIAL_MAP_NORMAL].texture = LoadTexture("assets/textures/stone1/normal.png"); + m->wall3.materials[0].maps[MATERIAL_MAP_ROUGHNESS].texture = LoadTexture("assets/textures/stone1/roughness.png"); + m->wall3.materials[0].maps[MATERIAL_MAP_HEIGHT].texture = LoadTexture("assets/textures/stone1/height.png"); + m->wall3.materials[0].maps[MATERIAL_MAP_OCCLUSION].texture = LoadTexture("assets/textures/stone1/ao.png"); } void sk_map_draw(sk_map *m) { DrawModel(m->floor, (Vector3) { 0, 0, 0 }, 1, WHITE); + DrawModel(m->wall1, (Vector3) { -16, 2.5f, 0 }, 1, WHITE); + DrawModel(m->wall2, (Vector3) { 16, 2.5f, 0 }, 1, WHITE); + DrawModel(m->wall3, (Vector3) { 0, 2.5f, 16 }, 1, WHITE); } diff --git a/src/sk_renderer_draw.c b/src/sk_renderer_draw.c index dda21a2..674fa65 100644 --- a/src/sk_renderer_draw.c +++ b/src/sk_renderer_draw.c @@ -105,10 +105,6 @@ static void __draw_gameplay_world(sk_state *s) { sk_weapon_draw(&s->player.weapon, &s->player.camera, (Vector3) { 1, -1, -3 }, 0.5f); sk_player_draw(&s->player); sk_map_draw(&s->map); - // DrawPlane((Vector3) { 0, 0, 0 }, (Vector2) { 32, 32 }, DARKGRAY); - DrawCube((Vector3) { -16, 2.5f, 0 }, 1, 5, 32, MAROON); - DrawCube((Vector3) { 16, 2.5f, 0 }, 1, 5, 32, LIME); - DrawCube((Vector3) { 0, 2.5f, 16 }, 32, 5, 1, GOLD); EndMode3D(); }