mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-09-22 11:23:27 -04:00
Address feedback
This commit is contained in:
parent
86e40f5b6b
commit
5f3f3a7e1d
@ -205,7 +205,7 @@ namespace Fx
|
|||||||
advance();
|
advance();
|
||||||
return { Comma{} };
|
return { Comma{} };
|
||||||
default:
|
default:
|
||||||
error(std::format("unexpected token <{}>", head()));
|
error(std::format("unexpected token <{:c}>", head()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ namespace Fx
|
|||||||
Technique::UniformMap::iterator Technique::findUniform(std::string_view name)
|
Technique::UniformMap::iterator Technique::findUniform(std::string_view name)
|
||||||
{
|
{
|
||||||
return std::find_if(mDefinedUniforms.begin(), mDefinedUniforms.end(),
|
return std::find_if(mDefinedUniforms.begin(), mDefinedUniforms.end(),
|
||||||
[=](const auto& uniform) { return uniform->mName == name; });
|
[name](const auto& uniform) { return uniform->mName == name; });
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Technique::compile()
|
bool Technique::compile()
|
||||||
@ -372,7 +372,7 @@ namespace Fx
|
|||||||
else if (!pass->mFragment)
|
else if (!pass->mFragment)
|
||||||
pass->mFragment = new osg::Shader(osg::Shader::FRAGMENT, getBlockWithLineDirective());
|
pass->mFragment = new osg::Shader(osg::Shader::FRAGMENT, getBlockWithLineDirective());
|
||||||
else
|
else
|
||||||
error(std::format("duplicate vertex shader for block '{}'", mBlockName));
|
error(std::format("duplicate fragment shader for block '{}'", mBlockName));
|
||||||
|
|
||||||
pass->mType = Pass::Type::Pixel;
|
pass->mType = Pass::Type::Pixel;
|
||||||
}
|
}
|
||||||
@ -397,7 +397,7 @@ namespace Fx
|
|||||||
else if (!pass->mFragment)
|
else if (!pass->mFragment)
|
||||||
pass->mCompute = new osg::Shader(osg::Shader::COMPUTE, getBlockWithLineDirective());
|
pass->mCompute = new osg::Shader(osg::Shader::COMPUTE, getBlockWithLineDirective());
|
||||||
else
|
else
|
||||||
error(std::format("duplicate vertex shader for block '{}'", mBlockName));
|
error(std::format("duplicate compute shader for block '{}'", mBlockName));
|
||||||
|
|
||||||
pass->mType = Pass::Type::Compute;
|
pass->mType = Pass::Type::Compute;
|
||||||
}
|
}
|
||||||
@ -690,9 +690,9 @@ namespace Fx
|
|||||||
if (!std::holds_alternative<T>(mToken) && !std::holds_alternative<T2>(mToken))
|
if (!std::holds_alternative<T>(mToken) && !std::holds_alternative<T2>(mToken))
|
||||||
{
|
{
|
||||||
if (err.empty())
|
if (err.empty())
|
||||||
error(std::format("{}. Expected {} or {}", err, T::repr, T2::repr));
|
|
||||||
else
|
|
||||||
error(std::format("Expected {} or {}", T::repr, T2::repr));
|
error(std::format("Expected {} or {}", T::repr, T2::repr));
|
||||||
|
else
|
||||||
|
error(std::format("{}. Expected {} or {}", err, T::repr, T2::repr));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,12 +112,7 @@ namespace Fx
|
|||||||
|
|
||||||
size_t getNumElements() const
|
size_t getNumElements() const
|
||||||
{
|
{
|
||||||
return std::visit(
|
return std::visit([](auto&& arg) { return arg.isArray() ? arg.getArray().size() : 1; }, mData);
|
||||||
[&](auto&& arg) {
|
|
||||||
;
|
|
||||||
return arg.isArray() ? arg.getArray().size() : 1;
|
|
||||||
},
|
|
||||||
mData);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
@ -261,29 +256,30 @@ namespace Fx
|
|||||||
if (useUniform)
|
if (useUniform)
|
||||||
return std::format("uniform vec2 {};", uname);
|
return std::format("uniform vec2 {};", uname);
|
||||||
|
|
||||||
return std::format("const vec2 {}=vec2({},{});", mName, value[0], value[1]);
|
return std::format("const vec2 {}=vec2({:f},{:f});", mName, value[0], value[1]);
|
||||||
}
|
}
|
||||||
else if constexpr (std::is_same_v<T, osg::Vec3f>)
|
else if constexpr (std::is_same_v<T, osg::Vec3f>)
|
||||||
{
|
{
|
||||||
if (useUniform)
|
if (useUniform)
|
||||||
return std::format("uniform vec3 {};", uname);
|
return std::format("uniform vec3 {};", uname);
|
||||||
|
|
||||||
return std::format("const vec3 {}=vec3({},{},{});", mName, value[0], value[1], value[2]);
|
return std::format(
|
||||||
|
"const vec3 {}=vec3({:f},{:f},{:f});", mName, value[0], value[1], value[2]);
|
||||||
}
|
}
|
||||||
else if constexpr (std::is_same_v<T, osg::Vec4f>)
|
else if constexpr (std::is_same_v<T, osg::Vec4f>)
|
||||||
{
|
{
|
||||||
if (useUniform)
|
if (useUniform)
|
||||||
return std::format("uniform vec4 {};", uname);
|
return std::format("uniform vec4 {};", uname);
|
||||||
|
|
||||||
return std::format(
|
return std::format("const vec4 {}=vec4({:f},{:f},{:f},{:f});", mName, value[0], value[1],
|
||||||
"const vec4 {}=vec4({},{},{},{});", mName, value[0], value[1], value[2], value[3]);
|
value[2], value[3]);
|
||||||
}
|
}
|
||||||
else if constexpr (std::is_same_v<T, float>)
|
else if constexpr (std::is_same_v<T, float>)
|
||||||
{
|
{
|
||||||
if (useUniform)
|
if (useUniform)
|
||||||
return std::format("uniform float {};", uname);
|
return std::format("uniform float {};", uname);
|
||||||
|
|
||||||
return std::format("const float {}={};", mName, value);
|
return std::format("const float {}={:f};", mName, value);
|
||||||
}
|
}
|
||||||
else if constexpr (std::is_same_v<T, int>)
|
else if constexpr (std::is_same_v<T, int>)
|
||||||
{
|
{
|
||||||
@ -298,7 +294,7 @@ namespace Fx
|
|||||||
if (useUniform)
|
if (useUniform)
|
||||||
return std::format("uniform bool {};", uname);
|
return std::format("uniform bool {};", uname);
|
||||||
|
|
||||||
return std::format("const bool {}={};", mName, value ? "true" : "false");
|
return std::format("const bool {}={};", mName, value);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mData);
|
mData);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user