From Farshid Lashkari, Added ability to read/write the texture tile
settings of osgParticle::Particle to .osg files.
This commit is contained in:
parent
4291dd8d60
commit
14dab7f818
@ -146,6 +146,15 @@ namespace osgParticle
|
|||||||
/// Get the t texture coordinate of the bottom left of the particle
|
/// Get the t texture coordinate of the bottom left of the particle
|
||||||
inline float getTCoord() const { return _t_coord; }
|
inline float getTCoord() const { return _t_coord; }
|
||||||
|
|
||||||
|
/// Get width of texture tile
|
||||||
|
inline int getTileS() const;
|
||||||
|
|
||||||
|
/// Get height of texture tile
|
||||||
|
inline int getTileT() const;
|
||||||
|
|
||||||
|
/// Get number of texture tiles
|
||||||
|
inline int getNumTiles() const { return _num_tile; }
|
||||||
|
|
||||||
/** Kill the particle on next update
|
/** Kill the particle on next update
|
||||||
NOTE: after calling this function, the <CODE>isAlive()</CODE> method will still
|
NOTE: after calling this function, the <CODE>isAlive()</CODE> method will still
|
||||||
return true until the particle is updated again.
|
return true until the particle is updated again.
|
||||||
@ -396,6 +405,16 @@ namespace osgParticle
|
|||||||
return _prev_angle;
|
return _prev_angle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline int Particle::getTileS() const
|
||||||
|
{
|
||||||
|
return (_s_tile>0.0f) ? static_cast<int>(1.0f / _s_tile) : 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline int Particle::getTileT() const
|
||||||
|
{
|
||||||
|
return (_t_tile>0.0f) ? static_cast<int>(1.0f / _t_tile) : 1;
|
||||||
|
}
|
||||||
|
|
||||||
inline void Particle::kill()
|
inline void Particle::kill()
|
||||||
{
|
{
|
||||||
_mustdie = true;
|
_mustdie = true;
|
||||||
|
@ -124,6 +124,16 @@ bool read_particle(osgDB::Input &fr, osgParticle::Particle &P)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (fr[0].matchWord("textureTile")) {
|
||||||
|
int sTile,tTile,numTiles;
|
||||||
|
if (fr[1].getInt(sTile) && fr[2].getInt(tTile) && fr[3].getInt(numTiles)) {
|
||||||
|
P.setTextureTile(sTile,tTile,numTiles);
|
||||||
|
fr += 4;
|
||||||
|
itAdvanced = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// interpolators
|
// interpolators
|
||||||
|
|
||||||
if (fr[0].matchWord("sizeInterpolator") && fr[1].matchString("{")) {
|
if (fr[0].matchWord("sizeInterpolator") && fr[1].matchString("{")) {
|
||||||
@ -206,6 +216,7 @@ void write_particle(const osgParticle::Particle &P, osgDB::Output &fw)
|
|||||||
|
|
||||||
fw.indent() << "radius " << P.getRadius() << std::endl;
|
fw.indent() << "radius " << P.getRadius() << std::endl;
|
||||||
fw.indent() << "mass " << P.getMass() << std::endl;
|
fw.indent() << "mass " << P.getMass() << std::endl;
|
||||||
|
fw.indent() << "textureTile " << P.getTileS() << " " << P.getTileT() << " " << P.getNumTiles() << std::endl;
|
||||||
|
|
||||||
// interpolators
|
// interpolators
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user