Shadows WIP
This commit is contained in:
parent
9538636af6
commit
4a06032bea
|
@ -1,4 +1,4 @@
|
||||||
Start in Fullscreen: false
|
Start in Fullscreen: false
|
||||||
Starting Scene ID: 86098106
|
Starting Scene ID: 87285316
|
||||||
Window Size: {x: 1920, y: 1080}
|
Window Size: {x: 1920, y: 1080}
|
||||||
Window Title: SHADE Engine
|
Window Title: SHADE Engine
|
|
@ -5,8 +5,9 @@
|
||||||
Components:
|
Components:
|
||||||
Transform Component:
|
Transform Component:
|
||||||
Translate: {x: 0, y: 0.304069757, z: 1.73034382}
|
Translate: {x: 0, y: 0.304069757, z: 1.73034382}
|
||||||
Rotate: {x: 0, y: 0, z: 0}
|
Rotate: {x: -1.48352981, y: 0, z: 0}
|
||||||
Scale: {x: 1, y: 1, z: 1}
|
Scale: {x: 1, y: 1, z: 1}
|
||||||
|
IsActive: true
|
||||||
Camera Component:
|
Camera Component:
|
||||||
Position: {x: 0, y: 0.304069757, z: 1.73034382}
|
Position: {x: 0, y: 0.304069757, z: 1.73034382}
|
||||||
Pitch: 0
|
Pitch: 0
|
||||||
|
@ -17,6 +18,7 @@
|
||||||
Near: 0.00999999978
|
Near: 0.00999999978
|
||||||
Far: 10000
|
Far: 10000
|
||||||
Perspective: true
|
Perspective: true
|
||||||
|
IsActive: true
|
||||||
Scripts: ~
|
Scripts: ~
|
||||||
- EID: 1
|
- EID: 1
|
||||||
Name: Raccoon
|
Name: Raccoon
|
||||||
|
@ -27,9 +29,11 @@
|
||||||
Translate: {x: 0, y: 0, z: 0}
|
Translate: {x: 0, y: 0, z: 0}
|
||||||
Rotate: {x: 0, y: 0, z: 0}
|
Rotate: {x: 0, y: 0, z: 0}
|
||||||
Scale: {x: 1, y: 1, z: 1}
|
Scale: {x: 1, y: 1, z: 1}
|
||||||
|
IsActive: true
|
||||||
Renderable Component:
|
Renderable Component:
|
||||||
Mesh: 149697411
|
Mesh: 149697411
|
||||||
Material: 126974645
|
Material: 126974645
|
||||||
|
IsActive: true
|
||||||
Scripts: ~
|
Scripts: ~
|
||||||
- EID: 3
|
- EID: 3
|
||||||
Name: Bag
|
Name: Bag
|
||||||
|
@ -40,9 +44,11 @@
|
||||||
Translate: {x: 0.006237939, y: -0.000393368304, z: 0}
|
Translate: {x: 0.006237939, y: -0.000393368304, z: 0}
|
||||||
Rotate: {x: -0, y: 2.79945588, z: 0}
|
Rotate: {x: -0, y: 2.79945588, z: 0}
|
||||||
Scale: {x: 1.0000881, y: 1, z: 1.0000881}
|
Scale: {x: 1.0000881, y: 1, z: 1.0000881}
|
||||||
|
IsActive: true
|
||||||
Renderable Component:
|
Renderable Component:
|
||||||
Mesh: 144838771
|
Mesh: 144838771
|
||||||
Material: 123745521
|
Material: 123745521
|
||||||
|
IsActive: true
|
||||||
Scripts: ~
|
Scripts: ~
|
||||||
- EID: 2
|
- EID: 2
|
||||||
Name: DirectionalLight
|
Name: DirectionalLight
|
||||||
|
@ -56,6 +62,7 @@
|
||||||
Color: {x: 1, y: 1, z: 1, w: 1}
|
Color: {x: 1, y: 1, z: 1, w: 1}
|
||||||
Layer: 4294967295
|
Layer: 4294967295
|
||||||
Strength: 0
|
Strength: 0
|
||||||
|
IsActive: true
|
||||||
Scripts: ~
|
Scripts: ~
|
||||||
- EID: 4
|
- EID: 4
|
||||||
Name: AmbientLight
|
Name: AmbientLight
|
||||||
|
@ -69,4 +76,20 @@
|
||||||
Color: {x: 1, y: 1, z: 1, w: 1}
|
Color: {x: 1, y: 1, z: 1, w: 1}
|
||||||
Layer: 4294967295
|
Layer: 4294967295
|
||||||
Strength: 0.600000024
|
Strength: 0.600000024
|
||||||
|
IsActive: true
|
||||||
|
Scripts: ~
|
||||||
|
- EID: 5
|
||||||
|
Name: Floor
|
||||||
|
IsActive: true
|
||||||
|
NumberOfChildren: 0
|
||||||
|
Components:
|
||||||
|
Transform Component:
|
||||||
|
Translate: {x: 0, y: 0.0810000002, z: 0}
|
||||||
|
Rotate: {x: -1.57079637, y: 0, z: 0}
|
||||||
|
Scale: {x: 50, y: 50, z: 50}
|
||||||
|
IsActive: true
|
||||||
|
Renderable Component:
|
||||||
|
Mesh: 141771688
|
||||||
|
Material: 124370424
|
||||||
|
IsActive: true
|
||||||
Scripts: ~
|
Scripts: ~
|
|
@ -47,6 +47,11 @@ layout(std430, set = 1, binding = 4) buffer AmbientLightData
|
||||||
AmbientLightStruct aLightData[];
|
AmbientLightStruct aLightData[];
|
||||||
} AmbLightData;
|
} AmbLightData;
|
||||||
|
|
||||||
|
// bool IsInShadow (sampler2D shadowMap, vec2 coords, float depth, mat4 lightVP)
|
||||||
|
// {
|
||||||
|
// // vec4 fragPosLightPOV = lightVP *
|
||||||
|
// }
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
// convenient variables
|
// convenient variables
|
||||||
|
@ -68,6 +73,16 @@ void main()
|
||||||
|
|
||||||
vec4 shadowMapColor = vec4 (1.0f);
|
vec4 shadowMapColor = vec4 (1.0f);
|
||||||
|
|
||||||
|
for (int i = 0; i < lightCounts.ambientLights; ++i)
|
||||||
|
{
|
||||||
|
if ((lightLayer & AmbLightData.aLightData[i].cullingMask) != 0)
|
||||||
|
{
|
||||||
|
// Just do some add
|
||||||
|
//fragColor += pixelDiffuse.rgb * AmbLightData.aLightData[i].ambientColor.rgb * vec3 (0.5f);
|
||||||
|
fragColor += pixelDiffuse.rgb * AmbLightData.aLightData[i].ambientColor.rgb * vec3 (AmbLightData.aLightData[i].strength);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i < lightCounts.directionalLights; ++i)
|
for (int i = 0; i < lightCounts.directionalLights; ++i)
|
||||||
{
|
{
|
||||||
if ((lightLayer & DirLightData.dLightData[i].cullingMask) != 0)
|
if ((lightLayer & DirLightData.dLightData[i].cullingMask) != 0)
|
||||||
|
@ -81,32 +96,22 @@ void main()
|
||||||
// Calculate the fragment color
|
// Calculate the fragment color
|
||||||
fragColor += DirLightData.dLightData[i].diffuseColor.rgb * diffuseStrength.rrr * pixelDiffuse;
|
fragColor += DirLightData.dLightData[i].diffuseColor.rgb * diffuseStrength.rrr * pixelDiffuse;
|
||||||
|
|
||||||
|
// If the shadow map is enabled (test the bit)
|
||||||
if ((DirLightData.dLightData[i].shadowData & uint(1)) == 1)
|
if ((DirLightData.dLightData[i].shadowData & uint(1)) == 1)
|
||||||
{
|
{
|
||||||
// calculate shadow map here
|
// calculate shadow map here
|
||||||
vec2 texCoord = vec2 (gl_GlobalInvocationID.xy) / vec2 (imageSize (targetImage));
|
vec2 texCoord = vec2 (gl_GlobalInvocationID.xy) / vec2 (imageSize (targetImage));
|
||||||
shadowMapColor = texture (shadowMaps[0], texCoord).xxxx;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < lightCounts.ambientLights; ++i)
|
|
||||||
{
|
|
||||||
if ((lightLayer & AmbLightData.aLightData[i].cullingMask) != 0)
|
|
||||||
{
|
|
||||||
// Just do some add
|
|
||||||
//fragColor += pixelDiffuse.rgb * AmbLightData.aLightData[i].ambientColor.rgb * vec3 (0.5f);
|
|
||||||
fragColor += pixelDiffuse.rgb * AmbLightData.aLightData[i].ambientColor.rgb * vec3 (AmbLightData.aLightData[i].strength);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
float ssaoVal = imageLoad (ssaoBlurredImage, globalThread).r;
|
float ssaoVal = imageLoad (ssaoBlurredImage, globalThread).r;
|
||||||
fragColor *= ssaoVal;
|
fragColor *= ssaoVal;
|
||||||
|
|
||||||
// store result into result image
|
// store result into result image
|
||||||
imageStore(targetImage, ivec2(gl_GlobalInvocationID.xy), vec4(fragColor.rgb, 1.0f));
|
imageStore(targetImage, ivec2(gl_GlobalInvocationID.xy), vec4(fragColor.rgb, 1.0f));
|
||||||
|
|
||||||
imageStore(targetImage, ivec2(gl_GlobalInvocationID.xy), shadowMapColor);
|
// imageStore(targetImage, ivec2(gl_GlobalInvocationID.xy), shadowMapColor);
|
||||||
//imageStore(targetImage, ivec2(gl_GlobalInvocationID.xy), vec4(ssaoVal.rrr, 1.0f));
|
//imageStore(targetImage, ivec2(gl_GlobalInvocationID.xy), vec4(ssaoVal.rrr, 1.0f));
|
||||||
|
|
||||||
}
|
}
|
Binary file not shown.
|
@ -16,11 +16,12 @@ layout(location = 0) in struct
|
||||||
vec4 vertPos; // location 0
|
vec4 vertPos; // location 0
|
||||||
vec2 uv; // location = 1
|
vec2 uv; // location = 1
|
||||||
vec4 normal; // location = 2
|
vec4 normal; // location = 2
|
||||||
|
vec4 worldPos; // location = 3
|
||||||
|
|
||||||
} In;
|
} In;
|
||||||
|
|
||||||
// material stuff
|
// material stuff
|
||||||
layout(location = 3) flat in struct
|
layout(location = 4) flat in struct
|
||||||
{
|
{
|
||||||
int materialIndex;
|
int materialIndex;
|
||||||
uint eid;
|
uint eid;
|
||||||
|
@ -38,12 +39,14 @@ layout(location = 1) out uint outEntityID;
|
||||||
layout(location = 2) out uint lightLayerIndices;
|
layout(location = 2) out uint lightLayerIndices;
|
||||||
layout(location = 3) out vec4 normals;
|
layout(location = 3) out vec4 normals;
|
||||||
layout(location = 4) out vec4 albedo;
|
layout(location = 4) out vec4 albedo;
|
||||||
|
layout(location = 5) out vec4 worldSpacePosition;
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
position = In.vertPos;
|
position = In.vertPos;
|
||||||
normals = In.normal;
|
normals = In.normal;
|
||||||
albedo = texture(textures[nonuniformEXT(MatProp.data[In2.materialIndex].textureIndex)], In.uv) * MatProp.data[In2.materialIndex].color;
|
albedo = texture(textures[nonuniformEXT(MatProp.data[In2.materialIndex].textureIndex)], In.uv) * MatProp.data[In2.materialIndex].color;
|
||||||
|
worldSpacePosition = In.worldPos;
|
||||||
|
|
||||||
outEntityID = In2.eid;
|
outEntityID = In2.eid;
|
||||||
lightLayerIndices = In2.lightLayerIndex;
|
lightLayerIndices = In2.lightLayerIndex;
|
||||||
|
|
Binary file not shown.
|
@ -17,11 +17,12 @@ layout(location = 0) out struct
|
||||||
vec4 vertPos; // location 0
|
vec4 vertPos; // location 0
|
||||||
vec2 uv; // location = 1
|
vec2 uv; // location = 1
|
||||||
vec4 normal; // location = 2
|
vec4 normal; // location = 2
|
||||||
|
vec4 worldPos; // location = 3
|
||||||
|
|
||||||
} Out;
|
} Out;
|
||||||
|
|
||||||
// material stuff
|
// material stuff
|
||||||
layout(location = 3) out struct
|
layout(location = 4) out struct
|
||||||
{
|
{
|
||||||
int materialIndex;
|
int materialIndex;
|
||||||
uint eid;
|
uint eid;
|
||||||
|
@ -49,6 +50,8 @@ void main()
|
||||||
// gBuffer position will be in view space
|
// gBuffer position will be in view space
|
||||||
Out.vertPos = modelViewMat * vec4(aVertexPos, 1.0f);
|
Out.vertPos = modelViewMat * vec4(aVertexPos, 1.0f);
|
||||||
|
|
||||||
|
Out.worldPos = worldTransform * vec4 (aVertexPos, 1.0f);
|
||||||
|
|
||||||
// uvs for texturing in fragment shader
|
// uvs for texturing in fragment shader
|
||||||
Out.uv = aUV;
|
Out.uv = aUV;
|
||||||
|
|
||||||
|
|
Binary file not shown.
|
@ -131,6 +131,8 @@ namespace SHADE
|
||||||
SHAssetManager::CompileAsset("../../Assets/Shaders/SSAO_CS.glsl", false);
|
SHAssetManager::CompileAsset("../../Assets/Shaders/SSAO_CS.glsl", false);
|
||||||
SHAssetManager::CompileAsset("../../Assets/Shaders/SSAOBlur_CS.glsl", false);
|
SHAssetManager::CompileAsset("../../Assets/Shaders/SSAOBlur_CS.glsl", false);
|
||||||
SHAssetManager::CompileAsset("../../Assets/Shaders/PureCopy_CS.glsl", false);
|
SHAssetManager::CompileAsset("../../Assets/Shaders/PureCopy_CS.glsl", false);
|
||||||
|
SHAssetManager::CompileAsset("../../Assets/Shaders/TestCube_VS.glsl", false);
|
||||||
|
SHAssetManager::CompileAsset("../../Assets/Shaders/TestCube_FS.glsl", false);
|
||||||
|
|
||||||
// Load Built In Shaders
|
// Load Built In Shaders
|
||||||
static constexpr AssetID VS_DEFAULT = 39210065; defaultVertShader = SHResourceManager::LoadOrGet<SHVkShaderModule>(VS_DEFAULT);
|
static constexpr AssetID VS_DEFAULT = 39210065; defaultVertShader = SHResourceManager::LoadOrGet<SHVkShaderModule>(VS_DEFAULT);
|
||||||
|
@ -194,6 +196,7 @@ namespace SHADE
|
||||||
// Initialize world render graph
|
// Initialize world render graph
|
||||||
renderGraph->Init("World Render Graph", device, swapchain, &resourceManager, renderContextCmdPools);
|
renderGraph->Init("World Render Graph", device, swapchain, &resourceManager, renderContextCmdPools);
|
||||||
renderGraph->AddResource("Position", { SH_RENDER_GRAPH_RESOURCE_FLAGS::COLOR, SH_RENDER_GRAPH_RESOURCE_FLAGS::INPUT, SH_RENDER_GRAPH_RESOURCE_FLAGS::STORAGE }, true, windowDims.first, windowDims.second, vk::Format::eR32G32B32A32Sfloat);
|
renderGraph->AddResource("Position", { SH_RENDER_GRAPH_RESOURCE_FLAGS::COLOR, SH_RENDER_GRAPH_RESOURCE_FLAGS::INPUT, SH_RENDER_GRAPH_RESOURCE_FLAGS::STORAGE }, true, windowDims.first, windowDims.second, vk::Format::eR32G32B32A32Sfloat);
|
||||||
|
renderGraph->AddResource("Position World Space", { SH_RENDER_GRAPH_RESOURCE_FLAGS::COLOR, SH_RENDER_GRAPH_RESOURCE_FLAGS::INPUT, SH_RENDER_GRAPH_RESOURCE_FLAGS::STORAGE }, true, windowDims.first, windowDims.second, vk::Format::eR32G32B32A32Sfloat);
|
||||||
renderGraph->AddResource("Normals", { SH_RENDER_GRAPH_RESOURCE_FLAGS::COLOR, SH_RENDER_GRAPH_RESOURCE_FLAGS::INPUT, SH_RENDER_GRAPH_RESOURCE_FLAGS::STORAGE }, true, windowDims.first, windowDims.second, vk::Format::eR32G32B32A32Sfloat);
|
renderGraph->AddResource("Normals", { SH_RENDER_GRAPH_RESOURCE_FLAGS::COLOR, SH_RENDER_GRAPH_RESOURCE_FLAGS::INPUT, SH_RENDER_GRAPH_RESOURCE_FLAGS::STORAGE }, true, windowDims.first, windowDims.second, vk::Format::eR32G32B32A32Sfloat);
|
||||||
//worldRenderGraph->AddResource("Tangents", { SH_ATT_DESC_TYPE_FLAGS::COLOR, SH_ATT_DESC_TYPE_FLAGS::INPUT, SH_ATT_DESC_TYPE_FLAGS::STORAGE }, windowDims.first, windowDims.second, vk::Format::eR32G32B32A32Sfloat);
|
//worldRenderGraph->AddResource("Tangents", { SH_ATT_DESC_TYPE_FLAGS::COLOR, SH_ATT_DESC_TYPE_FLAGS::INPUT, SH_ATT_DESC_TYPE_FLAGS::STORAGE }, windowDims.first, windowDims.second, vk::Format::eR32G32B32A32Sfloat);
|
||||||
renderGraph->AddResource("Albedo", { SH_RENDER_GRAPH_RESOURCE_FLAGS::COLOR, SH_RENDER_GRAPH_RESOURCE_FLAGS::INPUT, SH_RENDER_GRAPH_RESOURCE_FLAGS::STORAGE }, true, windowDims.first, windowDims.second);
|
renderGraph->AddResource("Albedo", { SH_RENDER_GRAPH_RESOURCE_FLAGS::COLOR, SH_RENDER_GRAPH_RESOURCE_FLAGS::INPUT, SH_RENDER_GRAPH_RESOURCE_FLAGS::STORAGE }, true, windowDims.first, windowDims.second);
|
||||||
|
@ -218,7 +221,8 @@ namespace SHADE
|
||||||
"Albedo",
|
"Albedo",
|
||||||
"Depth Buffer",
|
"Depth Buffer",
|
||||||
"SSAO",
|
"SSAO",
|
||||||
"SSAO Blur"
|
"SSAO Blur",
|
||||||
|
"Position World Space"
|
||||||
},
|
},
|
||||||
{}); // no predecessors
|
{}); // no predecessors
|
||||||
|
|
||||||
|
@ -231,6 +235,7 @@ namespace SHADE
|
||||||
gBufferSubpass->AddColorOutput("Light Layer Indices");
|
gBufferSubpass->AddColorOutput("Light Layer Indices");
|
||||||
gBufferSubpass->AddColorOutput("Normals");
|
gBufferSubpass->AddColorOutput("Normals");
|
||||||
gBufferSubpass->AddColorOutput("Albedo");
|
gBufferSubpass->AddColorOutput("Albedo");
|
||||||
|
gBufferSubpass->AddColorOutput("Position World Space");
|
||||||
gBufferSubpass->AddDepthOutput("Depth Buffer", SH_RENDER_GRAPH_RESOURCE_FLAGS::DEPTH_STENCIL);
|
gBufferSubpass->AddDepthOutput("Depth Buffer", SH_RENDER_GRAPH_RESOURCE_FLAGS::DEPTH_STENCIL);
|
||||||
|
|
||||||
|
|
||||||
|
@ -277,7 +282,7 @@ namespace SHADE
|
||||||
"Normals",
|
"Normals",
|
||||||
"Albedo",
|
"Albedo",
|
||||||
"Scene",
|
"Scene",
|
||||||
"SSAO Blur"
|
"SSAO Blur",
|
||||||
},
|
},
|
||||||
{ SHGraphicsConstants::RenderGraphEntityNames::GBUFFER_PASS .data()});
|
{ SHGraphicsConstants::RenderGraphEntityNames::GBUFFER_PASS .data()});
|
||||||
|
|
||||||
|
@ -763,6 +768,9 @@ namespace SHADE
|
||||||
// Create new renderer for the light component and give it to the light component
|
// Create new renderer for the light component and give it to the light component
|
||||||
Handle<SHRenderer> newRenderer = resourceManager.Create<SHRenderer>(device, swapchain->GetNumImages(), descPool, SHRenderer::PROJECTION_TYPE::ORTHOGRAPHIC);
|
Handle<SHRenderer> newRenderer = resourceManager.Create<SHRenderer>(device, swapchain->GetNumImages(), descPool, SHRenderer::PROJECTION_TYPE::ORTHOGRAPHIC);
|
||||||
lightComp->SetRenderer (newRenderer);
|
lightComp->SetRenderer (newRenderer);
|
||||||
|
|
||||||
|
// assign shadow map index to light component
|
||||||
|
lightComp->SetShadowMapIndex (lightingSubSystem->GetNumShadowMaps());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the shadow map resource to the graph
|
// Add the shadow map resource to the graph
|
||||||
|
|
|
@ -129,6 +129,11 @@ namespace SHADE
|
||||||
renderer = newRenderer;
|
renderer = newRenderer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SHLightComponent::SetShadowMapIndex(uint32_t index) noexcept
|
||||||
|
{
|
||||||
|
lightData.shadowMapIndex = index;
|
||||||
|
}
|
||||||
|
|
||||||
SHLightData const& SHLightComponent::GetLightData(void) const noexcept
|
SHLightData const& SHLightComponent::GetLightData(void) const noexcept
|
||||||
{
|
{
|
||||||
return lightData;
|
return lightData;
|
||||||
|
|
|
@ -55,6 +55,7 @@ namespace SHADE
|
||||||
void SetStrength (float value) noexcept; // serialized
|
void SetStrength (float value) noexcept; // serialized
|
||||||
void SetEnableShadow (bool flag) noexcept;
|
void SetEnableShadow (bool flag) noexcept;
|
||||||
void SetRenderer (Handle<SHRenderer> newRenderer) noexcept;
|
void SetRenderer (Handle<SHRenderer> newRenderer) noexcept;
|
||||||
|
void SetShadowMapIndex (uint32_t index) noexcept;
|
||||||
|
|
||||||
|
|
||||||
SHLightData const& GetLightData (void) const noexcept;
|
SHLightData const& GetLightData (void) const noexcept;
|
||||||
|
|
|
@ -395,7 +395,7 @@ namespace SHADE
|
||||||
switch (lightComp->GetLightData().type)
|
switch (lightComp->GetLightData().type)
|
||||||
{
|
{
|
||||||
case SH_LIGHT_TYPE::DIRECTIONAL:
|
case SH_LIGHT_TYPE::DIRECTIONAL:
|
||||||
return SHMatrix::Transpose (SHMatrix::LookAtLH(/*lightComp->GetLightData().position*/SHVec3(-0.7768f, 3.82611f, 9.23839f), SHVec3(-0.7619f, 3.30361f, 8.38588f), SHVec3(0.0f, -1.0f, 0.0f)));
|
return SHMatrix::Transpose (SHMatrix::LookAtLH(/*lightComp->GetLightData().position*/SHVec3(1.27862f, 4.78952f, 4.12811f), SHVec3(-0.280564f, -0.66262f, -0.69422f), SHVec3(0.0f, -1.0f, 0.0f)));
|
||||||
case SH_LIGHT_TYPE::POINT:
|
case SH_LIGHT_TYPE::POINT:
|
||||||
return {};
|
return {};
|
||||||
case SH_LIGHT_TYPE::SPOT:
|
case SH_LIGHT_TYPE::SPOT:
|
||||||
|
@ -478,6 +478,7 @@ namespace SHADE
|
||||||
//#endif
|
//#endif
|
||||||
|
|
||||||
shadowMapSampler = inShadowMapSampler;
|
shadowMapSampler = inShadowMapSampler;
|
||||||
|
shadowMaps.clear();
|
||||||
//numLightComponents = 0;
|
//numLightComponents = 0;
|
||||||
#pragma endregion
|
#pragma endregion
|
||||||
}
|
}
|
||||||
|
@ -516,7 +517,7 @@ namespace SHADE
|
||||||
if (auto renderer = light.GetRenderer())
|
if (auto renderer = light.GetRenderer())
|
||||||
{
|
{
|
||||||
//SHMatrix orthoMatrix = SHMatrix::OrthographicRH()
|
//SHMatrix orthoMatrix = SHMatrix::OrthographicRH()
|
||||||
renderer->UpdateDataManual(frameIndex, GetViewMatrix(&light), SHMatrix::OrthographicLH(12.0f, 12.0f, 0.1f, 20.0f));
|
renderer->UpdateDataManual(frameIndex, GetViewMatrix(&light), SHMatrix::OrthographicLH(9.0f, 9.0f, 0.1f, 20.0f));
|
||||||
}
|
}
|
||||||
|
|
||||||
auto enumValue = SHUtilities::ConvertEnum(light.GetLightData().type);
|
auto enumValue = SHUtilities::ConvertEnum(light.GetLightData().type);
|
||||||
|
@ -595,7 +596,7 @@ namespace SHADE
|
||||||
uint32_t SHLightingSubSystem::AddShadowMap(Handle<SHRenderGraphResource> newShadowMap, EntityID lightEntity) noexcept
|
uint32_t SHLightingSubSystem::AddShadowMap(Handle<SHRenderGraphResource> newShadowMap, EntityID lightEntity) noexcept
|
||||||
{
|
{
|
||||||
// Add to container of shadow maps
|
// Add to container of shadow maps
|
||||||
shadowMapIndexing.emplace(lightEntity, shadowMaps.size());
|
shadowMapIndexing.emplace(lightEntity, static_cast<uint32_t> (shadowMaps.size()));
|
||||||
shadowMaps.emplace_back(newShadowMap);
|
shadowMaps.emplace_back(newShadowMap);
|
||||||
|
|
||||||
// Just use the image view stored in the resource
|
// Just use the image view stored in the resource
|
||||||
|
@ -684,4 +685,9 @@ namespace SHADE
|
||||||
return shadowMapImageSamplers[index];
|
return shadowMapImageSamplers[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t SHLightingSubSystem::GetNumShadowMaps(void) const noexcept
|
||||||
|
{
|
||||||
|
return static_cast<uint32_t>(shadowMaps.size());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -223,6 +223,7 @@ namespace SHADE
|
||||||
/*-----------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------*/
|
||||||
Handle<SHVkDescriptorSetGroup> GetLightDataDescriptorSet (void) const noexcept;
|
Handle<SHVkDescriptorSetGroup> GetLightDataDescriptorSet (void) const noexcept;
|
||||||
std::tuple<Handle<SHVkImageView>, Handle<SHVkSampler>, vk::ImageLayout> const& GetViewSamplerLayout (uint32_t index) const noexcept;
|
std::tuple<Handle<SHVkImageView>, Handle<SHVkSampler>, vk::ImageLayout> const& GetViewSamplerLayout (uint32_t index) const noexcept;
|
||||||
|
uint32_t GetNumShadowMaps (void) const noexcept;
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue