mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-18 13:12:50 +00:00
Merge branch 'absoluteprecision' into 'master'
Fix compilation errors with double precision bound types (bug #6579) Closes #6579 See merge request OpenMW/openmw!1619
This commit is contained in:
commit
fb99ed78d5
@ -100,6 +100,7 @@
|
||||
Bug #6519: Effects tooltips for ingredients work incorrectly
|
||||
Bug #6523: Disintegrate Weapon is resisted by Resist Magicka instead of Sanctuary
|
||||
Bug #6544: Far from world origin objects jitter when camera is still
|
||||
Bug #6579: OpenMW compilation error when using OSG doubles for BoundingSphere
|
||||
Feature #890: OpenMW-CS: Column filtering
|
||||
Feature #1465: "Reset" argument for AI functions
|
||||
Feature #2554: Modifying an object triggers the instances table to scroll to the corresponding record
|
||||
|
@ -460,8 +460,10 @@ void LocalMap::requestInteriorMap(const MWWorld::CellStore* cell)
|
||||
yOffset++;
|
||||
mBounds.yMin() = fog->mBounds.mMinY - yOffset * mMapWorldSize;
|
||||
}
|
||||
mBounds.xMax() = std::max(mBounds.xMax(), fog->mBounds.mMaxX);
|
||||
mBounds.yMax() = std::max(mBounds.yMax(), fog->mBounds.mMaxY);
|
||||
if (fog->mBounds.mMaxX > mBounds.xMax())
|
||||
mBounds.xMax() = fog->mBounds.mMaxX;
|
||||
if (fog->mBounds.mMaxY > mBounds.yMax())
|
||||
mBounds.yMax() = fog->mBounds.mMaxY;
|
||||
|
||||
if(xOffset != 0 || yOffset != 0)
|
||||
Log(Debug::Warning) << "Warning: expanding fog by " << xOffset << ", " << yOffset;
|
||||
|
@ -1109,7 +1109,8 @@ namespace SceneUtil
|
||||
if (transform.mLightSource->getLastAppliedFrame() != frameNum && mPointLightFadeEnd != 0.f)
|
||||
{
|
||||
const float fadeDelta = mPointLightFadeEnd - mPointLightFadeStart;
|
||||
float fade = 1 - std::clamp((viewBound.center().length() - mPointLightFadeStart) / fadeDelta, 0.f, 1.f);
|
||||
const float viewDelta = viewBound.center().length() - mPointLightFadeStart;
|
||||
float fade = 1 - std::clamp(viewDelta / fadeDelta, 0.f, 1.f);
|
||||
if (fade == 0.f)
|
||||
continue;
|
||||
|
||||
|
@ -188,37 +188,6 @@ private:
|
||||
osg::ref_ptr<osg::FrameBufferObject> mMsaaFbo;
|
||||
};
|
||||
|
||||
void transformBoundingSphere (const osg::Matrixf& matrix, osg::BoundingSphere& bsphere)
|
||||
{
|
||||
osg::BoundingSphere::vec_type xdash = bsphere._center;
|
||||
xdash.x() += bsphere._radius;
|
||||
xdash = xdash*matrix;
|
||||
|
||||
osg::BoundingSphere::vec_type ydash = bsphere._center;
|
||||
ydash.y() += bsphere._radius;
|
||||
ydash = ydash*matrix;
|
||||
|
||||
osg::BoundingSphere::vec_type zdash = bsphere._center;
|
||||
zdash.z() += bsphere._radius;
|
||||
zdash = zdash*matrix;
|
||||
|
||||
bsphere._center = bsphere._center*matrix;
|
||||
|
||||
xdash -= bsphere._center;
|
||||
osg::BoundingSphere::value_type sqrlen_xdash = xdash.length2();
|
||||
|
||||
ydash -= bsphere._center;
|
||||
osg::BoundingSphere::value_type sqrlen_ydash = ydash.length2();
|
||||
|
||||
zdash -= bsphere._center;
|
||||
osg::BoundingSphere::value_type sqrlen_zdash = zdash.length2();
|
||||
|
||||
bsphere._radius = sqrlen_xdash;
|
||||
if (bsphere._radius<sqrlen_ydash) bsphere._radius = sqrlen_ydash;
|
||||
if (bsphere._radius<sqrlen_zdash) bsphere._radius = sqrlen_zdash;
|
||||
bsphere._radius = sqrtf(bsphere._radius);
|
||||
}
|
||||
|
||||
osg::Vec4f colourFromRGB(unsigned int clr)
|
||||
{
|
||||
osg::Vec4f colour(((clr >> 0) & 0xFF) / 255.0f,
|
||||
|
@ -49,7 +49,37 @@ namespace SceneUtil
|
||||
// Transform a bounding sphere by a matrix
|
||||
// based off private code in osg::Transform
|
||||
// TODO: patch osg to make public
|
||||
void transformBoundingSphere (const osg::Matrixf& matrix, osg::BoundingSphere& bsphere);
|
||||
template<typename VT>
|
||||
inline void transformBoundingSphere (const osg::Matrixf& matrix, osg::BoundingSphereImpl<VT>& bsphere)
|
||||
{
|
||||
VT xdash = bsphere._center;
|
||||
xdash.x() += bsphere._radius;
|
||||
xdash = xdash*matrix;
|
||||
|
||||
VT ydash = bsphere._center;
|
||||
ydash.y() += bsphere._radius;
|
||||
ydash = ydash*matrix;
|
||||
|
||||
VT zdash = bsphere._center;
|
||||
zdash.z() += bsphere._radius;
|
||||
zdash = zdash*matrix;
|
||||
|
||||
bsphere._center = bsphere._center*matrix;
|
||||
|
||||
xdash -= bsphere._center;
|
||||
typename VT::value_type sqrlen_xdash = xdash.length2();
|
||||
|
||||
ydash -= bsphere._center;
|
||||
typename VT::value_type sqrlen_ydash = ydash.length2();
|
||||
|
||||
zdash -= bsphere._center;
|
||||
typename VT::value_type sqrlen_zdash = zdash.length2();
|
||||
|
||||
bsphere._radius = sqrlen_xdash;
|
||||
if (bsphere._radius<sqrlen_ydash) bsphere._radius = sqrlen_ydash;
|
||||
if (bsphere._radius<sqrlen_zdash) bsphere._radius = sqrlen_zdash;
|
||||
bsphere._radius = sqrtf(bsphere._radius);
|
||||
}
|
||||
|
||||
osg::Vec4f colourFromRGB (unsigned int clr);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user