used Color4f instead of r,g,b,a at CommandBuffer::SetClearColor

This commit is contained in:
hyzboy 2022-03-11 17:43:07 +08:00
parent 07092da047
commit 057e18640c
2 changed files with 8 additions and 8 deletions

View File

@ -80,7 +80,7 @@ public:
virtual bool Init(int w,int h)
{
clear_color.Zero();
clear_color.Set(0,0,0,1);
#ifdef _DEBUG
if(!CheckStrideBytesByFormat())
@ -211,7 +211,7 @@ public:
cb->Begin();
cb->BindFramebuffer(rp,fb);
cb->SetClearColor(0,clear_color.r,clear_color.g,clear_color.b);
cb->SetClearColor(0,clear_color);
cb->BeginRenderPass();
cb->BindPipeline(ri->GetPipeline());
cb->BindDescriptorSets(ri);
@ -268,7 +268,7 @@ public:
cb->Begin();
cb->BindFramebuffer(sc_render_target->GetRenderPass(),sc_render_target->GetFramebuffer(index));
cb->SetClearColor(0,clear_color.r,clear_color.g,clear_color.b);
cb->SetClearColor(0,clear_color);
cb->BeginRenderPass();
rl->Render(cb);
cb->EndRenderPass();

View File

@ -60,16 +60,16 @@ public:
void SetRenderArea(const VkExtent2D &);
void SetViewport(const VkViewport &vp){viewport=vp;}
void SetClearColor(uint32_t index,float r,float g,float b,float a=1.0f)
void SetClearColor(uint32_t index,const Color4f &cc)
{
if(index>=cv_count)return;
VkClearValue *cv=clear_values+index;
cv->color.float32[0]=r;
cv->color.float32[1]=g;
cv->color.float32[2]=b;
cv->color.float32[3]=a;
cv->color.float32[0]=cc.r;
cv->color.float32[1]=cc.g;
cv->color.float32[2]=cc.b;
cv->color.float32[3]=cc.a;
}
void SetClearDepthStencil(uint32_t index,float d=1.0f,float s=0)