diff --git a/CMakeLists.txt b/CMakeLists.txt index af368e1..d4aa351 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,5 @@ cmake_minimum_required(VERSION 3.7) - option(VERSION_STRING "Project version string" "0.0.0") project(antkeeper VERSION ${VERSION_STRING} LANGUAGES CXX) diff --git a/src/game/biome.hpp b/src/game/biome.hpp deleted file mode 100644 index 7a272c1..0000000 --- a/src/game/biome.hpp +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (C) 2021 Christopher J. Howard - * - * This file is part of Antkeeper source code. - * - * Antkeeper source code is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Antkeeper source code is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Antkeeper source code. If not, see . - */ - -#ifndef ANTKEEPER_BIOME_HPP -#define ANTKEEPER_BIOME_HPP - -#include -#include "utility/fundamental-types.hpp" -class material; -class image; - -struct biome -{ - std::string name; - - /// Latitude (radians), longitude (radians), altitude (meters) - float3 location; - - // Terrain - material* terrain_material; - - // Weather - image* sky_palette; - image* sun_palette; - image* moon_palette; - image* ambient_palette; - image* shadow_palette; - - // Traits -}; - -#endif // ANTKEEPER_BIOME_HPP diff --git a/src/game/context.hpp b/src/game/context.hpp index ff01952..e32637a 100644 --- a/src/game/context.hpp +++ b/src/game/context.hpp @@ -63,7 +63,6 @@ class timeline; class renderer; class outline_pass; -struct biome; template class animation; template class material_property; @@ -250,9 +249,6 @@ struct context entity::system::orbit* orbit_system; entity::system::proteome* proteome_system; - // Game - biome* biome; - // Debug debug::cli* cli; }; diff --git a/src/resources/biome-loader.cpp b/src/resources/biome-loader.cpp deleted file mode 100644 index 899223a..0000000 --- a/src/resources/biome-loader.cpp +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright (C) 2021 Christopher J. Howard - * - * This file is part of Antkeeper source code. - * - * Antkeeper source code is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Antkeeper source code is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Antkeeper source code. If not, see . - */ - -#include "resource-loader.hpp" -#include "resource-manager.hpp" -#include "game/biome.hpp" -#include "math/angles.hpp" -#include -#include - -template -static bool load_value(T* value, const nlohmann::json& json, const std::string& name) -{ - if (auto element = json.find(name); element != json.end()) - { - *value = element.value().get(); - return true; - } - - return false; -} - -template -static bool load_array(T* value, std::size_t size, const nlohmann::json& json, const std::string& name) -{ - if (auto element = json.find(name); element != json.end()) - { - std::size_t i = 0; - for (auto it = element.value().cbegin(); (it != element.value().cend()) && (i < size); ++it) - { - *(value++) = it.value().get(); - ++i; - } - - return true; - } - - return false; -} - -template <> -biome* resource_loader::load(resource_manager* resource_manager, PHYSFS_File* file) -{ - // Read file into buffer - std::size_t size = static_cast(PHYSFS_fileLength(file)); - std::string buffer; - buffer.resize(size); - PHYSFS_readBytes(file, &buffer[0], size); - - // Parse json from file buffer - nlohmann::json json = nlohmann::json::parse(buffer); - - biome* biome = new ::biome(); - - load_value(&biome->name, json, "name"); - - float3 location; - if (load_array(&location.x, 3, json, "location")) - { - biome->location = {math::radians(location.x), math::radians(location.y), location.z}; - } - - if (auto terrain = json.find("terrain"); terrain != json.end()) - { - std::string material_filename; - if (load_value(&material_filename, terrain.value(), "material")) - { - biome->terrain_material = resource_manager->load<::material>(material_filename); - } - } - - if (auto weather = json.find("weather"); weather != json.end()) - { - std::string sky_palette_filename; - if (load_value(&sky_palette_filename, weather.value(), "sky_palette")) - { - biome->sky_palette = resource_manager->load(sky_palette_filename); - } - - std::string sun_palette_filename; - if (load_value(&sun_palette_filename, weather.value(), "sun_palette")) - { - biome->sun_palette = resource_manager->load(sun_palette_filename); - } - - std::string moon_palette_filename; - if (load_value(&moon_palette_filename, weather.value(), "moon_palette")) - { - biome->moon_palette = resource_manager->load(moon_palette_filename); - } - - std::string ambient_palette_filename; - if (load_value(&ambient_palette_filename, weather.value(), "ambient_palette")) - { - biome->ambient_palette = resource_manager->load(ambient_palette_filename); - } - - std::string shadow_palette_filename; - if (load_value(&shadow_palette_filename, weather.value(), "shadow_palette")) - { - biome->shadow_palette = resource_manager->load(shadow_palette_filename); - } - } - - return biome; -} -