From 3fa88a144750b64c70f9f11db6284318ab9d7be5 Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Fri, 6 Oct 2023 00:43:13 +0200 Subject: [PATCH] More setup code --- src/lightmapper/gpuraytracer.cpp | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/lightmapper/gpuraytracer.cpp b/src/lightmapper/gpuraytracer.cpp index f008372..e3a1043 100644 --- a/src/lightmapper/gpuraytracer.cpp +++ b/src/lightmapper/gpuraytracer.cpp @@ -1,7 +1,10 @@ #include "gpuraytracer.h" #include "vk_renderdevice.h" +#include "vk_raytrace.h" +#include "vk_lightmap.h" #include "renderdoc_app.h" +#include "doom_levelmesh.h" #ifndef _WIN32 #include @@ -20,7 +23,7 @@ GPURaytracer::~GPURaytracer() { } -void GPURaytracer::Raytrace(DoomLevelMesh* levelMesh) +void GPURaytracer::Raytrace(DoomLevelMesh* mesh) { if (rdoc_api) rdoc_api->StartFrameCapture(nullptr, nullptr); @@ -34,10 +37,28 @@ void GPURaytracer::Raytrace(DoomLevelMesh* levelMesh) try { - // To do raytrace here + auto raytrace = mDevice->GetRaytrace(); + auto lightmap = mDevice->GetLightmap(); + + // mDevice->GetTextureManager()->CreateLightmap(mesh->LMTextureSize, mesh->LMTextureCount); + printf("."); + raytrace->SetLevelMesh(mesh); + lightmap->SetLevelMesh(mesh); + raytrace->BeginFrame(); + lightmap->BeginFrame(); + printf("."); + // lightmap->Raytrace(surfaces); + printf("."); + /* + TArray buffer; + for (int arrayIndex = 0; arrayIndex < mesh->LMTextureCount; arrayIndex++) + { + mDevice->GetTextureManager()->DownloadLightmap(arrayIndex, buffer); + } + */ } catch (...) {