forked from mirror/openmw-tes3mp
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 );
|
||||
mat.orthoNormalize(mat); // don't undo the scale
|
||||
mat = osg::Matrix::inverse(mat);
|
||||
mat.invert(mat);
|
||||
trans->setMatrix(mat);
|
||||
}
|
||||
traverse(node,nv);
|
||||
|
|
|
@ -82,7 +82,7 @@ namespace
|
|||
osg::MatrixList mats = node->getWorldMatrices();
|
||||
if (mats.empty())
|
||||
return;
|
||||
osg::Matrix worldMat = mats[0];
|
||||
osg::Matrixf worldMat = mats[0];
|
||||
worldMat.orthoNormalize(worldMat); // scale is already applied on the particle node
|
||||
for (int i=0; i<partsys->numParticles(); ++i)
|
||||
{
|
||||
|
|
|
@ -164,7 +164,7 @@ namespace SceneUtil
|
|||
mStateSetCache.clear();
|
||||
}
|
||||
|
||||
void LightManager::addLight(LightSource* lightSource, osg::Matrix worldMat)
|
||||
void LightManager::addLight(LightSource* lightSource, osg::Matrixf worldMat)
|
||||
{
|
||||
LightSourceTransform l;
|
||||
l.mLightSource = lightSource;
|
||||
|
@ -221,7 +221,7 @@ namespace SceneUtil
|
|||
|
||||
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());
|
||||
transformBoundingSphere(worldViewMat, viewBound);
|
||||
|
||||
|
|
|
@ -77,12 +77,12 @@ namespace SceneUtil
|
|||
void update();
|
||||
|
||||
// Called automatically by the LightSource's UpdateCallback
|
||||
void addLight(LightSource* lightSource, osg::Matrix worldMat);
|
||||
void addLight(LightSource* lightSource, osg::Matrixf worldMat);
|
||||
|
||||
struct LightSourceTransform
|
||||
{
|
||||
LightSource* mLightSource;
|
||||
osg::Matrix mWorldMatrix;
|
||||
osg::Matrixf mWorldMatrix;
|
||||
};
|
||||
|
||||
const std::vector<LightSourceTransform>& getLights() const;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
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;
|
||||
xdash.x() += bsphere._radius;
|
||||
|
|
|
@ -11,7 +11,7 @@ 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::Matrix& matrix, osg::BoundingSphere& bsphere);
|
||||
void transformBoundingSphere (const osg::Matrixf& matrix, osg::BoundingSphere& bsphere);
|
||||
|
||||
osg::Vec4f colourFromRGB (unsigned int clr);
|
||||
|
||||
|
|
Loading…
Reference in a new issue