2024-07-05 12:02:46 +02:00
|
|
|
#include "Asset/AssetRegistry.h"
|
|
|
|
|
#include "Graphics/Initializer.h"
|
|
|
|
|
#include "Graphics/StaticMeshVertexData.h"
|
|
|
|
|
#include "Graphics/Vulkan/Graphics.h"
|
|
|
|
|
#include "PlayView.h"
|
2026-11-09 17:18:33 +00:00
|
|
|
#include "Scene/Scene.h"
|
|
|
|
|
#include "System/SystemGraph.h"
|
|
|
|
|
#include "Window/Application.h"
|
2024-07-05 12:02:46 +02:00
|
|
|
#include <fmt/core.h>
|
|
|
|
|
#include <random>
|
|
|
|
|
|
|
|
|
|
using namespace Seele;
|
|
|
|
|
|
|
|
|
|
// make it global so it gets deleted last and automatically
|
|
|
|
|
static Gfx::OGraphics graphics;
|
|
|
|
|
|
|
|
|
|
int main(int argc, char** argv) {
|
|
|
|
|
if (argc > 2)
|
|
|
|
|
{
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
bool useDepthCulling = true;
|
|
|
|
|
if (argc == 2 && strcmp(argv[1], "NOCULL") == 0)
|
|
|
|
|
{
|
|
|
|
|
useDepthCulling = false;
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-27 14:41:23 +01:00
|
|
|
std::filesystem::path binaryPath = "MeshShadingDemo.dll";
|
2024-08-28 17:54:14 +02:00
|
|
|
|
2026-03-13 22:30:46 +01:00
|
|
|
graphics = new Vulkan::Graphics();
|
2024-07-05 12:02:46 +02:00
|
|
|
GraphicsInitializer initializer;
|
|
|
|
|
graphics->init(initializer);
|
|
|
|
|
StaticMeshVertexData* vd = StaticMeshVertexData::getInstance();
|
|
|
|
|
vd->init(graphics);
|
2025-01-29 21:55:11 +01:00
|
|
|
getGlobals().useRayTracing = true;
|
2024-07-05 12:02:46 +02:00
|
|
|
|
2026-11-09 17:18:33 +00:00
|
|
|
// The benchmark is a worldless host: it builds a plain Scene + SystemGraph
|
|
|
|
|
// (no game binary) and hands ownership to the Application, which then steps
|
|
|
|
|
// it once per frame and lets the views render it. The view renders the
|
|
|
|
|
// non-owning application->scene() handle.
|
|
|
|
|
OApplication application = new Application();
|
|
|
|
|
OScene scene = new Scene(graphics);
|
|
|
|
|
OSystemGraph systemGraph = new SystemGraph();
|
|
|
|
|
application->attachWorld(std::move(scene), std::move(systemGraph));
|
2024-10-27 14:41:23 +01:00
|
|
|
AssetRegistry::init("Assets", graphics);
|
2024-07-05 12:02:46 +02:00
|
|
|
vd->commitMeshes();
|
|
|
|
|
WindowCreateInfo mainWindowInfo = {
|
|
|
|
|
.width = 1920,
|
|
|
|
|
.height = 1080,
|
|
|
|
|
.title = "Benchmark",
|
|
|
|
|
.preferredFormat = Gfx::SE_FORMAT_B8G8R8A8_SRGB,
|
|
|
|
|
};
|
2026-11-09 17:18:33 +00:00
|
|
|
auto window = application->addWindow(graphics, mainWindowInfo);
|
2024-07-05 12:02:46 +02:00
|
|
|
ViewportCreateInfo sceneViewInfo = {
|
|
|
|
|
.dimensions =
|
|
|
|
|
{
|
|
|
|
|
.size = {1920, 1080},
|
|
|
|
|
.offset = {0, 0},
|
|
|
|
|
},
|
|
|
|
|
};
|
2026-11-09 17:18:33 +00:00
|
|
|
OGameView sceneView = new PlayView(graphics, window, application->scene(), sceneViewInfo, useDepthCulling);
|
2024-07-05 12:02:46 +02:00
|
|
|
sceneView->setFocused();
|
|
|
|
|
|
2026-11-09 17:18:33 +00:00
|
|
|
while (application->isActive()) {
|
|
|
|
|
application->render();
|
2024-07-05 12:02:46 +02:00
|
|
|
}
|
2024-07-18 11:45:56 +02:00
|
|
|
graphics->waitDeviceIdle();
|
2024-07-05 12:02:46 +02:00
|
|
|
vd->destroy();
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|