Update project structure
This commit is contained in:
@@ -19,7 +19,8 @@ include(FetchContent)
|
|||||||
# EnTT
|
# EnTT
|
||||||
FetchContent_Declare(
|
FetchContent_Declare(
|
||||||
entt
|
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)
|
FetchContent_MakeAvailable(entt)
|
||||||
@@ -27,38 +28,42 @@ FetchContent_MakeAvailable(entt)
|
|||||||
# GLFW
|
# GLFW
|
||||||
FetchContent_Declare(
|
FetchContent_Declare(
|
||||||
glfw
|
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
|
# nlohmann-json
|
||||||
FetchContent_Declare(
|
FetchContent_Declare(
|
||||||
json
|
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)
|
FetchContent_MakeAvailable(json)
|
||||||
|
|
||||||
option(GLFW_BUILD_DOCS "" OFF)
|
set(GLFW_BUILD_DOCS OFF)
|
||||||
option(GLFW_BUILD_EXAMPLES "" OFF)
|
set(GLFW_BUILD_EXAMPLES OFF)
|
||||||
option(GLFW_BUILD_TESTS "" OFF)
|
set(GLFW_BUILD_TESTS OFF)
|
||||||
option(GLFW_INSTALL "" OFF)
|
set(GLFW_INSTALL OFF)
|
||||||
FetchContent_MakeAvailable(glfw)
|
FetchContent_MakeAvailable(glfw)
|
||||||
|
|
||||||
|
|
||||||
# fx-gltf
|
# fx-gltf
|
||||||
FetchContent_Declare(
|
FetchContent_Declare(
|
||||||
fx-gltf
|
fx-gltf
|
||||||
|
SYSTEM
|
||||||
URL https://github.com/jessey-git/fx-gltf/archive/refs/tags/v2.0.0.tar.gz
|
URL https://github.com/jessey-git/fx-gltf/archive/refs/tags/v2.0.0.tar.gz
|
||||||
)
|
)
|
||||||
|
|
||||||
option(FX_GLTF_BUILD_TESTS "" OFF)
|
set(FX_GLTF_BUILD_TESTS OFF)
|
||||||
option(FX_GLTF_INSTALL "" OFF)
|
set(FX_GLTF_INSTALL OFF)
|
||||||
FetchContent_MakeAvailable(fx-gltf)
|
FetchContent_MakeAvailable(fx-gltf)
|
||||||
|
|
||||||
# glm
|
# glm
|
||||||
FetchContent_Declare(
|
FetchContent_Declare(
|
||||||
glm
|
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)
|
FetchContent_MakeAvailable(glm)
|
||||||
@@ -66,7 +71,8 @@ FetchContent_MakeAvailable(glm)
|
|||||||
# glm
|
# glm
|
||||||
FetchContent_Declare(
|
FetchContent_Declare(
|
||||||
spdlog
|
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)
|
FetchContent_MakeAvailable(spdlog)
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
],
|
],
|
||||||
"cacheVariables": {
|
"cacheVariables": {
|
||||||
"CMAKE_BUILD_TYPE": "Debug",
|
"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
|
add_subdirectory(lib)
|
||||||
components/transform.cpp
|
add_subdirectory(bin)
|
||||||
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)
|
|
||||||
|
|||||||
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 "components/transform.h"
|
||||||
#include "core/camera.h"
|
#include "core/camera.h"
|
||||||
#include "core/light.h"
|
#include "core/light.h"
|
||||||
|
#include "spdlog/spdlog.h"
|
||||||
#include "window/window.h"
|
#include "window/window.h"
|
||||||
|
|
||||||
using namespace entt::literals;
|
using namespace entt::literals;
|
||||||
|
|
||||||
Controller::Controller()
|
Controller::Controller(std::string_view path)
|
||||||
{
|
{
|
||||||
std::filesystem::path document_path("ABeautifulGame.glb");
|
spdlog::info("Open {}", path);
|
||||||
// std::filesystem::path document_path("WaterBottle/glTF-Binary/WaterBottle.glb");
|
std::filesystem::path document_path(path);
|
||||||
entt::hashed_string document_hash(document_path.string().c_str());
|
entt::hashed_string document_hash(document_path.string().c_str());
|
||||||
|
|
||||||
entt::resource<Gltf> gltf_document =
|
entt::resource<Gltf> gltf_document =
|
||||||
|
|||||||
@@ -4,13 +4,10 @@
|
|||||||
|
|
||||||
#include <entt/entt.hpp>
|
#include <entt/entt.hpp>
|
||||||
#include <glm/glm.hpp>
|
#include <glm/glm.hpp>
|
||||||
#include <memory>
|
|
||||||
#include <unordered_map>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
class Controller : public GameLoop
|
class Controller : public GameLoop
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Controller();
|
Controller(std::string_view path);
|
||||||
void update() override;
|
void update() override;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -2,11 +2,12 @@
|
|||||||
#include "util/log.h"
|
#include "util/log.h"
|
||||||
|
|
||||||
#include <GLFW/glfw3.h>
|
#include <GLFW/glfw3.h>
|
||||||
#include <iostream>
|
|
||||||
#include <spdlog/spdlog.h>
|
#include <spdlog/spdlog.h>
|
||||||
|
|
||||||
auto main() -> int
|
auto main(int argc, char *argv[]) -> int
|
||||||
{
|
{
|
||||||
|
auto arguments = std::span(argv, argc);
|
||||||
|
|
||||||
Log::initialize();
|
Log::initialize();
|
||||||
|
|
||||||
// Initialize GLFW
|
// Initialize GLFW
|
||||||
@@ -17,7 +18,7 @@ auto main() -> int
|
|||||||
|
|
||||||
{
|
{
|
||||||
// Create controller
|
// Create controller
|
||||||
Controller controller;
|
Controller controller(arguments[1]);
|
||||||
controller.run();
|
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 <entt/entt.hpp>
|
||||||
#include <glm/glm.hpp>
|
#include <glm/glm.hpp>
|
||||||
|
|
||||||
|
#define GLM_ENABLE_EXPERIMENTAL
|
||||||
#include <glm/gtx/quaternion.hpp>
|
#include <glm/gtx/quaternion.hpp>
|
||||||
|
|
||||||
struct Transform
|
struct Transform
|
||||||
@@ -42,6 +42,12 @@ Window::Window(entt::dispatcher& event_dispatcher) : event_dispatcher(event_disp
|
|||||||
glfwSetFramebufferSizeCallback(glfw_window.get(), framebuffer_size_callback);
|
glfwSetFramebufferSizeCallback(glfw_window.get(), framebuffer_size_callback);
|
||||||
|
|
||||||
init_glad();
|
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)
|
void Window::glfw_error_callback(int error, char const* description)
|
||||||
Reference in New Issue
Block a user