mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-21 13:23:53 +00:00
Fix frozen rain when water refractions are disabled
This commit is contained in:
parent
01d725d2d1
commit
0333cd2dd4
1 changed files with 8 additions and 8 deletions
|
@ -266,16 +266,16 @@ public:
|
||||||
|
|
||||||
META_Node(MWRender, CameraRelativeTransform)
|
META_Node(MWRender, CameraRelativeTransform)
|
||||||
|
|
||||||
const osg::Vec3f& getLastEyePoint() const
|
const osg::Vec3f& getLastViewPoint() const
|
||||||
{
|
{
|
||||||
return mEyePoint;
|
return mViewPoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool computeLocalToWorldMatrix(osg::Matrix& matrix, osg::NodeVisitor* nv) const
|
virtual bool computeLocalToWorldMatrix(osg::Matrix& matrix, osg::NodeVisitor* nv) const
|
||||||
{
|
{
|
||||||
if (nv->getVisitorType() == osg::NodeVisitor::CULL_VISITOR)
|
if (nv->getVisitorType() == osg::NodeVisitor::CULL_VISITOR)
|
||||||
{
|
{
|
||||||
mEyePoint = static_cast<osgUtil::CullVisitor*>(nv)->getEyePoint();
|
mViewPoint = static_cast<osgUtil::CullVisitor*>(nv)->getViewPoint();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_referenceFrame==RELATIVE_RF)
|
if (_referenceFrame==RELATIVE_RF)
|
||||||
|
@ -337,8 +337,8 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
private:
|
private:
|
||||||
// eyePoint for the current frame
|
// viewPoint for the current frame
|
||||||
mutable osg::Vec3f mEyePoint;
|
mutable osg::Vec3f mViewPoint;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ModVertexAlphaVisitor : public osg::NodeVisitor
|
class ModVertexAlphaVisitor : public osg::NodeVisitor
|
||||||
|
@ -391,7 +391,7 @@ private:
|
||||||
/// @brief Hides the node subgraph if the eye point is below water.
|
/// @brief Hides the node subgraph if the eye point is below water.
|
||||||
/// @note Must be added as cull callback.
|
/// @note Must be added as cull callback.
|
||||||
/// @note Meant to be used on a node that is child of a CameraRelativeTransform.
|
/// @note Meant to be used on a node that is child of a CameraRelativeTransform.
|
||||||
/// The current eye point must be retrieved by the CameraRelativeTransform since we can't get it anymore once we are in camera-relative space.
|
/// The current view point must be retrieved by the CameraRelativeTransform since we can't get it anymore once we are in camera-relative space.
|
||||||
class UnderwaterSwitchCallback : public osg::NodeCallback
|
class UnderwaterSwitchCallback : public osg::NodeCallback
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -404,8 +404,8 @@ public:
|
||||||
|
|
||||||
bool isUnderwater()
|
bool isUnderwater()
|
||||||
{
|
{
|
||||||
osg::Vec3f eyePoint = mCameraRelativeTransform->getLastEyePoint();
|
osg::Vec3f viewPoint = mCameraRelativeTransform->getLastViewPoint();
|
||||||
return mEnabled && eyePoint.z() < mWaterLevel;
|
return mEnabled && viewPoint.z() < mWaterLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)
|
virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)
|
||||||
|
|
Loading…
Reference in a new issue