diff --git a/.gitignore b/.gitignore index 68ae9ca10740c9530df69bab77b88c587e84ea9f..8d5b73b454c2ebade21010a1eef7d4b89fb94a37 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ build/ builds/ cmake-build-debug/ cmake-build-debug-coverage/ +cmake-build-debug-coverage-event-trace/ imgui.ini .flatpak-builder/ compile_commands.json @@ -13,4 +14,4 @@ compile_commands.json # windows vs stuff .vs/ CMakePresets.json -CMakeSettings.json \ No newline at end of file +CMakeSettings.json diff --git a/CMakeLists.txt b/CMakeLists.txt index 70753536ad8a4081912073c2a5db6394005e0964..ed81edfaef7d952ea0a02e945d872c1717eed312 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,6 +23,7 @@ if (CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) conan_cmake_configure( REQUIRES + assimp/5.2.2 opengl/system glfw/3.3.7 glad/0.1.35 diff --git a/fggl/CMakeLists.txt b/fggl/CMakeLists.txt index 99e994ab1a32af1f0cbe2ad90af9e2ff93e3e4c5..0c2e40a0e5c9f3f29348234ea82a75156d06676e 100644 --- a/fggl/CMakeLists.txt +++ b/fggl/CMakeLists.txt @@ -64,9 +64,9 @@ target_sources(${PROJECT_NAME} find_package(yaml-cpp) target_link_libraries(fggl PUBLIC yaml-cpp) -# spdlog for cleaner logging -find_package(spdlog) -target_link_libraries(${PROJECT_NAME} PRIVATE spdlog::spdlog) +# model loading +find_package(assimp) +target_link_libraries(${PROJECT_NAME} PUBLIC assimp) find_package(freetype) target_link_libraries(${PROJECT_NAME} PUBLIC freetype) diff --git a/fggl/debug/CMakeLists.txt b/fggl/debug/CMakeLists.txt index 09ac442d3f89228ef3919e9969172f3b165e4b38..3cb822eae5e67e1615a43b1cfe189f7bc8fb337f 100644 --- a/fggl/debug/CMakeLists.txt +++ b/fggl/debug/CMakeLists.txt @@ -12,3 +12,7 @@ target_sources(fggl imgui/imgui_impl_glfw.cpp imgui/imgui_impl_opengl3.cpp ) + +# spdlog for cleaner logging +find_package(spdlog) +target_link_libraries(fggl PRIVATE spdlog::spdlog) diff --git a/include/fggl/data/geom.hpp b/include/fggl/data/geom.hpp new file mode 100644 index 0000000000000000000000000000000000000000..c640737363f59d2cf7d98dd81b8db3ac8b930f77 --- /dev/null +++ b/include/fggl/data/geom.hpp @@ -0,0 +1,53 @@ +/* + * ${license.title} + * Copyright (C) 2022 ${license.owner} + * ${license.mailto} + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +// +// Created by webpigeon on 11/06/22. +// + +#ifndef FGGL_DATA_GEOM_HPP +#define FGGL_DATA_GEOM_HPP + +#include <assimp/Importer.hpp> +#include <assimp/scene.h> +#include <assimp/postprocess.h> + +#include <filesystem> +#include "storage.hpp" +#include "model.hpp" + +namespace fggl::data { + + template<> + bool fggl_deserialize(std::filesystem::path &data, StaticMesh *out) { + Assimp::Importer importer; + const aiScene* scene = importer.ReadFile( data.c_str(), aiProcess_Triangulate | aiProcess_FlipUVs ); + + if (!scene || scene->mFlags & AI_SCENE_FLAGS_INCOMPLETE || !scene->mRootNode) { + return false; + } + + //TODO implement the rest of this + return false; + } + +} // namespace fggl::data + +#endif //FGGL_DATA_GEOM_HPP