Revision: 2477
          http://rigsofrods.svn.sourceforge.net/rigsofrods/?rev=2477&view=rev
Author:   ulteq
Date:     2012-04-09 22:14:27 +0000 (Mon, 09 Apr 2012)
Log Message:
-----------
-Cleanup

Modified Paths:
--------------
    trunk/source/main/gameplay/RoRFrameListener.cpp
    trunk/source/main/gameplay/Road.cpp
    trunk/source/main/gameplay/Road.h
    trunk/source/main/gameplay/road2.cpp
    trunk/source/main/gameplay/road2.h

Modified: trunk/source/main/gameplay/RoRFrameListener.cpp
===================================================================
--- trunk/source/main/gameplay/RoRFrameListener.cpp     2012-03-16 20:03:38 UTC 
(rev 2476)
+++ trunk/source/main/gameplay/RoRFrameListener.cpp     2012-04-09 22:14:27 UTC 
(rev 2477)
@@ -4704,16 +4704,16 @@
                        r=sscanf(line, "%f, %f, %f, %f, %f, %f, %f, %f, %f, 
%s",&ox,&oy,&oz, &rx, &ry, &rz, &rwidth, &bwidth, &bheight, oname);
                        Vector3 pos=Vector3(ox, oy, oz);
                        Quaternion rotation = Quaternion(Degree(rx), 
Vector3::UNIT_X)*Quaternion(Degree(ry), Vector3::UNIT_Y)*Quaternion(Degree(rz), 
Vector3::UNIT_Z);
-                       int roadtype=ROAD_AUTOMATIC;
+                       int roadtype=Road2::ROAD_AUTOMATIC;
                        int pillartype = 0;
-                       if (!strcmp(oname, "flat")) roadtype=ROAD_FLAT;
-                       if (!strcmp(oname, "left")) roadtype=ROAD_LEFT;
-                       if (!strcmp(oname, "right")) roadtype=ROAD_RIGHT;
-                       if (!strcmp(oname, "both")) roadtype=ROAD_BOTH;
-                       if (!strcmp(oname, "bridge")) 
{roadtype=ROAD_BRIDGE;pillartype=1;}
-                       if (!strcmp(oname, "monorail")) 
{roadtype=ROAD_MONORAIL;pillartype=2;}
-                       if (!strcmp(oname, "monorail2")) 
{roadtype=ROAD_MONORAIL;pillartype=0;}
-                       if (!strcmp(oname, "bridge_no_pillars")) 
{roadtype=ROAD_BRIDGE;pillartype=0;}
+                       if (!strcmp(oname, "flat")) roadtype=Road2::ROAD_FLAT;
+                       if (!strcmp(oname, "left")) roadtype=Road2::ROAD_LEFT;
+                       if (!strcmp(oname, "right")) roadtype=Road2::ROAD_RIGHT;
+                       if (!strcmp(oname, "both")) roadtype=Road2::ROAD_BOTH;
+                       if (!strcmp(oname, "bridge")) 
{roadtype=Road2::ROAD_BRIDGE;pillartype=1;}
+                       if (!strcmp(oname, "monorail")) 
{roadtype=Road2::ROAD_MONORAIL;pillartype=2;}
+                       if (!strcmp(oname, "monorail2")) 
{roadtype=Road2::ROAD_MONORAIL;pillartype=0;}
+                       if (!strcmp(oname, "bridge_no_pillars")) 
{roadtype=Road2::ROAD_BRIDGE;pillartype=0;}
 
                        if(r2oldmode)
                        {
@@ -4774,8 +4774,8 @@
                {
                        int pillartype = !(strcmp(oname, "roadbridgenopillar") 
== 0);
                        //okay, this is a job for roads2
-                       int roadtype=ROAD_AUTOMATIC;
-                       if (!strcmp(oname, "road")) roadtype=ROAD_FLAT;
+                       int roadtype=Road2::ROAD_AUTOMATIC;
+                       if (!strcmp(oname, "road")) roadtype=Road2::ROAD_FLAT;
                        Vector3 pos=Vector3(ox, oy, oz);
                        Quaternion rotation;
                        rotation=Quaternion(Degree(rx), 
Vector3::UNIT_X)*Quaternion(Degree(ry), Vector3::UNIT_Y)*Quaternion(Degree(rz), 
Vector3::UNIT_Z);
@@ -4849,7 +4849,7 @@
                pp.pillartype = 1;
                pp.position = r2lastpos+r2lastrot*Vector3(10.0,0,0);
                pp.rotation = r2lastrot;
-               pp.type = ROAD_AUTOMATIC;
+               pp.type = Road2::ROAD_AUTOMATIC;
                pp.width = 8;
                po.points.push_back(pp);
 

Modified: trunk/source/main/gameplay/Road.cpp
===================================================================
--- trunk/source/main/gameplay/Road.cpp 2012-03-16 20:03:38 UTC (rev 2476)
+++ trunk/source/main/gameplay/Road.cpp 2012-04-09 22:14:27 UTC (rev 2477)
@@ -17,13 +17,38 @@
 You should have received a copy of the GNU General Public License
 along with Rigs of Rods.  If not, see <http://www.gnu.org/licenses/>.
 */
+
 #include "Road.h"
+#include "Ogre.h"
+
+using namespace Ogre;
+
+Road::Road(SceneManager *scm, Vector3 start) :
+         mSceneMgr(scm)
+       , cur_rtype(0)
+       , free_rtype(0)
+       , lastpturn(0)
+       , ppitch(0)
+       , ppos(start)
+       , pturn(0)
+{
+       addRoadType("Road");
+       addRoadType("RoadBorderLeft");
+       addRoadType("RoadBorderRight");
+       addRoadType("RoadBorderBoth");
+       addRoadType("RoadBridge");
+       strcpy(curtype, rtypes[cur_rtype].name);
+       tenode = rtypes[cur_rtype].node;
+       tenode->setVisible(true);
+       preparePending();
+};
+
 void Road::preparePending()
 {
        //setup rotation points
-       lastpturn=pturn;
-       protl=ppos+Quaternion(Degree(pturn), Vector3::UNIT_Y)*Vector3(0, 0, 
4.5);
-       protr=ppos+Quaternion(Degree(pturn), Vector3::UNIT_Y)*Vector3(0, 0, 
-4.5);
+       lastpturn = pturn;
+       protl = ppos+Quaternion(Degree(pturn), Vector3::UNIT_Y)*Vector3(0, 0, 
4.5);
+       protr = ppos+Quaternion(Degree(pturn), Vector3::UNIT_Y)*Vector3(0, 0, 
-4.5);
        tenode->setPosition(ppos);
        tenode->setOrientation(Quaternion(Degree(pturn), 
Vector3::UNIT_Y)*Quaternion(Degree(ppitch), Vector3::UNIT_Z));
        tenode->pitch(Degree(-90));
@@ -31,75 +56,64 @@
 
 void Road::updatePending()
 {
-       if (pturn-lastpturn>0) 
tenode->setPosition(Quaternion(Degree(pturn-lastpturn), 
Vector3::UNIT_Y)*(ppos-protl)+protl);
+       if (pturn-lastpturn > 0)
+       {
+               tenode->setPosition(Quaternion(Degree(pturn-lastpturn), 
Vector3::UNIT_Y)*(ppos-protl)+protl);
+       } else
+       {
+               if (pturn-lastpturn < 0)
+                       tenode->setPosition(Quaternion(Degree(pturn-lastpturn), 
Vector3::UNIT_Y)*(ppos-protr)+protr);
                else
-               if (pturn-lastpturn<0) 
tenode->setPosition(Quaternion(Degree(pturn-lastpturn), 
Vector3::UNIT_Y)*(ppos-protr)+protr);
-                       else tenode->setPosition(ppos);
+                       tenode->setPosition(ppos);
+       }
        tenode->setOrientation(Quaternion(Degree(pturn), 
Vector3::UNIT_Y)*Quaternion(Degree(ppitch), Vector3::UNIT_Z));
        tenode->pitch(Degree(-90));
 }
 
-Road::Road(SceneManager *scm, Vector3 start)
-{
-       mSceneMgr=scm;
-       free_rtype=0;
-//             roadlink=0;
-       ppitch=0;
-       pturn=0;
-       lastpturn=0;
-       ppos=start;
-       addRoadType("road");
-       addRoadType("roadborderleft");
-       addRoadType("roadborderright");
-       addRoadType("roadborderboth");
-       addRoadType("roadbridge");
-       cur_rtype=0;
-       tenode=rtypes[cur_rtype].node;
-       strcpy(curtype, rtypes[cur_rtype].name);
-       tenode->setVisible(true);
-       preparePending();
-};
-
 void Road::reset(Vector3 start)
 {
-       ppitch=0;
-       pturn=0;
-       lastpturn=0;
-       ppos=start;
-       cur_rtype=0;
-       tenode=rtypes[cur_rtype].node;
+       cur_rtype = 0;
+       lastpturn = 0;
+       ppitch = 0;
+       ppos = start;
+       pturn = 0;
        strcpy(curtype, rtypes[cur_rtype].name);
+       tenode = rtypes[cur_rtype].node;
        tenode->setVisible(true);
        preparePending();
 }
 
 void Road::addRoadType(const char* name)
 {
-       //create visuals
-       char oname[256];
-       char mname[256];
-       sprintf(oname,"roadpreview-%s", name);
-       sprintf(mname,"%s.mesh", name);
-       Entity *te = mSceneMgr->createEntity(oname, mname);
+       // create visuals
+       String entity_name = String("RoadPreview-").append(name);
+       String mesh_name = String(name).append(".mesh");
+       Entity *te = mSceneMgr->createEntity(entity_name, mesh_name);
+
        te->setCastShadows(false);
-       if(free_rtype >= MAX_RTYPES)
-               return;
-       
rtypes[free_rtype].node=mSceneMgr->getRootSceneNode()->createChildSceneNode();
-       (rtypes[free_rtype].node)->attachObject(te);
-       (rtypes[free_rtype].node)->setVisible(false);
-       strcpy(rtypes[free_rtype].name, name);
-       free_rtype++;
+
+       if(free_rtype < MAX_RTYPES)
+       {
+               rtypes[free_rtype].node = 
mSceneMgr->getRootSceneNode()->createChildSceneNode();
+               rtypes[free_rtype].node->attachObject(te);
+               rtypes[free_rtype].node->setVisible(false);
+               strcpy(rtypes[free_rtype].name, name);
+               free_rtype++;
+       }
 }
 
 void Road::toggleType()
 {
-       Quaternion rot=tenode->getOrientation();
-       Vector3 pos=tenode->getPosition();
+       Quaternion rot = tenode->getOrientation();
+       Vector3 pos = tenode->getPosition();
        cur_rtype++;
-       if (cur_rtype>=free_rtype || cur_rtype>= MAX_RTYPES) cur_rtype=0;
+       if (cur_rtype >=  free_rtype || cur_rtype >=  MAX_RTYPES)
+       {
+               cur_rtype = 0;
+       }
+       strcpy(curtype, rtypes[cur_rtype].name);
        tenode->setVisible(false);
-       tenode=rtypes[cur_rtype].node;
-       strcpy(curtype, rtypes[cur_rtype].name);
+       tenode = rtypes[cur_rtype].node;
        tenode->setOrientation(rot);
        tenode->setPosition(pos);
        tenode->setVisible(true);
@@ -107,35 +121,34 @@
 
 void Road::dpitch(float v)
 {
-       ppitch+=v;
+       ppitch += v;
        updatePending();
 }
 
 void Road::dturn(float v)
 {
-       pturn+=v;
+       pturn += v;
        updatePending();
 }
 
 void Road::append()
 {
-       //register pending and set collision boxes
-       //first, calculate the real position
-       if (pturn-lastpturn>0) rpos=Quaternion(Degree(pturn-lastpturn), 
Vector3::UNIT_Y)*(ppos-protl)+protl;
+       // register pending and set collision boxes
+       // first, calculate the real position
+       if (pturn-lastpturn > 0)
+       {
+               rpos = Quaternion(Degree(pturn-lastpturn), 
Vector3::UNIT_Y)*(ppos-protl)+protl;
+       } else
+       {
+               if (pturn-lastpturn < 0)
+                       rpos = Quaternion(Degree(pturn-lastpturn), 
Vector3::UNIT_Y)*(ppos-protr)+protr;
                else
-               if (pturn-lastpturn<0) rpos=Quaternion(Degree(pturn-lastpturn), 
Vector3::UNIT_Y)*(ppos-protr)+protr;
-                       else rpos=ppos;
-       //set real rot
-       rrot=Vector3(0, pturn, ppitch);
-       //set new pending coordinates (we keep angles)
-       ppos=rpos+(Quaternion(Degree(pturn), 
Vector3::UNIT_Y)*Quaternion(Degree(ppitch), Vector3::UNIT_Z))*Vector3(10,0,0);
-       //prepare pending
+                       rpos = ppos;
+       }
+       // set real rot
+       rrot = Vector3(0, pturn, ppitch);
+       // set new pending coordinates (we keep angles)
+       ppos = rpos+(Quaternion(Degree(pturn), 
Vector3::UNIT_Y)*Quaternion(Degree(ppitch), Vector3::UNIT_Z))*Vector3(10,0,0);
+       // prepare pending
        preparePending();
 }
-
-
-Road::~Road()
-{
-}
-
-

Modified: trunk/source/main/gameplay/Road.h
===================================================================
--- trunk/source/main/gameplay/Road.h   2012-03-16 20:03:38 UTC (rev 2476)
+++ trunk/source/main/gameplay/Road.h   2012-04-09 22:14:27 UTC (rev 2477)
@@ -17,69 +17,57 @@
 You should have received a copy of the GNU General Public License
 along with Rigs of Rods.  If not, see <http://www.gnu.org/licenses/>.
 */
-#ifndef __Road_H__
-#define __Road_H__
 
+#ifndef __Road_H_
+#define __Road_H_
+
 #include "RoRPrerequisites.h"
-#include <stdio.h>
-#include <math.h>
 
-
-#include "Ogre.h"
-using namespace Ogre;
-
-/*typedef struct _RoadElement RoadElement_t;
-
-typedef struct _RoadElement
-{
-       Vector3 pos;
-       Quaternion rot;
-       RoadElement_t *next;
-} RoadElement_t;
-*/
-
 typedef struct _RoadType
 {
        char name[256];
-       SceneNode *node;
+       Ogre::SceneNode *node;
 } RoadType_t;
 
 class Road
 {
-protected:
-       static const int MAX_RTYPES = 10;
-//     RoadElement_t *roadlink;
-       float ppitch;
-       float pturn;
-       float lastpturn;
-       Vector3 ppos;
-       Vector3 protl;
-       Vector3 protr;
-       SceneManager *mSceneMgr;
-//     Entity *te;
-       SceneNode *tenode;
-       RoadType_t rtypes[MAX_RTYPES];
-       int free_rtype;
-       int cur_rtype;
+       friend class RoRFrameListener;
 
-       void preparePending();
+public:
 
-       void updatePending();
+       Road(Ogre::SceneManager *scm, Ogre::Vector3 start);
 
-public:
-       Road(SceneManager *scm, Vector3 start);
-       void reset(Vector3 start);
+private:
+
        void addRoadType(const char* name);
-       void toggleType();
+       void append();
        void dpitch(float v);
        void dturn(float v);
-       Vector3 rpos;
-       Vector3 rrot;
-       char curtype[256];
-       void append();
-       ~Road();
-};
+       void preparePending();
+       void reset(Ogre::Vector3 start);
+       void toggleType();      
+       void updatePending();
 
-#endif
+       static const unsigned int MAX_RTYPES = 10;
+       RoadType_t rtypes[MAX_RTYPES];
 
+       Ogre::SceneManager *mSceneMgr;
+       Ogre::SceneNode *tenode;
 
+       Ogre::Vector3 ppos;
+       Ogre::Vector3 protl;
+       Ogre::Vector3 protr;
+       Ogre::Vector3 rpos;
+       Ogre::Vector3 rrot;
+
+       float lastpturn;
+       float ppitch;
+       float pturn;
+
+       int cur_rtype;
+       int free_rtype;
+
+       char curtype[256];
+};
+
+#endif // __Road_H_

Modified: trunk/source/main/gameplay/road2.cpp
===================================================================
--- trunk/source/main/gameplay/road2.cpp        2012-03-16 20:03:38 UTC (rev 
2476)
+++ trunk/source/main/gameplay/road2.cpp        2012-04-09 22:14:27 UTC (rev 
2477)
@@ -17,20 +17,22 @@
 You should have received a copy of the GNU General Public License
 along with Rigs of Rods.  If not, see <http://www.gnu.org/licenses/>.
 */
+
 #include "road2.h"
 #include "ResourceBuffer.h"
 
+using namespace Ogre;
 
-Road2::Road2(SceneManager *manager, HeightFinder *hf, Collisions *collisions, 
int id)
+Road2::Road2(SceneManager *manager, HeightFinder *hf, Collisions *collisions, 
int id) :
+         smanager(manager)
+       , coll(collisions)
+       , first(true)
+       , hfinder(hf)
+       , mid(id)
+       , snode(0)
+       , tricount(0)
+       , vertexcount(0)
 {
-       smanager=manager;
-       hfinder=hf;
-       coll=collisions;
-       vertexcount=0;
-       tricount=0;
-       snode=0;
-       first=true;
-       mid=id;
        msh.setNull();
 }
 
@@ -47,10 +49,9 @@
                MeshManager::getSingleton().remove(msh->getName());
                msh.setNull();
        }
-       if(registeredCollTris.size()>0)
+       if(registeredCollTris.size() > 0)
        {
-               std::vector<int>::iterator it;
-               for(it = registeredCollTris.begin(); it != 
registeredCollTris.end(); it++)
+               for(std::vector<int>::iterator it = registeredCollTris.begin(); 
it != registeredCollTris.end(); it++)
                {
                        //coll->enableCollisionTri(*it, false);
                        coll->removeCollisionTri(*it);
@@ -77,11 +78,9 @@
        addBlock(Vector3(1200,60,1717), Quaternion::IDENTITY, ROAD_FLAT, 8, 
1.4, 0.2);
 */
        createMesh();
-       char n1[256];
-       char n2[256];
-       sprintf(n1, "roadsystem_instance-%i", mid);
-       sprintf(n2, "roadsystem-%i", mid);
-       Entity *ec = smanager->createEntity(n1,n2);
+       String entity_name = 
String("RoadSystem_Instance-").append(StringConverter::toString(mid));
+       String mesh_name = 
String("RoadSystem-").append(StringConverter::toString(mid));
+       Entity *ec = smanager->createEntity(entity_name, mesh_name);
        snode = smanager->getRootSceneNode()->createChildSceneNode();
        snode->attachObject(ec);
 }
@@ -331,12 +330,16 @@
 
 inline Vector3 Road2::baseOf(Vector3 p)
 {
-       float y=hfinder->getHeightAt(p.x, p.z)-0.01;
-       if (y>p.y) y=p.y-0.01;
+       float y = hfinder->getHeightAt(p.x, p.z) - 0.01;
+
+       if (y > p.y)
+       {
+               y = p.y - 0.01;
+       }
+
        return Vector3(p.x, y, p.z);
 }
 
-//the two firsts must be the "high" points
 void Road2::addQuad(Vector3 p1, Vector3 p2, Vector3 p3, Vector3 p4, int 
texfit, bool collision, Vector3 pos, Vector3 lastpos, float width, bool flip)
 {
        if(vertexcount+3 >= MAX_VERTEX || tricount*3+3+2 >= MAX_TRIS*3) return;
@@ -541,30 +544,24 @@
 void Road2::createMesh()
 {
        AxisAlignedBox *aab=new AxisAlignedBox();
-       size_t nVertices=vertexcount;
-       size_t nTris=tricount;
        union
        {
                float *vertices;
                CoVertice_t *covertices;
        };
        /// Create the mesh via the MeshManager
-       char n2[256];
-       sprintf(n2, "roadsystem-%i", mid);
-       msh = MeshManager::getSingleton().createManual(n2, 
ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, new ResourceBuffer());
+       Ogre::String mesh_name = 
Ogre::String("RoadSystem-").append(Ogre::StringConverter::toString(mid));
+       msh = MeshManager::getSingleton().createManual(mesh_name, 
ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, new ResourceBuffer());
 
-       /// Create submeshes
        mainsub = msh->createSubMesh();
-
-       //materials
        mainsub->setMaterialName("road2");
 
        /// Define the vertices
-       size_t vbufCount = (2*3+2)*nVertices;
+       size_t vbufCount = (2*3+2)*vertexcount;
        vertices=(float*)malloc(vbufCount*sizeof(float));
        int i;
        //fill values
-       for (i=0; i<(int)nVertices; i++)
+       for (i=0; i < vertexcount; i++)
        {
                covertices[i].texcoord=tex[i];
                covertices[i].vertex=vertex[i];
@@ -574,14 +571,11 @@
        }
 
        /// Define triangles
-       /// The values in this table refer to vertices in the above table
-       //nTris=???;
-       size_t ibufCount = 3*nTris;
+       size_t ibufCount = 3*tricount;
 
        //compute normals
-       for (i=0; i<(int)nTris; i++)
+       for (i=0; i < tricount && i*3+2 < MAX_TRIS*3; i++)
        {
-               // TODO: fix warning C6011: Dereferencing NULL pointer 
'$S5.covertices'
                Vector3 v1, v2;
                v1=covertices[tris[i*3+1]].vertex-covertices[tris[i*3]].vertex;
                v2=covertices[tris[i*3+2]].vertex-covertices[tris[i*3]].vertex;
@@ -592,15 +586,14 @@
                covertices[tris[i*3+2]].normal+=v1;
        }
        //normalize
-       for (i=0; i<(int)nVertices; i++)
+       for (i=0; i < vertexcount; i++)
        {
                covertices[i].normal.normalise();
        }
 
-
-       /// Create vertex data structure for vertices shared between submeshes
+       /// Create vertex data structure for vertices shared between sub meshes
        msh->sharedVertexData = new VertexData();
-       msh->sharedVertexData->vertexCount = nVertices;
+       msh->sharedVertexData->vertexCount = vertexcount;
 
        /// Create declaration (memory format) of vertex data
        VertexDeclaration* decl = msh->sharedVertexData->vertexDeclaration;

Modified: trunk/source/main/gameplay/road2.h
===================================================================
--- trunk/source/main/gameplay/road2.h  2012-03-16 20:03:38 UTC (rev 2476)
+++ trunk/source/main/gameplay/road2.h  2012-04-09 22:14:27 UTC (rev 2477)
@@ -17,94 +17,75 @@
 You should have received a copy of the GNU General Public License
 along with Rigs of Rods.  If not, see <http://www.gnu.org/licenses/>.
 */
-#ifndef __Road2_H__
-#define __Road2_H__
 
+#ifndef __Road2_H_
+#define __Road2_H_
+
 #include "RoRPrerequisites.h"
-#include <stdio.h>
-#include <math.h>
-#include <vector>
 
-#include "Ogre.h"
-using namespace Ogre;
-
 #include "heightfinder.h"
 #include "collisions.h"
-//dynamic roads
 
-#define MAX_VERTEX 50000
-#define MAX_TRIS 50000
+// dynamic roads
 
-#define ROAD_AUTOMATIC 0
-#define ROAD_FLAT 1
-#define ROAD_LEFT 2
-#define ROAD_RIGHT 3
-#define ROAD_BOTH 4
-#define ROAD_BRIDGE 5
-#define ROAD_MONORAIL 6
-
-#define TEXFIT_NONE 0
-#define TEXFIT_BRICKWALL 1
-#define TEXFIT_ROADS1 2
-#define TEXFIT_ROADS2 3
-#define TEXFIT_ROAD 4
-#define TEXFIT_ROADS3 5
-#define TEXFIT_ROADS4 6
-#define TEXFIT_CONCRETEWALL 7
-#define TEXFIT_CONCRETEWALLI 8
-#define TEXFIT_CONCRETETOP 9
-#define TEXFIT_CONCRETEUNDER 10
-
 class Road2
 {
-protected:
-       typedef struct
-       {
-               Vector3 vertex;
-               Vector3 normal;
-               Vector2 texcoord;
-       } CoVertice_t;
+public:
 
+       Road2(Ogre::SceneManager *manager, HeightFinder *hf, Collisions 
*collisions, int id);
+       ~Road2();
 
+       void addBlock(Ogre::Vector3 pos, Quaternion rot, int type, float width, 
float bwidth, float bheight, int pillartype=1);
+       /**
+        * @param p1 Top left point.
+        * @param p2 Top right point.
+        */
+       void addQuad(Ogre::Vector3 p1, Ogre::Vector3 p2, Ogre::Vector3 p3, 
Ogre::Vector3 p4, int texfit, bool collision, Ogre::Vector3 pos, Ogre::Vector3 
lastpos, float width, bool flip=false);
+       void addCollisionQuad(Ogre::Vector3 p1, Ogre::Vector3 p2, Ogre::Vector3 
p3, Ogre::Vector3 p4, ground_model_t* gm, bool flip=false);
+       void createMesh();
+       void finish();
 
-       MeshPtr msh;
-       SubMesh* mainsub;
-       SceneManager *smanager;
+       static const unsigned int MAX_VERTEX = 50000;
+       static const unsigned int MAX_TRIS = 50000;
 
+       enum { ROAD_AUTOMATIC, ROAD_FLAT, ROAD_LEFT, ROAD_RIGHT, ROAD_BOTH, 
ROAD_BRIDGE, ROAD_MONORAIL };
+       enum { TEXFIT_NONE, TEXFIT_BRICKWALL, TEXFIT_ROADS1, TEXFIT_ROADS2, 
TEXFIT_ROAD, TEXFIT_ROADS3, TEXFIT_ROADS4, TEXFIT_CONCRETEWALL, 
TEXFIT_CONCRETEWALLI, TEXFIT_CONCRETETOP, TEXFIT_CONCRETEUNDER };
 
-       Vector3 vertex[MAX_VERTEX];
-       Vector2 tex[MAX_VERTEX];
+private:
+
+       inline Ogre::Vector3 baseOf(Ogre::Vector3 p);
+       void computePoints(Ogre::Vector3 *pts, Ogre::Vector3 pos, 
Ogre::Quaternion rot, int type, float width, float bwidth, float bheight);
+       void textureFit(Ogre::Vector3 p1, Ogre::Vector3 p2, Ogre::Vector3 p3, 
Ogre::Vector3 p4, int texfit, Vector2 *texc, Ogre::Vector3 pos, Ogre::Vector3 
lastpos, float width);
+
+       typedef struct
+       {
+               Ogre::Vector3 vertex;
+               Ogre::Vector3 normal;
+               Ogre::Vector2 texcoord;
+       } CoVertice_t;
+
+       Ogre::MeshPtr msh;
+       Ogre::SubMesh* mainsub;
+       Ogre::SceneManager *smanager;
+
+       Ogre::Vector2 tex[MAX_VERTEX];
+       Ogre::Vector3 vertex[MAX_VERTEX];
+       int tricount;
        int vertexcount;
        short tris[MAX_TRIS*3];
-       int tricount;
 
+       Collisions *coll;
+       HeightFinder* hfinder;
+       Ogre::Quaternion lastrot;
+       Ogre::SceneNode *snode;
+       Ogre::Vector3 lastpos;
        bool first;
-       Vector3 lastpos;
-       Quaternion lastrot;
-       float lastwidth;
        float lastbheight;
        float lastbwidth;
+       float lastwidth;
        int lasttype;
-       HeightFinder* hfinder;
-       Collisions *coll;
        int mid;
-       SceneNode *snode;
        std::vector<int> registeredCollTris;
-public:
-       Road2(SceneManager *manager, HeightFinder *hf, Collisions *collisions, 
int id);
-       void finish();
-       void addBlock(Vector3 pos, Quaternion rot, int type, float width, float 
bwidth, float bheight, int pillartype=1);
-       void computePoints(Vector3 *pts, Vector3 pos, Quaternion rot, int type, 
float width, float bwidth, float bheight);
-
-       inline Vector3 baseOf(Vector3 p);
-       //the two firsts must be the "high" points
-       void addQuad(Vector3 p1, Vector3 p2, Vector3 p3, Vector3 p4, int 
texfit, bool collision, Vector3 pos, Vector3 lastpos, float width, bool 
flip=false);
-       void textureFit(Vector3 p1, Vector3 p2, Vector3 p3, Vector3 p4, int 
texfit, Vector2 *texc, Vector3 pos, Vector3 lastpos, float width);
-       void addCollisionQuad(Vector3 p1, Vector3 p2, Vector3 p3, Vector3 p4, 
ground_model_t* gm, bool flip=false);
-       void createMesh();
-       ~Road2();
 };
 
-#endif
-
-
+#endif // __Road2_H_

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


------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
Rigsofrods-devel mailing list
Rigsofrods-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rigsofrods-devel

Reply via email to