From: <mk...@pr...> - 2004-01-31 17:13:25
|
Update of /cvsroot/csp/APPLICATIONS/CSPSim/Source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20217/Source Modified Files: LogoScreen.cpp Log Message: Index: LogoScreen.cpp =================================================================== RCS file: /cvsroot/csp/APPLICATIONS/CSPSim/Source/LogoScreen.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** LogoScreen.cpp 1 Jan 2004 23:25:29 -0000 1.16 --- LogoScreen.cpp 31 Jan 2004 17:11:41 -0000 1.17 *************** *** 54,64 **** class ImageUpdateCallback: public osg::NodeCallback { typedef std::vector<osg::ref_ptr<osg::Image> > ImageList; ! osg::ref_ptr<osg::Texture2D> m_Texture; double m_Delay; ! ImageList m_ImageList; ! size_t m_CurrPos; ! double m_PrevTime; public: ! ImageUpdateCallback(osg::Texture2D *texture, double delay): m_Texture(texture), m_Delay(delay), --- 54,64 ---- class ImageUpdateCallback: public osg::NodeCallback { typedef std::vector<osg::ref_ptr<osg::Image> > ImageList; ! osg::ref_ptr<osg::Texture2D> m_Texture; double m_Delay; ! ImageList m_ImageList; ! size_t m_CurrPos; ! double m_PrevTime; public: ! ImageUpdateCallback(osg::Texture2D *texture, double delay): m_Texture(texture), m_Delay(delay), *************** *** 98,102 **** } } ! virtual void operator()(osg::Node*, osg::NodeVisitor *nv) { if (nv->getFrameStamp()) { double currTime = nv->getFrameStamp()->getReferenceTime(); --- 98,102 ---- } } ! virtual void operator()(osg::Node*, osg::NodeVisitor *nv) { if (nv->getFrameStamp()) { double currTime = nv->getFrameStamp()->getReferenceTime(); *************** *** 109,113 **** //} } ! } void setValue() { m_Texture->setImage(m_ImageList[m_CurrPos].get()); --- 109,113 ---- //} } ! } void setValue() { m_Texture->setImage(m_ImageList[m_CurrPos].get()); *************** *** 126,157 **** // create geometry ! osg::Geometry* geom = new osg::Geometry; // disable display list so our modified tex show up ! geom->setUseDisplayList(false); scale = 0.5f * 1.0f; w = scale * m_width; h = scale * m_height; ! osg::Vec3Array* vertices = new osg::Vec3Array(4); (*vertices)[0] = osg::Vec3(-w,h,0.0f);//top left ! (*vertices)[1] = osg::Vec3(-w,-h,0.0f);//bottom left ! (*vertices)[2] = osg::Vec3(w,-h,0.0f);//bottom right ! (*vertices)[3] = osg::Vec3(w,h,0.0f);//top right ! geom->setVertexArray(vertices); ! osg::Vec2Array* texcoords = new osg::Vec2Array(4); ! (*texcoords)[0].set(0.0f, 1.0f); ! (*texcoords)[1].set(0.0f, 0.0f); ! (*texcoords)[2].set(1.0f, 0.0f); ! (*texcoords)[3].set(1.0f, 1.0f); ! geom->setTexCoordArray(0,texcoords); osg::Vec4Array* colors = new osg::Vec4Array(1); ! (*colors)[0].set(1.0f,1.0f,1.0f,1.0f); ! geom->setColorArray(colors); ! geom->setColorBinding(osg::Geometry::BIND_OVERALL); ! geom->addPrimitiveSet(new osg::DrawArrays(GL_QUADS, 0, 4)); m_Texture = new osg::Texture2D; --- 126,157 ---- // create geometry ! osg::Geometry* geom = new osg::Geometry; // disable display list so our modified tex show up ! geom->setUseDisplayList(false); scale = 0.5f * 1.0f; w = scale * m_width; h = scale * m_height; ! osg::Vec3Array* vertices = new osg::Vec3Array(4); (*vertices)[0] = osg::Vec3(-w,h,0.0f);//top left ! (*vertices)[1] = osg::Vec3(-w,-h,0.0f);//bottom left ! (*vertices)[2] = osg::Vec3(w,-h,0.0f);//bottom right ! (*vertices)[3] = osg::Vec3(w,h,0.0f);//top right ! geom->setVertexArray(vertices); ! osg::Vec2Array* texcoords = new osg::Vec2Array(4); ! (*texcoords)[0].set(0.0f, 1.0f); ! (*texcoords)[1].set(0.0f, 0.0f); ! (*texcoords)[2].set(1.0f, 0.0f); ! (*texcoords)[3].set(1.0f, 1.0f); ! geom->setTexCoordArray(0,texcoords); osg::Vec4Array* colors = new osg::Vec4Array(1); ! (*colors)[0].set(1.0f,1.0f,1.0f,1.0f); ! geom->setColorArray(colors); ! geom->setColorBinding(osg::Geometry::BIND_OVERALL); ! geom->addPrimitiveSet(new osg::DrawArrays(GL_QUADS, 0, 4)); m_Texture = new osg::Texture2D; *************** *** 162,166 **** geom->setStateSet(stateset); ! osg::Geode *geode = new osg::Geode; geode->addDrawable(geom); geode->setUpdateCallback(new ImageUpdateCallback(m_Texture.get(),0.5)); --- 162,166 ---- geom->setStateSet(stateset); ! osg::Geode *geode = new osg::Geode; geode->addDrawable(geom); geode->setUpdateCallback(new ImageUpdateCallback(m_Texture.get(),0.5)); |