Version acceptable pourl es toits.
This commit is contained in:
parent
8c844607e8
commit
876fe13a48
|
@ -35,7 +35,7 @@ public:
|
||||||
static const unsigned int largeurRoute = 200;
|
static const unsigned int largeurRoute = 200;
|
||||||
static const unsigned int largeurTrottoir = 140;
|
static const unsigned int largeurTrottoir = 140;
|
||||||
static const unsigned int hauteurEtage = 300;
|
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 hauteurTrottoir = 20;
|
||||||
static const unsigned int hauteurMaxBatiment = hauteurTrottoir + hauteurEtage + hauteurToit;
|
static const unsigned int hauteurMaxBatiment = hauteurTrottoir + hauteurEtage + hauteurToit;
|
||||||
};
|
};
|
||||||
|
|
|
@ -15,7 +15,7 @@ void ToitQuad::triangulation() {
|
||||||
switch (hash2(seed, -1) % 4) {
|
switch (hash2(seed, -1) % 4) {
|
||||||
case 0: pointCentral(); break;
|
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.
|
// 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 2: deuxPointsVerticaux(); break;
|
||||||
case 3:
|
case 3:
|
||||||
default: plat(); break;
|
default: plat(); break;
|
||||||
|
@ -33,8 +33,16 @@ void ToitQuad::deuxPoints() {
|
||||||
// Orienter c dans le sens de la longueur d'est en ouest.
|
// Orienter c dans le sens de la longueur d'est en ouest.
|
||||||
Quad q = c >> ((c.maxLengthNS() > c.maxLengthEW()) ? 1 : 0);
|
Quad q = c >> ((c.maxLengthNS() > c.maxLengthEW()) ? 1 : 0);
|
||||||
Quad qh = q.offsetNormal(height);
|
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 centerE = Segment(e,w).randomPos(seed, 2, 0.6f, 0.8f);
|
||||||
Vertex centerW = Segment(e,w).randomPos(seed, 2, 0.2f, 0.4f);
|
Vertex centerW = Segment(e,w).randomPos(seed, 2, 0.2f, 0.4f);
|
||||||
addGPUTriangle(q[SE], centerE, q[NE], Couleurs::toit);
|
addGPUTriangle(q[SE], centerE, q[NE], Couleurs::toit);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user