Update project structure
This commit is contained in:
@@ -19,7 +19,8 @@ include(FetchContent)
|
||||
# EnTT
|
||||
FetchContent_Declare(
|
||||
entt
|
||||
URL https://github.com/skypjack/entt/archive/refs/tags/v3.12.0.tar.gz
|
||||
SYSTEM
|
||||
URL https://github.com/skypjack/entt/releases/download/v3.13.2/entt-v3.13.2.tar.gz
|
||||
)
|
||||
|
||||
FetchContent_MakeAvailable(entt)
|
||||
@@ -27,38 +28,42 @@ FetchContent_MakeAvailable(entt)
|
||||
# GLFW
|
||||
FetchContent_Declare(
|
||||
glfw
|
||||
URL https://github.com/glfw/glfw/releases/download/3.3.8/glfw-3.3.8.zip
|
||||
SYSTEM
|
||||
URL https://github.com/glfw/glfw/releases/download/3.4/glfw-3.4.zip
|
||||
)
|
||||
|
||||
# nlohmann-json
|
||||
FetchContent_Declare(
|
||||
json
|
||||
URL https://github.com/nlohmann/json/releases/download/v3.11.2/json.tar.xz
|
||||
SYSTEM
|
||||
URL https://github.com/nlohmann/json/releases/download/v3.11.3/json.tar.xz
|
||||
)
|
||||
|
||||
FetchContent_MakeAvailable(json)
|
||||
|
||||
option(GLFW_BUILD_DOCS "" OFF)
|
||||
option(GLFW_BUILD_EXAMPLES "" OFF)
|
||||
option(GLFW_BUILD_TESTS "" OFF)
|
||||
option(GLFW_INSTALL "" OFF)
|
||||
set(GLFW_BUILD_DOCS OFF)
|
||||
set(GLFW_BUILD_EXAMPLES OFF)
|
||||
set(GLFW_BUILD_TESTS OFF)
|
||||
set(GLFW_INSTALL OFF)
|
||||
FetchContent_MakeAvailable(glfw)
|
||||
|
||||
|
||||
# fx-gltf
|
||||
FetchContent_Declare(
|
||||
fx-gltf
|
||||
SYSTEM
|
||||
URL https://github.com/jessey-git/fx-gltf/archive/refs/tags/v2.0.0.tar.gz
|
||||
)
|
||||
|
||||
option(FX_GLTF_BUILD_TESTS "" OFF)
|
||||
option(FX_GLTF_INSTALL "" OFF)
|
||||
set(FX_GLTF_BUILD_TESTS OFF)
|
||||
set(FX_GLTF_INSTALL OFF)
|
||||
FetchContent_MakeAvailable(fx-gltf)
|
||||
|
||||
# glm
|
||||
FetchContent_Declare(
|
||||
glm
|
||||
URL https://github.com/g-truc/glm/archive/refs/tags/0.9.9.8.tar.gz
|
||||
SYSTEM
|
||||
URL https://github.com/g-truc/glm/archive/refs/tags/1.0.1.tar.gz
|
||||
)
|
||||
|
||||
FetchContent_MakeAvailable(glm)
|
||||
@@ -66,7 +71,8 @@ FetchContent_MakeAvailable(glm)
|
||||
# glm
|
||||
FetchContent_Declare(
|
||||
spdlog
|
||||
URL https://github.com/gabime/spdlog/archive/refs/tags/v1.11.0.tar.gz
|
||||
SYSTEM
|
||||
URL https://github.com/gabime/spdlog/archive/refs/tags/v1.14.1.tar.gz
|
||||
)
|
||||
|
||||
FetchContent_MakeAvailable(spdlog)
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
],
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Debug",
|
||||
"CMAKE_CXX_FLAGS": "-Wall -Wextra -Wpedantic"
|
||||
"CMAKE_CXX_FLAGS": "-Wall -Wextra -Wpedantic -fdiagnostics-color=always"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
@@ -1,42 +1,2 @@
|
||||
add_library(fever_engine
|
||||
components/transform.cpp
|
||||
core/graphics/framebuffer.cpp
|
||||
core/graphics/image.cpp
|
||||
core/graphics/material.cpp
|
||||
core/graphics/mesh.cpp
|
||||
core/camera.cpp
|
||||
core/game_loop.cpp
|
||||
core/glad.cpp
|
||||
core/light.cpp
|
||||
core/render.cpp
|
||||
core/shader.cpp
|
||||
core/time.cpp
|
||||
input/input.cpp
|
||||
scene/gltf.cpp
|
||||
scene/gltf_loader.cpp
|
||||
util/log.cpp
|
||||
window/window.cpp
|
||||
)
|
||||
|
||||
target_compile_features(fever_engine PUBLIC cxx_std_20)
|
||||
target_include_directories(fever_engine PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
target_link_libraries(
|
||||
fever_engine PUBLIC
|
||||
glad
|
||||
glfw
|
||||
EnTT::EnTT
|
||||
pthread
|
||||
spdlog
|
||||
glm
|
||||
fx-gltf::fx-gltf
|
||||
nlohmann_json::nlohmann_json
|
||||
stb
|
||||
)
|
||||
|
||||
add_executable(Fall-Fever
|
||||
bin/main.cpp
|
||||
bin/controller.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(Fall-Fever PRIVATE fever_engine)
|
||||
add_subdirectory(lib)
|
||||
add_subdirectory(bin)
|
||||
|
||||
6
src/bin/CMakeLists.txt
Normal file
6
src/bin/CMakeLists.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
add_executable(Fall-Fever
|
||||
main.cpp
|
||||
controller.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(Fall-Fever PRIVATE fever_core)
|
||||
@@ -3,14 +3,15 @@
|
||||
#include "components/transform.h"
|
||||
#include "core/camera.h"
|
||||
#include "core/light.h"
|
||||
#include "spdlog/spdlog.h"
|
||||
#include "window/window.h"
|
||||
|
||||
using namespace entt::literals;
|
||||
|
||||
Controller::Controller()
|
||||
Controller::Controller(std::string_view path)
|
||||
{
|
||||
std::filesystem::path document_path("ABeautifulGame.glb");
|
||||
// std::filesystem::path document_path("WaterBottle/glTF-Binary/WaterBottle.glb");
|
||||
spdlog::info("Open {}", path);
|
||||
std::filesystem::path document_path(path);
|
||||
entt::hashed_string document_hash(document_path.string().c_str());
|
||||
|
||||
entt::resource<Gltf> gltf_document =
|
||||
|
||||
@@ -4,13 +4,10 @@
|
||||
|
||||
#include <entt/entt.hpp>
|
||||
#include <glm/glm.hpp>
|
||||
#include <memory>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
class Controller : public GameLoop
|
||||
{
|
||||
public:
|
||||
Controller();
|
||||
Controller(std::string_view path);
|
||||
void update() override;
|
||||
};
|
||||
|
||||
@@ -2,11 +2,12 @@
|
||||
#include "util/log.h"
|
||||
|
||||
#include <GLFW/glfw3.h>
|
||||
#include <iostream>
|
||||
#include <spdlog/spdlog.h>
|
||||
|
||||
auto main() -> int
|
||||
auto main(int argc, char *argv[]) -> int
|
||||
{
|
||||
auto arguments = std::span(argv, argc);
|
||||
|
||||
Log::initialize();
|
||||
|
||||
// Initialize GLFW
|
||||
@@ -17,7 +18,7 @@ auto main() -> int
|
||||
|
||||
{
|
||||
// Create controller
|
||||
Controller controller;
|
||||
Controller controller(arguments[1]);
|
||||
controller.run();
|
||||
}
|
||||
|
||||
|
||||
35
src/lib/CMakeLists.txt
Normal file
35
src/lib/CMakeLists.txt
Normal file
@@ -0,0 +1,35 @@
|
||||
add_library(fever_core
|
||||
components/transform.cpp
|
||||
core/graphics/framebuffer.cpp
|
||||
core/graphics/image.cpp
|
||||
core/graphics/material.cpp
|
||||
core/graphics/mesh.cpp
|
||||
core/camera.cpp
|
||||
core/game_loop.cpp
|
||||
core/glad.cpp
|
||||
core/light.cpp
|
||||
core/render.cpp
|
||||
core/shader.cpp
|
||||
core/time.cpp
|
||||
input/input.cpp
|
||||
scene/gltf.cpp
|
||||
scene/gltf_loader.cpp
|
||||
util/log.cpp
|
||||
window/window.cpp
|
||||
)
|
||||
|
||||
target_compile_features(fever_core PUBLIC cxx_std_20)
|
||||
target_include_directories(fever_core PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
target_link_libraries(
|
||||
fever_core PUBLIC
|
||||
glad
|
||||
glfw
|
||||
EnTT::EnTT
|
||||
pthread
|
||||
spdlog
|
||||
glm::glm
|
||||
fx-gltf::fx-gltf
|
||||
nlohmann_json::nlohmann_json
|
||||
stb
|
||||
)
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
#include <entt/entt.hpp>
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
#define GLM_ENABLE_EXPERIMENTAL
|
||||
#include <glm/gtx/quaternion.hpp>
|
||||
|
||||
struct Transform
|
||||
@@ -42,6 +42,12 @@ Window::Window(entt::dispatcher& event_dispatcher) : event_dispatcher(event_disp
|
||||
glfwSetFramebufferSizeCallback(glfw_window.get(), framebuffer_size_callback);
|
||||
|
||||
init_glad();
|
||||
|
||||
{
|
||||
int width, height;
|
||||
glfwGetFramebufferSize(glfw_window.get(), &width, &height);
|
||||
glViewport(0, 0, width, height);
|
||||
}
|
||||
}
|
||||
|
||||
void Window::glfw_error_callback(int error, char const* description)
|
||||
Reference in New Issue
Block a user