Changed instances of new across to use osgNew to help debugging, and fixed

an unitialized variable in Sequence.
This commit is contained in:
Robert Osfield 2002-08-28 21:40:38 +00:00
parent 3065f35ae2
commit b546c63139
5 changed files with 35 additions and 26 deletions

View File

@ -34,7 +34,8 @@ public :
const float getTime(int frame) const; const float getTime(int frame) const;
/** Interval modes */ /** Interval modes */
enum LoopMode { enum LoopMode
{
LOOP, LOOP,
SWING SWING
}; };
@ -43,7 +44,8 @@ public :
void setInterval(LoopMode mode, int begin, int end); void setInterval(LoopMode mode, int begin, int end);
/** Get sequence mode & interval. */ /** Get sequence mode & interval. */
inline void getInterval(LoopMode& mode, int& begin, int& end) const { inline void getInterval(LoopMode& mode, int& begin, int& end) const
{
mode = _loopMode; mode = _loopMode;
begin = _begin; begin = _begin;
end = _end; end = _end;
@ -53,13 +55,15 @@ public :
void setDuration(float speed, int nreps = -1); void setDuration(float speed, int nreps = -1);
/** Get duration */ /** Get duration */
inline void getDuration(float& speed, int& nreps) const { inline void getDuration(float& speed, int& nreps) const
{
speed = _speed; speed = _speed;
nreps = _nreps; nreps = _nreps;
} }
/** Sequence modes */ /** Sequence modes */
enum SequenceMode { enum SequenceMode
{
START, START,
STOP, STOP,
PAUSE, PAUSE,

View File

@ -459,7 +459,7 @@ Starts a TestSuite singleton function
{ \ { \
static osg::ref_ptr<osgUtx::TestSuite> s_suite = 0; \ static osg::ref_ptr<osgUtx::TestSuite> s_suite = 0; \
if ( s_suite == 0 ) { \ if ( s_suite == 0 ) { \
s_suite = new osgUtx::TestSuite( #tsuite ); s_suite = osgNew osgUtx::TestSuite( #tsuite );
@ -468,7 +468,7 @@ Adds a test case to a suite object being created in a TestSuite singleton functi
@see OSGUTX_BEGIN_TESTSUITE, OSGUTX_END_TESTSUITE @see OSGUTX_BEGIN_TESTSUITE, OSGUTX_END_TESTSUITE
*/ */
#define OSGUTX_ADD_TESTCASE( tfixture, tmethod ) \ #define OSGUTX_ADD_TESTCASE( tfixture, tmethod ) \
s_suite->add( new osgUtx::TestCase_<tfixture>( \ s_suite->add( osgNew osgUtx::TestCase_<tfixture>( \
#tmethod, &tfixture::tmethod ) ); #tmethod, &tfixture::tmethod ) );
/** /**

View File

@ -28,14 +28,14 @@ void ClipNode::createClipBox(const BoundingBox& bb,unsigned int clipPlaneNumberB
{ {
_planes.clear(); _planes.clear();
_planes.push_back(new ClipPlane(clipPlaneNumberBase ,1.0,0.0,0.0,-bb.xMin())); _planes.push_back(osgNew ClipPlane(clipPlaneNumberBase ,1.0,0.0,0.0,-bb.xMin()));
_planes.push_back(new ClipPlane(clipPlaneNumberBase+1,-1.0,0.0,0.0,bb.xMax())); _planes.push_back(osgNew ClipPlane(clipPlaneNumberBase+1,-1.0,0.0,0.0,bb.xMax()));
_planes.push_back(new ClipPlane(clipPlaneNumberBase+2,0.0,1.0,0.0,-bb.yMin())); _planes.push_back(osgNew ClipPlane(clipPlaneNumberBase+2,0.0,1.0,0.0,-bb.yMin()));
_planes.push_back(new ClipPlane(clipPlaneNumberBase+3,0.0,-1.0,0.0,bb.yMax())); _planes.push_back(osgNew ClipPlane(clipPlaneNumberBase+3,0.0,-1.0,0.0,bb.yMax()));
_planes.push_back(new ClipPlane(clipPlaneNumberBase+4,0.0,0.0,1.0,-bb.zMin())); _planes.push_back(osgNew ClipPlane(clipPlaneNumberBase+4,0.0,0.0,1.0,-bb.zMin()));
_planes.push_back(new ClipPlane(clipPlaneNumberBase+5,0.0,0.0,-1.0,bb.zMax())); _planes.push_back(osgNew ClipPlane(clipPlaneNumberBase+5,0.0,0.0,-1.0,bb.zMax()));
setLocalStateSetModes(_value); setLocalStateSetModes(_value);
} }

View File

@ -8,26 +8,31 @@ using namespace osg;
Sequence::Sequence() : Sequence::Sequence() :
Switch(), Switch(),
_last(-1.0f), _last(-1.0f),
_step(1) _step(1),
_loopMode(LOOP),
_begin(0),
_end(-1),
_speed(0),
_nreps(0),
_nrepsremain(0),
_mode(STOP)
{ {
_frameTime.clear();
setInterval(LOOP, 0, -1);
setMode(STOP);
setNumChildrenRequiringAppTraversal(1); setNumChildrenRequiringAppTraversal(1);
} }
Sequence::Sequence(const Sequence& seq, const CopyOp& copyop) : Sequence::Sequence(const Sequence& seq, const CopyOp& copyop) :
Switch(seq, copyop), Switch(seq, copyop),
_last(seq._last), _last(seq._last),
_frameTime(seq._frameTime), _step(seq._step),
_step(seq._step) _loopMode(seq._loopMode),
_begin(seq._begin),
_end(seq._end),
_speed(seq._speed),
_nreps(seq._nreps),
_nrepsremain(seq._nrepsremain),
_mode(seq._mode)
{ {
setInterval(seq._loopMode, seq._begin, seq._end); setNumChildrenRequiringAppTraversal(getNumChildrenRequiringAppTraversal()+1);
setDuration(seq._speed, seq._nreps);
setMode(seq._mode);
setNumChildrenRequiringAppTraversal(1);
} }
void Sequence::setTime(int frame, float t) void Sequence::setTime(int frame, float t)

View File

@ -141,7 +141,7 @@ TestSuite* TestGraph::suite(
if(createIfNecessary){ if(createIfNecessary){
TestSuite* childSuite = new TestSuite(*it); TestSuite* childSuite = osgNew TestSuite(*it);
tsuite->add(childSuite); tsuite->add(childSuite);
return suite(it, end, childSuite, createIfNecessary); return suite(it, end, childSuite, createIfNecessary);
} }
@ -149,7 +149,7 @@ TestSuite* TestGraph::suite(
return 0; return 0;
} }
TestGraph::TestGraph(): root_(new TestSuite("root")) TestGraph::TestGraph(): root_(osgNew TestSuite("root"))
{ {
} }