mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-07-03 07:55:52 +00:00
Add master mulColor to programmable shader output
This commit is contained in:
parent
e07e82f798
commit
154a44e21f
@ -198,6 +198,7 @@ std::string GLSL::makeFrag(const char* glslVer, bool alphaTest,
|
|||||||
lightingSrc = "const vec4 colorReg0 = vec4(1.0);\n"
|
lightingSrc = "const vec4 colorReg0 = vec4(1.0);\n"
|
||||||
"const vec4 colorReg1 = vec4(1.0);\n"
|
"const vec4 colorReg1 = vec4(1.0);\n"
|
||||||
"const vec4 colorReg2 = vec4(1.0);\n"
|
"const vec4 colorReg2 = vec4(1.0);\n"
|
||||||
|
"const vec4 mulColor = vec4(1.0);\n"
|
||||||
"\n";
|
"\n";
|
||||||
|
|
||||||
std::string texMapDecl;
|
std::string texMapDecl;
|
||||||
@ -232,9 +233,9 @@ std::string GLSL::makeFrag(const char* glslVer, bool alphaTest,
|
|||||||
sampIdx++, sampling.mapIdx, sampling.tcgIdx);
|
sampIdx++, sampling.mapIdx, sampling.tcgIdx);
|
||||||
|
|
||||||
if (m_alphaExpr.size())
|
if (m_alphaExpr.size())
|
||||||
retval += " colorOut = vec4(" + m_colorExpr + ", " + m_alphaExpr + ");\n";
|
retval += " colorOut = vec4(" + m_colorExpr + ", " + m_alphaExpr + ") * mulColor;\n";
|
||||||
else
|
else
|
||||||
retval += " colorOut = vec4(" + m_colorExpr + ", 1.0);\n";
|
retval += " colorOut = vec4(" + m_colorExpr + ", 1.0) * mulColor;\n";
|
||||||
|
|
||||||
return retval + (alphaTest ? GenerateAlphaTest() : "") + "}\n";
|
return retval + (alphaTest ? GenerateAlphaTest() : "") + "}\n";
|
||||||
}
|
}
|
||||||
@ -251,6 +252,7 @@ std::string GLSL::makeFrag(const char* glslVer, bool alphaTest,
|
|||||||
lightingSrc = "const vec4 colorReg0 = vec4(1.0);\n"
|
lightingSrc = "const vec4 colorReg0 = vec4(1.0);\n"
|
||||||
"const vec4 colorReg1 = vec4(1.0);\n"
|
"const vec4 colorReg1 = vec4(1.0);\n"
|
||||||
"const vec4 colorReg2 = vec4(1.0);\n"
|
"const vec4 colorReg2 = vec4(1.0);\n"
|
||||||
|
"const vec4 mulColor = vec4(1.0);\n"
|
||||||
"\n";
|
"\n";
|
||||||
|
|
||||||
std::string postSrc;
|
std::string postSrc;
|
||||||
@ -300,9 +302,9 @@ std::string GLSL::makeFrag(const char* glslVer, bool alphaTest,
|
|||||||
sampIdx++, sampling.mapIdx, sampling.tcgIdx);
|
sampIdx++, sampling.mapIdx, sampling.tcgIdx);
|
||||||
|
|
||||||
if (m_alphaExpr.size())
|
if (m_alphaExpr.size())
|
||||||
retval += " colorOut = " + postEntry + "(vec4(" + m_colorExpr + ", " + m_alphaExpr + "));\n";
|
retval += " colorOut = " + postEntry + "(vec4(" + m_colorExpr + ", " + m_alphaExpr + ")) * mulColor;\n";
|
||||||
else
|
else
|
||||||
retval += " colorOut = " + postEntry + "(vec4(" + m_colorExpr + ", 1.0));\n";
|
retval += " colorOut = " + postEntry + "(vec4(" + m_colorExpr + ", 1.0)) * mulColor;\n";
|
||||||
|
|
||||||
return retval + (alphaTest ? GenerateAlphaTest() : "") + "}\n";
|
return retval + (alphaTest ? GenerateAlphaTest() : "") + "}\n";
|
||||||
}
|
}
|
||||||
|
@ -188,7 +188,8 @@ std::string HLSL::makeFrag(bool alphaTest, const ShaderFunction& lighting) const
|
|||||||
else
|
else
|
||||||
lightingSrc = "static const float4 colorReg0 = float4(1.0, 1.0, 1.0, 1.0);\n"
|
lightingSrc = "static const float4 colorReg0 = float4(1.0, 1.0, 1.0, 1.0);\n"
|
||||||
"static const float4 colorReg1 = float4(1.0, 1.0, 1.0, 1.0);\n"
|
"static const float4 colorReg1 = float4(1.0, 1.0, 1.0, 1.0);\n"
|
||||||
"static const float4 colorReg2 = float4(1.0, 1.0, 1.0, 1.0);\n";
|
"static const float4 colorReg2 = float4(1.0, 1.0, 1.0, 1.0);\n"
|
||||||
|
"static const float4 mulColor = float4(1.0, 1.0, 1.0, 1.0);\n";
|
||||||
|
|
||||||
std::string texMapDecl;
|
std::string texMapDecl;
|
||||||
if (m_texMapEnd)
|
if (m_texMapEnd)
|
||||||
@ -218,9 +219,9 @@ std::string HLSL::makeFrag(bool alphaTest, const ShaderFunction& lighting) const
|
|||||||
|
|
||||||
retval += " float4 colorOut;\n";
|
retval += " float4 colorOut;\n";
|
||||||
if (m_alphaExpr.size())
|
if (m_alphaExpr.size())
|
||||||
retval += " colorOut = float4(" + m_colorExpr + ", " + m_alphaExpr + ");\n";
|
retval += " colorOut = float4(" + m_colorExpr + ", " + m_alphaExpr + ") * mulColor;\n";
|
||||||
else
|
else
|
||||||
retval += " colorOut = float4(" + m_colorExpr + ", 1.0);\n";
|
retval += " colorOut = float4(" + m_colorExpr + ", 1.0) * mulColor;\n";
|
||||||
|
|
||||||
return retval + (alphaTest ? GenerateAlphaTest() : "") + " return colorOut;\n}\n";
|
return retval + (alphaTest ? GenerateAlphaTest() : "") + " return colorOut;\n}\n";
|
||||||
}
|
}
|
||||||
@ -235,7 +236,8 @@ std::string HLSL::makeFrag(bool alphaTest, const ShaderFunction& lighting,
|
|||||||
else
|
else
|
||||||
lightingSrc = "static const float4 colorReg0 = float4(1.0, 1.0, 1.0, 1.0);\n"
|
lightingSrc = "static const float4 colorReg0 = float4(1.0, 1.0, 1.0, 1.0);\n"
|
||||||
"static const float4 colorReg1 = float4(1.0, 1.0, 1.0, 1.0);\n"
|
"static const float4 colorReg1 = float4(1.0, 1.0, 1.0, 1.0);\n"
|
||||||
"static const float4 colorReg2 = float4(1.0, 1.0, 1.0, 1.0);\n";
|
"static const float4 colorReg2 = float4(1.0, 1.0, 1.0, 1.0);\n"
|
||||||
|
"static const float4 mulColor = float4(1.0, 1.0, 1.0, 1.0);\n";
|
||||||
|
|
||||||
std::string postSrc;
|
std::string postSrc;
|
||||||
if (post.m_source)
|
if (post.m_source)
|
||||||
@ -281,9 +283,9 @@ std::string HLSL::makeFrag(bool alphaTest, const ShaderFunction& lighting,
|
|||||||
|
|
||||||
retval += " float4 colorOut;\n";
|
retval += " float4 colorOut;\n";
|
||||||
if (m_alphaExpr.size())
|
if (m_alphaExpr.size())
|
||||||
retval += " colorOut = " + postEntry + "(" + (postEntry.size() ? "vtf, " : "") + "float4(" + m_colorExpr + ", " + m_alphaExpr + "));\n";
|
retval += " colorOut = " + postEntry + "(" + (postEntry.size() ? "vtf, " : "") + "float4(" + m_colorExpr + ", " + m_alphaExpr + ")) * mulColor;\n";
|
||||||
else
|
else
|
||||||
retval += " colorOut = " + postEntry + "(" + (postEntry.size() ? "vtf, " : "") + "float4(" + m_colorExpr + ", 1.0));\n";
|
retval += " colorOut = " + postEntry + "(" + (postEntry.size() ? "vtf, " : "") + "float4(" + m_colorExpr + ", 1.0)) * mulColor;\n";
|
||||||
|
|
||||||
return retval + (alphaTest ? GenerateAlphaTest() : "") + " return colorOut;\n}\n";
|
return retval + (alphaTest ? GenerateAlphaTest() : "") + " return colorOut;\n}\n";
|
||||||
}
|
}
|
||||||
|
@ -233,13 +233,15 @@ std::string Metal::makeFrag(size_t blockCount, const char** blockNames, bool alp
|
|||||||
{
|
{
|
||||||
retval += " float4 colorReg0 = block0.colorReg0;\n"
|
retval += " float4 colorReg0 = block0.colorReg0;\n"
|
||||||
" float4 colorReg1 = block0.colorReg1;\n"
|
" float4 colorReg1 = block0.colorReg1;\n"
|
||||||
" float4 colorReg2 = block0.colorReg2;\n";
|
" float4 colorReg2 = block0.colorReg2;\n"
|
||||||
|
" float4 mulColor = block0.mulColor;\n";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
retval += " float4 colorReg0 = float4(1.0, 1.0, 1.0, 1.0);\n"
|
retval += " float4 colorReg0 = float4(1.0, 1.0, 1.0, 1.0);\n"
|
||||||
" float4 colorReg1 = float4(1.0, 1.0, 1.0, 1.0);\n"
|
" float4 colorReg1 = float4(1.0, 1.0, 1.0, 1.0);\n"
|
||||||
" float4 colorReg2 = float4(1.0, 1.0, 1.0, 1.0);\n";
|
" float4 colorReg2 = float4(1.0, 1.0, 1.0, 1.0);\n"
|
||||||
|
" float4 mulColor = float4(1.0, 1.0, 1.0, 1.0);\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_lighting)
|
if (m_lighting)
|
||||||
@ -256,9 +258,9 @@ std::string Metal::makeFrag(size_t blockCount, const char** blockNames, bool alp
|
|||||||
sampIdx++, sampling.mapIdx, sampling.tcgIdx);
|
sampIdx++, sampling.mapIdx, sampling.tcgIdx);
|
||||||
|
|
||||||
if (m_alphaExpr.size())
|
if (m_alphaExpr.size())
|
||||||
retval += " out.color = float4(" + m_colorExpr + ", " + m_alphaExpr + ");\n";
|
retval += " out.color = float4(" + m_colorExpr + ", " + m_alphaExpr + ") * mulColor;\n";
|
||||||
else
|
else
|
||||||
retval += " out.color = float4(" + m_colorExpr + ", 1.0);\n";
|
retval += " out.color = float4(" + m_colorExpr + ", 1.0) * mulColor;\n";
|
||||||
|
|
||||||
return retval + (alphaTest ? GenerateAlphaTest() : "") +
|
return retval + (alphaTest ? GenerateAlphaTest() : "") +
|
||||||
" //out.depth = 1.0 - float(int((1.0 - vtf.mvpPos.z) * 16777216.0)) / 16777216.0;\n"
|
" //out.depth = 1.0 - float(int((1.0 - vtf.mvpPos.z) * 16777216.0)) / 16777216.0;\n"
|
||||||
@ -323,13 +325,15 @@ std::string Metal::makeFrag(size_t blockCount, const char** blockNames, bool alp
|
|||||||
{
|
{
|
||||||
retval += " float4 colorReg0 = block0.colorReg0;\n"
|
retval += " float4 colorReg0 = block0.colorReg0;\n"
|
||||||
" float4 colorReg1 = block0.colorReg1;\n"
|
" float4 colorReg1 = block0.colorReg1;\n"
|
||||||
" float4 colorReg2 = block0.colorReg2;\n";
|
" float4 colorReg2 = block0.colorReg2;\n"
|
||||||
|
" float4 mulColor = block0.mulColor;\n";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
retval += " float4 colorReg0 = float4(1.0, 1.0, 1.0, 1.0);\n"
|
retval += " float4 colorReg0 = float4(1.0, 1.0, 1.0, 1.0);\n"
|
||||||
" float4 colorReg1 = float4(1.0, 1.0, 1.0, 1.0);\n"
|
" float4 colorReg1 = float4(1.0, 1.0, 1.0, 1.0);\n"
|
||||||
" float4 colorReg2 = float4(1.0, 1.0, 1.0, 1.0);\n";
|
" float4 colorReg2 = float4(1.0, 1.0, 1.0, 1.0);\n"
|
||||||
|
" float4 mulColor = float4(1.0, 1.0, 1.0, 1.0);\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_lighting)
|
if (m_lighting)
|
||||||
@ -347,10 +351,10 @@ std::string Metal::makeFrag(size_t blockCount, const char** blockNames, bool alp
|
|||||||
|
|
||||||
if (m_alphaExpr.size())
|
if (m_alphaExpr.size())
|
||||||
retval += " out.color = " + postEntry + "(" + (postEntry.size() ? ("vtf, " + (blockCall.size() ? (blockCall + ", ") : "") + (extTexCall.size() ? (extTexCall + ", ") : "")) : "") +
|
retval += " out.color = " + postEntry + "(" + (postEntry.size() ? ("vtf, " + (blockCall.size() ? (blockCall + ", ") : "") + (extTexCall.size() ? (extTexCall + ", ") : "")) : "") +
|
||||||
"float4(" + m_colorExpr + ", " + m_alphaExpr + "));\n";
|
"float4(" + m_colorExpr + ", " + m_alphaExpr + ")) * mulColor;\n";
|
||||||
else
|
else
|
||||||
retval += " out.color = " + postEntry + "(" + (postEntry.size() ? ("vtf, " + (blockCall.size() ? (blockCall + ", ") : "") + (extTexCall.size() ? (extTexCall + ", ") : "")) : "") +
|
retval += " out.color = " + postEntry + "(" + (postEntry.size() ? ("vtf, " + (blockCall.size() ? (blockCall + ", ") : "") + (extTexCall.size() ? (extTexCall + ", ") : "")) : "") +
|
||||||
"float4(" + m_colorExpr + ", 1.0));\n";
|
"float4(" + m_colorExpr + ", 1.0)) * mulColor;\n";
|
||||||
|
|
||||||
return retval + (alphaTest ? GenerateAlphaTest() : "") +
|
return retval + (alphaTest ? GenerateAlphaTest() : "") +
|
||||||
" //out.depth = 1.0 - float(int((1.0 - vtf.mvpPos.z) * 16777216.0)) / 16777216.0;\n"
|
" //out.depth = 1.0 - float(int((1.0 - vtf.mvpPos.z) * 16777216.0)) / 16777216.0;\n"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user