2023-02-24 22:09:07 +01:00
|
|
|
#include "Asset/AssetImporter.h"
|
2024-04-18 13:33:35 +02:00
|
|
|
#include "Asset/AssetRegistry.h"
|
|
|
|
|
#include "Asset/FontLoader.h"
|
|
|
|
|
#include "Asset/MaterialLoader.h"
|
2023-02-24 22:09:07 +01:00
|
|
|
#include "Asset/MeshLoader.h"
|
|
|
|
|
#include "Asset/TextureLoader.h"
|
2024-04-18 13:33:35 +02:00
|
|
|
#include "Graphics/Initializer.h"
|
2024-04-23 08:11:44 +02:00
|
|
|
#ifdef __APPLE__
|
2024-04-18 13:33:35 +02:00
|
|
|
#include "Graphics/Metal/Graphics.h"
|
2024-04-23 08:11:44 +02:00
|
|
|
#else
|
|
|
|
|
#include "Graphics/Vulkan/Graphics.h"
|
|
|
|
|
#endif
|
2023-11-05 11:47:22 +01:00
|
|
|
#include "Graphics/StaticMeshVertexData.h"
|
2024-04-18 13:33:35 +02:00
|
|
|
#include "Graphics/Vulkan/Graphics.h"
|
|
|
|
|
#include "Window/PlayView.h"
|
|
|
|
|
#include "Window/WindowManager.h"
|
2024-01-16 19:24:49 +01:00
|
|
|
#include <fmt/core.h>
|
2021-03-31 12:18:16 +02:00
|
|
|
|
2020-03-05 11:43:38 +01:00
|
|
|
using namespace Seele;
|
2022-11-17 16:47:42 +01:00
|
|
|
using namespace Seele::Editor;
|
2021-03-31 12:18:16 +02:00
|
|
|
|
2023-12-12 11:37:00 +01:00
|
|
|
// make it global so it gets deleted last and automatically
|
|
|
|
|
static Gfx::OGraphics graphics;
|
|
|
|
|
|
2024-04-18 13:33:35 +02:00
|
|
|
int main() {
|
2024-04-23 08:11:44 +02:00
|
|
|
std::string gameName = "MeshShadingDemo";
|
2023-11-06 14:47:21 +01:00
|
|
|
#ifdef WIN32
|
2024-04-18 13:33:35 +02:00
|
|
|
std::filesystem::path outputPath = "C:/Users/Dynamitos/MeshShadingDemoGame";
|
|
|
|
|
std::filesystem::path sourcePath = "C:/Users/Dynamitos/MeshShadingDemo";
|
|
|
|
|
std::filesystem::path binaryPath = sourcePath / "bin" / "MeshShadingDemo.dll";
|
2024-01-17 17:57:59 +01:00
|
|
|
#elif __APPLE__
|
2024-04-18 13:33:35 +02:00
|
|
|
std::filesystem::path outputPath = "/Users/dynamitos/MeshShadingDemoGame";
|
|
|
|
|
std::filesystem::path sourcePath = "/Users/dynamitos/MeshShadingDemo";
|
|
|
|
|
std::filesystem::path binaryPath = sourcePath / "cmake" / "libMeshShadingDemo.dylib";
|
2023-11-06 14:47:21 +01:00
|
|
|
#else
|
2024-04-18 13:33:35 +02:00
|
|
|
std::filesystem::path outputPath = "/home/dynamitos/MeshShadingDemoGame";
|
|
|
|
|
std::filesystem::path sourcePath = "/home/dynamitos/MeshShadingDemo";
|
|
|
|
|
std::filesystem::path binaryPath = sourcePath / "cmake" / "libMeshShadingDemo.so";
|
2023-11-06 14:47:21 +01:00
|
|
|
#endif
|
2024-04-18 13:33:35 +02:00
|
|
|
std::filesystem::path cmakePath = outputPath / "cmake";
|
2023-04-09 16:39:53 +02:00
|
|
|
|
2024-04-09 18:24:21 +02:00
|
|
|
#ifdef __APPLE__
|
2024-04-18 13:33:35 +02:00
|
|
|
graphics = new Metal::Graphics();
|
2024-04-09 18:24:21 +02:00
|
|
|
#else
|
2024-04-18 13:33:35 +02:00
|
|
|
graphics = new Vulkan::Graphics();
|
2024-04-09 18:24:21 +02:00
|
|
|
#endif
|
2024-04-18 13:33:35 +02:00
|
|
|
GraphicsInitializer initializer;
|
|
|
|
|
graphics->init(initializer);
|
|
|
|
|
StaticMeshVertexData* vd = StaticMeshVertexData::getInstance();
|
|
|
|
|
vd->init(graphics);
|
|
|
|
|
OWindowManager windowManager = new WindowManager();
|
|
|
|
|
AssetRegistry::init(sourcePath / "Assets", graphics);
|
|
|
|
|
AssetImporter::init(graphics);
|
|
|
|
|
AssetImporter::importFont(FontImportArgs{
|
|
|
|
|
.filePath = "./fonts/Calibri.ttf",
|
|
|
|
|
});
|
|
|
|
|
AssetImporter::importMesh(MeshImportArgs{
|
|
|
|
|
.filePath = sourcePath / "import/models/cube.fbx",
|
|
|
|
|
});
|
2024-04-23 23:21:30 +02:00
|
|
|
AssetImporter::importMesh(MeshImportArgs{
|
|
|
|
|
.filePath = sourcePath / "import/models/after-the-rain-vr-sound/source/Whitechapel.blend",
|
|
|
|
|
.importPath = "Whitechapel"
|
|
|
|
|
});
|
2024-04-18 13:33:35 +02:00
|
|
|
WindowCreateInfo mainWindowInfo;
|
|
|
|
|
mainWindowInfo.title = "SeeleEngine";
|
|
|
|
|
mainWindowInfo.width = 1920;
|
|
|
|
|
mainWindowInfo.height = 1080;
|
|
|
|
|
mainWindowInfo.preferredFormat = Gfx::SE_FORMAT_B8G8R8A8_SRGB;
|
|
|
|
|
auto window = windowManager->addWindow(graphics, mainWindowInfo);
|
|
|
|
|
ViewportCreateInfo sceneViewInfo;
|
|
|
|
|
sceneViewInfo.dimensions.size.x = 1920;
|
|
|
|
|
sceneViewInfo.dimensions.size.y = 1080;
|
|
|
|
|
sceneViewInfo.dimensions.offset.x = 0;
|
|
|
|
|
sceneViewInfo.dimensions.offset.y = 0;
|
|
|
|
|
sceneViewInfo.numSamples = Gfx::SE_SAMPLE_COUNT_1_BIT;
|
|
|
|
|
OGameView sceneView = new Editor::PlayView(graphics, window, sceneViewInfo, binaryPath.generic_string());
|
|
|
|
|
sceneView->setFocused();
|
2023-02-24 22:09:07 +01:00
|
|
|
|
2024-04-18 13:33:35 +02:00
|
|
|
while (windowManager->isActive()) {
|
|
|
|
|
windowManager->render();
|
|
|
|
|
}
|
|
|
|
|
vd->destroy();
|
|
|
|
|
// export game
|
|
|
|
|
if (false) {
|
|
|
|
|
std::filesystem::create_directories(outputPath);
|
|
|
|
|
std::system(fmt::format("cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DGAME_TITLE=\"{}\" -DGAME_DESTINATION=\"{}\" "
|
|
|
|
|
"-DGAME_BINARY=\"{}\" -P ./cmake/ExportProject.cmake",
|
|
|
|
|
gameName, outputPath.generic_string(), binaryPath.generic_string())
|
|
|
|
|
.c_str());
|
|
|
|
|
std::system(fmt::format("cmake -S {} -B {}", cmakePath.generic_string(), cmakePath.generic_string()).c_str());
|
|
|
|
|
std::system(fmt::format("cmake --build {}", cmakePath.generic_string()).c_str());
|
|
|
|
|
std::filesystem::copy(sourcePath / "Assets", outputPath / "Assets", std::filesystem::copy_options::recursive);
|
|
|
|
|
std::filesystem::copy("shaders", outputPath / "shaders", std::filesystem::copy_options::recursive);
|
|
|
|
|
std::filesystem::copy("textures", outputPath / "textures", std::filesystem::copy_options::recursive);
|
2023-11-06 14:47:21 +01:00
|
|
|
#ifdef WIN32
|
2024-04-18 13:33:35 +02:00
|
|
|
std::filesystem::copy_file("assimp-vc143-mt.dll", outputPath / "assimp-vc143-mt.dll");
|
|
|
|
|
std::filesystem::copy_file("slang.dll", outputPath / "slang.dll");
|
|
|
|
|
std::filesystem::copy_file("slang-glslang.dll", outputPath / "slang-glslang.dll");
|
|
|
|
|
std::filesystem::copy_file("slang-llvm.dll", outputPath / "slang-llvm.dll");
|
2023-11-06 14:47:21 +01:00
|
|
|
#endif
|
2024-04-18 13:33:35 +02:00
|
|
|
}
|
|
|
|
|
return 0;
|
2024-04-19 18:23:36 +02:00
|
|
|
}
|