diff --git a/projects/voxelization/src/Voxelization.cpp b/projects/voxelization/src/Voxelization.cpp index 12b179e77815bfb45983bff267a2a29ba8b626b1..a04131cedfdc508e14a3dbd97da642e1af48f8da 100644 --- a/projects/voxelization/src/Voxelization.cpp +++ b/projects/voxelization/src/Voxelization.cpp @@ -301,4 +301,8 @@ void Voxelization::renderVoxelVisualisation( voxelVisualisationPushConstantData, { drawcall }, renderTargets); +} + +void Voxelization::setVoxelExtent(float extent) { + m_voxelExtent = extent; } \ No newline at end of file diff --git a/projects/voxelization/src/Voxelization.hpp b/projects/voxelization/src/Voxelization.hpp index 81039e5e69ae586914c9fbe6a836767babc954e1..25830b171edb9154e37b2d597c2bbbf2daea6b2e 100644 --- a/projects/voxelization/src/Voxelization.hpp +++ b/projects/voxelization/src/Voxelization.hpp @@ -29,6 +29,8 @@ public: const std::vector<vkcv::ImageHandle>& renderTargets, uint32_t mipLevel); + void setVoxelExtent(float extent); + private: vkcv::Core* m_corePtr; @@ -61,5 +63,5 @@ private: }; vkcv::Buffer<VoxelizationInfo> m_voxelInfoBuffer; - const float m_voxelExtent = 20.f; + float m_voxelExtent = 20.f; }; \ No newline at end of file diff --git a/projects/voxelization/src/main.cpp b/projects/voxelization/src/main.cpp index b37f6869c39dee7dbfed4b0c1a3add3613b87a8f..309c75d5cad862ed8bbd43cfd001c05a660caeec 100644 --- a/projects/voxelization/src/main.cpp +++ b/projects/voxelization/src/main.cpp @@ -330,6 +330,7 @@ int main(int argc, const char** argv) { glm::vec2 lightAngles(90.f, 0.f); int voxelVisualisationMip = 0; + float voxelizationExtent = 20.f; auto start = std::chrono::system_clock::now(); const auto appStartTime = start; @@ -413,6 +414,7 @@ int main(int argc, const char** argv) { { shadowMap.getHandle() }); core.prepareImageForSampling(cmdStream, shadowMap.getHandle()); + voxelization.setVoxelExtent(voxelizationExtent); voxelization.voxelizeMeshes( cmdStream, cameraManager.getActiveCamera().getPosition(), @@ -460,7 +462,9 @@ int main(int argc, const char** argv) { ImGui::DragFloat2("Light angles", &lightAngles.x); ImGui::ColorEdit3("Sun color", &lightInfo.sunColor.x); ImGui::DragFloat("Sun strength", &lightInfo.sunStrength); - ImGui::SliderInt("Visualisation mip", &voxelVisualisationMip, 0, 7); + ImGui::Checkbox("Draw voxel visualisation", &renderVoxelVis); + ImGui::SliderInt("Visualisation mip", &voxelVisualisationMip, 0, 7); + ImGui::DragFloat("Voxelization extent", &voxelizationExtent, 1.f, 0.f); voxelVisualisationMip = std::max(voxelVisualisationMip, 0); ImGui::End();