Works like garbage
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#include "CBT.h"
|
||||
#include "Graphics/Shader.h"
|
||||
#include "Asset/AssetRegistry.h"
|
||||
|
||||
using namespace Seele;
|
||||
|
||||
@@ -240,6 +241,8 @@ void MeshUpdater::init(Gfx::PGraphics gfx, Gfx::PDescriptorLayout viewParamsLayo
|
||||
layout->addDescriptorBinding(Gfx::DescriptorBinding{21, Gfx::SE_DESCRIPTOR_TYPE_STORAGE_BUFFER});
|
||||
layout->addDescriptorBinding(Gfx::DescriptorBinding{22, Gfx::SE_DESCRIPTOR_TYPE_STORAGE_BUFFER});
|
||||
layout->addDescriptorBinding(Gfx::DescriptorBinding{23, Gfx::SE_DESCRIPTOR_TYPE_STORAGE_BUFFER});
|
||||
layout->addDescriptorBinding(Gfx::DescriptorBinding{24, Gfx::SE_DESCRIPTOR_TYPE_SAMPLER});
|
||||
layout->addDescriptorBinding(Gfx::DescriptorBinding{25, Gfx::SE_DESCRIPTOR_TYPE_SAMPLED_IMAGE});
|
||||
layout->create();
|
||||
pipelineLayout = graphics->createPipelineLayout("ComputeLayout");
|
||||
pipelineLayout->addDescriptorLayout(viewParamsLayout);
|
||||
|
||||
@@ -30,6 +30,8 @@ constexpr auto MODIFIED_BISECTOR_INDICES = 20;
|
||||
constexpr auto LEB_POSITION_BUFFER = 21;
|
||||
constexpr auto LEB_MATRIX_CACHE = 22;
|
||||
constexpr auto DEBUG_BUFFER = 23;
|
||||
constexpr auto SAMPLER_LOCATION = 24;
|
||||
constexpr auto DISPLACEMENT_MAP = 25;
|
||||
|
||||
constexpr uint64 WORKGROUP_SIZE = 64;
|
||||
template <size_t Power> class CBT {
|
||||
|
||||
@@ -253,6 +253,8 @@ TerrainRenderer::TerrainRenderer(Gfx::PGraphics graphics, PScene scene, Gfx::PDe
|
||||
.computeShader = deformCS,
|
||||
.pipelineLayout = meshUpdater.pipelineLayout,
|
||||
});
|
||||
sampler = graphics->createSampler({});
|
||||
displacementAsset = AssetRegistry::findTexture("", "wgen")->getTexture().cast<Gfx::Texture2D>();
|
||||
meshUpdater.resetBuffers(plainMesh);
|
||||
meshUpdater.prepareIndirection(plainMesh, geometryBuffer);
|
||||
meshUpdater.evaluateLeb(baseMesh, plainMesh, viewParamsSet, geometryBuffer, updateBuffer, lebCache.getLebMatrixBuffer(), true, true);
|
||||
@@ -273,6 +275,8 @@ Gfx::ORenderCommand TerrainRenderer::render(Gfx::PDescriptorSet viewParamsSet) {
|
||||
Gfx::PDescriptorSet set = meshUpdater.layout->allocateDescriptorSet();
|
||||
set->updateBuffer(CURRENT_VERTEX_BUFFER, 0, plainMesh.currentVertexBuffer);
|
||||
set->updateBuffer(INDEXED_BISECTOR_BUFFER, 0, plainMesh.indexedBisectorBuffer);
|
||||
set->updateSampler(SAMPLER_LOCATION, 0, sampler);
|
||||
set->updateTexture(DISPLACEMENT_MAP, 0, displacementAsset);
|
||||
set->writeChanges();
|
||||
Gfx::ORenderCommand command = graphics->createRenderCommand("TerrainRender");
|
||||
command->setViewport(viewport);
|
||||
|
||||
@@ -31,6 +31,7 @@ class TerrainRenderer {
|
||||
Gfx::PTexture2D displacementMap;
|
||||
Gfx::PTexture2D colorMap;
|
||||
Gfx::OSampler sampler;
|
||||
Gfx::PTexture2D displacementAsset;
|
||||
|
||||
Gfx::OUniformBuffer geometryBuffer;
|
||||
Gfx::OUniformBuffer updateBuffer;
|
||||
|
||||
Reference in New Issue
Block a user