www

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

commit 9c9b65e2c3c528118c2a63bbfbbe55d12f99a94b
parent f7d889008a59cbe4a8860974bb9a229831853847
Author: Yoann <yoann.b87@voila.fr>
Date:   Sun, 18 Dec 2011 19:24:44 +0100

Tous les batiments possèdent un repère local.
Il faut par contre revoir l'implémentation du repère local voir fichier
bug correspondant.

Diffstat:
Mrules/batiment/batimentquadjardin.cpp | 11++++++++---
Mrules/batiment/batimentquadmaison.cpp | 23++++++++++++++---------
2 files changed, 22 insertions(+), 12 deletions(-)

diff --git a/rules/batiment/batimentquadjardin.cpp b/rules/batiment/batimentquadjardin.cpp @@ -1,7 +1,12 @@ #include "all_includes.hh" -BatimentQuadJardin::BatimentQuadJardin(Vertex ne, Vertex se, Vertex sw, Vertex nw) : Chose(), ne(ne), se(se), sw(sw), nw(nw) { +BatimentQuadJardin::BatimentQuadJardin(Vertex ne, Vertex se, Vertex sw, Vertex nw) : 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; triangulation(); } @@ -37,6 +42,6 @@ bool BatimentQuadJardin::merge() { void BatimentQuadJardin::triangulation() { triangles.reserve(2); - addTriangle(new Triangle(ne,nw,sw,0x12,0x64,0x12)); - addTriangle(new Triangle(sw,se,ne,0x10,0x60,0x10)); + addTriangle(new Triangle(lctr+ne,lctr+nw,lctr+sw,0x12,0x64,0x12)); + addTriangle(new Triangle(lctr+sw,lctr+se,lctr+ne,0x10,0x60,0x10)); } diff --git a/rules/batiment/batimentquadmaison.cpp b/rules/batiment/batimentquadmaison.cpp @@ -1,7 +1,12 @@ #include "all_includes.hh" -BatimentQuadMaison::BatimentQuadMaison(Vertex ne, Vertex se, Vertex sw, Vertex nw) : Chose(), ne(ne), se(se), sw(sw), nw(nw) { +BatimentQuadMaison::BatimentQuadMaison(Vertex ne, Vertex se, Vertex sw, Vertex nw) : 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; triangulation(); } @@ -46,14 +51,14 @@ void BatimentQuadMaison::triangulation() { Vertex toit = (neh + seh + nwh + swh) / 4 + Vertex(0,0,htoit); // 4 Murs - addTriangle(new Triangle(neh,seh,ne,0xf1,0xe3,0xad)); addTriangle(new Triangle(seh,se,ne,0xf1,0xe3,0xad)); // ne-se-seh-neh - addTriangle(new Triangle(seh,swh,se,0xf1,0xe3,0xad)); addTriangle(new Triangle(swh,sw,se,0xf1,0xe3,0xad)); // se-sw-swh-seh - addTriangle(new Triangle(swh,nwh,sw,0xf1,0xe3,0xad)); addTriangle(new Triangle(nwh,nw,sw,0xf1,0xe3,0xad)); // sw-nw-nwh-swh - addTriangle(new Triangle(nwh,neh,nw,0xf1,0xe3,0xad)); addTriangle(new Triangle(neh,ne,nw,0xf1,0xe3,0xad)); // nw-ne-neh-nwh + addTriangle(new Triangle(lctr+neh,lctr+seh,lctr+ne,0xf1,0xe3,0xad)); addTriangle(new Triangle(lctr+seh,lctr+se,lctr+ne,0xf1,0xe3,0xad)); // ne-se-seh-neh + addTriangle(new Triangle(lctr+seh,lctr+swh,lctr+se,0xf1,0xe3,0xad)); addTriangle(new Triangle(lctr+swh,lctr+sw,lctr+se,0xf1,0xe3,0xad)); // se-sw-swh-seh + addTriangle(new Triangle(lctr+swh,lctr+nwh,lctr+sw,0xf1,0xe3,0xad)); addTriangle(new Triangle(lctr+nwh,lctr+nw,lctr+sw,0xf1,0xe3,0xad)); // sw-nw-nwh-swh + addTriangle(new Triangle(lctr+nwh,lctr+neh,lctr+nw,0xf1,0xe3,0xad)); addTriangle(new Triangle(lctr+neh,lctr+ne,lctr+nw,0xf1,0xe3,0xad)); // nw-ne-neh-nwh // 1 Toit - addTriangle(new Triangle(neh,toit,seh,0x9a,0x48,0x3c)); - addTriangle(new Triangle(seh,toit,swh,0x9a,0x48,0x3c)); - addTriangle(new Triangle(swh,toit,nwh,0x9a,0x48,0x3c)); - addTriangle(new Triangle(nwh,toit,neh,0x9a,0x48,0x3c)); + addTriangle(new Triangle(lctr+neh,lctr+toit,lctr+seh,0x9a,0x48,0x3c)); + addTriangle(new Triangle(lctr+seh,lctr+toit,lctr+swh,0x9a,0x48,0x3c)); + addTriangle(new Triangle(lctr+swh,lctr+toit,lctr+nwh,0x9a,0x48,0x3c)); + addTriangle(new Triangle(lctr+nwh,lctr+toit,lctr+neh,0x9a,0x48,0x3c)); }