1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-02-03 18:15:35 +00:00

Merge pull request #2322 from Capostrophic/rain

Fix frozen rain when water refractions are disabled
This commit is contained in:
Andrei Kortunov 2019-04-12 18:03:17 +04:00 committed by GitHub
commit ab7ff4eaf9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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)