used FragColor instead of Color in Fragment shader.
This commit is contained in:
parent
9a5cead33e
commit
85ec666989
@ -21,18 +21,17 @@ void main()
|
|||||||
{
|
{
|
||||||
MaterialInstance mi=GetMI();
|
MaterialInstance mi=GetMI();
|
||||||
|
|
||||||
Color=mi.Color;
|
FragColor=mi.Color;
|
||||||
})";// ^ ^
|
})";// ^ ^
|
||||||
// | |
|
// | |
|
||||||
// | +--ps:这里的mi.Color是材质实例中的数据,MaterialInstance结构对应上面C++代码中的mi_codes
|
// | +--ps:这里的mi.Color是材质实例中的数据,MaterialInstance结构对应上面C++代码中的mi_codes
|
||||||
// +--ps:这里的Color就是最终的RT
|
// +--ps:这里的FrageColor就是最终的RT
|
||||||
|
|
||||||
class MaterialPureColor2D:public Std2DMaterial
|
class MaterialPureColor2D:public Std2DMaterial
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
using Std2DMaterial::Std2DMaterial;
|
using Std2DMaterial::Std2DMaterial;
|
||||||
|
|
||||||
~MaterialPureColor2D()=default;
|
~MaterialPureColor2D()=default;
|
||||||
|
|
||||||
bool CustomVertexShader(ShaderCreateInfoVertex *vsc) override
|
bool CustomVertexShader(ShaderCreateInfoVertex *vsc) override
|
||||||
@ -46,7 +45,7 @@ void main()
|
|||||||
|
|
||||||
bool CustomFragmentShader(ShaderCreateInfoFragment *fsc) override
|
bool CustomFragmentShader(ShaderCreateInfoFragment *fsc) override
|
||||||
{
|
{
|
||||||
fsc->AddOutput(VAT_VEC4,"Color"); //Fragment shader的输出等于最终的RT了,所以这个名称其实随便起。
|
fsc->AddOutput(VAT_VEC4,"FragColor"); //Fragment shader的输出等于最终的RT了,所以这个名称其实随便起。
|
||||||
|
|
||||||
fsc->SetMain(fs_main);
|
fsc->SetMain(fs_main);
|
||||||
return(true);
|
return(true);
|
||||||
|
@ -20,7 +20,7 @@ void main()
|
|||||||
constexpr const char fs_main[]=R"(
|
constexpr const char fs_main[]=R"(
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
Color=texture(TextureColor,Input.TexCoord);
|
FragColor=texture(TextureColor,Input.TexCoord);
|
||||||
})";
|
})";
|
||||||
|
|
||||||
class MaterialPureTexture2D:public Std2DMaterial
|
class MaterialPureTexture2D:public Std2DMaterial
|
||||||
@ -47,7 +47,7 @@ void main()
|
|||||||
{
|
{
|
||||||
mci->AddSampler(VK_SHADER_STAGE_FRAGMENT_BIT,DescriptorSetType::PerMaterial,SamplerType::Sampler2D,mtl::SamplerName::Color);
|
mci->AddSampler(VK_SHADER_STAGE_FRAGMENT_BIT,DescriptorSetType::PerMaterial,SamplerType::Sampler2D,mtl::SamplerName::Color);
|
||||||
|
|
||||||
fsc->AddOutput(VAT_VEC4,"Color"); //Fragment shader的输出等于最终的RT了,所以这个名称其实随便起。
|
fsc->AddOutput(VAT_VEC4,"FragColor"); //Fragment shader的输出等于最终的RT了,所以这个名称其实随便起。
|
||||||
|
|
||||||
fsc->SetMain(fs_main);
|
fsc->SetMain(fs_main);
|
||||||
return(true);
|
return(true);
|
||||||
|
@ -37,7 +37,7 @@ void main()
|
|||||||
constexpr const char fs_main[]=R"(
|
constexpr const char fs_main[]=R"(
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
Color=texture(TextureColor,Input.TexCoord);
|
FragColor=texture(TextureColor,Input.TexCoord);
|
||||||
})";
|
})";
|
||||||
|
|
||||||
class MaterialRectTexture2D:public Std2DMaterial
|
class MaterialRectTexture2D:public Std2DMaterial
|
||||||
@ -74,7 +74,7 @@ void main()
|
|||||||
{
|
{
|
||||||
mci->AddSampler(VK_SHADER_STAGE_FRAGMENT_BIT,DescriptorSetType::PerMaterial,SamplerType::Sampler2D,mtl::SamplerName::Color);
|
mci->AddSampler(VK_SHADER_STAGE_FRAGMENT_BIT,DescriptorSetType::PerMaterial,SamplerType::Sampler2D,mtl::SamplerName::Color);
|
||||||
|
|
||||||
fsc->AddOutput(VAT_VEC4,"Color"); //Fragment shader的输出等于最终的RT了,所以这个名称其实随便起。
|
fsc->AddOutput(VAT_VEC4,"FragColor"); //Fragment shader的输出等于最终的RT了,所以这个名称其实随便起。
|
||||||
|
|
||||||
fsc->SetMain(fs_main);
|
fsc->SetMain(fs_main);
|
||||||
return(true);
|
return(true);
|
||||||
|
@ -44,7 +44,7 @@ void main()
|
|||||||
{
|
{
|
||||||
MaterialInstance mi=GetMI();
|
MaterialInstance mi=GetMI();
|
||||||
|
|
||||||
Color=texture(TextureColor,vec3(Input.TexCoord,mi.id.x));
|
FragColor=texture(TextureColor,vec3(Input.TexCoord,mi.id.x));
|
||||||
})";
|
})";
|
||||||
|
|
||||||
class MaterialRectTexture2D:public Std2DMaterial
|
class MaterialRectTexture2D:public Std2DMaterial
|
||||||
@ -81,7 +81,7 @@ void main()
|
|||||||
{
|
{
|
||||||
mci->AddSampler(VK_SHADER_STAGE_FRAGMENT_BIT,DescriptorSetType::PerMaterial,SamplerType::Sampler2DArray,mtl::SamplerName::Color);
|
mci->AddSampler(VK_SHADER_STAGE_FRAGMENT_BIT,DescriptorSetType::PerMaterial,SamplerType::Sampler2DArray,mtl::SamplerName::Color);
|
||||||
|
|
||||||
fsc->AddOutput(VAT_VEC4,"Color"); //Fragment shader的输出等于最终的RT了,所以这个名称其实随便起。
|
fsc->AddOutput(VAT_VEC4,"FragColor"); //Fragment shader的输出等于最终的RT了,所以这个名称其实随便起。
|
||||||
|
|
||||||
fsc->SetMain(fs_main);
|
fsc->SetMain(fs_main);
|
||||||
return(true);
|
return(true);
|
||||||
|
@ -18,7 +18,7 @@ void main()
|
|||||||
constexpr const char fs_main[]=R"(
|
constexpr const char fs_main[]=R"(
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
Color=Input.Color;
|
FragColor=Input.Color;
|
||||||
})";// ^ ^
|
})";// ^ ^
|
||||||
// | |
|
// | |
|
||||||
// | +--ps:这里的Input.Color就是上一个Shader中的Output.Color
|
// | +--ps:这里的Input.Color就是上一个Shader中的Output.Color
|
||||||
@ -46,7 +46,7 @@ void main()
|
|||||||
|
|
||||||
bool CustomFragmentShader(ShaderCreateInfoFragment *fsc) override
|
bool CustomFragmentShader(ShaderCreateInfoFragment *fsc) override
|
||||||
{
|
{
|
||||||
fsc->AddOutput(VAT_VEC4,"Color"); //Fragment shader的输出等于最终的RT了,所以这个名称其实随便起。
|
fsc->AddOutput(VAT_VEC4,"FragColor"); //Fragment shader的输出等于最终的RT了,所以这个名称其实随便起。
|
||||||
|
|
||||||
fsc->SetMain(fs_main);
|
fsc->SetMain(fs_main);
|
||||||
return(true);
|
return(true);
|
||||||
|
@ -18,7 +18,7 @@ void main()
|
|||||||
constexpr const char fs_main[]=R"(
|
constexpr const char fs_main[]=R"(
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
Color=Input.Color;
|
FragColor=Input.Color;
|
||||||
})";// ^ ^
|
})";// ^ ^
|
||||||
// | |
|
// | |
|
||||||
// | +--ps:这里的Input.Color就是上一个Shader中的Output.Color
|
// | +--ps:这里的Input.Color就是上一个Shader中的Output.Color
|
||||||
@ -46,7 +46,7 @@ void main()
|
|||||||
|
|
||||||
bool CustomFragmentShader(ShaderCreateInfoFragment *fsc) override
|
bool CustomFragmentShader(ShaderCreateInfoFragment *fsc) override
|
||||||
{
|
{
|
||||||
fsc->AddOutput(VAT_VEC4,"Color"); //Fragment shader的输出等于最终的RT了,所以这个名称其实随便起。
|
fsc->AddOutput(VAT_VEC4,"FragColor"); //Fragment shader的输出等于最终的RT了,所以这个名称其实随便起。
|
||||||
|
|
||||||
fsc->SetMain(fs_main);
|
fsc->SetMain(fs_main);
|
||||||
return(true);
|
return(true);
|
||||||
|
@ -23,7 +23,7 @@ void main()
|
|||||||
constexpr const char fs_main[]=R"(
|
constexpr const char fs_main[]=R"(
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
Color=Input.Color;
|
FragColor=Input.Color;
|
||||||
})";// ^ ^
|
})";// ^ ^
|
||||||
// | |
|
// | |
|
||||||
// | +--ps:这里的Input.Color就是上一个Shader中的Output.Color
|
// | +--ps:这里的Input.Color就是上一个Shader中的Output.Color
|
||||||
@ -51,7 +51,7 @@ void main()
|
|||||||
|
|
||||||
bool CustomFragmentShader(ShaderCreateInfoFragment *fsc) override
|
bool CustomFragmentShader(ShaderCreateInfoFragment *fsc) override
|
||||||
{
|
{
|
||||||
fsc->AddOutput(VAT_VEC4,"Color"); //Fragment shader的输出等于最终的RT了,所以这个名称其实随便起。
|
fsc->AddOutput(VAT_VEC4,"FragColor"); //Fragment shader的输出等于最终的RT了,所以这个名称其实随便起。
|
||||||
|
|
||||||
fsc->SetMain(fs_main);
|
fsc->SetMain(fs_main);
|
||||||
return(true);
|
return(true);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user