parent
4ed4452dfb
commit
0e2805ed06
@ -2,6 +2,8 @@
|
|||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="VcsDirectoryMappings">
|
<component name="VcsDirectoryMappings">
|
||||||
<mapping directory="" vcs="Git" />
|
<mapping directory="" vcs="Git" />
|
||||||
|
<mapping directory="$PROJECT_DIR$/cmake-build-debug/_deps/catch2-src" vcs="Git" />
|
||||||
|
<mapping directory="$PROJECT_DIR$/cmake-build-debug/_deps/spdlog-src" vcs="Git" />
|
||||||
<mapping directory="$PROJECT_DIR$/lib/glfw" vcs="Git" />
|
<mapping directory="$PROJECT_DIR$/lib/glfw" vcs="Git" />
|
||||||
<mapping directory="$PROJECT_DIR$/lib/glm" vcs="Git" />
|
<mapping directory="$PROJECT_DIR$/lib/glm" vcs="Git" />
|
||||||
<mapping directory="$PROJECT_DIR$/lib/tinyobjloader" vcs="Git" />
|
<mapping directory="$PROJECT_DIR$/lib/tinyobjloader" vcs="Git" />
|
||||||
|
|||||||
@ -49,7 +49,7 @@ FetchContent_Declare(
|
|||||||
|
|
||||||
FetchContent_MakeAvailable(Catch2 spdlog)
|
FetchContent_MakeAvailable(Catch2 spdlog)
|
||||||
|
|
||||||
target_link_libraries(LayoutEngineTests PRIVATE Catch2::Catch2WithMain spdlog::spdlog)
|
target_link_libraries(LayoutEngineTests PRIVATE Catch2::Catch2WithMain spdlog::spdlog_header_only)
|
||||||
|
|
||||||
include(CTest)
|
include(CTest)
|
||||||
include(Catch)
|
include(Catch)
|
||||||
@ -311,6 +311,8 @@ if(BUILD_GAME)
|
|||||||
src/engine/renderer/loader/async/AssetLoader.cpp
|
src/engine/renderer/loader/async/AssetLoader.cpp
|
||||||
src/engine/renderer/loader/async/AssetLoader.h
|
src/engine/renderer/loader/async/AssetLoader.h
|
||||||
src/engine/renderer/loader/async/AssetLoadingProgressEvent.h
|
src/engine/renderer/loader/async/AssetLoadingProgressEvent.h
|
||||||
|
src/engine/core/scenes/Scene.cpp
|
||||||
|
src/engine/core/scenes/Scene.h
|
||||||
)
|
)
|
||||||
target_compile_options(Dicewars_Siedler PRIVATE
|
target_compile_options(Dicewars_Siedler PRIVATE
|
||||||
-Wall
|
-Wall
|
||||||
@ -334,7 +336,7 @@ if(BUILD_GAME)
|
|||||||
glad
|
glad
|
||||||
OpenGL::GL
|
OpenGL::GL
|
||||||
${FREETYPE_LIBRARIES}
|
${FREETYPE_LIBRARIES}
|
||||||
spdlog::spdlog
|
spdlog::spdlog_header_only
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|||||||
@ -159,7 +159,7 @@ RawModelData OBJLoader::loadModel(const std::string &modelPath) {
|
|||||||
return {"", subModels};
|
return {"", subModels};
|
||||||
}
|
}
|
||||||
|
|
||||||
TexturedModel OBJLoader::uploadToGPU(RawModelData &rawModelData) {
|
TexturedModel OBJLoader::uploadToGPU(const RawModelData &rawModelData) {
|
||||||
Loader loader = Loader::instance();
|
Loader loader = Loader::instance();
|
||||||
|
|
||||||
std::vector<SubModel> subModels;
|
std::vector<SubModel> subModels;
|
||||||
|
|||||||
@ -16,7 +16,7 @@ class OBJLoader {
|
|||||||
public:
|
public:
|
||||||
static std::shared_ptr<TexturedModel> loadModel(const std::string &modelPath, const std::string &texturePath, Loader &loader);
|
static std::shared_ptr<TexturedModel> loadModel(const std::string &modelPath, const std::string &texturePath, Loader &loader);
|
||||||
static RawModelData loadModel(const std::string &modelPath);
|
static RawModelData loadModel(const std::string &modelPath);
|
||||||
static TexturedModel uploadToGPU(RawModelData &rawModelData);
|
static TexturedModel uploadToGPU(const RawModelData &rawModelData);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -86,9 +86,8 @@ TextureData TextureLoader::loadTextureData(const std::string &path, bool flipVer
|
|||||||
return textureData;
|
return textureData;
|
||||||
}
|
}
|
||||||
|
|
||||||
Texture2D TextureLoader::uploadToGPU(RawTextureData &rawTextureData) {
|
Texture2D TextureLoader::uploadToGPU(const RawTextureData &rawTextureData) {
|
||||||
Texture2D texture;
|
Texture2D texture;
|
||||||
texture.pixels = rawTextureData.pixels.data();
|
|
||||||
texture.width = rawTextureData.width;
|
texture.width = rawTextureData.width;
|
||||||
texture.height = rawTextureData.height;
|
texture.height = rawTextureData.height;
|
||||||
texture.channels = rawTextureData.channels;
|
texture.channels = rawTextureData.channels;
|
||||||
@ -119,7 +118,7 @@ Texture2D TextureLoader::uploadToGPU(RawTextureData &rawTextureData) {
|
|||||||
0,
|
0,
|
||||||
format,
|
format,
|
||||||
GL_UNSIGNED_BYTE,
|
GL_UNSIGNED_BYTE,
|
||||||
texture.pixels
|
rawTextureData.pixels.data()
|
||||||
);
|
);
|
||||||
|
|
||||||
glGenerateMipmap(GL_TEXTURE_2D);
|
glGenerateMipmap(GL_TEXTURE_2D);
|
||||||
|
|||||||
@ -17,8 +17,8 @@ class TextureLoader {
|
|||||||
public:
|
public:
|
||||||
static Texture2D loadTexture(const std::string& path, bool flipVertically= true);
|
static Texture2D loadTexture(const std::string& path, bool flipVertically= true);
|
||||||
static RawTextureData loadRawTextureData(const std::string &path, bool flipVertically = true);
|
static RawTextureData loadRawTextureData(const std::string &path, bool flipVertically = true);
|
||||||
static TextureData loadTextureData(const std::string &path, bool flipVertically = true, TextureType textureType);
|
static TextureData loadTextureData(const std::string &path, bool flipVertically = true, TextureType textureType = TextureType::Diffuse);
|
||||||
static Texture2D uploadToGPU(RawTextureData &rawTextureData);
|
static Texture2D uploadToGPU(const RawTextureData &rawTextureData);
|
||||||
static Texture2D uploadToGPU(TextureData& textureData);
|
static Texture2D uploadToGPU(TextureData& textureData);
|
||||||
static void free(Texture2D& texture);
|
static void free(Texture2D& texture);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -147,14 +147,14 @@ nlohmann::json AssetLoader::loadJson(const std::string &path) {
|
|||||||
void AssetLoader::processUploadQueue(int maxPerFrame) {
|
void AssetLoader::processUploadQueue(int maxPerFrame) {
|
||||||
auto uploadQueue = determineUploadQueue(maxPerFrame);
|
auto uploadQueue = determineUploadQueue(maxPerFrame);
|
||||||
for (const auto& intermediateAsset : uploadQueue) {
|
for (const auto& intermediateAsset : uploadQueue) {
|
||||||
std::visit([]<typename T0>(T0& rawData) -> IntermediateAsset {
|
std::visit([]<typename T0>(const T0& rawData) -> void {
|
||||||
using T = std::decay_t<T0>;
|
using T = std::decay_t<T0>;
|
||||||
if constexpr (std::is_same_v<T, RawTextureData>) {
|
if constexpr (std::is_same_v<T, RawTextureData>) {
|
||||||
return processIntermediateTextureAsset(rawData);
|
processIntermediateTextureAsset(rawData);
|
||||||
} else if constexpr (std::is_same_v<T, RawModelData>) {
|
} else if constexpr (std::is_same_v<T, RawModelData>) {
|
||||||
return processIntermediateModelAsset(rawData);
|
processIntermediateModelAsset(rawData);
|
||||||
} else {
|
} else {
|
||||||
return processIntermediateStagedModelAsset(rawData);
|
processIntermediateStagedModelAsset(rawData);
|
||||||
}
|
}
|
||||||
}, intermediateAsset);
|
}, intermediateAsset);
|
||||||
++loaded;
|
++loaded;
|
||||||
@ -175,12 +175,12 @@ std::vector<IntermediateAsset> AssetLoader::determineUploadQueue(const int maxPe
|
|||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AssetLoader::processIntermediateTextureAsset(RawTextureData &textureData) {
|
void AssetLoader::processIntermediateTextureAsset(const RawTextureData &textureData) {
|
||||||
const Texture2D texture = TextureLoader::uploadToGPU(textureData);
|
const Texture2D texture = TextureLoader::uploadToGPU(textureData);
|
||||||
AssetManager::insertLoadedTexture(textureData.name, texture);
|
AssetManager::insertLoadedTexture(textureData.name, texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AssetLoader::processIntermediateModelAsset(RawModelData &modelData) {
|
void AssetLoader::processIntermediateModelAsset(const RawModelData &modelData) {
|
||||||
const TexturedModel texturedModel = OBJLoader::uploadToGPU(modelData);
|
const TexturedModel texturedModel = OBJLoader::uploadToGPU(modelData);
|
||||||
AssetManager::insertTexturedModel(modelData.name, texturedModel);
|
AssetManager::insertTexturedModel(modelData.name, texturedModel);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -72,8 +72,8 @@ private:
|
|||||||
static nlohmann::json loadJson(const std::string& path);
|
static nlohmann::json loadJson(const std::string& path);
|
||||||
std::vector<IntermediateAsset> determineUploadQueue(int maxPerFrame);
|
std::vector<IntermediateAsset> determineUploadQueue(int maxPerFrame);
|
||||||
|
|
||||||
static void processIntermediateTextureAsset(RawTextureData &textureData);
|
static void processIntermediateTextureAsset(const RawTextureData &textureData);
|
||||||
static void processIntermediateModelAsset(RawModelData &modelData);
|
static void processIntermediateModelAsset(const RawModelData &modelData);
|
||||||
static void processIntermediateStagedModelAsset(const RawStagedModelData &stagedModelData);
|
static void processIntermediateStagedModelAsset(const RawStagedModelData &stagedModelData);
|
||||||
|
|
||||||
// Render-Thread schreibt, Loading Thread liest
|
// Render-Thread schreibt, Loading Thread liest
|
||||||
|
|||||||
@ -8,11 +8,5 @@
|
|||||||
#include "UILayer.h"
|
#include "UILayer.h"
|
||||||
|
|
||||||
DicewarsApp::DicewarsApp() {
|
DicewarsApp::DicewarsApp() {
|
||||||
gameMode = std::make_shared<GameMode>();
|
|
||||||
GameLayer* gamelayer = new GameLayer();
|
|
||||||
gamelayer->setGameMode(gameMode);
|
|
||||||
pushLayer(gamelayer);
|
|
||||||
UILayer* uiLayer = new UILayer();
|
|
||||||
uiLayer->setGameMode(gameMode);
|
|
||||||
pushLayer(uiLayer);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,8 +11,6 @@
|
|||||||
|
|
||||||
class DicewarsApp: public Application
|
class DicewarsApp: public Application
|
||||||
{
|
{
|
||||||
private:
|
|
||||||
std::shared_ptr<GameMode> gameMode;
|
|
||||||
public:
|
public:
|
||||||
DicewarsApp();
|
DicewarsApp();
|
||||||
};
|
};
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include "engine/core/Application.h"
|
#include "engine/core/Application.h"
|
||||||
#include "game/DicewarsApp.h"
|
#include "game/DicewarsApp.h"
|
||||||
#include "spdlog/spdlog-inl.h"
|
#include "spdlog/spdlog.h" // ← nur das
|
||||||
// TIP To <b>Run</b> code, press <shortcut actionId="Run"/> or click the <icon src="AllIcons.Actions.Execute"/> icon in the gutter.
|
// TIP To <b>Run</b> code, press <shortcut actionId="Run"/> or click the <icon src="AllIcons.Actions.Execute"/> icon in the gutter.
|
||||||
|
|
||||||
Application* CreateApplication()
|
Application* CreateApplication()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user