From 9c698f58ed26aa8fe9622ee256e561e6edeb5702 Mon Sep 17 00:00:00 2001 From: Nick Gasson Date: Fri, 30 Oct 2009 19:58:39 +0000 Subject: [PATCH] Rename some variables --- include/IFog.hpp | 8 ++++---- include/ILight.hpp | 2 +- src/Fog.cpp | 22 +++++++++++----------- src/Game.cpp | 6 +++--- src/Light.cpp | 2 +- src/Map.cpp | 24 ++++++++++++------------ 6 files changed, 32 insertions(+), 32 deletions(-) diff --git a/include/IFog.hpp b/include/IFog.hpp index ca73d35..70ef6d8 100644 --- a/include/IFog.hpp +++ b/include/IFog.hpp @@ -27,13 +27,13 @@ struct IFog { virtual void apply() const = 0; }; -typedef std::tr1::shared_ptr IFogPtr; +typedef shared_ptr IFogPtr; // Construct a generic fog -IFogPtr makeFog(float r, float g, float b, - float density, float start, float end); +IFogPtr make_fog(float r, float g, float b, + float density, float start, float end); // Construct a fog from the current clear colour -IFogPtr makeFog(float density, float start, float end); +IFogPtr make_fog(float density, float start, float end); #endif diff --git a/include/ILight.hpp b/include/ILight.hpp index f0896a5..e8dbf58 100644 --- a/include/ILight.hpp +++ b/include/ILight.hpp @@ -31,6 +31,6 @@ struct ILight { typedef std::tr1::shared_ptr ILightPtr; // A weak non-directional light -ILightPtr makeSunLight(); +ILightPtr make_sun_light(); #endif diff --git a/src/Fog.cpp b/src/Fog.cpp index e80a11b..0e5cbe3 100644 --- a/src/Fog.cpp +++ b/src/Fog.cpp @@ -27,40 +27,40 @@ class Fog : public IFog { public: Fog(float r, float g, float b, float density, float start, float end) - : myR(r), myG(g), myB(b), - myDensity(density), myStart(start), myEnd(end) {} + : r(r), g(g), b(b), + density(density), start(start), end(end) {} void apply() const; private: - float myR, myG, myB; - float myDensity, myStart, myEnd; + float r, g, b; + float density, start, end; }; void Fog::apply() const { - GLfloat fogColor[4] = { myR, myG, myB, 1.0f }; + GLfloat fogColor[4] = { r, g, b, 1.0f }; glFogi(GL_FOG_MODE, GL_LINEAR); glFogfv(GL_FOG_COLOR, fogColor); - glFogf(GL_FOG_DENSITY, myDensity); + glFogf(GL_FOG_DENSITY, density); glHint(GL_FOG_HINT, GL_DONT_CARE); - glFogf(GL_FOG_START, myStart); - glFogf(GL_FOG_END, myEnd); + glFogf(GL_FOG_START, start); + glFogf(GL_FOG_END, end); glEnable(GL_FOG); } -IFogPtr makeFog(float r, float g, float b, +IFogPtr make_fog(float r, float g, float b, float density, float start, float end) { return IFogPtr(new Fog(r, g, b, density, start, end)); } -IFogPtr makeFog(float density, float start, float end) +IFogPtr make_fog(float density, float start, float end) { float params[4]; glGetFloatv(GL_COLOR_CLEAR_VALUE, params); - return makeFog(params[0], params[1], params[2], + return make_fog(params[0], params[1], params[2], density, start, end); } diff --git a/src/Game.cpp b/src/Game.cpp index 8609f36..c46783c 100644 --- a/src/Game.cpp +++ b/src/Game.cpp @@ -57,7 +57,7 @@ private: IMapPtr myMap; ITrainPtr myTrain; - ILightPtr mySun; + ILightPtr sun; // Station the train is either approaching or stopped at IStationPtr myActiveStation; @@ -90,7 +90,7 @@ Game::Game(IMapPtr aMap) myCameraSpeed(1.0f), myCameraMode(CAMERA_FLOATING) { myTrain = makeTrain(myMap); - mySun = makeSunLight(); + sun = make_sun_light(); myMap->setGrid(false); @@ -154,7 +154,7 @@ void Game::display(IGraphicsPtr aContext) const aContext->lookAt(position, trainPos); setBillboardCameraOrigin(position); - mySun->apply(); + sun->apply(); myMap->render(aContext); myTrain->render(); diff --git a/src/Light.cpp b/src/Light.cpp index 83a3d7d..07980d1 100644 --- a/src/Light.cpp +++ b/src/Light.cpp @@ -48,7 +48,7 @@ struct SunLight : ILight { }; -ILightPtr makeSunLight() +ILightPtr make_sun_light() { return ILightPtr(new SunLight); } diff --git a/src/Map.cpp b/src/Map.cpp index e77c71b..a216255 100644 --- a/src/Map.cpp +++ b/src/Map.cpp @@ -48,11 +48,11 @@ class TrackNode { public: TrackNode(ITrackSegmentPtr aTrack, int x, int y) - : myTrack(aTrack), amMarked(false), myX(x), myY(y) {} + : myTrack(aTrack), marked_(false), myX(x), myY(y) {} - inline void setMark() { amMarked = true; } - inline void resetMark() { amMarked = false; } - inline bool marked() const { return amMarked; } + inline void set_mark() { marked_ = true; } + inline void reset_mark() { marked_ = false; } + inline bool marked() const { return marked_; } inline ITrackSegmentPtr get() { return myTrack; } @@ -60,7 +60,7 @@ public: inline int originY() const { return myY; } private: ITrackSegmentPtr myTrack; - bool amMarked; + bool marked_; int myX, myY; // Position of origin }; @@ -173,7 +173,7 @@ private: return makePoint(a % myWidth, a / myWidth); } - void resetMarks() const; + void reset_marks() const; void writeHeightMap() const; void readHeightMap(IResource::Handle aHandle); void tileVertices(int x, int y, int* indexes) const; @@ -213,8 +213,8 @@ Map::Map(IResourcePtr aRes) shouldDrawGridLines(false), inPickMode(false), myResource(aRes) { - myFog = makeFog(0.005f, // Density - 50.0f, 70.0f); // Start and end distance + myFog = make_fog(0.005f, // Density + 50.0f, 70.0f); // Start and end distance } Map::~Map() @@ -376,7 +376,7 @@ void Map::resetMap(int aWidth, int aDepth) myQuadTree = makeQuadTree(shared_from_this(), myWidth); } -void Map::resetMarks() const +void Map::reset_marks() const { // Clear the mark bit of every track segment // This is set whenever we render a track endpoint to ensure @@ -384,14 +384,14 @@ void Map::resetMarks() const for (int x = 0; x < myWidth; x++) { for (int y = 0; y < myDepth; y++) { if (tileAt(x, y).track) - tileAt(x, y).track->resetMark(); + tileAt(x, y).track->reset_mark(); } } } void Map::render(IGraphicsPtr aContext) const { - resetMarks(); + reset_marks(); myFog->apply(); @@ -724,7 +724,7 @@ void Map::renderSector(IGraphicsPtr aContext, int id, tile.track->get()->render(); glPopMatrix(); - tile.track->setMark(); + tile.track->set_mark(); // Draw the endpoints for debugging //list > endpoints; -- 2.39.2