From 5400f8293b7386b74a0eec648b219a4d465da1b3 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Sun, 31 Aug 2003 22:17:53 +0000 Subject: [PATCH] Converted cout's to notify's. --- examples/osgviewer/osgviewer.cpp | 552 ------------------------- src/osgGA/AnimationPathManipulator.cpp | 4 +- 2 files changed, 2 insertions(+), 554 deletions(-) diff --git a/examples/osgviewer/osgviewer.cpp b/examples/osgviewer/osgviewer.cpp index 458077fa0..59ae93472 100644 --- a/examples/osgviewer/osgviewer.cpp +++ b/examples/osgviewer/osgviewer.cpp @@ -13,558 +13,6 @@ #include #include -// main viewer code at bottom of file. - -// experimental templated rendering code, please ignore... -// will move to osg::Geometry once complete. -// Robert Osfield, August 2003. -#if 0 - - -struct DrawArrays -{ - virtual void draw() const = 0; -}; - -struct DrawVertex -{ - inline void operator () (const osg::Vec2* v) const { glVertex2fv(v->ptr()); } - inline void operator () (const osg::Vec3* v) const { glVertex3fv(v->ptr()); } - inline void operator () (const osg::Vec4* v) const { glVertex4fv(v->ptr()); } -}; - -struct DrawNormal -{ - inline void operator () (const osg::Vec3* v) const { glNormal3fv(v->ptr()); } -}; - -struct DrawColor -{ - inline void operator () (const osg::Vec4* v) const { glColor4fv(v->ptr()); } -}; - -struct DrawTexCoord -{ - inline void operator () (const osg::Vec2* v) const { glTexCoord2fv(v->ptr()); } -}; - - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - -template< class F1, class T1> -struct DrawFunctor_T : public DrawArrays -{ - inline DrawFunctor_T(T1* begin1, T1* end1): _begin1(begin1),_end1(end1) {} - - virtual void draw() const - { - for(T1* ptr1=_begin1; - ptr1!=_end1; - ++ptr1) - { - F1(ptr1); - } - } - - T1* _begin1; - T1* _end1; -}; - -template< class F1, class T1, class I1> -struct DrawFunctor_TI : public DrawArrays -{ - inline DrawFunctor_TI(T1* begin1, I1* ibegin1, I1* iend1): _begin1(begin1),_ibegin1(ibegin1),_iend1(end1) {} - - virtual void draw() const - { - for(I1* iptr1=_ibegin1; - iptr1!=_iend1; - ++iptr1) - { - F1(_begin1[*iptr1]); - } - } - - T1* _begin1; - I1* _ibegin1; - I1* _iend1; - -}; - - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - -template< class F1, class T1, class F2, class T2> -struct DrawFunctor_TT : public DrawArrays -{ - inline DrawFunctor_TT(T1* begin1, T1* end1, T2* begin2): _begin1(begin1),_end1(end1),_begin2(begin2) {} - - virtual void draw() const - { - T2* ptr2=_begin2; - for(T1* ptr1=_begin1; - ptr1!=_end1; - ++ptr1,++ptr2) - { - F2(ptr2); - F1(ptr1); - } - } - - T1* _begin1; - T1* _end1; - - T2* _begin2; -}; - -template< class F1, class T1, class I1, class F2, class T2> -struct DrawFunctor_TIT : public DrawArrays -{ - inline DrawFunctor_TIT(T1* begin1, I1* ibegin1, I1* iend1, T2* begin2): _begin1(begin1),_ibegin1(ibegin1),_iend1(end1) {} - - virtual void draw() const - { - T2* ptr2=_begin2; - for(I1* iptr1=_ibegin1; - iptr1!=_iend1; - ++iptr1,++ptr2) - { - F2(_ptr2); - F1(_begin1[*iptr1]); - } - } - - T1* _begin1; - I1* _ibegin1; - I1* _iend1; - - T2* _begin2; - -}; - -template< class F1, class T1, class F2, class T2, class I2> -struct DrawFunctor_TTI : public DrawArrays -{ - inline DrawFunctor_TTI(T1* begin1, T1* end1, T2* begin2, I2* ibegin2): _begin1(begin1),_end1(end1),_begin2(begin2),_ibegin2(ibegin2) {} - - virtual void draw() const - { - I2* iptr2 = _ibegin2; - for(T1* ptr1=_begin1; - ptr1!=_end1; - ++ptr1,++iptr2) - { - F2(_begin2[*iptr2]); - F1(ptr1); - } - } - - T1* _begin1; - T1* _end1; - - T2* _begin2; - I2* _ibegin2; -}; - -template< class F1, class T1, class F2, class I1, class T2, class I2> -struct DrawFunctor_TITI : public DrawArrays -{ - inline DrawFunctor_TITI(T1* begin1, I1* ibegin1, I2* iend1, T2* begin2, I2* ibegin2): _begin1(begin1),_ibegin1(ibegin1), _iend1(end1),_begin2(begin2),_ibegin2(ibegin2) {} - - virtual void draw() const - { - I2* iptr2 = _ibegin2; - for(T1* iptr1=_ibegin1; - iptr1!=_iend1; - ++iptr1,++iptr2) - { - F2(_begin2[*iptr2]); - F1(_begin1[*iptr1]); - } - } - - T1* _begin1; - I1* _ibegin1; - I1* _iend1; - - T2* _begin2; - I2* _ibegin2; -}; - - -template< class F1, class T1, class F2, class T2, class I> -struct DrawFunctor_TT_I : public DrawArrays -{ - inline DrawFunctor_TT_I(T1* begin1, T2* begin2, I* ibegin, I* iend): _begin1(begin1),_begin2(begin2),_ibegin(ibegin),_iend(iend) {} - - virtual void draw() const - { - I index; - for(I* iptr=_ibegin; - iptr!=_iend; - ++iptr) - { - index = *iptr; - F2(_begin2[index]); - F1(_begin1[index]); - } - } - - T1* _begin1; - T2* _begin2; - - I* _ibegin; - I* _iend; -}; - - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - -template< class F1, class T1, class F2, class T2, class F3, class T3> -struct DrawFunctor_TTT : public DrawArrays -{ - inline DrawFunctor_TTT(T1* begin1, T1* end1, T2* begin2, T3* begin): _begin1(begin1),_end1(end1),_begin2(begin2),_begin3(begin3) {} - - virtual void draw() const - { - T2* ptr2=_begin2; - T3* ptr3=_begin3; - for(T1* ptr1=_begin1; - ptr1!=_end1; - ++ptr1,++ptr2,++ptr3) - { - F3(ptr3); - F2(ptr2); - F1(ptr1); - } - } - - T1* _begin1; - T1* _end1; - - T2* _begin2; - T3* _begin3; -}; - -template< class F1, class T1, class I1, class F2, class T2, class F3, class T3> -struct DrawFunctor_TITT : public DrawArrays -{ - inline DrawFunctor_TITT(T1* begin1, I1* ibegin1, I1* iend1, T2* begin2, T3* begin): _begin1(begin1),_ibegin1(ibegin1),_iend1(end1),_begin3(begin3) {} - - virtual void draw() const - { - T2* ptr2=_begin2; - T3* ptr3=_begin3; - for(I1* iptr1=_ibegin1; - iptr1!=_iend1; - ++iptr1,++ptr2,++ptr3) - { - F3(_ptr3); - F2(_ptr2); - F1(_begin1[*iptr1]); - } - } - - T1* _begin1; - I1* _ibegin1; - I1* _iend1; - - T2* _begin2; - T3* _begin3; -}; - -template< class F1, class T1, class F2, class T2, class I2, class F3, class T3> -struct DrawFunctor_TTIT : public DrawArrays -{ - inline DrawFunctor_TTIT(T1* begin1, T1* end1, T2* begin2, I2* ibegin2, T3* begin): _begin1(begin1),_end1(end1),_begin2(begin2),_ibegin2(ibegin2),_begin3(begin3) {} - - virtual void draw() const - { - I2* iptr2 = _ibegin2; - T3* ptr3 = _begin3; - for(T1* ptr1=_begin1; - ptr1!=_end1; - ++ptr1,++iptr2,++ptr3) - { - F3(ptr3); - F2(_begin2[*iptr2]); - F1(ptr1); - } - } - - T1* _begin1; - T1* _end1; - - T2* _begin2; - I2* _ibegin2; - - T3* _begin3; -}; - - -template< class F1, class T1, class F2, class I1, class T2, class I2, class F3, class T3> -struct DrawFunctor_TITIT : public DrawArrays -{ - inline DrawFunctor_TITIT(T1* begin1, I1* ibegin1, I2* iend1, T2* begin2, I2* ibegin2, T3* begin3): _begin1(begin1),_ibegin1(ibegin1), _iend1(end1),_begin2(begin2),_ibegin2(ibegin2),_begin3(begin3) {} - - virtual void draw() const - { - I2* iptr2 = _ibegin2; - T3* ptr3 = _begin3; - for(I1* iptr1=_ibegin1; - iptr1!=_iend1; - ++iptr1,++iptr2,++ptr3) - { - F3(ptr3); - F2(_begin2[*iptr2]); - F1(_begin1[*iptr1]); - } - } - - T1* _begin1; - I1* _ibegin1; - I1* _iend1; - - T2* _begin2; - I2* _ibegin2; - - T3* _begin3; -}; - -template< class F1, class T1, class F2, class T2, class I2, class F3, class T3, class I3> -struct DrawFunctor_TTITI : public DrawArrays -{ - inline DrawFunctor_TTITI(T1* begin1, T1* end1, T2* begin2, I2* ibegin2, T3* begin3, I3* ibegin3): _begin1(begin1),_end1(end1),_begin2(begin2),_ibegin2(ibegin2),_begin3(begin3),_ibegin3(begin3) {} - - virtual void draw() const - { - I2* iptr2 = _ibegin2; - I3* iptr3 = _ibegin3; - for(T1* ptr1=_begin1; - ptr1!=_end1; - ++ptr1,++iptr2,++iptr3) - { - F3(_begin3[*iptr3]); - F2(_begin2[*iptr2]); - F1(ptr1); - } - } - - T1* _begin1; - T1* _end1; - - T2* _begin2; - I2* _ibegin2; - - T3* _begin3; - I3* _ibegin3; -}; - -template< class F1, class T1, class I1, class F2, class T2, class I2, class F3, class T3, class I3> -struct DrawFunctor_TITITI : public DrawArrays -{ - inline DrawFunctor_TITITI(T1* begin1, I1* ibegin1, I2* iend1, T2* begin2, I2* ibegin2, T3* begin3, I3* ibegin3): _begin1(begin1),_ibegin1(ibegin1), _iend1(end1),_begin2(begin2),_ibegin2(ibegin2),_begin3(begin3),_ibegin3(begin3) {} - - virtual void draw() const - { - I2* iptr2 = _ibegin2; - I3* iptr3 = _ibegin3; - for(I1* iptr1=_ibegin1; - iptr1!=_iend1; - ++iptr1,++iptr2,++iptr3) - { - F3(_begin3[*iptr3]); - F2(_begin2[*iptr2]); - F1(_begin1[*iptr1]); - } - } - - T1* _begin1; - I1* _ibegin1; - I1* _iend1; - - T2* _begin2; - I2* _ibegin2; - - T3* _begin3; - I3* _ibegin3; -}; - -template< class F1, class T1, class F2, class T2, class F3, class T3, class I> -struct DrawFunctor_TTT_I : public DrawArrays -{ - inline DrawFunctor_TTT_I(T1* begin1, T2* begin2, T3* begin3, I* ibegin, I* iend): _begin1(begin1),_begin2(begin2),_begin3(begin3),_ibegin(ibegin),_iend(iend) {} - - virtual void draw() const - { - I index; - for(I* iptr=_ibegin; - iptr!=_iend; - ++iptr) - { - index = *iptr; - F3(_begin3[index]); - F2(_begin2[index]); - F1(_begin1[index]); - } - } - - T1* _begin1; - T2* _begin2; - T3* _begin3; - - I* _ibegin; - I* _iend; -}; - - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - -// single vertex attribute -typedef DrawFunctor_T V3; -typedef DrawFunctor_TI V3i; - -// two attributes - vertex + one other attribute -typedef DrawFunctor_TT V3N3; -typedef DrawFunctor_TT V3C4; -typedef DrawFunctor_TT V3T2; - -typedef DrawFunctor_TIT V3iN3; -typedef DrawFunctor_TIT V3iC4; -typedef DrawFunctor_TIT V3iT2; - -typedef DrawFunctor_TTI V3N3i; -typedef DrawFunctor_TTI V3C4i; -typedef DrawFunctor_TTI V3T2i; - -typedef DrawFunctor_TT_I V3N3_i; -typedef DrawFunctor_TT_I V3C4_i; -typedef DrawFunctor_TT_I V3T2_i; - -// three attributes - vertex + two other attributes. - -typedef DrawFunctor_TTT V3N3C4; -typedef DrawFunctor_TTT V3N3T2; -typedef DrawFunctor_TTT V3C4T2; - -typedef DrawFunctor_TITT V3iN3C4; -typedef DrawFunctor_TITT V3iN3T2; -typedef DrawFunctor_TITT V3iC4T2; - -typedef DrawFunctor_TTIT V3N3iC4; -typedef DrawFunctor_TTIT V3N3iT2; -typedef DrawFunctor_TTIT V3C4iN3; -typedef DrawFunctor_TTIT V3C4iT2; -typedef DrawFunctor_TTIT V3T2iC4; -typedef DrawFunctor_TTIT V3T2iN3; - -typedef DrawFunctor_TTITI V3N3iC4i; -typedef DrawFunctor_TTITI V3N3iT2i; -typedef DrawFunctor_TTITI V3C4iT2i; - -typedef DrawFunctor_TTT_I V3N3C4_i; -typedef DrawFunctor_TTT_I V3N3T2_i; -typedef DrawFunctor_TTT_I V3C4T2_i; - - - -class MyDrawable : public osg::Drawable -{ - public: - - MyDrawable(); - - virtual void drawImplementation(osg::State& state); - - virtual bool computeBound() const; - - - enum RenderingMode - { - v, - vI,// 2 - - vn, - vIn, - vnI, - vInI, - vn_sI, // 5 - - vc, - vIc, - vnc, - vInc, - vnIc, - vInIc, - vcI, - vIcI, - vncI, - vIncI, - vnIcI, - vInIcI, - vnc_sI, // 13 - - vt, - vIt, - vnt, - vInt, - vnIt, - vInIt, - vct, - vIct, - vnct, - vInct, - vnIct, - vInIct, - vcIt, - vIcIt, - vncIt, - vIncIt, - vnIcIt, - vInIcIt, - vtI, - vItI, - vntI, - vIntI, - vnItI, - vInItI, - vctI, - vIctI, - vnctI, - vInctI, - vnIctI, - vInIctI, - vcItI, - vIcItI, - vncItI, - vIncItI, - vnIcItI, - vInIcItI - vnct_sI // 37 - }; // 57 combinations. - - - GLenum _primitiveType; - - ref_ptr _vertices; - ref_ptr _vertexIndices; - - ref_ptr _normals; - ref_ptr _normalIndices; - - ref_ptr _colors; - ref_ptr _colorIndices; - - ref_ptr _texcoords; - ref_ptr _texcoordIndices; -} - -#endif - int main( int argc, char **argv ) { diff --git a/src/osgGA/AnimationPathManipulator.cpp b/src/osgGA/AnimationPathManipulator.cpp index 24ac02b8b..d445b3579 100644 --- a/src/osgGA/AnimationPathManipulator.cpp +++ b/src/osgGA/AnimationPathManipulator.cpp @@ -144,8 +144,8 @@ void AnimationPathManipulator::handleFrame( double time ) if (delta>=_animationPath->getPeriod()) { double frameRate = (double)_numOfFramesSinceStartOfTimedPeriod/delta; - std::cout <<"AnimatonPath completed in "<