www

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

commit 876fe13a489df0a9f2e2c488523d778fbd085cf4
parent 8c844607e8209dd70f1f69d5bffe5b002bd212c4
Author: Yoann <yoann.b87@voila.fr>
Date:   Wed, 18 Jan 2012 15:09:57 +0100

Version acceptable pourl es toits.

Diffstat:
Mrules/architecture/couleursDimensions.hh | 2+-
Mrules/architecture/toit.cpp | 14+++++++++++---
Mview.cpp | 2+-
3 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/rules/architecture/couleursDimensions.hh b/rules/architecture/couleursDimensions.hh @@ -35,7 +35,7 @@ public: static const unsigned int largeurRoute = 200; static const unsigned int largeurTrottoir = 140; static const unsigned int hauteurEtage = 300; - static const unsigned int hauteurToit = 200 * 10; + static const unsigned int hauteurToit = 200; static const unsigned int hauteurTrottoir = 20; static const unsigned int hauteurMaxBatiment = hauteurTrottoir + hauteurEtage + hauteurToit; }; diff --git a/rules/architecture/toit.cpp b/rules/architecture/toit.cpp @@ -15,7 +15,7 @@ void ToitQuad::triangulation() { switch (hash2(seed, -1) % 4) { case 0: pointCentral(); break; // TODO : deuxPoints() et deuxPointsVerticaux() ne génèrent pas des quad où les 4 points sont sur le même plan. - case 1: deuxPointsVerticaux(); break; + case 1: deuxPoints(); break; case 2: deuxPointsVerticaux(); break; case 3: default: plat(); break; @@ -33,8 +33,16 @@ void ToitQuad::deuxPoints() { // Orienter c dans le sens de la longueur d'est en ouest. Quad q = c >> ((c.maxLengthNS() > c.maxLengthEW()) ? 1 : 0); Quad qh = q.offsetNormal(height); - Vertex w = Segment(qh[NW], qh[SW]).randomPos(seed, 0, 1.f/3.f, 2.f/3.f); - Vertex e = Segment(qh[NE], qh[SE]).randomPos(seed, 1, 1.f/3.f, 2.f/3.f); + + float coef = height / Segment(q[NW],q[SW]).length(); + float eLength = Segment(q[NE],q[SE]).length(); + qh[NE] = q[NE] + Vertex(qh[NE]-q[NE]).setNorm(coef*eLength); + qh[SE] = q[SE] + Vertex(qh[SE]-q[SE]).setNorm(coef*eLength); + + //Vertex w = Segment(qh[NW], qh[SW]).randomPos(seed, 0, 1.f/3.f, 2.f/3.f); + //Vertex e = Segment(qh[NE], qh[SE]).randomPos(seed, 1, 1.f/3.f, 2.f/3.f); + Vertex w = qh[SW] + Vertex(qh[NW] - qh[SW])/2; + Vertex e = qh[SE] + Vertex(qh[NE] - qh[SE])/2; Vertex centerE = Segment(e,w).randomPos(seed, 2, 0.6f, 0.8f); Vertex centerW = Segment(e,w).randomPos(seed, 2, 0.2f, 0.4f); addGPUTriangle(q[SE], centerE, q[NE], Couleurs::toit); diff --git a/view.cpp b/view.cpp @@ -147,7 +147,7 @@ void View::renderScene(int lastTime, int currentTime) { lod.setCamera(camera.cameraCenter); setLight(); - //setSkybox(); + setSkybox(); glBegin(GL_TRIANGLES); root->display();