From 420328025f950b66a50ff17ca3af95d6be699d9f Mon Sep 17 00:00:00 2001 From: Nick Gasson Date: Sat, 31 Oct 2009 23:27:32 +0000 Subject: [PATCH] Revert "Rename some variables" This reverts commit 9c698f58ed26aa8fe9622ee256e561e6edeb5702. --- 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 70ef6d8..ca73d35 100644 --- a/include/IFog.hpp +++ b/include/IFog.hpp @@ -27,13 +27,13 @@ struct IFog { virtual void apply() const = 0; }; -typedef shared_ptr IFogPtr; +typedef std::tr1::shared_ptr IFogPtr; // Construct a generic fog -IFogPtr make_fog(float r, float g, float b, - float density, float start, float end); +IFogPtr makeFog(float r, float g, float b, + float density, float start, float end); // Construct a fog from the current clear colour -IFogPtr make_fog(float density, float start, float end); +IFogPtr makeFog(float density, float start, float end); #endif diff --git a/include/ILight.hpp b/include/ILight.hpp index e8dbf58..f0896a5 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 make_sun_light(); +ILightPtr makeSunLight(); #endif diff --git a/src/Fog.cpp b/src/Fog.cpp index 0e5cbe3..e80a11b 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) - : r(r), g(g), b(b), - density(density), start(start), end(end) {} + : myR(r), myG(g), myB(b), + myDensity(density), myStart(start), myEnd(end) {} void apply() const; private: - float r, g, b; - float density, start, end; + float myR, myG, myB; + float myDensity, myStart, myEnd; }; void Fog::apply() const { - GLfloat fogColor[4] = { r, g, b, 1.0f }; + GLfloat fogColor[4] = { myR, myG, myB, 1.0f }; glFogi(GL_FOG_MODE, GL_LINEAR); glFogfv(GL_FOG_COLOR, fogColor); - glFogf(GL_FOG_DENSITY, density); + glFogf(GL_FOG_DENSITY, myDensity); glHint(GL_FOG_HINT, GL_DONT_CARE); - glFogf(GL_FOG_START, start); - glFogf(GL_FOG_END, end); + glFogf(GL_FOG_START, myStart); + glFogf(GL_FOG_END, myEnd); glEnable(GL_FOG); } -IFogPtr make_fog(float r, float g, float b, +IFogPtr makeFog(float r, float g, float b, float density, float start, float end) { return IFogPtr(new Fog(r, g, b, density, start, end)); } -IFogPtr make_fog(float density, float start, float end) +IFogPtr makeFog(float density, float start, float end) { float params[4]; glGetFloatv(GL_COLOR_CLEAR_VALUE, params); - return make_fog(params[0], params[1], params[2], + return makeFog(params[0], params[1], params[2], density, start, end); } diff --git a/src/Game.cpp b/src/Game.cpp index 46d0e83..086a218 100644 --- a/src/Game.cpp +++ b/src/Game.cpp @@ -60,7 +60,7 @@ private: IMapPtr myMap; ITrainPtr myTrain; - ILightPtr sun; + ILightPtr mySun; // Station the train is either approaching or stopped at IStationPtr myActiveStation; @@ -94,7 +94,7 @@ Game::Game(IMapPtr aMap) myCameraSpeed(1.0f), myCameraMode(CAMERA_FLOATING) { myTrain = makeTrain(myMap); - sun = make_sun_light(); + mySun = makeSunLight(); myMap->setGrid(false); @@ -160,7 +160,7 @@ void Game::display(IGraphicsPtr aContext) const aContext->lookAt(position, trainPos); setBillboardCameraOrigin(position); - sun->apply(); + mySun->apply(); myMap->render(aContext); myTrain->render(); diff --git a/src/Light.cpp b/src/Light.cpp index 07980d1..83a3d7d 100644 --- a/src/Light.cpp +++ b/src/Light.cpp @@ -48,7 +48,7 @@ struct SunLight : ILight { }; -ILightPtr make_sun_light() +ILightPtr makeSunLight() { return ILightPtr(new SunLight); } diff --git a/src/Map.cpp b/src/Map.cpp index a216255..e77c71b 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), marked_(false), myX(x), myY(y) {} + : myTrack(aTrack), amMarked(false), myX(x), myY(y) {} - inline void set_mark() { marked_ = true; } - inline void reset_mark() { marked_ = false; } - inline bool marked() const { return marked_; } + inline void setMark() { amMarked = true; } + inline void resetMark() { amMarked = false; } + inline bool marked() const { return amMarked; } inline ITrackSegmentPtr get() { return myTrack; } @@ -60,7 +60,7 @@ public: inline int originY() const { return myY; } private: ITrackSegmentPtr myTrack; - bool marked_; + bool amMarked; int myX, myY; // Position of origin }; @@ -173,7 +173,7 @@ private: return makePoint(a % myWidth, a / myWidth); } - void reset_marks() const; + void resetMarks() 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 = make_fog(0.005f, // Density - 50.0f, 70.0f); // Start and end distance + myFog = makeFog(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::reset_marks() const +void Map::resetMarks() 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::reset_marks() const for (int x = 0; x < myWidth; x++) { for (int y = 0; y < myDepth; y++) { if (tileAt(x, y).track) - tileAt(x, y).track->reset_mark(); + tileAt(x, y).track->resetMark(); } } } void Map::render(IGraphicsPtr aContext) const { - reset_marks(); + resetMarks(); myFog->apply(); @@ -724,7 +724,7 @@ void Map::renderSector(IGraphicsPtr aContext, int id, tile.track->get()->render(); glPopMatrix(); - tile.track->set_mark(); + tile.track->setMark(); // Draw the endpoints for debugging //list > endpoints; -- 2.39.2