mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-25 03:40:40 +00:00
SunGlareCallback: Fix incorrect view matrix for RELATIVE_RF cameras
This commit is contained in:
parent
49df6b7450
commit
ef5838df7e
@ -741,7 +741,7 @@ private:
|
|||||||
{
|
{
|
||||||
osgUtil::CullVisitor* cv = static_cast<osgUtil::CullVisitor*>(nv);
|
osgUtil::CullVisitor* cv = static_cast<osgUtil::CullVisitor*>(nv);
|
||||||
|
|
||||||
float angleRadians = getAngleToSunInRadians(cv->getCurrentCamera());
|
float angleRadians = getAngleToSunInRadians(*cv->getCurrentRenderStage()->getInitialViewMatrix());
|
||||||
float visibleRatio = getVisibleRatio(cv->getCurrentCamera());
|
float visibleRatio = getVisibleRatio(cv->getCurrentCamera());
|
||||||
|
|
||||||
const float angleMaxRadians = osg::DegreesToRadians(mSunGlareFaderAngleMax);
|
const float angleMaxRadians = osg::DegreesToRadians(mSunGlareFaderAngleMax);
|
||||||
@ -784,10 +784,10 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
float getAngleToSunInRadians(osg::Camera* camera) const
|
float getAngleToSunInRadians(const osg::Matrix& viewMatrix) const
|
||||||
{
|
{
|
||||||
osg::Vec3d eye, center, up;
|
osg::Vec3d eye, center, up;
|
||||||
camera->getViewMatrixAsLookAt(eye, center, up);
|
viewMatrix.getLookAt(eye, center, up);
|
||||||
|
|
||||||
osg::Vec3d forward = center - eye;
|
osg::Vec3d forward = center - eye;
|
||||||
osg::Vec3d sun = mSunTransform->getPosition();
|
osg::Vec3d sun = mSunTransform->getPosition();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user