Quelques modification sur les maison avec passages. Ajout d'un surface
de remplissage de l'espace libre au sol.
This commit is contained in:
parent
aa02d7010d
commit
7778e77386
|
@ -29,11 +29,13 @@ void BatimentQuad::getBoundingBoxPoints() {
|
|||
bool BatimentQuad::split() {
|
||||
int rand = this->seed % 20; // TODO : utiliser les fonctions random in range & co.
|
||||
|
||||
if(rand <= 2) {
|
||||
Quad q = Quad(c[NE],c[SE],c[SW],c[NW]).makeParallelogram();
|
||||
if(rand <= 1) {
|
||||
Quad q = Quad(c[NE],c[SE],c[SW],c[NW]);
|
||||
// TODO ajouter une classe surface.
|
||||
//addQuad(c[SE],c[SW],c[NW],c[NE],0xDD,0xDD,0xDD);
|
||||
addChild(new BatimentQuadMaisonPont(q.corner[0],q.corner[1],q.corner[2],q.corner[3],800));
|
||||
}
|
||||
else if(rand <= 15) {
|
||||
else {
|
||||
int th = 20; // Terrain height.
|
||||
Quad q = Quad(c[NE],c[SE],c[SW],c[NW]);
|
||||
th = th;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "all_includes.hh"
|
||||
|
||||
BatimentQuadMaisonBlock::BatimentQuadMaisonBlock(Vertex ne, Vertex se, Vertex sw, Vertex nw, int height) : Chose() {
|
||||
BatimentQuadBlock::BatimentQuadBlock(Vertex ne, Vertex se, Vertex sw, Vertex nw, int height) : Chose() {
|
||||
addEntropy(ne, se, sw, nw);
|
||||
lctr = Vertex(ne.x-nw.x,se.y-ne.y,0.0f);
|
||||
c[NE] = ne;
|
||||
|
@ -10,12 +10,12 @@ BatimentQuadMaisonBlock::BatimentQuadMaisonBlock(Vertex ne, Vertex se, Vertex sw
|
|||
this->height = height;
|
||||
}
|
||||
|
||||
BatimentQuadMaisonBlock::~BatimentQuadMaisonBlock() {
|
||||
BatimentQuadBlock::~BatimentQuadBlock() {
|
||||
children.clear();
|
||||
triangles.clear();
|
||||
}
|
||||
|
||||
void BatimentQuadMaisonBlock::getBoundingBoxPoints() {
|
||||
void BatimentQuadBlock::getBoundingBoxPoints() {
|
||||
addBBPoint(c[NE]);
|
||||
addBBPoint(c[SE]);
|
||||
addBBPoint(c[SW]);
|
||||
|
@ -26,11 +26,11 @@ void BatimentQuadMaisonBlock::getBoundingBoxPoints() {
|
|||
addBBPoint(c[NW] + Vertex(0,0,height));// TODO
|
||||
}
|
||||
|
||||
bool BatimentQuadMaisonBlock::split() {
|
||||
bool BatimentQuadBlock::split() {
|
||||
return false;
|
||||
}
|
||||
|
||||
void BatimentQuadMaisonBlock::triangulation() {
|
||||
void BatimentQuadBlock::triangulation() {
|
||||
//triangles.reserve(2);
|
||||
Vertex seh = c[SE] + Vertex(0,0,height);
|
||||
Vertex swh = c[SW] + Vertex(0,0,height);
|
||||
|
|
|
@ -4,15 +4,15 @@
|
|||
#include "all_includes.hh"
|
||||
|
||||
// RectangleRoutes est un quadrilatère de routes avec des angles aux coins égaux à 90°.
|
||||
class BatimentQuadMaisonBlock : public Chose {
|
||||
class BatimentQuadBlock : public Chose {
|
||||
private :
|
||||
Vertex c[4];
|
||||
int height;
|
||||
|
||||
public :
|
||||
|
||||
BatimentQuadMaisonBlock(Vertex ne, Vertex se, Vertex sw, Vertex nw, int height);
|
||||
virtual ~BatimentQuadMaisonBlock();
|
||||
BatimentQuadBlock(Vertex ne, Vertex se, Vertex sw, Vertex nw, int height);
|
||||
virtual ~BatimentQuadBlock();
|
||||
virtual bool split();
|
||||
virtual void triangulation();
|
||||
Chose* factory(int seed, int n, Vertex ne, Vertex se, Vertex sw, Vertex nw);
|
||||
|
|
|
@ -46,21 +46,22 @@ bool BatimentQuadMaisonPont::split() {
|
|||
Vertex nw = qa.corner[2];
|
||||
Vertex ne = qa.corner[3];
|
||||
|
||||
addChild(new BatimentQuadMaisonBlock(ne,se,sw,nw,partHeight));
|
||||
addChild(new BatimentQuadJardin(c[SE],c[SW],c[NW],c[NE]));
|
||||
addChild(new BatimentQuadBlock(ne,se,sw,nw,partHeight));
|
||||
|
||||
se = qb.corner[0];
|
||||
sw = qb.corner[1];
|
||||
nw = qb.corner[2];
|
||||
ne = qb.corner[3];
|
||||
|
||||
addChild(new BatimentQuadMaisonBlock(ne,se,sw,nw,partHeight));
|
||||
addChild(new BatimentQuadBlock(ne,se,sw,nw,partHeight));
|
||||
|
||||
se = qh.corner[0] + Vertex(0,0,partHeight);
|
||||
sw = qh.corner[1] + Vertex(0,0,partHeight);
|
||||
nw = qh.corner[2] + Vertex(0,0,partHeight);
|
||||
ne = qh.corner[3] + Vertex(0,0,partHeight);
|
||||
|
||||
addChild(new BatimentQuadMaisonBlock(ne,se,sw,nw,partHeight));
|
||||
addChild(new BatimentQuadBlock(ne,se,sw,nw,partHeight));
|
||||
|
||||
se = qc.corner[0];
|
||||
sw = qc.corner[1];
|
||||
|
@ -89,12 +90,14 @@ bool BatimentQuadMaisonPont::split() {
|
|||
void BatimentQuadMaisonPont::triangulation() {
|
||||
//triangles.reserve(2);
|
||||
float h = 2.5*height/3.;
|
||||
Vertex seh = c[SE] + Vertex(0,0,h);
|
||||
Vertex swh = c[SW] + Vertex(0,0,h);
|
||||
Vertex nwh = c[NW] + Vertex(0,0,h);
|
||||
Vertex neh = c[NE] + Vertex(0,0,h);
|
||||
Quad q = Quad(c[NE],c[SE],c[SW],c[NW]).makeParallelogram();
|
||||
Vertex seh = q.corner[SE] + Vertex(0,0,h);
|
||||
Vertex swh = q.corner[SW] + Vertex(0,0,h);
|
||||
Vertex nwh = q.corner[NW] + Vertex(0,0,h);
|
||||
Vertex neh = q.corner[NE] + Vertex(0,0,h);
|
||||
|
||||
addOcto(c[NE],c[SE],c[SW],c[NW],neh,seh,swh,nwh,0xDD,0xDD,0xDD);
|
||||
addQuad(c[SE],c[SW],c[NW],c[NE],0xDD,0xDD,0xDD);
|
||||
addOcto(q.corner[NE],q.corner[SE],q.corner[SW],q.corner[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.);
|
||||
|
|
Loading…
Reference in New Issue
Block a user