www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 61ad0a65039f4ace14a95715dbf04b95783535b8
parent 73f265654e9a37f883b7e7f03f8ba95541b5b58e
Author: Yoann <yoann.b87@voila.fr>
Date:   Tue, 13 Dec 2011 15:58:00 +0100

Privatisation des attributs propres au classes.

Diffstat:
Mquad.hh | 5+++--
Mrules/batiment/batimentquad.cpp | 3++-
Mrules/batiment/batimentquad.hh | 10++++++----
Mrules/batiment/batimentquadjardin.hh | 7++++---
Mrules/batiment/batimentquadmaison.hh | 7++++---
Mrules/chose.hh | 15+++++++++++----
Mrules/route/routequadcarrefour.hh | 5+++--
Mrules/route/routequadchaussee.hh | 5+++--
Msegment.hh | 5+++--
Mtriangle.hh | 6+++---
Mvertex.hh | 12++++++------
Mview.hh | 16++++++++--------
12 files changed, 56 insertions(+), 40 deletions(-)

diff --git a/quad.hh b/quad.hh @@ -5,9 +5,10 @@ // Quad est un quadrilatère class Quad { -public: + public : Vertex corner[4]; -public: + + public : Quad(); Quad(Vertex ne, Vertex se, Vertex sw, Vertex nw); void offset(Cardinal side, int offset); diff --git a/rules/batiment/batimentquad.cpp b/rules/batiment/batimentquad.cpp @@ -1,7 +1,8 @@ #include "all_includes.hh" -BatimentQuad::BatimentQuad(Vertex ne, Vertex se, Vertex sw, Vertex nw) : Chose(), ne(ne), se(se), sw(sw), nw(nw) { +BatimentQuad::BatimentQuad(Vertex ne, Vertex se, Vertex sw, Vertex nw/*, Cardinal door*/) : Chose(), ne(ne), se(se), sw(sw), nw(nw) { addEntropy(ne, se, sw, nw); + //this->door = door; triangulation(); } diff --git a/rules/batiment/batimentquad.hh b/rules/batiment/batimentquad.hh @@ -5,16 +5,18 @@ // RectangleRoutes est un quadrilatère de routes avec des angles aux coins égaux à 90°. class BatimentQuad : public Chose { -public: + private : Vertex ne; Vertex se; Vertex sw; Vertex nw; -public: + Cardinal door; + + public : static const int minHeight = 400; static const int maxHeight = 800; -public: - BatimentQuad(Vertex ne, Vertex se, Vertex sw, Vertex nw); + + BatimentQuad(Vertex ne, Vertex se, Vertex sw, Vertex nw/*, Cardinal door*/); int width(); int height(); virtual bool subdivide(); diff --git a/rules/batiment/batimentquadjardin.hh b/rules/batiment/batimentquadjardin.hh @@ -5,15 +5,16 @@ // RectangleRoutes est un quadrilatère de routes avec des angles aux coins égaux à 90°. class BatimentQuadJardin : public Chose { -public: + private : Vertex ne; Vertex se; Vertex sw; Vertex nw; -public: + + public : static const int minHeight = 400; static const int maxHeight = 800; -public: + BatimentQuadJardin(Vertex ne, Vertex se, Vertex sw, Vertex nw); int width(); int height(); diff --git a/rules/batiment/batimentquadmaison.hh b/rules/batiment/batimentquadmaison.hh @@ -5,15 +5,16 @@ // RectangleRoutes est un quadrilatère de routes avec des angles aux coins égaux à 90°. class BatimentQuadMaison : public Chose { -public: + private : Vertex ne; Vertex se; Vertex sw; Vertex nw; -public: + + public : static const int minHeight = 400; static const int maxHeight = 800; -public: + BatimentQuadMaison(Vertex ne, Vertex se, Vertex sw, Vertex nw); int width(); int height(); diff --git a/rules/chose.hh b/rules/chose.hh @@ -5,15 +5,23 @@ // RectangleRoutes est un quadrilatère de routes avec des angles aux coins égaux à 90°. class Chose { -public: + public : static unsigned int initialSeed; unsigned int seed; std::vector<Chose*> children; std::vector<Triangle*> triangles; + + protected : int inCounter; int splitCube[6]; int mergeCube[6]; -public: + + + public : + void display(); + virtual bool subdivide() = 0; + + protected : Chose(); inline void addEntropy(unsigned int x1) { seed = hash2(seed, x1); } inline void addEntropy(unsigned int x1, unsigned int x2) { addEntropy(x1); addEntropy(x2); } @@ -25,9 +33,8 @@ public: inline void addEntropy(Vertex v1, Vertex v2, Vertex v3, Vertex v4) { addEntropy(v1, v2); addEntropy(v3, v4); } void addChild(Chose* c); void addTriangle(Triangle* t); - virtual bool subdivide() = 0; virtual void triangulation() = 0; - void display(); + }; std::ostream& operator<<(std::ostream& os, const Chose& r); diff --git a/rules/route/routequadcarrefour.hh b/rules/route/routequadcarrefour.hh @@ -4,12 +4,13 @@ #include "all_includes.hh" class RouteQuadCarrefour : public Chose { -public: + private : Vertex ne; Vertex se; Vertex sw; Vertex nw; -public: + + public : RouteQuadCarrefour(Vertex ne, Vertex se, Vertex sw, Vertex nw); virtual bool subdivide(); virtual void triangulation(); diff --git a/rules/route/routequadchaussee.hh b/rules/route/routequadchaussee.hh @@ -4,12 +4,13 @@ #include "all_includes.hh" class RouteQuadChaussee : public Chose { -public: + private : Vertex ne; Vertex se; Vertex sw; Vertex nw; -public: + + public : RouteQuadChaussee(Vertex ne, Vertex se, Vertex sw, Vertex nw); virtual bool subdivide(); virtual void triangulation(); diff --git a/segment.hh b/segment.hh @@ -4,10 +4,11 @@ #include "all_includes.hh" class Segment { -public: + private : Vertex u; Vertex v; -public: + + public : Segment(Vertex u, Vertex v); int length(); int width(); diff --git a/triangle.hh b/triangle.hh @@ -4,7 +4,7 @@ #include "all_includes.hh" class Triangle { - public: + public : Vertex v1; Vertex v2; Vertex v3; @@ -13,7 +13,7 @@ class Triangle { unsigned char b; Vertexf vnormal; - public: + public : friend std::ostream& operator<<(std::ostream& os, const Triangle* t); friend std::ostream& operator<<(std::ostream& os, const Triangle& t); Triangle(); @@ -24,7 +24,7 @@ class Triangle { float minAngle(); // angle minimum du triangle (en v1, v2 ou v3). void offsetBase(int offset); void display(); - + private : Vertexf normal(Vertex v1, Vertex v2, Vertex v3); }; diff --git a/vertex.hh b/vertex.hh @@ -5,12 +5,12 @@ class Vertexf; class Vertex { - public: + public : int x; int y; int z; - public: + public : Vertex(); Vertex(int x, int y, int z); float norm(); @@ -21,7 +21,7 @@ class Vertex { static Vertex fromSpherical(float r, float xAngle, float yAngle); friend Vertex intersection(Vertex a, Vertex b, Vertex c, Vertex d); // Intersection entre (a,b) et (c,d). - public: + public : operator Vertexf(); friend std::ostream& operator<<(std::ostream& os, const Vertex& v); friend Vertex operator+(const Vertex& u, const Vertex& v); @@ -36,18 +36,18 @@ class Vertex { }; class Vertexf { - public: + public : float x; float y; float z; - public: + public : Vertexf(); Vertexf(float x, float y, float z); float norm(); static Vertexf fromSpherical(float r, float xAngle, float yAngle); - public: + public : operator Vertex(); friend std::ostream& operator<<(std::ostream& os, const Vertexf& v); friend Vertexf operator+(const Vertexf& u, const Vertexf& v); diff --git a/view.hh b/view.hh @@ -10,7 +10,7 @@ // Prendre en compte tous les évènements X en attente avant de relancer le rendu. class Camera { - private: + private : Vertexf cameraCenter; Vertexf cameraSight; float xAngle; @@ -23,8 +23,8 @@ class Camera { bool right; bool pageUp; bool pageDown; - - public: + + public : Camera(Vertexf pos, float xA, float yA, int moveSensitivity, float mouseSensitivity); void setCamera(); void mouseMotion(const SDL_MouseMotionEvent &event); @@ -36,14 +36,14 @@ class Camera { class View { - private: + private : Chose* root; Camera camera; - + static const int windowWidth = 1024; static const int windowHeight = 768; - public: + public : View(Chose* root); void initWindow(); void mainLoop(); @@ -51,8 +51,8 @@ class View { void displayAxes(); static void setColor(unsigned char r, unsigned char g, unsigned char b); - - private: + + private : void setLight(); };