mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-20 09:23:52 +00:00
Option to disable per view mapping.
This commit is contained in:
parent
5c4e6c3f57
commit
2393fe9e1d
3 changed files with 11 additions and 3 deletions
|
@ -233,6 +233,7 @@ class Refraction : public SceneUtil::RTTNode
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Refraction()
|
Refraction()
|
||||||
|
: RTTNode(false)
|
||||||
{
|
{
|
||||||
mClipCullNode = new ClipCullNode;
|
mClipCullNode = new ClipCullNode;
|
||||||
}
|
}
|
||||||
|
@ -296,6 +297,7 @@ class Reflection : public SceneUtil::RTTNode
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Reflection(bool isInterior)
|
Reflection(bool isInterior)
|
||||||
|
: RTTNode(false)
|
||||||
{
|
{
|
||||||
setInterior(isInterior);
|
setInterior(isInterior);
|
||||||
mClipCullNode = new ClipCullNode;
|
mClipCullNode = new ClipCullNode;
|
||||||
|
|
|
@ -34,7 +34,6 @@ namespace SceneUtil
|
||||||
setClearMask(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
|
setClearMask(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
|
||||||
setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT);
|
setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT);
|
||||||
|
|
||||||
|
|
||||||
unsigned int rttSize = Settings::Manager::getInt("rtt size", "Water");
|
unsigned int rttSize = Settings::Manager::getInt("rtt size", "Water");
|
||||||
setViewport(0, 0, rttSize, rttSize);
|
setViewport(0, 0, rttSize, rttSize);
|
||||||
|
|
||||||
|
@ -63,7 +62,8 @@ namespace SceneUtil
|
||||||
osg::ref_ptr<osg::Texture2D> mDepthBuffer;
|
osg::ref_ptr<osg::Texture2D> mDepthBuffer;
|
||||||
};
|
};
|
||||||
|
|
||||||
RTTNode::RTTNode()
|
RTTNode::RTTNode(bool doPerViewMapping)
|
||||||
|
: mDoPerViewMapping(doPerViewMapping)
|
||||||
{
|
{
|
||||||
addCullCallback(new CullCallback(this));
|
addCullCallback(new CullCallback(this));
|
||||||
}
|
}
|
||||||
|
@ -91,6 +91,11 @@ namespace SceneUtil
|
||||||
|
|
||||||
RTTNode::ViewDependentData* RTTNode::getViewDependentData(osgUtil::CullVisitor* cv)
|
RTTNode::ViewDependentData* RTTNode::getViewDependentData(osgUtil::CullVisitor* cv)
|
||||||
{
|
{
|
||||||
|
if (!mDoPerViewMapping)
|
||||||
|
// Always setting it to null is an easy way to disable per-view mapping when mDoPerViewMapping is false.
|
||||||
|
// This is safe since the visitor is never dereferenced.
|
||||||
|
cv = nullptr;
|
||||||
|
|
||||||
if (mViewDependentDataMap.count(cv) == 0)
|
if (mViewDependentDataMap.count(cv) == 0)
|
||||||
{
|
{
|
||||||
mViewDependentDataMap[cv].reset(new ViewDependentData);
|
mViewDependentDataMap[cv].reset(new ViewDependentData);
|
||||||
|
|
|
@ -30,7 +30,7 @@ namespace SceneUtil
|
||||||
class RTTNode : public osg::Node
|
class RTTNode : public osg::Node
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RTTNode();
|
RTTNode(bool doPerViewMapping);
|
||||||
~RTTNode();
|
~RTTNode();
|
||||||
|
|
||||||
osg::Texture2D* getColorTexture(osgUtil::CullVisitor* cv);
|
osg::Texture2D* getColorTexture(osgUtil::CullVisitor* cv);
|
||||||
|
@ -57,6 +57,7 @@ namespace SceneUtil
|
||||||
|
|
||||||
typedef std::map< osgUtil::CullVisitor*, std::unique_ptr<ViewDependentData> > ViewDependentDataMap;
|
typedef std::map< osgUtil::CullVisitor*, std::unique_ptr<ViewDependentData> > ViewDependentDataMap;
|
||||||
ViewDependentDataMap mViewDependentDataMap;
|
ViewDependentDataMap mViewDependentDataMap;
|
||||||
|
bool mDoPerViewMapping;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue