Bug fixes, Scene changes and new features #376

Merged
glencelow merged 15 commits from PlayerController into main 2023-02-28 23:10:33 +08:00
8 changed files with 24 additions and 9 deletions
Showing only changes of commit 0da61aa842 - Show all commits

View File

@ -23,7 +23,7 @@ layout(location = 0) in struct
layout(location = 3) flat in struct layout(location = 3) flat in struct
{ {
uint eid; uint eid;
vec3 textColor; vec4 textColor;
} In2; } In2;
@ -50,7 +50,7 @@ void main()
if (opacity < 0.2f) if (opacity < 0.2f)
discard; discard;
else else
fragColor = mix(vec4(0.0f), vec4(In2.textColor, 1.0f), min (opacity, 1.0f)); fragColor = mix(vec4(0.0f), vec4(In2.textColor.xyz, 1.0f), min (opacity, In2.textColor.a));
// fragColor = vec4 (1.0f); // fragColor = vec4 (1.0f);

Binary file not shown.

View File

@ -21,7 +21,7 @@ layout(location = 0) out struct
layout(location = 3) out struct layout(location = 3) out struct
{ {
uint eid; uint eid;
vec3 textColor; vec4 textColor;
} Out2; } Out2;
// Camera data // Camera data
@ -38,7 +38,7 @@ layout(std140, push_constant) uniform TestPushConstant
{ {
mat4 worldTransform; mat4 worldTransform;
uint eid; uint eid;
vec3 textColor; vec4 textColor;
} testPushConstant; } testPushConstant;
@ -91,6 +91,7 @@ void main()
// Transform the vertices to font space // Transform the vertices to font space
vertexPos = toFontSpace * vec3(vertexPos.xy, 1.0f); vertexPos = toFontSpace * vec3(vertexPos.xy, 1.0f);
vertexPos.z = 0.0f;
Out2.textColor = testPushConstant.textColor; Out2.textColor = testPushConstant.textColor;

Binary file not shown.

View File

@ -599,6 +599,8 @@ namespace SHADE
component->SetText(val); component->SetText(val);
} }
); );
SHEditorWidgets::ColorPicker("Color", [&textComp = component]() {return textComp->GetColour(); }, [&textComp = component](SHVec4 const& newColor) {textComp->SetColour(newColor); });
} }
else else
{ {

View File

@ -61,6 +61,11 @@ namespace SHADE
MakeDirty(); MakeDirty();
} }
void SHTextRenderableComponent::SetColour(SHColour const& newColor) noexcept
{
color = newColor;
}
/***************************************************************************/ /***************************************************************************/
/*! /*!
@ -82,6 +87,11 @@ namespace SHADE
return fontHandle; return fontHandle;
} }
SHADE::SHColour const& SHTextRenderableComponent::GetColour(void) const noexcept
{
return color;
}
} }
namespace rttr namespace rttr

View File

@ -52,9 +52,11 @@ namespace SHADE
/*-----------------------------------------------------------------------*/ /*-----------------------------------------------------------------------*/
void SetText (std::string_view newText) noexcept; void SetText (std::string_view newText) noexcept;
void SetFont(Handle<SHFont> font) noexcept; void SetFont(Handle<SHFont> font) noexcept;
void SetColour(SHColour const& newColor) noexcept;
std::string const& GetText (void) const noexcept; std::string const& GetText (void) const noexcept;
Handle<SHFont> GetFont (void) const noexcept; Handle<SHFont> GetFont (void) const noexcept;
SHColour const& GetColour (void) const noexcept;
friend class SHTextRenderingSubSystem; friend class SHTextRenderingSubSystem;

View File

@ -138,8 +138,8 @@ namespace SHADE
.srcColorBlendFactor = vk::BlendFactor::eSrcAlpha, .srcColorBlendFactor = vk::BlendFactor::eSrcAlpha,
.dstColorBlendFactor = vk::BlendFactor::eOneMinusSrcAlpha, .dstColorBlendFactor = vk::BlendFactor::eOneMinusSrcAlpha,
.colorBlendOp = vk::BlendOp::eAdd, .colorBlendOp = vk::BlendOp::eAdd,
.srcAlphaBlendFactor = vk::BlendFactor::eOne, .srcAlphaBlendFactor = vk::BlendFactor::eSrcAlpha,
.dstAlphaBlendFactor = vk::BlendFactor::eZero, .dstAlphaBlendFactor = vk::BlendFactor::eOneMinusSrcAlpha,
.alphaBlendOp = vk::BlendOp::eAdd, .alphaBlendOp = vk::BlendOp::eAdd,
.colorWriteMask = vk::ColorComponentFlagBits::eR | vk::ColorComponentFlagBits::eG | vk::ColorComponentFlagBits::eB | vk::ColorComponentFlagBits::eA, .colorWriteMask = vk::ColorComponentFlagBits::eR | vk::ColorComponentFlagBits::eG | vk::ColorComponentFlagBits::eB | vk::ColorComponentFlagBits::eA,
} }
@ -217,7 +217,7 @@ namespace SHADE
cmdBuffer->SetPushConstantVariable("TestPushConstant.eid", comp.GetEID(), SH_PIPELINE_TYPE::GRAPHICS); cmdBuffer->SetPushConstantVariable("TestPushConstant.eid", comp.GetEID(), SH_PIPELINE_TYPE::GRAPHICS);
cmdBuffer->SetPushConstantVariable("TestPushConstant.textColor", SHVec3 (1.0f, 1.0f, 1.0f), SH_PIPELINE_TYPE::GRAPHICS); cmdBuffer->SetPushConstantVariable("TestPushConstant.textColor", comp.color, SH_PIPELINE_TYPE::GRAPHICS);
cmdBuffer->SubmitPushConstants(SH_PIPELINE_TYPE::GRAPHICS); cmdBuffer->SubmitPushConstants(SH_PIPELINE_TYPE::GRAPHICS);