Fixed material desc set binding

This commit is contained in:
Brandon Mak 2022-09-28 15:31:37 +08:00
parent d9582cd0bd
commit 2df9252e17
4 changed files with 15 additions and 12 deletions

View File

@ -71,7 +71,7 @@ namespace Sandbox
customMat->SetProperty("data.color", SHVec4(0.0f, 1.0f, 1.0f, 1.0f));
// Create Stress Test Objects
static const SHVec3 TEST_OBJ_SCALE = { 0.05f, 0.05f, 0.05f };
static const SHVec3 TEST_OBJ_SCALE = { 4.0f, 4.0f, 4.0f };
constexpr int NUM_ROWS = 2;
constexpr int NUM_COLS = 2;
static const SHVec3 TEST_OBJ_SPACING = { 20.0f, 20.0f, 20.0f };
@ -98,10 +98,11 @@ namespace Sandbox
auto& renderable = *SHComponentManager::GetComponent_s<SHRenderable>(entity);
auto& transform = *SHComponentManager::GetComponent_s<SHTransformComponent>(entity);
renderable.Mesh = handles.front();
renderable.Mesh = handles.back();
renderable.SetMaterial(customMat);
////transform.SetLocalScale(TEST_OBJ_SCALE);
transform.SetLocalScale(TEST_OBJ_SCALE);
transform.SetWorldPosition({-1.0f, -1.0f, -1.0f});
//stressTestObjects.emplace_back(entity);
@ -126,7 +127,7 @@ namespace Sandbox
auto& transform = *SHADE::SHComponentManager::GetComponent_s<SHADE::SHTransformComponent>(testObj);
transform.SetWorldPosition({1.0f, 1.0f, 1.0f});
transform.SetWorldPosition({1.0f, 1.0f, -1.0f});
transform.SetWorldRotation(0.0f, 0.0f + rotation, 0.0f);
rotation += dt * 0.2f;

View File

@ -341,13 +341,13 @@ namespace SHADE
cmdBuffer->BindVertexBuffer(SHGraphicsConstants::VertexBufferBindings::TRANSFORM, transformDataBuffer[frameIndex], 0);
if (matPropsDescSet[frameIndex])
{
cmdBuffer->BindDescriptorSet
(
matPropsDescSet[frameIndex],
vk::PipelineBindPoint::eGraphics,
0,
dynamicOffset
);
cmdBuffer->BindDescriptorSet
(
matPropsDescSet[frameIndex],
vk::PipelineBindPoint::eGraphics,
SHGraphicsConstants::DescriptorSetIndex::PER_INSTANCE,
dynamicOffset
);
}
cmdBuffer->DrawMultiIndirect(drawDataBuffer[frameIndex], static_cast<uint32_t>(drawData.size()));
}

View File

@ -32,6 +32,8 @@ layout(location = 0) out vec4 outColor;
//layout(binding = 3) uniform sampler2D glossinessMap;
//layout(binding = 4) uniform sampler2D samplerRoughnessMap;
layout (set = 0, binding = 1) uniform sampler2D textures[];
struct MatPropData
{
vec4 color;
@ -80,6 +82,6 @@ void main()
//outColor.rgb = pow(outColor.rgb, vec3(1.0f / gamma));
//outColor.a = diffuseColor.a;
outColor = MatProp.data[0].color;
outColor = texture(textures[0], In.uv) ;
//outColor = vec4 (1.0f);
}

Binary file not shown.