diff --git a/rules/architecture/couleursDimensions.hh b/rules/architecture/couleursDimensions.hh index 433ff40..06e7c56 100644 --- 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 index 597251d..a18c119 100644 --- 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 index c3e197c..7b7cad8 100644 --- 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();