From Tom Jolly, added setPulse

This commit is contained in:
Robert Osfield 2005-07-08 19:33:38 +00:00
parent 99279fbf61
commit 3943a14f0d

View File

@ -59,6 +59,9 @@ class OSGSIM_EXPORT BlinkSequence : public osg::Object
/** return the pulse data at position i. */
inline void getPulse(unsigned int i, double& length,osg::Vec4& color) const;
/** set pulse of specified color and duration to the BlinkSequence.*/
inline void setPulse(unsigned int i,double length,const osg::Vec4& color);
/** get the total pulse period of the blink sequence, which is equal to the sum of all the pulse periods.*/
inline double getPulsePeriod() const { return _pulsePeriod; }
@ -117,6 +120,14 @@ inline void BlinkSequence::getPulse(unsigned int i, double& length, osg::Vec4& c
color = ic.second;
}
inline void BlinkSequence::setPulse(unsigned int i,double length,const osg::Vec4& color)
{
if( i > _pulseData.size() ) return;
IntervalColor& ic = _pulseData[i];
ic.first = length;
ic.second = color;
}
inline osg::Vec4 BlinkSequence::color(double time,double length) const
{
if (_pulseData.empty()) return osg::Vec4(1.0f,1.0f,1.0f,1.0f);