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();
|
||||
return { Comma{} };
|
||||
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)
|
||||
{
|
||||
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()
|
||||
@ -372,7 +372,7 @@ namespace Fx
|
||||
else if (!pass->mFragment)
|
||||
pass->mFragment = new osg::Shader(osg::Shader::FRAGMENT, getBlockWithLineDirective());
|
||||
else
|
||||
error(std::format("duplicate vertex shader for block '{}'", mBlockName));
|
||||
error(std::format("duplicate fragment shader for block '{}'", mBlockName));
|
||||
|
||||
pass->mType = Pass::Type::Pixel;
|
||||
}
|
||||
@ -397,7 +397,7 @@ namespace Fx
|
||||
else if (!pass->mFragment)
|
||||
pass->mCompute = new osg::Shader(osg::Shader::COMPUTE, getBlockWithLineDirective());
|
||||
else
|
||||
error(std::format("duplicate vertex shader for block '{}'", mBlockName));
|
||||
error(std::format("duplicate compute shader for block '{}'", mBlockName));
|
||||
|
||||
pass->mType = Pass::Type::Compute;
|
||||
}
|
||||
@ -690,9 +690,9 @@ namespace Fx
|
||||
if (!std::holds_alternative<T>(mToken) && !std::holds_alternative<T2>(mToken))
|
||||
{
|
||||
if (err.empty())
|
||||
error(std::format("{}. Expected {} or {}", err, T::repr, T2::repr));
|
||||
else
|
||||
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
|
||||
{
|
||||
return std::visit(
|
||||
[&](auto&& arg) {
|
||||
;
|
||||
return arg.isArray() ? arg.getArray().size() : 1;
|
||||
},
|
||||
mData);
|
||||
return std::visit([](auto&& arg) { return arg.isArray() ? arg.getArray().size() : 1; }, mData);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
@ -261,29 +256,30 @@ namespace Fx
|
||||
if (useUniform)
|
||||
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>)
|
||||
{
|
||||
if (useUniform)
|
||||
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>)
|
||||
{
|
||||
if (useUniform)
|
||||
return std::format("uniform vec4 {};", uname);
|
||||
|
||||
return std::format(
|
||||
"const vec4 {}=vec4({},{},{},{});", mName, value[0], value[1], value[2], value[3]);
|
||||
return std::format("const vec4 {}=vec4({:f},{:f},{:f},{:f});", mName, value[0], value[1],
|
||||
value[2], value[3]);
|
||||
}
|
||||
else if constexpr (std::is_same_v<T, float>)
|
||||
{
|
||||
if (useUniform)
|
||||
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>)
|
||||
{
|
||||
@ -298,7 +294,7 @@ namespace Fx
|
||||
if (useUniform)
|
||||
return std::format("uniform bool {};", uname);
|
||||
|
||||
return std::format("const bool {}={};", mName, value ? "true" : "false");
|
||||
return std::format("const bool {}={};", mName, value);
|
||||
}
|
||||
},
|
||||
mData);
|
||||
|
Loading…
x
Reference in New Issue
Block a user