From: <de...@us...> - 2003-01-11 10:55:14
|
Update of /cvsroot/csp/APPLICATIONS/CSPFlightSim/Source In directory sc8-pr-cvs1:/tmp/cvs-serv23417 Modified Files: VirtualBattlefield.cpp Log Message: new call to trees generation Index: VirtualBattlefield.cpp =================================================================== RCS file: /cvsroot/csp/APPLICATIONS/CSPFlightSim/Source/VirtualBattlefield.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** VirtualBattlefield.cpp 15 Dec 2002 00:48:45 -0000 1.6 --- VirtualBattlefield.cpp 11 Jan 2003 10:55:10 -0000 1.7 *************** *** 5,13 **** #include <osg/PolygonMode> - #include <osgDB/FileUtils> - #include <osgUtil/CullVisitor> #include "LogStream.h" #include "VirtualBattlefield.h" --- 5,12 ---- #include <osg/PolygonMode> #include <osgUtil/CullVisitor> #include "LogStream.h" + #include "Trees.h" #include "VirtualBattlefield.h" *************** *** 20,25 **** extern osg::Node *makeSky( void ); extern osg::Node *makeBase( void ); - extern osg::Node *makeTreesPatch( float xcen, float ycen, float spacing, float width, - float height, VirtualBattlefield * pBattlefield); const float SKY_RED = 0.1f; --- 19,22 ---- *************** *** 123,142 **** int ScreenHeight = g_ScreenHeight; - // must be updated to match your file path configuration - #ifdef _WIN32 - std::string sep = ";"; - #else - std::string sep = ":"; - #endif - - osgDB::setDataFilePathList("../Data" + sep + "../Data/Images" + sep + "../Data/Models" + sep + "../Data/Fonts"); - - // we don't need this on Linux since libs are usually - // installed in /usr/local/lib/osgPlugins or /usr/lib/osgPlugins. - // OSG can find itself the plugins. - #ifdef _WIN32 - osgDB::setLibraryFilePathList("../DemoPackage"); - #endif - ///////////////////////////////////// // --- 120,123 ---- *************** *** 147,162 **** ///////////////////////////////////// ! m_rpRootNode = osgNew osg::Group; m_rpRootNode->setName( "RootSceneGroup" ); ! m_rpObjectRootNode = osgNew osg::Group; m_rpObjectRootNode->setName("ObjectRootSceneGraph."); ! osg::ClearNode* earthSky = osgNew osg::ClearNode; ! earthSky->setRequiresClear(false); // we've got base and sky to do it. ! //earthSky->setRequiresClear(true); // we've got base and sky to do it. // use a transform to make the sky and base around with the eye point. ! osg::Transform* transform = osgNew osg::Transform; // transform's value isn't knowm until in the cull traversal so its bounding --- 128,142 ---- ///////////////////////////////////// ! m_rpRootNode = new osg::Group; m_rpRootNode->setName( "RootSceneGroup" ); ! m_rpObjectRootNode = new osg::Group; m_rpObjectRootNode->setName("ObjectRootSceneGraph."); ! osg::ClearNode* earthSky = new osg::ClearNode; ! earthSky->setRequiresClear(false); // we've got base and sky to do it. // use a transform to make the sky and base around with the eye point. ! osg::Transform* transform = new osg::Transform ; // transform's value isn't knowm until in the cull traversal so its bounding *************** *** 169,173 **** // set the compute transform callback to do all the work of // determining the transform according to the current eye point. ! transform->setComputeTransformCallback(osgNew MoveEarthySkyWithEyePointCallback); // add the sky and base layer. --- 149,153 ---- // set the compute transform callback to do all the work of // determining the transform according to the current eye point. ! transform->setComputeTransformCallback(new MoveEarthySkyWithEyePointCallback); // add the sky and base layer. *************** *** 181,185 **** m_rpRootNode->addChild(earthSky); ! m_pView = osgNew osgUtil::SceneView(); m_pView->setDefaults(); m_pView->setViewport(0,0,ScreenWidth,ScreenHeight); --- 161,165 ---- m_rpRootNode->addChild(earthSky); ! m_pView = new osgUtil::SceneView(); m_pView->setDefaults(); m_pView->setViewport(0,0,ScreenWidth,ScreenHeight); *************** *** 195,200 **** // Fog properties: start and end distances are read from Start.csp ! osg::StateSet * pFogState = osgNew osg::StateSet; ! osg::Fog* fog = osgNew osg::Fog; fog->setMode(osg::Fog::LINEAR); fog->setDensity(0.3f); --- 175,180 ---- // Fog properties: start and end distances are read from Start.csp ! osg::StateSet * pFogState = new osg::StateSet; ! osg::Fog* fog = new osg::Fog; fog->setMode(osg::Fog::LINEAR); fog->setDensity(0.3f); *************** *** 209,213 **** // light properties ! osg::Light * pLight = osgNew osg::Light; pLight->setDirection( osg::Vec3(0,0,-1) ); --- 189,193 ---- // light properties ! osg::Light * pLight = new osg::Light; pLight->setDirection( osg::Vec3(0,0,-1) ); *************** *** 215,219 **** pLight->setDiffuse( osg::Vec4(0.8f,0.8f,0.8f,1.0f) ); pLight->setSpecular( osg::Vec4(0.75f,0.75f,0.75f,1.0f) ); ! osg::StateSet * pLightSet = osgNew osg::StateSet; pFogState->setAttributeAndModes(pLight, osg::StateAttribute::ON); --- 195,199 ---- pLight->setDiffuse( osg::Vec4(0.8f,0.8f,0.8f,1.0f) ); pLight->setSpecular( osg::Vec4(0.75f,0.75f,0.75f,1.0f) ); ! osg::StateSet * pLightSet = new osg::StateSet; pFogState->setAttributeAndModes(pLight, osg::StateAttribute::ON); *************** *** 228,237 **** m_pView->setSceneData(m_rpRootNode.get() ); ! m_rpFrameStamp = osgNew osg::FrameStamp; m_pView->setFrameStamp(m_rpFrameStamp.get()); - osgDB::Registry::instance(); - osg::Camera * pCamera = m_pView->getCamera(); pCamera->setNearFar(1.0f,20000); --- 208,215 ---- m_pView->setSceneData(m_rpRootNode.get() ); ! m_rpFrameStamp = new osg::FrameStamp; m_pView->setFrameStamp(m_rpFrameStamp.get()); osg::Camera * pCamera = m_pView->getCamera(); pCamera->setNearFar(1.0f,20000); *************** *** 389,397 **** if (!globalStateSet) { ! globalStateSet = osgNew osg::StateSet; m_pView->setGlobalStateSet(globalStateSet); } ! osg::PolygonMode* polyModeObj = osgNew osg::PolygonMode; if (flag) --- 367,375 ---- if (!globalStateSet) { ! globalStateSet = new osg::StateSet; m_pView->setGlobalStateSet(globalStateSet); } ! osg::PolygonMode* polyModeObj = new osg::PolygonMode; if (flag) *************** *** 743,758 **** if (m_pActiveTerrainObject) m_pActiveTerrainObject->setCameraPosition( xPatch, yPatch, 1000); ! for (unsigned short i=0; i < 15;++i) ! { ! osg::Node * pTrees = makeTreesPatch( xPatch, yPatch + 256 * i, 100, 1000, ! 100, this); ! pTrees->setName("Trees"); ! addNodeToScene(pTrees); ! ! } ! ! } --- 721,736 ---- if (m_pActiveTerrainObject) m_pActiveTerrainObject->setCameraPosition( xPatch, yPatch, 1000); + ! for (unsigned short i=0; i < 10;++i) ! for (unsigned short j = 0; j <3; ++j) ! { ! osg::ref_ptr<Forest> rpforest = new Forest(osg::Vec2(xPatch,yPatch + 2048.0 * (i+1)),1024, this); ! rpforest->setName("Forest"); ! addNodeToScene(rpforest.get()); ! } ! } + |