www

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

commit 9a8635f94b6b1fad158af6549e6ccc304f389860
parent 7778e773866716ccd58537f422a8f3c1435baa36
Author: Yoann <yoann.b87@voila.fr>
Date:   Fri, 23 Dec 2011 14:47:39 +0100

Ajout d'un toit surs les batiments avec passage.
Définition de la classe toit de manière générale.
// TODO faire de la classe toit une classe abstraite dont les classes
filles (héritées) représentent les différents types de toit.
Petit nettoyage des quelques fichiers.

Diffstat:
Mall_includes.hh | 1+
Mrules/batiment/batimentquad.hh | 2+-
Mrules/batiment/batimentquadblock.cpp | 2+-
Mrules/batiment/batimentquadblock.hh | 2+-
Mrules/batiment/batimentquadjardin.hh | 2+-
Mrules/batiment/batimentquadmaison.hh | 2+-
Mrules/batiment/batimentquadmaisonpont.cpp | 25+++++++++----------------
Mrules/batiment/batimentquadmaisonpont.hh | 2+-
Mrules/batiment/batimentquadpont.hh | 2+-
Mrules/batiment/batimentquadtoit.cpp | 42++++++++++++++++++++++++++++++++++++++++++
Mrules/batiment/batimentquadtoit.hh | 22++++++++++++++++++++++
Mrules/quartier/quartierquad.hh | 2+-
Mrules/quartier/quartiertri.hh | 2+-
Mrules/terrain/terrainquadherbe.hh | 2+-
14 files changed, 84 insertions(+), 26 deletions(-)

diff --git a/all_includes.hh b/all_includes.hh @@ -41,6 +41,7 @@ class Chose; #include "rules/batiment/batimentquadpont.hh" #include "rules/batiment/batimentquadmaisonpont.hh" #include "rules/batiment/batimentquadblock.hh" +#include "rules/batiment/batimentquadtoit.hh" #include "rules/quartier/quartierquad.hh" #include "rules/quartier/quartierquadangle.hh" diff --git a/rules/batiment/batimentquad.hh b/rules/batiment/batimentquad.hh @@ -3,7 +3,7 @@ #include "all_includes.hh" -// RectangleRoutes est un quadrilatère de routes avec des angles aux coins égaux à 90°. + class BatimentQuad : public Chose { private : Vertex c[4]; diff --git a/rules/batiment/batimentquadblock.cpp b/rules/batiment/batimentquadblock.cpp @@ -37,5 +37,5 @@ void BatimentQuadBlock::triangulation() { Vertex nwh = c[NW] + Vertex(0,0,height); Vertex neh = c[NE] + Vertex(0,0,height); - addOcto(c[SE],c[SW],c[NW],c[NE],seh,swh,nwh,neh,0xFF,0x36,0x00); + addOcto(c[SE],c[SW],c[NW],c[NE],seh,swh,nwh,neh,0xF1,0xE0,0xE0); } diff --git a/rules/batiment/batimentquadblock.hh b/rules/batiment/batimentquadblock.hh @@ -3,7 +3,7 @@ #include "all_includes.hh" -// RectangleRoutes est un quadrilatère de routes avec des angles aux coins égaux à 90°. + class BatimentQuadBlock : public Chose { private : Vertex c[4]; diff --git a/rules/batiment/batimentquadjardin.hh b/rules/batiment/batimentquadjardin.hh @@ -3,7 +3,7 @@ #include "all_includes.hh" -// RectangleRoutes est un quadrilatère de routes avec des angles aux coins égaux à 90°. + class BatimentQuadJardin : public Chose { private : Vertex corner[4]; diff --git a/rules/batiment/batimentquadmaison.hh b/rules/batiment/batimentquadmaison.hh @@ -3,7 +3,7 @@ #include "all_includes.hh" -// RectangleRoutes est un quadrilatère de routes avec des angles aux coins égaux à 90°. + class BatimentQuadMaison : public Chose { private : Vertex corner[4]; diff --git a/rules/batiment/batimentquadmaisonpont.cpp b/rules/batiment/batimentquadmaisonpont.cpp @@ -69,21 +69,14 @@ bool BatimentQuadMaisonPont::split() { ne = qc.corner[3]; addChild(new BatimentQuadPont(se,sw,nw,ne,partHeight)); -/* - Vertex seh = qh.corner[0] + Vertex(0,0,partHeight); - Vertex swh = qh.corner[1] + Vertex(0,0,partHeight); - Vertex nwh = qh.corner[2] + Vertex(0,0,partHeight); - Vertex neh = qh.corner[3] + Vertex(0,0,partHeight); - Vertex ce = seh + (neh - seh)/2 + Vertex(0,0,0.5*height/3.); - Vertex cw = swh + (nwh - swh)/2 + Vertex(0,0,0.5*height/3.); + Vertex seh = qh.corner[0] + Vertex(0,0,2*partHeight); + Vertex swh = qh.corner[1] + Vertex(0,0,2*partHeight); + Vertex nwh = qh.corner[2] + Vertex(0,0,2*partHeight); + Vertex neh = qh.corner[3] + Vertex(0,0,2*partHeight); - addTriangle(new Triangle(swh,nwh,cw,0xDD,0xDD,0xDD)); - addTriangle(new Triangle(neh,seh,ce,0xDD,0xDD,0xDD)); + addChild(new BatimentQuadToit(seh,swh,nwh,neh,150)); - addQuad(neh,nwh,cw,ce,0xE0,0x20,0x00); - addQuad(swh,seh,ce,cw,0xE0,0x20,0x00); -*/ return true; } @@ -96,14 +89,14 @@ void BatimentQuadMaisonPont::triangulation() { Vertex nwh = q.corner[NW] + Vertex(0,0,h); Vertex neh = q.corner[NE] + Vertex(0,0,h); - addQuad(c[SE],c[SW],c[NW],c[NE],0xDD,0xDD,0xDD); - addOcto(q.corner[NE],q.corner[SE],q.corner[SW],q.corner[NW],neh,seh,swh,nwh,0xDD,0xDD,0xDD); + addQuad(c[SE],c[SW],c[NW],c[NE],0x80,0x80,0x80); + addOcto(q.corner[NE],q.corner[SE],q.corner[SW],q.corner[NW],neh,seh,swh,nwh,0xF1,0xE0,0xE0); Vertex ce = seh + (neh - seh)/2 + Vertex(0,0,0.5*height/3.); Vertex cw = swh + (nwh - swh)/2 + Vertex(0,0,0.5*height/3.); - addTriangle(new Triangle(swh,nwh,cw,0xDD,0xDD,0xDD)); - addTriangle(new Triangle(neh,seh,ce,0xDD,0xDD,0xDD)); + addTriangle(new Triangle(swh,nwh,cw,0xF1,0xE0,0xE0)); + addTriangle(new Triangle(neh,seh,ce,0xF1,0xE0,0xE0)); addQuad(neh,nwh,cw,ce,0xE0,0x20,0x00); addQuad(swh,seh,ce,cw,0xE0,0x20,0x00); diff --git a/rules/batiment/batimentquadmaisonpont.hh b/rules/batiment/batimentquadmaisonpont.hh @@ -3,7 +3,7 @@ #include "all_includes.hh" -// RectangleRoutes est un quadrilatère de routes avec des angles aux coins égaux à 90°. + class BatimentQuadMaisonPont: public Chose { private : Vertex c[4]; diff --git a/rules/batiment/batimentquadpont.hh b/rules/batiment/batimentquadpont.hh @@ -3,7 +3,7 @@ #include "all_includes.hh" -// RectangleRoutes est un quadrilatère de routes avec des angles aux coins égaux à 90°. + class BatimentQuadPont: public Chose { private : Vertex c[4]; diff --git a/rules/batiment/batimentquadtoit.cpp b/rules/batiment/batimentquadtoit.cpp @@ -0,0 +1,42 @@ +#include "all_includes.hh" + +BatimentQuadToit::BatimentQuadToit(Vertex ne, Vertex se, Vertex sw, Vertex nw, int height) : Chose() { + addEntropy(ne, se, sw, nw); + c[NE] = ne; + c[SE] = se; + c[SW] = sw; + c[NW] = nw; + this->height = height; +} + +BatimentQuadToit::~BatimentQuadToit() { + children.clear(); + triangles.clear(); +} + +void BatimentQuadToit::getBoundingBoxPoints() { + addBBPoint(c[NE]); + addBBPoint(c[SE]); + addBBPoint(c[SW]); + addBBPoint(c[NW]); + addBBPoint(c[NE] + Vertex(0,0,height)); // TODO + addBBPoint(c[SE] + Vertex(0,0,height)); + addBBPoint(c[SW] + Vertex(0,0,height)); + addBBPoint(c[NW] + Vertex(0,0,height)); +} + +bool BatimentQuadToit::split() { + return false; +} + +void BatimentQuadToit::triangulation() { + //triangles.reserve(2); + Vertex ce = c[SE] + (c[NE] - c[SE])/2 + Vertex(0,0,height/3.); + Vertex cw = c[SW] + (c[NW] - c[SW])/2 + Vertex(0,0,height/3.); + + addTriangle(new Triangle(c[SW],c[NW],cw,0xF1,0xE0,0xE0)); + addTriangle(new Triangle(c[NE],c[SE],ce,0xF1,0xE0,0xE0)); + + addQuad(c[NE],c[NW],cw,ce,0xE0,0x20,0x00); + addQuad(c[SW],c[SE],ce,cw,0xE0,0x20,0x00); +} diff --git a/rules/batiment/batimentquadtoit.hh b/rules/batiment/batimentquadtoit.hh @@ -0,0 +1,22 @@ +#ifndef _RULES_BATIMENTTOIT_HH_ +#define _RULES_BATIMENTTOIT_HH_ + +#include "all_includes.hh" + +// TOTO en faire un classe abstraite et définir des classe filles pour les différents types de toits. +class BatimentQuadToit: public Chose { + private : + Vertex c[4]; + int height; + + public : + + BatimentQuadToit(Vertex ne, Vertex se, Vertex sw, Vertex nw, int height); + virtual ~BatimentQuadToit(); + virtual bool split(); + virtual void triangulation(); + Chose* factory(int seed, int n, Vertex ne, Vertex se, Vertex sw, Vertex nw); + virtual void getBoundingBoxPoints(); +}; + +#endif diff --git a/rules/quartier/quartierquad.hh b/rules/quartier/quartierquad.hh @@ -3,7 +3,7 @@ #include "all_includes.hh" -// RectangleRoutes est un quadrilatère de routes avec des angles aux coins égaux à 90°. + class QuartierQuad : public Chose { public: Vertex corner[4]; diff --git a/rules/quartier/quartiertri.hh b/rules/quartier/quartiertri.hh @@ -3,7 +3,7 @@ #include "all_includes.hh" -// RectangleRoutes est un quadrilatère de routes avec des angles aux coins égaux à 90°. + class QuartierTri : public Chose { public : Vertex corner[3]; diff --git a/rules/terrain/terrainquadherbe.hh b/rules/terrain/terrainquadherbe.hh @@ -3,7 +3,7 @@ #include "all_includes.hh" -// Quad est un quadrilatère + class TerrainQuadHerbe : public Chose { private : Vertex corner[4];