mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-05-04 15:57:59 +03:00
apply same logic to render targets, remove UB
This commit is contained in:
parent
dec120f38c
commit
85fcfbafda
8 changed files with 76 additions and 30 deletions
|
@ -12,7 +12,6 @@
|
|||
#include <osg/StateSet>
|
||||
|
||||
#include <components/resource/scenemanager.hpp>
|
||||
#include <components/sceneutil/clearcolor.hpp>
|
||||
#include <components/sceneutil/lightmanager.hpp>
|
||||
#include <components/settings/values.hpp>
|
||||
#include <components/stereo/multiview.hpp>
|
||||
|
@ -326,9 +325,6 @@ float omw_EstimateFogCoverageFromUV(vec2 uv)
|
|||
|
||||
if (mBlendEq)
|
||||
stateSet->setAttributeAndModes(new osg::BlendEquation(mBlendEq.value()));
|
||||
|
||||
if (mClearColor)
|
||||
stateSet->setAttributeAndModes(new SceneUtil::ClearColor(mClearColor.value(), GL_COLOR_BUFFER_BIT));
|
||||
}
|
||||
|
||||
void Pass::dirty()
|
||||
|
|
|
@ -72,7 +72,6 @@ namespace fx
|
|||
std::array<std::string, 3> mRenderTargets;
|
||||
|
||||
std::string mTarget;
|
||||
std::optional<osg::Vec4f> mClearColor;
|
||||
|
||||
std::optional<osg::BlendFunc::BlendFuncMode> mBlendSource;
|
||||
std::optional<osg::BlendFunc::BlendFuncMode> mBlendDest;
|
||||
|
|
|
@ -313,6 +313,8 @@ namespace fx
|
|||
rt.mTarget->setSourceFormat(parseSourceFormat());
|
||||
else if (key == "mipmaps")
|
||||
rt.mMipMap = parseBool();
|
||||
else if (key == "clear_color")
|
||||
rt.mClearColor = parseVec<osg::Vec4f, Lexer::Vec4>();
|
||||
else
|
||||
error(Misc::StringUtils::format("unexpected key '%s'", std::string(key)));
|
||||
|
||||
|
@ -798,9 +800,6 @@ namespace fx
|
|||
if (!pass)
|
||||
pass = std::make_shared<fx::Pass>();
|
||||
|
||||
bool clear = true;
|
||||
osg::Vec4f clearColor = { 1, 1, 1, 1 };
|
||||
|
||||
while (!isNext<Lexer::Eof>())
|
||||
{
|
||||
expect<Lexer::Literal>("invalid key in block header");
|
||||
|
@ -844,10 +843,6 @@ namespace fx
|
|||
if (blendEq != osg::BlendEquation::FUNC_ADD)
|
||||
pass->mBlendEq = blendEq;
|
||||
}
|
||||
else if (key == "clear")
|
||||
clear = parseBool();
|
||||
else if (key == "clear_color")
|
||||
clearColor = parseVec<osg::Vec4f, Lexer::Vec4>();
|
||||
else
|
||||
error(Misc::StringUtils::format("unrecognized key '%s' in block header", std::string(key)));
|
||||
|
||||
|
@ -865,9 +860,6 @@ namespace fx
|
|||
return;
|
||||
}
|
||||
|
||||
if (clear)
|
||||
pass->mClearColor = clearColor;
|
||||
|
||||
error("malformed block header");
|
||||
}
|
||||
|
||||
|
|
|
@ -63,6 +63,17 @@ namespace fx
|
|||
osg::ref_ptr<osg::Texture2D> mTarget = new osg::Texture2D;
|
||||
SizeProxy mSize;
|
||||
bool mMipMap = false;
|
||||
osg::Vec4f mClearColor = osg::Vec4f(0.0, 0.0, 0.0, 1.0);
|
||||
|
||||
RenderTarget() = default;
|
||||
|
||||
RenderTarget(const RenderTarget& other)
|
||||
: mTarget(other.mTarget)
|
||||
, mSize(other.mSize)
|
||||
, mMipMap(other.mMipMap)
|
||||
, mClearColor(other.mClearColor)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue