www

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

commit 714036fffbde8bd901510ef1f6a9a64d42456d5f
parent bd5459cf2fcc5a0e1b3c8a471c305dd5c62b23b1
Author: Yoann <yoann.b87@voila.fr>
Date:   Tue, 13 Dec 2011 12:27:46 +0100

Ajout du nez des marches.

Diffstat:
Mrules/batiment/batimentquad.cpp | 8++++----
Mrules/route/trottoirquadnormal.cpp | 51++++++++++++++++++++++++++++++++++++---------------
Mrules/route/trottoirquadnormal.hh | 3++-
3 files changed, 42 insertions(+), 20 deletions(-)

diff --git a/rules/batiment/batimentquad.cpp b/rules/batiment/batimentquad.cpp @@ -25,10 +25,10 @@ Chose* BatimentQuad::factory(int seed, int n, Vertex ne, Vertex se, Vertex sw, V q.offset(W,-140); addChild(new BatimentQuadMaison(q.corner[0],q.corner[1],q.corner[2],q.corner[3])); - addChild(new TrottoirQuadNormal(q.corner[0],ne,se,q.corner[1],20)); - addChild(new TrottoirQuadNormal(q.corner[1],se,sw,q.corner[2],20)); - addChild(new TrottoirQuadNormal(q.corner[2],sw,nw,q.corner[3],20)); - addChild(new TrottoirQuadNormal(q.corner[3],nw,ne,q.corner[0],20)); + addChild(new TrottoirQuadNormal(ne,se,q.corner[1],q.corner[0],20,E)); + addChild(new TrottoirQuadNormal(se,sw,q.corner[2],q.corner[1],20,E)); + addChild(new TrottoirQuadNormal(sw,nw,q.corner[3],q.corner[2],20,E)); + addChild(new TrottoirQuadNormal(nw,ne,q.corner[0],q.corner[3],20,E)); return NULL; // pour compilation, à virer. } diff --git a/rules/route/trottoirquadnormal.cpp b/rules/route/trottoirquadnormal.cpp @@ -1,11 +1,12 @@ #include "all_includes.hh" -TrottoirQuadNormal::TrottoirQuadNormal(Vertex ne, Vertex se, Vertex sw, Vertex nw, int height) { +TrottoirQuadNormal::TrottoirQuadNormal(Vertex ne, Vertex se, Vertex sw, Vertex nw, int height, Cardinal border) { this->ne = ne; this->nw = nw; this->se = se; this->sw = sw; this->height = height; + this->border = border; triangulation(); } @@ -15,18 +16,38 @@ bool TrottoirQuadNormal::subdivide() { } void TrottoirQuadNormal::triangulation() { - addTriangle(new Triangle(ne + Vertex(0,0,height), nw + Vertex(0,0,height) , sw + Vertex(0,0,height), 0x66, 0x66, 0x66)); - addTriangle(new Triangle(sw + Vertex(0,0,height), se + Vertex(0,0,height), ne + Vertex(0,0,height), 0x66, 0x66, 0x66)); - //addTriangle(new Triangle(ne + Vertex(0,0,height), nw + Vertex(0,0,height), sw + Vertex(0,0,height), 0x66, 0x66, 0x66)); - //addTriangle(new Triangle(sw + Vertex(0,0,height), se + Vertex(0,0,height), ne + Vertex(0,0,height), 0x66, 0x66, 0x66)); - - addTriangle(new Triangle(nw + Vertex(0,0,height), nw, sw, 0x66, 0x66, 0x66)); - addTriangle(new Triangle(sw, sw + Vertex(0,0,height), nw + Vertex(0,0,height), 0x66, 0x66, 0x66)); - addTriangle(new Triangle(ne, ne + Vertex(0,0,height), se + Vertex(0,0,height), 0x66, 0x66, 0x66)); - addTriangle(new Triangle(se + Vertex(0,0,height), se, ne, 0x66, 0x66, 0x66)); - - addTriangle(new Triangle(ne + Vertex(0,0,height), ne, nw, 0x66, 0x66, 0x66)); - addTriangle(new Triangle(nw, nw + Vertex(0,0,height), ne + Vertex(0,0,height), 0x66, 0x66, 0x66)); - addTriangle(new Triangle(sw, sw + Vertex(0,0,height), se + Vertex(0,0,height), 0x66, 0x66, 0x66)); - addTriangle(new Triangle(se + Vertex(0,0,height), se, sw, 0x66, 0x66, 0x66)); + Vertex tne, tnw, tse, tsw, bne, bnw, bse, bsw; + Quad q = Quad(ne,se,sw,nw); + + if(border == E) { + q.offset(E,-15); + addTriangle(new Triangle(q.corner[0] + Vertex(0,0,height), q.corner[3] + Vertex(0,0,height), q.corner[2] + Vertex(0,0,height), 0x66, 0x66, 0x66)); + addTriangle(new Triangle(q.corner[2] + Vertex(0,0,height), q.corner[1] + Vertex(0,0,height), q.corner[0] + Vertex(0,0,height), 0x66, 0x66, 0x66)); + addTriangle(new Triangle(ne + Vertex(0,0,height),q.corner[0] + Vertex(0,0,height), q.corner[1] + Vertex(0,0,height), 0xAA, 0xAA, 0xAA)); + addTriangle(new Triangle(q.corner[1] + Vertex(0,0,height), se + Vertex(0,0,height), ne + Vertex(0,0,height), 0xAA, 0xAA, 0xAA)); + + addTriangle(new Triangle(nw + Vertex(0,0,height), nw, sw, 0x66, 0x66, 0x66)); + addTriangle(new Triangle(sw, sw + Vertex(0,0,height), nw + Vertex(0,0,height), 0x66, 0x66, 0x66)); + addTriangle(new Triangle(ne, ne + Vertex(0,0,height), se + Vertex(0,0,height), 0xAA, 0xAA, 0xAA)); + addTriangle(new Triangle(se + Vertex(0,0,height), se, ne, 0xAA, 0xAA, 0xAA)); + + addTriangle(new Triangle(ne + Vertex(0,0,height), ne, nw, 0x66, 0x66, 0x66)); + addTriangle(new Triangle(nw, nw + Vertex(0,0,height), ne + Vertex(0,0,height), 0x66, 0x66, 0x66)); + addTriangle(new Triangle(sw, sw + Vertex(0,0,height), se + Vertex(0,0,height), 0x66, 0x66, 0x66)); + addTriangle(new Triangle(se + Vertex(0,0,height), se, sw, 0x66, 0x66, 0x66)); + } + else { + addTriangle(new Triangle(q.corner[0] + Vertex(0,0,height), q.corner[3] + Vertex(0,0,height), q.corner[2] + Vertex(0,0,height), 0x66, 0x66, 0x66)); + addTriangle(new Triangle(q.corner[2] + Vertex(0,0,height), q.corner[1] + Vertex(0,0,height), q.corner[0] + Vertex(0,0,height), 0x66, 0x66, 0x66)); + + addTriangle(new Triangle(nw + Vertex(0,0,height), nw, sw, 0x66, 0x66, 0x66)); + addTriangle(new Triangle(sw, sw + Vertex(0,0,height), nw + Vertex(0,0,height), 0x66, 0x66, 0x66)); + addTriangle(new Triangle(ne, ne + Vertex(0,0,height), se + Vertex(0,0,height), 0x66, 0x66, 0x66)); + addTriangle(new Triangle(se + Vertex(0,0,height), se, ne, 0x66, 0x66, 0x66)); + + addTriangle(new Triangle(ne + Vertex(0,0,height), ne, nw, 0x66, 0x66, 0x66)); + addTriangle(new Triangle(nw, nw + Vertex(0,0,height), ne + Vertex(0,0,height), 0x66, 0x66, 0x66)); + addTriangle(new Triangle(sw, sw + Vertex(0,0,height), se + Vertex(0,0,height), 0x66, 0x66, 0x66)); + addTriangle(new Triangle(se + Vertex(0,0,height), se, sw, 0x66, 0x66, 0x66)); + } } diff --git a/rules/route/trottoirquadnormal.hh b/rules/route/trottoirquadnormal.hh @@ -10,9 +10,10 @@ class TrottoirQuadNormal : public Chose { Vertex sw; Vertex nw; int height; + Cardinal border; public : - TrottoirQuadNormal(Vertex ne, Vertex se, Vertex sw, Vertex nw, int height); + TrottoirQuadNormal(Vertex ne, Vertex se, Vertex sw, Vertex nw, int height, Cardinal border); virtual bool subdivide(); virtual void triangulation(); };