Revision: 2776
          http://rigsofrods.svn.sourceforge.net/rigsofrods/?rev=2776&view=rev
Author:   rorthomas
Date:     2012-06-05 09:59:40 +0000 (Tue, 05 Jun 2012)
Log Message:
-----------
fixes water not working, code was not completely ported
fixes trees: paged geometry update was not called
fixed ogre overlays: render window was not set
fixes landuse: was commented out
fixes strange terrain update behavior
improved notice that the user directory was created

Modified Paths:
--------------
    trunk/source/configurator/Configurator.cpp
    trunk/source/main/gameplay/RoRFrameListener.cpp
    trunk/source/main/gfx/Water.cpp
    trunk/source/main/gui/OverlayWrapper.cpp
    trunk/source/main/physics/collision/Collisions.cpp
    trunk/source/main/terrain/TerrainGeometryManager.cpp
    trunk/source/main/terrain/TerrainGeometryManager.h
    trunk/source/main/terrain/TerrainManager.cpp
    trunk/source/main/terrain/TerrainManager.h
    trunk/source/main/terrain/TerrainObjectManager.cpp

Modified: trunk/source/configurator/Configurator.cpp
===================================================================
--- trunk/source/configurator/Configurator.cpp  2012-06-02 23:31:30 UTC (rev 
2775)
+++ trunk/source/configurator/Configurator.cpp  2012-06-05 09:59:40 UTC (rev 
2776)
@@ -732,7 +732,7 @@
                extractZipFiles(skeletonZipFile, UserPath);
 
                // tell the user
-               wxLogError(wxT("User directory created as it was not existing: 
") + UserPath);
+               wxLogInfo(wxT("User directory created as it was not existing: 
") + UserPath);
                /*
                wxString warning = wxString::Format(_("Rigs of Rods User 
directory recreated, as it was missing:\n%s"), UserPath.c_str());
                wxString caption = _("error upon loading RoR user directory");

Modified: trunk/source/main/gameplay/RoRFrameListener.cpp
===================================================================
--- trunk/source/main/gameplay/RoRFrameListener.cpp     2012-06-02 23:31:30 UTC 
(rev 2775)
+++ trunk/source/main/gameplay/RoRFrameListener.cpp     2012-06-05 09:59:40 UTC 
(rev 2776)
@@ -703,7 +703,7 @@
        // we don't use overlays in embedded mode
        if (!gEnv->embeddedMode)
        {
-               //ow = new OverlayWrapper();
+               ow = new OverlayWrapper();
        }
 
        enablePosStor = BSETTING("Position Storage", false);
@@ -3109,9 +3109,6 @@
        //if (current_truck != -1 && trucks[current_truck] == 0)
        //      BeamFactory::getSingleton().setCurrentTruck(-1);
 
-       // update animated objects
-       gEnv->terrainManager->update(dt);
-
        // update network gui if required, at most every 2 seconds
        if (net)
        {
@@ -3157,9 +3154,13 @@
        
        Beam *curr_truck = BeamFactory::getSingleton().getCurrentTruck();
 
-       // environment map
+       // terrain updates
        if (gEnv->terrainManager)
        {
+               // update animated objects
+               gEnv->terrainManager->update(dt);
+
+               // env map update
                if (gEnv->terrainManager->getEnvmap())
                {
                        if (curr_truck)
@@ -3177,14 +3178,15 @@
                }
 
                // water
-               if (gEnv->terrainManager->getWater())
+               Water *water = gEnv->terrainManager->getWater();
+               if (water)
                {
                        if (curr_truck)
                        {
-                               
gEnv->terrainManager->getWater()->moveTo(gEnv->mainCamera, 
gEnv->terrainManager->getWater()->getHeightWaves(curr_truck->getPosition()));
+                               water->moveTo(gEnv->mainCamera, 
water->getHeightWaves(curr_truck->getPosition()));
                        } else
                        {
-                               
gEnv->terrainManager->getWater()->moveTo(gEnv->mainCamera, 
gEnv->terrainManager->getWater()->getHeight());
+                               water->moveTo(gEnv->mainCamera, 
water->getHeight());
                        }
                }
 

Modified: trunk/source/main/gfx/Water.cpp
===================================================================
--- trunk/source/main/gfx/Water.cpp     2012-06-02 23:31:30 UTC (rev 2775)
+++ trunk/source/main/gfx/Water.cpp     2012-06-05 09:59:40 UTC (rev 2776)
@@ -90,6 +90,27 @@
        free_wavetrain=0;
        maxampl=0;
 
+       haswaves = BSETTING("Waves", false);
+
+       // disable waves in multiplayer
+       if(gEnv->network)
+               haswaves = false;
+
+       // parse height
+       float wheight = PARSEREAL(mTerrainConfig.getSetting("WaterLine", 
"General"));
+
+       // and the type
+       String waterSettingsString = SSETTING("Water effects", "Reflection + 
refraction (speed optimized)");
+       if (waterSettingsString == "Basic (fastest)")
+               mType = WATER_BASIC;
+       if (waterSettingsString == "Reflection")
+               mType = WATER_REFLECT;
+       else if (waterSettingsString == "Reflection + refraction (speed 
optimized)")
+               mType = WATER_FULL_SPEED;
+       else if (waterSettingsString == "Reflection + refraction (quality 
optimized)")
+               mType = WATER_FULL_QUALITY;
+
+
        if (haswaves)
        {
                char line[1024] = {};
@@ -121,9 +142,8 @@
        pTestNode=0;
        waterSceneMgr=gEnv->sceneManager;
        framecounter=0;
-       //height=wheight;
+       height=wheight;
        orgheight=wheight;
-       //mType=type;
        rttTex1=0;
        rttTex2=0;
        MeshPtr mprt;

Modified: trunk/source/main/gui/OverlayWrapper.cpp
===================================================================
--- trunk/source/main/gui/OverlayWrapper.cpp    2012-06-02 23:31:30 UTC (rev 
2775)
+++ trunk/source/main/gui/OverlayWrapper.cpp    2012-06-05 09:59:40 UTC (rev 
2776)
@@ -36,8 +36,10 @@
 OverlayWrapper::OverlayWrapper()
 {
        setSingleton(this);
+       win = gEnv->renderWindow;
        init();
        mTimeUntilNextToggle=0;
+
 }
 
 OverlayWrapper::~OverlayWrapper()

Modified: trunk/source/main/physics/collision/Collisions.cpp
===================================================================
--- trunk/source/main/physics/collision/Collisions.cpp  2012-06-02 23:31:30 UTC 
(rev 2775)
+++ trunk/source/main/physics/collision/Collisions.cpp  2012-06-05 09:59:40 UTC 
(rev 2776)
@@ -353,14 +353,12 @@
 
 void Collisions::setupLandUse(const char *configfile)
 {
-#if 0
 #ifdef USE_PAGED
        if (landuse) return;
        landuse = new Landusemap(configfile);
 #else
        LOG("RoR was not compiled with PagedGeometry support. You cannot use 
Landuse maps with it.");
 #endif //USE_PAGED
-#endif
 }
 
 ground_model_t *Collisions::getGroundModelByString(const String name)

Modified: trunk/source/main/terrain/TerrainGeometryManager.cpp
===================================================================
--- trunk/source/main/terrain/TerrainGeometryManager.cpp        2012-06-02 
23:31:30 UTC (rev 2775)
+++ trunk/source/main/terrain/TerrainGeometryManager.cpp        2012-06-05 
09:59:40 UTC (rev 2776)
@@ -82,11 +82,11 @@
        pageMaxY = PARSEINT(terrainConfig.getSetting("Pages_Y"));
 
 
-       Vector3 mTerrainPos(mapsizex / 2.0f, 0.0f, mapsizez / 2.0f);
+       terrainPos = Vector3(mapsizex / 2.0f, 0.0f, mapsizez / 2.0f);
 
        mTerrainGroup = OGRE_NEW TerrainGroup(gEnv->sceneManager, 
Terrain::ALIGN_X_Z, terrainSize, worldSize);
        mTerrainGroup->setFilenameConvention(baseName, filenameSuffix);
-       mTerrainGroup->setOrigin(mTerrainPos);
+       mTerrainGroup->setOrigin(terrainPos);
        mTerrainGroup->setResourceGroup("cache");
 
        configureTerrainDefaults();
@@ -349,3 +349,8 @@
        return Vector3(mapsizex, mapsizey, mapsizez);
 }
 
+Ogre::Vector3 TerrainGeometryManager::getTerrainPosition()
+{
+       return terrainPos;
+}
+

Modified: trunk/source/main/terrain/TerrainGeometryManager.h
===================================================================
--- trunk/source/main/terrain/TerrainGeometryManager.h  2012-06-02 23:31:30 UTC 
(rev 2775)
+++ trunk/source/main/terrain/TerrainGeometryManager.h  2012-06-05 09:59:40 UTC 
(rev 2776)
@@ -60,6 +60,7 @@
        }
 
        Ogre::Vector3 getMaxTerrainSize();
+       Ogre::Vector3 getTerrainPosition();
 
        void update(float dt);
        void updateLightMap();
@@ -76,6 +77,8 @@
        int pageMinX, pageMaxX, pageMinY, pageMaxY;
        int terrainLayers;
 
+       Ogre::Vector3 terrainPos;
+
        // terrain engine specific
        Ogre::TerrainGroup *mTerrainGroup;
        Ogre::TerrainPaging* mTerrainPaging;

Modified: trunk/source/main/terrain/TerrainManager.cpp
===================================================================
--- trunk/source/main/terrain/TerrainManager.cpp        2012-06-02 23:31:30 UTC 
(rev 2775)
+++ trunk/source/main/terrain/TerrainManager.cpp        2012-06-05 09:59:40 UTC 
(rev 2776)
@@ -124,6 +124,9 @@
        PROGRESS_WINDOW(80, _L("Loading Terrain Geometry"));
        geometry_manager->loadOgreTerrainConfig(ogre_terrain_config_filename);
 
+       // must happen here
+       initWater();
+
        PROGRESS_WINDOW(90, _L("Loading Terrain Objects"));
        loadTerrainObjects();
 
@@ -178,8 +181,9 @@
        PROGRESS_WINDOW(31, _L("Initializing Vegetation Subsystem"));
        initVegetation();
 
-       PROGRESS_WINDOW(33, _L("Initializing Water Subsystem"));
-       initWater();
+       // water must be done later on
+       //PROGRESS_WINDOW(33, _L("Initializing Water Subsystem"));
+       //initWater();
 
        if (BSETTING("HDR", false))
        {
@@ -466,7 +470,9 @@
 
 void TerrainManager::initWater()
 {
-       water = new Water(mTerrainConfig);
+       String waterSettingsString = SSETTING("Water effects", "Reflection + 
refraction (speed optimized)");
+       if (waterSettingsString != "None")
+               water = new Water(mTerrainConfig);
 }
 
 void TerrainManager::initEnvironmentMap()
@@ -515,6 +521,16 @@
        }
 }
 
+void TerrainManager::update(float dt)
+{
+       if(object_manager)
+               object_manager->update(dt);
+
+       if(geometry_manager)
+               geometry_manager->update(dt);
+}
+
+
 void TerrainManager::initScripting()
 {
 #ifdef USE_ANGELSCRIPT

Modified: trunk/source/main/terrain/TerrainManager.h
===================================================================
--- trunk/source/main/terrain/TerrainManager.h  2012-06-02 23:31:30 UTC (rev 
2775)
+++ trunk/source/main/terrain/TerrainManager.h  2012-06-05 09:59:40 UTC (rev 
2776)
@@ -38,8 +38,9 @@
        void loadTerrain(Ogre::String filename);
        void loadTerrainConfigBasics(Ogre::DataStreamPtr &ds);
        
-       void update(float dt) {};
 
+       void update(float dt);
+
        void setGravity(float value);
        float getGravity() { return gravity; };
 

Modified: trunk/source/main/terrain/TerrainObjectManager.cpp
===================================================================
--- trunk/source/main/terrain/TerrainObjectManager.cpp  2012-06-02 23:31:30 UTC 
(rev 2775)
+++ trunk/source/main/terrain/TerrainObjectManager.cpp  2012-06-05 09:59:40 UTC 
(rev 2776)
@@ -264,7 +264,7 @@
                        paged.geom->setPageSize(50);
                        paged.geom->setInfinite();
                        Ogre::TRect<Ogre::Real> bounds = TBounds(0, 0, 
mapsizex, mapsizez);
-                       //trees->setBounds(bounds);
+                       paged.geom->setBounds(bounds);
 
                        //Set up LODs
                        //trees->addDetailLevel<EntityPage>(50);

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Rigsofrods-devel mailing list
Rigsofrods-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rigsofrods-devel

Reply via email to