Files
Seele/src/Editor/main.cpp
T

258 lines
11 KiB
C++
Raw Normal View History

2021-09-29 22:12:56 +02:00
#include "Window/WindowManager.h"
2021-01-19 15:30:00 +01:00
#include "Window/SceneView.h"
2023-02-24 22:09:07 +01:00
#include "Window/PlayView.h"
2021-09-23 10:10:39 +02:00
#include "Window/InspectorView.h"
2020-06-02 11:46:18 +02:00
#include "Asset/AssetRegistry.h"
2023-02-24 22:09:07 +01:00
#include "Asset/AssetImporter.h"
2023-02-13 14:56:13 +01:00
#include "Asset/TextureLoader.h"
2023-11-05 10:36:01 +01:00
#include "Graphics/Vulkan/Graphics.h"
2023-02-24 22:09:07 +01:00
#include "Asset/MeshLoader.h"
#include "Asset/TextureLoader.h"
#include "Asset/MaterialLoader.h"
#include "Asset/FontLoader.h"
#include "Asset/AssetImporter.h"
2023-11-05 11:47:22 +01:00
#include "Graphics/StaticMeshVertexData.h"
2023-11-06 14:47:21 +01:00
#include <format>
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-02-24 22:09:07 +01:00
extern AssetRegistry* instance;
2020-03-05 11:43:38 +01:00
int main()
2020-02-05 20:58:58 +01:00
{
2023-11-06 14:47:21 +01:00
#ifdef WIN32
std::filesystem::path outputPath = "C:/Users/Dynamitos/TrackClearGame";
std::filesystem::path sourcePath= "C:/Users/Dynamitos/TrackClear";
std::filesystem::path binaryPath = sourcePath / "bin" / "TrackClear.dll";
#else
std::filesystem::path outputPath = "/home/dynamitos/TrackClearGame";
std::filesystem::path sourcePath= "/home/dynamitos/TrackClear";
std::filesystem::path binaryPath = sourcePath / "cmake" / "libTrackClear.so";
#endif
2023-04-09 16:39:53 +02:00
std::string gameName = "TrackClear";
2023-11-06 14:47:21 +01:00
std::filesystem::path cmakePath = outputPath / "cmake";
2023-04-09 16:39:53 +02:00
2023-11-05 10:36:01 +01:00
Gfx::OGraphics graphics = new Vulkan::Graphics();
2023-02-13 14:56:13 +01:00
2023-01-29 18:58:59 +01:00
GraphicsInitializer initializer;
graphics->init(initializer);
2023-11-05 11:47:22 +01:00
StaticMeshVertexData* vd = StaticMeshVertexData::getInstance();
vd->init(graphics);
2022-04-02 17:42:07 +02:00
PWindowManager windowManager = new WindowManager();
2023-11-06 14:47:21 +01:00
AssetRegistry::init(sourcePath / "Assets", graphics);
2023-08-26 15:19:12 +02:00
AssetImporter::init(graphics, AssetRegistry::getInstance());
2023-02-24 22:09:07 +01:00
AssetImporter::importFont(FontImportArgs{
.filePath = "./fonts/Calibri.ttf",
});
AssetImporter::importMesh(MeshImportArgs{
2023-11-06 14:47:21 +01:00
.filePath = sourcePath / "old_resources/models/arena.fbx",
2023-02-24 22:09:07 +01:00
});
AssetImporter::importMesh(MeshImportArgs{
2023-11-06 14:47:21 +01:00
.filePath = sourcePath / "old_resources/models/train.fbx",
2023-02-24 22:09:07 +01:00
});
AssetImporter::importMesh(MeshImportArgs{
2023-11-06 14:47:21 +01:00
.filePath= sourcePath / "old_resources/models/bird.fbx",
2023-02-24 22:09:07 +01:00
});
AssetImporter::importMesh(MeshImportArgs{
2023-11-06 14:47:21 +01:00
.filePath= sourcePath / "old_resources/models/cube.fbx",
2023-02-24 22:09:07 +01:00
});
AssetImporter::importMesh(MeshImportArgs{
2023-11-06 14:47:21 +01:00
.filePath= sourcePath / "old_resources/models/flameThrower.fbx",
2023-02-24 22:09:07 +01:00
});
AssetImporter::importMesh(MeshImportArgs{
2023-11-06 14:47:21 +01:00
.filePath= sourcePath / "old_resources/models/player.fbx",
2023-02-24 22:09:07 +01:00
});
AssetImporter::importMesh(MeshImportArgs{
2023-11-06 14:47:21 +01:00
.filePath= sourcePath / "old_resources/models/shotgun.fbx",
2023-02-24 22:09:07 +01:00
});
AssetImporter::importMesh(MeshImportArgs{
2023-11-06 14:47:21 +01:00
.filePath= sourcePath / "old_resources/models/track.fbx",
2023-02-24 22:09:07 +01:00
});
AssetImporter::importMesh(MeshImportArgs{
2023-11-06 14:47:21 +01:00
.filePath= sourcePath / "old_resources/models/zombie.fbx",
2023-02-24 22:09:07 +01:00
});
AssetImporter::importTexture(TextureImportArgs{
2023-11-06 14:47:21 +01:00
.filePath= sourcePath / "old_resources/textures/Dirt.png",
2023-02-24 22:09:07 +01:00
});
AssetImporter::importTexture(TextureImportArgs{
2023-11-06 14:47:21 +01:00
.filePath= sourcePath / "old_resources/textures/DirtGrass.png",
2023-02-24 22:09:07 +01:00
});
AssetImporter::importTexture(TextureImportArgs{
2023-11-06 14:47:21 +01:00
.filePath= sourcePath / "old_resources/textures/Grass.png",
2023-02-24 22:09:07 +01:00
});
AssetImporter::importTexture(TextureImportArgs{
2023-11-06 14:47:21 +01:00
.filePath= sourcePath / "old_resources/textures/Ice.png",
2023-02-24 22:09:07 +01:00
});
AssetImporter::importTexture(TextureImportArgs{
2023-11-06 14:47:21 +01:00
.filePath= sourcePath / "old_resources/textures/Lava.png",
2023-02-24 22:09:07 +01:00
});
AssetImporter::importTexture(TextureImportArgs{
2023-11-06 14:47:21 +01:00
.filePath= sourcePath / "old_resources/textures/Obsidian.png",
2023-02-24 22:09:07 +01:00
});
AssetImporter::importTexture(TextureImportArgs{
2023-11-06 14:47:21 +01:00
.filePath= sourcePath / "old_resources/textures/Rocks.png",
2023-02-24 22:09:07 +01:00
});
AssetImporter::importTexture(TextureImportArgs{
2023-11-06 14:47:21 +01:00
.filePath= sourcePath / "old_resources/textures/Sand.png",
2023-02-24 22:09:07 +01:00
});
AssetImporter::importTexture(TextureImportArgs{
2023-11-06 14:47:21 +01:00
.filePath= sourcePath / "old_resources/textures/Water.png",
2023-02-24 22:09:07 +01:00
});
AssetImporter::importTexture(TextureImportArgs{
2023-11-06 14:47:21 +01:00
.filePath= sourcePath / "old_resources/textures/Wood.png",
2023-02-24 22:09:07 +01:00
});
AssetImporter::importTexture(TextureImportArgs{
2023-11-06 14:47:21 +01:00
.filePath= sourcePath / "old_resources/textures/level0/blendMap.png",
2023-02-24 22:09:07 +01:00
.importPath = "level0",
});
AssetImporter::importTexture(TextureImportArgs{
2023-11-06 14:47:21 +01:00
.filePath= sourcePath / "old_resources/textures/level0/heightMap.png",
2023-02-24 22:09:07 +01:00
.importPath = "level0",
});
AssetImporter::importTexture(TextureImportArgs{
2023-11-06 14:47:21 +01:00
.filePath= sourcePath / "old_resources/textures/level0/trackMap.png",
2023-02-24 22:09:07 +01:00
.importPath = "level0",
});
AssetImporter::importMaterial(MaterialImportArgs{
2023-11-06 14:47:21 +01:00
.filePath= sourcePath / "old_resources/shaders/TerrainMaterial.json",
2023-02-24 22:09:07 +01:00
.importPath = "level0",
});
AssetImporter::importTexture(TextureImportArgs{
2023-11-06 14:47:21 +01:00
.filePath= sourcePath / "old_resources/textures/level1/blendMap.png",
2023-02-24 22:09:07 +01:00
.importPath = "level1",
});
AssetImporter::importTexture(TextureImportArgs{
2023-11-06 14:47:21 +01:00
.filePath= sourcePath / "old_resources/textures/level1/heightMap.png",
2023-02-24 22:09:07 +01:00
.importPath = "level1",
});
AssetImporter::importTexture(TextureImportArgs{
2023-11-06 14:47:21 +01:00
.filePath= sourcePath / "old_resources/textures/level1/trackMap.png",
2023-02-24 22:09:07 +01:00
.importPath = "level1",
});
AssetImporter::importTexture(TextureImportArgs{
2023-11-06 14:47:21 +01:00
.filePath= sourcePath / "old_resources/textures/level2/blendMap.png",
2023-02-24 22:09:07 +01:00
.importPath = "level2",
});
AssetImporter::importTexture(TextureImportArgs{
2023-11-06 14:47:21 +01:00
.filePath= sourcePath / "old_resources/textures/level2/heightMap.png",
2023-02-24 22:09:07 +01:00
.importPath = "level2",
});
AssetImporter::importTexture(TextureImportArgs{
2023-11-06 14:47:21 +01:00
.filePath= sourcePath / "old_resources/textures/level2/trackMap.png",
2023-02-24 22:09:07 +01:00
.importPath = "level2",
});
AssetImporter::importTexture(TextureImportArgs{
2023-11-06 14:47:21 +01:00
.filePath= sourcePath / "old_resources/textures/level3/blendMap.png",
2023-02-24 22:09:07 +01:00
.importPath = "level3",
});
AssetImporter::importTexture(TextureImportArgs{
2023-11-06 14:47:21 +01:00
.filePath= sourcePath / "old_resources/textures/level3/heightMap.png",
2023-02-24 22:09:07 +01:00
.importPath = "level3",
});
AssetImporter::importTexture(TextureImportArgs{
2023-11-06 14:47:21 +01:00
.filePath= sourcePath / "old_resources/textures/level3/trackMap.png",
2023-02-24 22:09:07 +01:00
.importPath = "level3",
});
AssetImporter::importTexture(TextureImportArgs{
2023-11-06 14:47:21 +01:00
.filePath= sourcePath / "old_resources/textures/level4/blendMap.png",
2023-02-24 22:09:07 +01:00
.importPath = "level4",
});
AssetImporter::importTexture(TextureImportArgs{
2023-11-06 14:47:21 +01:00
.filePath= sourcePath / "old_resources/textures/level4/heightMap.png",
2023-02-24 22:09:07 +01:00
.importPath = "level4",
});
AssetImporter::importTexture(TextureImportArgs{
2023-11-06 14:47:21 +01:00
.filePath= sourcePath / "old_resources/textures/level4/trackMap.png",
2023-02-24 22:09:07 +01:00
.importPath = "level4",
});
AssetImporter::importTexture(TextureImportArgs{
2023-11-06 14:47:21 +01:00
.filePath= sourcePath / "old_resources/textures/level5/blendMap.png",
2023-02-24 22:09:07 +01:00
.importPath = "level5",
});
AssetImporter::importTexture(TextureImportArgs{
2023-11-06 14:47:21 +01:00
.filePath= sourcePath / "old_resources/textures/level5/heightMap.png",
2023-02-24 22:09:07 +01:00
.importPath = "level5",
});
AssetImporter::importTexture(TextureImportArgs{
2023-11-06 14:47:21 +01:00
.filePath= sourcePath / "old_resources/textures/level5/trackMap.png",
2023-02-24 22:09:07 +01:00
.importPath = "level5",
});
AssetImporter::importTexture(TextureImportArgs{
2023-11-06 14:47:21 +01:00
.filePath= sourcePath / "old_resources/textures/level6/blendMap.png",
2023-02-24 22:09:07 +01:00
.importPath = "level6",
});
AssetImporter::importTexture(TextureImportArgs{
2023-11-06 14:47:21 +01:00
.filePath= sourcePath / "old_resources/textures/level6/heightMap.png",
2023-02-24 22:09:07 +01:00
.importPath = "level6",
});
AssetImporter::importTexture(TextureImportArgs{
2023-11-06 14:47:21 +01:00
.filePath= sourcePath / "old_resources/textures/level6/trackMap.png",
2023-02-24 22:09:07 +01:00
.importPath = "level6",
});
AssetImporter::importTexture(TextureImportArgs{
2023-11-06 14:47:21 +01:00
.filePath= sourcePath / "old_resources/textures/level7/blendMap.png",
2023-02-24 22:09:07 +01:00
.importPath = "level7",
});
AssetImporter::importTexture(TextureImportArgs{
2023-11-06 14:47:21 +01:00
.filePath= sourcePath / "old_resources/textures/level7/heightMap.png",
2023-02-24 22:09:07 +01:00
.importPath = "level7",
});
AssetImporter::importTexture(TextureImportArgs{
2023-11-06 14:47:21 +01:00
.filePath= sourcePath / "old_resources/textures/level7/trackMap.png",
2023-02-24 22:09:07 +01:00
.importPath = "level7",
});
AssetImporter::importTexture(TextureImportArgs{
2023-11-06 14:47:21 +01:00
.filePath= sourcePath / "old_resources/skyboxes/FS000_Day_01.png",
2023-02-24 22:09:07 +01:00
.type = TextureImportType::TEXTURE_CUBEMAP,
});
AssetImporter::importTexture(TextureImportArgs{
2023-11-06 14:47:21 +01:00
.filePath= sourcePath / "old_resources/skyboxes/FS000_Night_01.png",
2023-02-24 22:09:07 +01:00
.type = TextureImportType::TEXTURE_CUBEMAP,
});
2022-04-02 17:42:07 +02:00
WindowCreateInfo mainWindowInfo;
mainWindowInfo.title = "SeeleEngine";
mainWindowInfo.width = 1280;
mainWindowInfo.height = 720;
mainWindowInfo.bFullscreen = false;
mainWindowInfo.numSamples = 1;
mainWindowInfo.pixelFormat = Gfx::SE_FORMAT_B8G8R8A8_UNORM;
2023-01-29 18:58:59 +01:00
auto window = windowManager->addWindow(graphics, mainWindowInfo);
2022-04-02 17:42:07 +02:00
ViewportCreateInfo sceneViewInfo;
2022-11-17 16:47:42 +01:00
sceneViewInfo.dimensions.size.x = 1280;
sceneViewInfo.dimensions.size.y = 720;
sceneViewInfo.dimensions.offset.x = 0;
sceneViewInfo.dimensions.offset.y = 0;
2023-11-07 16:55:13 +01:00
OGameView sceneView = new Editor::PlayView(graphics, window, sceneViewInfo, binaryPath.generic_string());
2022-04-02 17:42:07 +02:00
2023-02-01 22:13:04 +01:00
//ViewportCreateInfo inspectorViewInfo;
//inspectorViewInfo.dimensions.size.x = 640;
//inspectorViewInfo.dimensions.size.y = 720;
//inspectorViewInfo.dimensions.offset.x = 640;
//inspectorViewInfo.dimensions.offset.y = 0;
//PInspectorView inspectorView = new InspectorView(graphics, window, inspectorViewInfo);
2022-11-17 16:47:42 +01:00
//window->addView(inspectorView);
2022-04-02 17:42:07 +02:00
sceneView->setFocused();
2022-03-19 22:45:30 +01:00
2022-04-02 17:42:07 +02:00
window->render();
2023-01-29 18:58:59 +01:00
//export game
2023-04-09 16:39:53 +02:00
std::filesystem::create_directories(outputPath);
2023-11-06 14:47:21 +01:00
std::system(std::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(std::format("cmake -S {} -B {}", cmakePath.generic_string(), cmakePath.generic_string()).c_str());
std::system(std::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);
#ifdef WIN32
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");
#endif
2022-04-02 17:42:07 +02:00
return 0;
2022-04-15 11:19:30 +02:00
}