mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-05-06 19:01:21 +03:00
Don't compute the world matrix multiple times
This commit is contained in:
parent
055d35a2b0
commit
8bd16e4d5a
8 changed files with 30 additions and 30 deletions
|
@ -261,10 +261,10 @@ void Emitter::emitParticles(double dt)
|
|||
osg::Matrix worldToPs;
|
||||
|
||||
// maybe this could be optimized by halting at the lowest common ancestor of the particle and emitter nodes
|
||||
osg::MatrixList worldMats = getParticleSystem()->getWorldMatrices();
|
||||
if (!worldMats.empty())
|
||||
osg::NodePathList partsysNodePaths = getParticleSystem()->getParentalNodePaths();
|
||||
if (partsysNodePaths.size())
|
||||
{
|
||||
const osg::Matrix psToWorld = worldMats[0];
|
||||
osg::Matrix psToWorld = osg::computeLocalToWorld(partsysNodePaths[0]);
|
||||
worldToPs = osg::Matrix::inverse(psToWorld);
|
||||
}
|
||||
|
||||
|
|
|
@ -69,10 +69,10 @@ namespace
|
|||
|
||||
void transformInitialParticles(osgParticle::ParticleSystem* partsys, osg::Node* node)
|
||||
{
|
||||
osg::MatrixList mats = node->getWorldMatrices();
|
||||
if (mats.empty())
|
||||
osg::NodePathList nodepaths = node->getParentalNodePaths();
|
||||
if (nodepaths.empty())
|
||||
return;
|
||||
osg::Matrixf worldMat = mats[0];
|
||||
osg::Matrixf worldMat = osg::computeLocalToWorld(nodepaths[0]);
|
||||
worldMat.orthoNormalize(worldMat); // scale is already applied on the particle node
|
||||
for (int i=0; i<partsys->numParticles(); ++i)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue