Added dynamic flags for render graph nodes and light comp shadow flags
This commit is contained in:
parent
b6b2c75fc3
commit
ff4c294313
|
@ -470,6 +470,7 @@ namespace SHADE
|
|||
SHEditorWidgets::DragVec3("Direction", { "X", "Y", "Z" }, [component]() {return component->GetDirection(); }, [component](SHVec3 const& vec) {component->SetDirection(vec); });
|
||||
SHEditorWidgets::ColorPicker("Color", [component]() {return component->GetColor(); }, [component](SHVec4 const& rgba) {component->SetColor(rgba); });
|
||||
SHEditorWidgets::DragFloat("Strength", [component]() {return component->GetStrength(); }, [component](float const& value) {component->SetStrength(value); });
|
||||
SHEditorWidgets::CheckBox("Casting Shadows", [comp = component]() {return comp->GetEnableShadow(); }, [comp = component](bool b) {comp->SetEnableShadow(b);});
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -672,22 +672,6 @@ namespace SHADE
|
|||
#endif
|
||||
}
|
||||
|
||||
static bool shadowAdded = false;
|
||||
|
||||
if (shadowAdded == false && SHInputManager::GetKey(SHInputManager::SH_KEYCODE::B))
|
||||
{
|
||||
shadowAdded = true;
|
||||
auto& lightComps = SHComponentManager::GetDense<SHLightComponent>();
|
||||
if (lightComps.size() > 2)
|
||||
{
|
||||
lightComps[2].SetEnableShadow(true);
|
||||
}
|
||||
for (auto& comp : lightComps)
|
||||
{
|
||||
comp.SetEnableShadow(true);
|
||||
}
|
||||
}
|
||||
|
||||
renderGraph->Begin(frameIndex);
|
||||
auto cmdBuffer = renderGraph->GetCommandBuffer(frameIndex);
|
||||
|
||||
|
|
|
@ -190,6 +190,11 @@ namespace SHADE
|
|||
return renderer;
|
||||
}
|
||||
|
||||
bool SHLightComponent::GetEnableShadow(void) const noexcept
|
||||
{
|
||||
return lightData.castShadows;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
RTTR_REGISTRATION
|
||||
|
@ -212,5 +217,6 @@ RTTR_REGISTRATION
|
|||
.property("Color", &SHLightComponent::GetColor, &SHLightComponent::SetColor)
|
||||
.property("Layer", &SHLightComponent::GetCullingMask, &SHLightComponent::SetCullingMask)
|
||||
.property("Strength", &SHLightComponent::GetStrength, &SHLightComponent::SetStrength)
|
||||
.property("Casting Shadows", &SHLightComponent::GetEnableShadow, &SHLightComponent::SetEnableShadow)
|
||||
;
|
||||
}
|
||||
|
|
|
@ -69,6 +69,7 @@ namespace SHADE
|
|||
//uint32_t GetIndexInBuffer (void) const noexcept;
|
||||
float GetStrength (void) const noexcept;
|
||||
Handle<SHRenderer> GetRenderer (void) const noexcept;
|
||||
bool GetEnableShadow (void) const noexcept;
|
||||
RTTR_ENABLE()
|
||||
};
|
||||
}
|
||||
|
|
|
@ -526,7 +526,7 @@ namespace SHADE
|
|||
if (auto renderer = light.GetRenderer())
|
||||
{
|
||||
//SHMatrix orthoMatrix = SHMatrix::OrthographicRH()
|
||||
renderer->UpdateDataManual(frameIndex, GetViewMatrix(&light), SHMatrix::OrthographicLH(12.0f, 12.0f, 1.0f, 80.0f));
|
||||
renderer->UpdateDataManual(frameIndex, GetViewMatrix(&light), SHMatrix::OrthographicLH(15.0f, 15.0f, 1.0f, 80.0f));
|
||||
}
|
||||
|
||||
auto enumValue = SHUtilities::ConvertEnum(light.GetLightData().type);
|
||||
|
|
|
@ -479,7 +479,7 @@ namespace SHADE
|
|||
// get target node
|
||||
auto targetNode = nodes.begin() + nodeIndexing.at(nodeToAddAfter);
|
||||
|
||||
auto node = nodes.insert(targetNode, renderGraphStorage->resourceHub->Create<SHRenderGraphNode>(nodeName, renderGraphStorage, std::move(descInitParams), std::vector<Handle<SHRenderGraphNode>>()));
|
||||
auto node = nodes.insert(targetNode, renderGraphStorage->resourceHub->Create<SHRenderGraphNode>(nodeName, renderGraphStorage, std::move(descInitParams), std::vector<Handle<SHRenderGraphNode>>(), true));
|
||||
ReindexNodes ();
|
||||
return *node;
|
||||
|
||||
|
@ -583,6 +583,10 @@ namespace SHADE
|
|||
|
||||
for (auto& node : nodes)
|
||||
{
|
||||
// if node is dynamic check for active flag
|
||||
if ((node->isDynamic) ? !node->dynamicIsActive : false)
|
||||
continue;
|
||||
|
||||
if (node->renderpass)
|
||||
{
|
||||
// bind static global data
|
||||
|
|
|
@ -292,7 +292,7 @@ namespace SHADE
|
|||
|
||||
*/
|
||||
/***************************************************************************/
|
||||
SHRenderGraphNode::SHRenderGraphNode(std::string nodeName, Handle<SHRenderGraphStorage> renderGraphStorage, std::vector<SHAttachmentDescInitParams> attDescInitParams, std::vector<Handle<SHRenderGraphNode>> predecessors) noexcept
|
||||
SHRenderGraphNode::SHRenderGraphNode(std::string nodeName, Handle<SHRenderGraphStorage> renderGraphStorage, std::vector<SHAttachmentDescInitParams> attDescInitParams, std::vector<Handle<SHRenderGraphNode>> predecessors, bool inIsDynamic) noexcept
|
||||
: graphStorage{ renderGraphStorage}
|
||||
, renderpass{}
|
||||
, framebuffers{}
|
||||
|
@ -305,6 +305,8 @@ namespace SHADE
|
|||
, configured{ false }
|
||||
, nodeComputes{}
|
||||
, name { std::move(nodeName) }
|
||||
, dynamicIsActive {true} // default set to true
|
||||
, isDynamic{inIsDynamic}
|
||||
{
|
||||
// pipeline library initialization
|
||||
pipelineLibrary.Init(graphStorage->logicalDevice);
|
||||
|
@ -368,6 +370,8 @@ namespace SHADE
|
|||
, nodeComputes{ std::move(rhs.nodeComputes) }
|
||||
, name { std::move(rhs.name) }
|
||||
, ISelfHandle<SHRenderGraphNode>{std::move(rhs)}
|
||||
, dynamicIsActive {rhs.dynamicIsActive}
|
||||
, isDynamic {rhs.isDynamic}
|
||||
|
||||
{
|
||||
rhs.renderpass = {};
|
||||
|
@ -393,6 +397,8 @@ namespace SHADE
|
|||
spDeps = std::move(rhs.spDeps);
|
||||
nodeComputes = std::move(rhs.nodeComputes);
|
||||
name = std::move(rhs.name);
|
||||
dynamicIsActive = rhs.dynamicIsActive;
|
||||
isDynamic = rhs.isDynamic;
|
||||
|
||||
rhs.renderpass = {};
|
||||
|
||||
|
@ -805,6 +811,11 @@ namespace SHADE
|
|||
CreateFramebuffer();
|
||||
}
|
||||
|
||||
void SHRenderGraphNode::SetDynamicActive(bool active) noexcept
|
||||
{
|
||||
dynamicIsActive = active;
|
||||
}
|
||||
|
||||
/***************************************************************************/
|
||||
/*!
|
||||
|
||||
|
@ -850,4 +861,9 @@ namespace SHADE
|
|||
return {};
|
||||
}
|
||||
|
||||
bool SHRenderGraphNode::GetDynamicActive(void) const noexcept
|
||||
{
|
||||
return dynamicIsActive;
|
||||
}
|
||||
|
||||
}
|
|
@ -80,6 +80,13 @@ namespace SHADE
|
|||
//! Whether or not the node has been configured already or not
|
||||
bool configured;
|
||||
|
||||
//! Whether or not the rendergraph should be executed. Should ONLY be used for dynamic
|
||||
//! nodes that are independent from other nodes.
|
||||
bool dynamicIsActive;
|
||||
|
||||
//! True if the function is dynamic
|
||||
bool isDynamic;
|
||||
|
||||
//! Manages batching for this RenderPass
|
||||
SHBatcher batcher;
|
||||
|
||||
|
@ -101,7 +108,7 @@ namespace SHADE
|
|||
/*-----------------------------------------------------------------------*/
|
||||
/* CTORS AND DTORS */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
SHRenderGraphNode(std::string nodeName, Handle<SHRenderGraphStorage> renderGraphStorage, std::vector<SHAttachmentDescInitParams> attDescInitParams, std::vector<Handle<SHRenderGraphNode>> predecessors) noexcept;
|
||||
SHRenderGraphNode(std::string nodeName, Handle<SHRenderGraphStorage> renderGraphStorage, std::vector<SHAttachmentDescInitParams> attDescInitParams, std::vector<Handle<SHRenderGraphNode>> predecessors, bool inIsDynamic = false) noexcept;
|
||||
SHRenderGraphNode(SHRenderGraphNode&& rhs) noexcept;
|
||||
SHRenderGraphNode& operator= (SHRenderGraphNode&& rhs) noexcept;
|
||||
|
||||
|
@ -123,11 +130,15 @@ namespace SHADE
|
|||
/*-----------------------------------------------------------------------*/
|
||||
/* SETTERS AND GETTERS */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
void SetDynamicActive(bool active) noexcept;
|
||||
|
||||
Handle<SHVkRenderpass> GetRenderpass(void) const noexcept;
|
||||
Handle<SHSubpass> GetSubpass(std::string_view subpassName) const noexcept;
|
||||
Handle<SHRenderGraphResource> GetResource (uint32_t resourceIndex) const noexcept;
|
||||
std::vector<Handle<SHRenderGraphResource>> const& GetResources (void) const noexcept;
|
||||
Handle<SHRenderGraphNodeCompute> GetNodeCompute (std::string nodeComputeName) const noexcept;
|
||||
bool GetDynamicActive (void) const noexcept;
|
||||
|
||||
friend class SHRenderGraph;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue