commit acc706970ce4b78a1bde0561c13238ea7d57ddf4
parent e9326924f28d4dfcaf35d691195149829642d77e
Author: Georges Dupéron <jahvascriptmaniac+github@free.fr>
Date: Thu, 22 Dec 2011 15:49:56 +0100
Merge branch 'master' of github.com:jsmaniac/2011-m2s3-city-builder
Diffstat:
5 files changed, 35 insertions(+), 17 deletions(-)
diff --git a/.gitignore b/.gitignore
@@ -1,4 +1,4 @@
city
all.cpp
all_includes.hh.gch
-city-builder/*
+city-builder
diff --git a/rules/batiment/batimentquadmaisonblock.cpp b/rules/batiment/batimentquadmaisonblock.cpp
@@ -3,10 +3,10 @@
BatimentQuadMaisonBlock::BatimentQuadMaisonBlock(Vertex ne, Vertex se, Vertex sw, Vertex nw, int height) : Chose() {
addEntropy(ne, se, sw, nw);
lctr = Vertex(ne.x-nw.x,se.y-ne.y,0.0f);
- this->ne = ne-lctr;
- this->se = se-lctr;
- this-> sw = sw-lctr;
- this->nw = nw-lctr;
+ c[NE] = ne;
+ c[SE] = se;
+ c[SW] = sw;
+ c[NW] = nw;
this->height = height;
}
@@ -16,7 +16,14 @@ BatimentQuadMaisonBlock::~BatimentQuadMaisonBlock() {
}
void BatimentQuadMaisonBlock::getBoundingBoxPoints() {
- // TODO
+ 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));// TODO
}
bool BatimentQuadMaisonBlock::split() {
@@ -25,10 +32,10 @@ bool BatimentQuadMaisonBlock::split() {
void BatimentQuadMaisonBlock::triangulation() {
//triangles.reserve(2);
- Vertex seh = se + Vertex(0,0,height);
- Vertex swh = sw + Vertex(0,0,height);
- Vertex nwh = nw + Vertex(0,0,height);
- Vertex neh = ne + Vertex(0,0,height);
+ Vertex seh = c[SE] + Vertex(0,0,height);
+ Vertex swh = c[SW] + Vertex(0,0,height);
+ Vertex nwh = c[NW] + Vertex(0,0,height);
+ Vertex neh = c[NE] + Vertex(0,0,height);
- addOcto(lctr+se,lctr+sw,lctr+nw,lctr+ne,lctr+seh,lctr+swh,lctr+nwh,lctr+neh,0xFF,0x36,0x00);
+ addOcto(c[SE],c[SW],c[NW],c[NE],seh,swh,nwh,neh,0xFF,0x36,0x00);
}
diff --git a/rules/batiment/batimentquadmaisonblock.hh b/rules/batiment/batimentquadmaisonblock.hh
@@ -6,10 +6,7 @@
// RectangleRoutes est un quadrilatère de routes avec des angles aux coins égaux à 90°.
class BatimentQuadMaisonBlock : public Chose {
private :
- Vertex ne;
- Vertex se;
- Vertex sw;
- Vertex nw;
+ Vertex c[4];
int height;
public :
diff --git a/rules/batiment/batimentquadmaisonpont.cpp b/rules/batiment/batimentquadmaisonpont.cpp
@@ -15,7 +15,14 @@ BatimentQuadMaisonPont::~BatimentQuadMaisonPont() {
}
void BatimentQuadMaisonPont::getBoundingBoxPoints() {
- // TODO
+ 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 BatimentQuadMaisonPont::split() {
diff --git a/rules/batiment/batimentquadpont.cpp b/rules/batiment/batimentquadpont.cpp
@@ -15,7 +15,14 @@ BatimentQuadPont::~BatimentQuadPont() {
}
void BatimentQuadPont::getBoundingBoxPoints() {
- // TODO !
+ 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 BatimentQuadPont::split() {