www

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

commit cdb5dd06979e8bdbcfa2b366cd0ad17300da94a7
parent 831d9e36209d56e875f6be198115917b5c68ba9d
Author: Yoann <yoann.b87@voila.fr>
Date:   Wed, 21 Dec 2011 15:59:54 +0100

Dessin pour la maison avec pont sans details.

Diffstat:
Mrules/batiment/batimentquad.cpp | 2+-
Mrules/batiment/batimentquadmaisonpont.cpp | 18++++++++++++++++++
2 files changed, 19 insertions(+), 1 deletion(-)

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 BatimentQuadMaisonPont(lctr+q.corner[0],lctr+q.corner[1],lctr+q.corner[2],lctr+q.corner[3],600)); + addChild(new BatimentQuadMaisonPont(lctr+q.corner[0],lctr+q.corner[1],lctr+q.corner[2],lctr+q.corner[3],800)); } else if(rand <= 15) { int th = 20; // Terrain height. diff --git a/rules/batiment/batimentquadmaisonpont.cpp b/rules/batiment/batimentquadmaisonpont.cpp @@ -27,6 +27,7 @@ std::vector<Vertex*> BatimentQuadMaisonPont::getBoundingBoxPoints() const { } bool BatimentQuadMaisonPont::split() { +/* Quad q = Quad(ne,se,sw,nw); q.makeParallelogram(); if(Segment(q.corner[0],q.corner[3]).length() < Segment(q.corner[0],q.corner[1]).length()) @@ -69,6 +70,7 @@ bool BatimentQuadMaisonPont::split() { ne = lctr+qc.corner[3]; addChild(new BatimentQuadPont(se,sw,nw,ne,partHeight)); +*/ return true; } @@ -82,5 +84,21 @@ bool BatimentQuadMaisonPont::merge() { void BatimentQuadMaisonPont::triangulation() { //triangles.reserve(2); + float h = 2.5*height/3.; + Vertex seh = se + Vertex(0,0,h); + Vertex swh = sw + Vertex(0,0,h); + Vertex nwh = nw + Vertex(0,0,h); + Vertex neh = ne + Vertex(0,0,h); + + addOcto(ne,se,sw,nw,neh,seh,swh,nwh,0xDD,0xDD,0xDD); + + 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)); + + addQuad(neh,nwh,cw,ce,0xE0,0x20,0x00); + addQuad(swh,seh,ce,cw,0xE0,0x20,0x00); }