www

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

commit 9821466311bba8d20edc78a8dbf8dd88d409cb79
parent 5092f6271dc809ea093c4166c1dd076ac37ada1e
Author: Yoann <yoann.b87@voila.fr>
Date:   Wed, 21 Dec 2011 14:15:14 +0100

Premier éléments des maison avec pont.

Diffstat:
Mall_includes.hh | 1+
Mmain.cpp | 2+-
Mrules/batiment/batimentquad.cpp | 23+++--------------------
Mrules/chose.cpp | 12++++++------
4 files changed, 11 insertions(+), 27 deletions(-)

diff --git a/all_includes.hh b/all_includes.hh @@ -33,6 +33,7 @@ class Chose; #include "rules/batiment/batimentquadmaison.hh" #include "rules/batiment/batimentquadjardin.hh" #include "rules/batiment/batimentquadpont.hh" +#include "rules/batiment/batimentquadmaisonpont.hh" #include "rules/quartier/quartierquad.hh" #include "rules/quartier/quartierquadangle.hh" diff --git a/main.cpp b/main.cpp @@ -26,7 +26,7 @@ int main() { Vertex se(size, 0, 0); Vertex sw(0, 0, 0); Vertex nw(0, size, 0); - //Chose::initialSeed = 1440907084; + Chose::initialSeed = 1889676033; Chose* c = QuartierQuad::factory(Chose::initialSeed, 0, ne, se, sw, nw); // c->split(); recursiveSubdivide(c); diff --git a/rules/batiment/batimentquad.cpp b/rules/batiment/batimentquad.cpp @@ -44,7 +44,7 @@ Chose* BatimentQuad::factory(int seed, int n, Vertex ne, Vertex se, Vertex sw, V if(rand <= 2) { Quad q = Quad(ne,se,sw,nw).makeParallelogram(); - addChild(new BatimentQuadPont(lctr+q.corner[0],lctr+q.corner[1],lctr+q.corner[2],lctr+q.corner[3],300)); + addChild(new BatimentQuadMaisonPont(lctr+q.corner[0],lctr+q.corner[1],lctr+q.corner[2],lctr+q.corner[3],600)); } else if(rand <= 15) { int th = 20; // Terrain height. @@ -80,30 +80,13 @@ Chose* BatimentQuad::factory(int seed, int n, Vertex ne, Vertex se, Vertex sw, V void BatimentQuad::triangulation() { triangles.reserve(12); - //addTriangle(new Triangle(lctr+ne,lctr+nw,lctr+sw,0xFF,0xFF,0x00)); - //addTriangle(new Triangle(lctr+sw,lctr+se,lctr+ne,0xFF,0xFF,0x00)); - int h = hashInRange(seed,0,minHeight,maxHeight); - //int htoit = hashInRange(seed,0,minHeight/2,maxHeight/2); + int htoit = hashInRange(seed,0,minHeight/2,maxHeight/2); + h += htoit; Vertex neh = ne + Vertex(0,0,h); Vertex seh = se + Vertex(0,0,h); Vertex nwh = nw + Vertex(0,0,h); Vertex swh = sw + Vertex(0,0,h); - //Vertex toit = (neh + seh + nwh + swh) / 4 + Vertex(0,0,htoit); addOcto(lctr+ne,lctr+se,lctr+sw,lctr+nw,lctr+neh,lctr+seh,lctr+swh,lctr+nwh,0xFF,0xFF,0x00); - -/* - // 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 - - // 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)); -*/ } diff --git a/rules/chose.cpp b/rules/chose.cpp @@ -28,12 +28,12 @@ void Chose::addQuad(Vertex u, Vertex v, Vertex w, Vertex x, char r, char g, char void Chose::addOcto(Vertex a, Vertex b, Vertex c, Vertex d, Vertex e, Vertex f, Vertex g, Vertex h, char red, char green, char blue) { - this->addQuad(d,c,b,a,red,green,blue); - this->addQuad(d,h,g,c,red,green,blue); - this->addQuad(c,g,f,b,red,green,blue); - this->addQuad(b,f,e,a,red,green,blue); - this->addQuad(a,e,h,d,red,green,blue); - this->addQuad(h,g,f,e,red,green,blue); + this->addQuad(a,b,c,d,red,green,blue); + this->addQuad(e,f,g,h,red,green,blue); + this->addQuad(b,a,e,f,red,green,blue); + this->addQuad(c,b,f,g,red,green,blue); + this->addQuad(d,c,g,h,red,green,blue); + this->addQuad(a,d,h,e,red,green,blue); } void Chose::display() {