mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-03-03 15:19:42 +00:00
Explicitely opt for float matrices in performance critical places
This commit is contained in:
parent
ffea9ec2c4
commit
fc7456e0a1
6 changed files with 8 additions and 8 deletions
|
@ -49,7 +49,7 @@ void InverseWorldMatrix::operator()(osg::Node *node, osg::NodeVisitor *nv)
|
||||||
|
|
||||||
osg::Matrix mat = osg::computeLocalToWorld( path );
|
osg::Matrix mat = osg::computeLocalToWorld( path );
|
||||||
mat.orthoNormalize(mat); // don't undo the scale
|
mat.orthoNormalize(mat); // don't undo the scale
|
||||||
mat = osg::Matrix::inverse(mat);
|
mat.invert(mat);
|
||||||
trans->setMatrix(mat);
|
trans->setMatrix(mat);
|
||||||
}
|
}
|
||||||
traverse(node,nv);
|
traverse(node,nv);
|
||||||
|
|
|
@ -82,7 +82,7 @@ namespace
|
||||||
osg::MatrixList mats = node->getWorldMatrices();
|
osg::MatrixList mats = node->getWorldMatrices();
|
||||||
if (mats.empty())
|
if (mats.empty())
|
||||||
return;
|
return;
|
||||||
osg::Matrix worldMat = mats[0];
|
osg::Matrixf worldMat = mats[0];
|
||||||
worldMat.orthoNormalize(worldMat); // scale is already applied on the particle node
|
worldMat.orthoNormalize(worldMat); // scale is already applied on the particle node
|
||||||
for (int i=0; i<partsys->numParticles(); ++i)
|
for (int i=0; i<partsys->numParticles(); ++i)
|
||||||
{
|
{
|
||||||
|
|
|
@ -164,7 +164,7 @@ namespace SceneUtil
|
||||||
mStateSetCache.clear();
|
mStateSetCache.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LightManager::addLight(LightSource* lightSource, osg::Matrix worldMat)
|
void LightManager::addLight(LightSource* lightSource, osg::Matrixf worldMat)
|
||||||
{
|
{
|
||||||
LightSourceTransform l;
|
LightSourceTransform l;
|
||||||
l.mLightSource = lightSource;
|
l.mLightSource = lightSource;
|
||||||
|
@ -221,7 +221,7 @@ namespace SceneUtil
|
||||||
|
|
||||||
for (std::vector<LightSourceTransform>::iterator lightIt = mLights.begin(); lightIt != mLights.end(); ++lightIt)
|
for (std::vector<LightSourceTransform>::iterator lightIt = mLights.begin(); lightIt != mLights.end(); ++lightIt)
|
||||||
{
|
{
|
||||||
osg::Matrix worldViewMat = lightIt->mWorldMatrix * (*viewMatrix);
|
osg::Matrixf worldViewMat = lightIt->mWorldMatrix * (*viewMatrix);
|
||||||
osg::BoundingSphere viewBound = osg::BoundingSphere(osg::Vec3f(0,0,0), lightIt->mLightSource->getRadius());
|
osg::BoundingSphere viewBound = osg::BoundingSphere(osg::Vec3f(0,0,0), lightIt->mLightSource->getRadius());
|
||||||
transformBoundingSphere(worldViewMat, viewBound);
|
transformBoundingSphere(worldViewMat, viewBound);
|
||||||
|
|
||||||
|
|
|
@ -77,12 +77,12 @@ namespace SceneUtil
|
||||||
void update();
|
void update();
|
||||||
|
|
||||||
// Called automatically by the LightSource's UpdateCallback
|
// Called automatically by the LightSource's UpdateCallback
|
||||||
void addLight(LightSource* lightSource, osg::Matrix worldMat);
|
void addLight(LightSource* lightSource, osg::Matrixf worldMat);
|
||||||
|
|
||||||
struct LightSourceTransform
|
struct LightSourceTransform
|
||||||
{
|
{
|
||||||
LightSource* mLightSource;
|
LightSource* mLightSource;
|
||||||
osg::Matrix mWorldMatrix;
|
osg::Matrixf mWorldMatrix;
|
||||||
};
|
};
|
||||||
|
|
||||||
const std::vector<LightSourceTransform>& getLights() const;
|
const std::vector<LightSourceTransform>& getLights() const;
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
namespace SceneUtil
|
namespace SceneUtil
|
||||||
{
|
{
|
||||||
|
|
||||||
void transformBoundingSphere (const osg::Matrix& matrix, osg::BoundingSphere& bsphere)
|
void transformBoundingSphere (const osg::Matrixf& matrix, osg::BoundingSphere& bsphere)
|
||||||
{
|
{
|
||||||
osg::BoundingSphere::vec_type xdash = bsphere._center;
|
osg::BoundingSphere::vec_type xdash = bsphere._center;
|
||||||
xdash.x() += bsphere._radius;
|
xdash.x() += bsphere._radius;
|
||||||
|
|
|
@ -11,7 +11,7 @@ namespace SceneUtil
|
||||||
// Transform a bounding sphere by a matrix
|
// Transform a bounding sphere by a matrix
|
||||||
// based off private code in osg::Transform
|
// based off private code in osg::Transform
|
||||||
// TODO: patch osg to make public
|
// TODO: patch osg to make public
|
||||||
void transformBoundingSphere (const osg::Matrix& matrix, osg::BoundingSphere& bsphere);
|
void transformBoundingSphere (const osg::Matrixf& matrix, osg::BoundingSphere& bsphere);
|
||||||
|
|
||||||
osg::Vec4f colourFromRGB (unsigned int clr);
|
osg::Vec4f colourFromRGB (unsigned int clr);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue