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"
|
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;
|
|
|
|
|
|
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";
|
2024-01-17 17:57:59 +01:00
|
|
|
#elif __APPLE__
|
|
|
|
|
std::filesystem::path outputPath = "/dynamitos/TrackClearGame";
|
|
|
|
|
std::filesystem::path sourcePath= "/dynamitos/TrackClear";
|
|
|
|
|
std::filesystem::path binaryPath = sourcePath / "cmake" / "libTrackClear.dynlib";
|
2023-11-06 14:47:21 +01:00
|
|
|
#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-12-12 11:37:00 +01:00
|
|
|
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);
|
2023-11-22 13:18:54 +01:00
|
|
|
OWindowManager windowManager = new WindowManager();
|
2023-11-06 14:47:21 +01:00
|
|
|
AssetRegistry::init(sourcePath / "Assets", graphics);
|
2023-11-08 23:27:21 +01:00
|
|
|
AssetImporter::init(graphics);
|
2023-02-24 22:09:07 +01:00
|
|
|
AssetImporter::importFont(FontImportArgs{
|
|
|
|
|
.filePath = "./fonts/Calibri.ttf",
|
|
|
|
|
});
|
2023-11-22 13:18:54 +01:00
|
|
|
//AssetImporter::importMesh(MeshImportArgs{
|
|
|
|
|
// .filePath = sourcePath / "old_resources/models/arena.fbx",
|
|
|
|
|
// });
|
2023-11-27 22:50:37 +01:00
|
|
|
AssetImporter::importMesh(MeshImportArgs{
|
|
|
|
|
.filePath = sourcePath / "old_resources/models/frog.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
|
|
|
});
|
2023-11-22 13:18:54 +01:00
|
|
|
//AssetImporter::importMesh(MeshImportArgs{
|
|
|
|
|
// .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
|
|
|
});
|
2023-12-02 10:55:00 +01:00
|
|
|
AssetImporter::importMesh(MeshImportArgs{
|
|
|
|
|
.filePath = sourcePath / "old_resources/models/sponza/sponza.gltf",
|
|
|
|
|
});
|
2023-11-22 13:18:54 +01:00
|
|
|
//AssetImporter::importMesh(MeshImportArgs{
|
|
|
|
|
// .filePath= sourcePath / "old_resources/models/flameThrower.fbx",
|
|
|
|
|
// });
|
|
|
|
|
//AssetImporter::importMesh(MeshImportArgs{
|
|
|
|
|
// .filePath= sourcePath / "old_resources/models/player.fbx",
|
|
|
|
|
// });
|
|
|
|
|
//AssetImporter::importMesh(MeshImportArgs{
|
|
|
|
|
// .filePath= sourcePath / "old_resources/models/shotgun.fbx",
|
|
|
|
|
// });
|
|
|
|
|
//AssetImporter::importMesh(MeshImportArgs{
|
|
|
|
|
// .filePath= sourcePath / "old_resources/models/track.fbx",
|
|
|
|
|
// });
|
|
|
|
|
//AssetImporter::importMesh(MeshImportArgs{
|
|
|
|
|
// .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";
|
2023-11-30 11:51:53 +01:00
|
|
|
mainWindowInfo.width = 1920;
|
|
|
|
|
mainWindowInfo.height = 1080;
|
2023-11-16 22:58:47 +01:00
|
|
|
mainWindowInfo.preferredFormat = Gfx::SE_FORMAT_B8G8R8A8_SRGB;
|
2023-01-29 18:58:59 +01:00
|
|
|
auto window = windowManager->addWindow(graphics, mainWindowInfo);
|
2022-04-02 17:42:07 +02:00
|
|
|
ViewportCreateInfo sceneViewInfo;
|
2023-11-30 11:51:53 +01:00
|
|
|
sceneViewInfo.dimensions.size.x = 1920;
|
|
|
|
|
sceneViewInfo.dimensions.size.y = 1080;
|
2022-11-17 16:47:42 +01:00
|
|
|
sceneViewInfo.dimensions.offset.x = 0;
|
|
|
|
|
sceneViewInfo.dimensions.offset.y = 0;
|
2023-12-11 14:45:37 +01:00
|
|
|
sceneViewInfo.numSamples = Gfx::SE_SAMPLE_COUNT_4_BIT;
|
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
|
|
|
|
2023-04-09 16:39:53 +02:00
|
|
|
|
2023-12-02 10:55:00 +01:00
|
|
|
while (windowManager->isActive())
|
|
|
|
|
{
|
|
|
|
|
windowManager->render();
|
|
|
|
|
}
|
2023-12-12 11:37:00 +01:00
|
|
|
vd->destroy();
|
2023-12-02 10:55:00 +01:00
|
|
|
//export game
|
|
|
|
|
if (false)
|
|
|
|
|
{
|
|
|
|
|
std::filesystem::create_directories(outputPath);
|
2024-01-16 19:24:49 +01:00
|
|
|
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());
|
2023-12-02 10:55:00 +01:00
|
|
|
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
|
2023-12-02 10:55:00 +01: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
|
2023-12-02 10:55:00 +01:00
|
|
|
}
|
2022-04-02 17:42:07 +02:00
|
|
|
return 0;
|
2022-04-15 11:19:30 +02:00
|
|
|
}
|