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:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user