Introduce osgParticle::ParticleSystem::s/getParticleScaleReferenceFrame() to

help manage the scaling of particles, whether they should be relative to the
local coordiante frame of the particle system, or be in world coordinates.
This commit is contained in:
Robert Osfield
2008-03-17 12:09:05 +00:00
parent 7ec5673a7e
commit 00f161ca35
4 changed files with 68 additions and 15 deletions

View File

@@ -43,6 +43,19 @@ bool ParticleSystem_readLocalData(osg::Object &obj, osgDB::Input &fr)
}
}
if (fr[0].matchWord("particleScaleReferenceFrame")) {
if (fr[1].matchWord("LOCAL_COORDINATES")) {
myobj.setParticleScaleReferenceFrame(osgParticle::ParticleSystem::LOCAL_COORDINATES);
fr += 2;
itAdvanced = true;
}
if (fr[1].matchWord("")) {
myobj.setParticleScaleReferenceFrame(osgParticle::ParticleSystem::WORLD_COORDINATES);
fr += 2;
itAdvanced = true;
}
}
if (fr[0].matchWord("alignVectorX")) {
osg::Vec3 v;
if (fr[1].getFloat(v.x()) && fr[2].getFloat(v.y()) && fr[3].getFloat(v.z())) {
@@ -138,6 +151,17 @@ bool ParticleSystem_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
break;
}
fw.indent() << "particleScaleReferenceFrame ";
switch (myobj.getParticleScaleReferenceFrame()) {
default:
case osgParticle::ParticleSystem::LOCAL_COORDINATES:
fw << "LOCAL_COORDINATES" << std::endl;
break;
case osgParticle::ParticleSystem::WORLD_COORDINATES:
fw << "WORLD_COORDINATES" << std::endl;
break;
}
osg::Vec3 v = myobj.getAlignVectorX();
fw.indent() << "alignVectorX " << v.x() << " " << v.y() << " " << v.z() << std::endl;
v = myobj.getAlignVectorY();