Revision: 1515
          http://rigsofrods.svn.sourceforge.net/rigsofrods/?rev=1515&view=rev
Author:   rorthomas
Date:     2010-08-18 13:26:03 +0000 (Wed, 18 Aug 2010)

Log Message:
-----------
removed old truck and object LOD settings completely.
Autogenerated LODS are not supported anymore (too buggy)
added LODs to flexbodies: not working well yet

Modified Paths:
--------------
    trunk/source/main/Beam.cpp
    trunk/source/main/FlexBody.cpp

Modified: trunk/source/main/Beam.cpp
===================================================================
--- trunk/source/main/Beam.cpp  2010-08-18 12:13:17 UTC (rev 1514)
+++ trunk/source/main/Beam.cpp  2010-08-18 13:26:03 UTC (rev 1515)
@@ -1369,7 +1369,6 @@
        float wingarea=0.0;
        int currentScriptCommandNumber=-1;
        // TODO Unused Varaible
-       //bool enable_truck_lod = (SETTINGS.getSetting("Truck LOD Enabled") == 
"Yes");
        bool enable_background_loading = (SETTINGS.getSetting("Background 
Loading") == "Yes");
 
        //convert ry

Modified: trunk/source/main/FlexBody.cpp
===================================================================
--- trunk/source/main/FlexBody.cpp      2010-08-18 12:13:17 UTC (rev 1514)
+++ trunk/source/main/FlexBody.cpp      2010-08-18 13:26:03 UTC (rev 1515)
@@ -112,6 +112,30 @@
        MeshPtr mesh = Ogre::MeshManager::getSingleton().load(meshname, 
groupname);
        MeshPtr newmesh = mesh->clone(uname_mesh);
        
+       // now find possible LODs
+       String basename, ext;
+       StringUtil::splitBaseFilename(String(meshname), basename, ext);
+       for(int i=0; i<4;i++)
+       {
+               String fn = basename + "_" + StringConverter::toString(i) + 
".mesh";
+               String group = "";
+               try
+               {
+                       group = 
ResourceGroupManager::getSingleton().findGroupContainingResource(fn);
+               }catch(...)
+               {
+                       continue;
+               }
+
+               if(group.empty()) continue;
+
+               float distance = 3;
+               if(i == 1) distance = 20;
+               if(i == 2) distance = 50;
+               if(i == 3) distance = 200;
+               newmesh->createManualLodLevel(distance, fn);
+       }
+
        Entity *ent = manager->createEntity(uname, uname_mesh);
        MaterialFunctionMapper::replaceSimpleMeshMaterials(ent, 
ColourValue(0.5, 0.5, 1));
        if(mfm) mfm->replaceMeshMaterials(ent);
@@ -447,40 +471,7 @@
        LogManager::getSingleton().logMessage("FLEXBODY show mesh");
        //okay, show the mesh now
        snode=manager->getRootSceneNode()->createChildSceneNode();
-
-       bool enable_truck_lod = (SETTINGS.getSetting("Truck LOD Enabled") == 
"Yes");
-       if(enable_truck_lod)
-       {
-               LogManager::getSingleton().logMessage("FLEXBODY uses " + 
StringConverter::toString(msh->getNumLodLevels()) + " LOD levels.");
-#if 0
-               // XXX: FIX: LODs in 1.7
-               // enforce LOD
-               if(msh->getNumLodLevels() < 2 && vertex_count > 10000)
-               {
-                       LogManager::getSingleton().logMessage("FLEXBODY uses > 
10k (" + StringConverter::toString(vertex_count) + ") vertices but does not 
provide its own LODs, will generate some now. This can take a while. Please add 
LODs when exporting the mesh, this prevents the automatic generation (and the 
waiting time).");
-                       
-                       Ogre::Mesh::LodDistanceList default_dists;
-                       default_dists.push_back(50);
-                       default_dists.push_back(100);
-                       default_dists.push_back(300);
-                       msh->generateLodLevels(default_dists, 
ProgressiveMesh::VRQ_PROPORTIONAL, Ogre::Real(0.8));
-                       // custom entities for custom LODs
-                       Entity *ent_lod = 
manager->createEntity(String(uname)+"LOD", msh->getName());
-
-                       snode->attachObject(ent_lod);
-
-               } else
-#endif //0     
-               {
-                       // no custom LOD's here
-                       snode->attachObject(ent);
-               }
-               LogManager::getSingleton().logMessage("flexbody is using LODs");
-       } else
-       {
-               // no LOD's here
-               snode->attachObject(ent);
-       }
+       snode->attachObject(ent);
        snode->setPosition(position);
 
 #if 0


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

------------------------------------------------------------------------------
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
_______________________________________________
Rigsofrods-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rigsofrods-devel

Reply via email to