Ajout de la fonction de split sur les maison avec la division en block.
Rectification de la division des blocks en mors. Amélioration des toits.
This commit is contained in:
parent
62197c4e2b
commit
474ab3e706
|
@ -36,5 +36,5 @@ void BatimentQuad::triangulation() {
|
|||
float h = floatInRange(seed,1,minHeight,maxHeight);
|
||||
float htoit = floatInRange(seed,2,minHeight/2,maxHeight/2);
|
||||
|
||||
addGPUOcto(c, c + Vertex(0,0,h + htoit), 0xFF, 0xFF, 0x00);
|
||||
addGPUOcto(c, c + Vertex(0,0,h + htoit), 0xFF, 0xFF, 0xFF);
|
||||
}
|
||||
|
|
|
@ -1,27 +1,32 @@
|
|||
#include "all_includes.hh"
|
||||
|
||||
BatimentQuadBlock::BatimentQuadBlock(Quad _c, float _height) : Chose(), c(_c), height(_height) {
|
||||
BatimentQuadBlock::BatimentQuadBlock(Quad _c, Quad _ch) : Chose(), c(_c), ch(_ch) {
|
||||
addEntropy(c);
|
||||
addEntropy(ch);
|
||||
}
|
||||
|
||||
void BatimentQuadBlock::getBoundingBoxPoints() {
|
||||
addBBPoints(c);
|
||||
addBBPoints(c + Vertex(0,0,height)); // TODO
|
||||
addBBPoints(ch);
|
||||
}
|
||||
|
||||
bool BatimentQuadBlock::split() {
|
||||
Quad me = c.insetOpp(E,28);
|
||||
Quad ms = c.inset(E,-28).inset(W,-28).insetOpp(S,28);
|
||||
Quad ms = c.inset(E,28).inset(W,28).insetOpp(S,28);
|
||||
Quad mw = c.insetOpp(W,28);
|
||||
Quad mn = c.inset(E,-28).inset(W,-28).insetOpp(N,28);
|
||||
Quad mn = c.inset(E,28).inset(W,28).insetOpp(N,28);
|
||||
Quad meh = ch.insetOpp(E,28);
|
||||
Quad msh = ch.inset(E,28).inset(W,28).insetOpp(S,28);
|
||||
Quad mwh = ch.insetOpp(W,28);
|
||||
Quad mnh = ch.inset(E,28).inset(W,28).insetOpp(N,28);
|
||||
|
||||
addChild(new BatimentQuadMur(me,height));
|
||||
addChild(new BatimentQuadMur(mw,height));
|
||||
addChild(new BatimentQuadMur(mn,height));
|
||||
addChild(new BatimentQuadMur(ms,height));
|
||||
addChild(new BatimentQuadMur(me,meh));
|
||||
addChild(new BatimentQuadMur(mw,mwh));
|
||||
addChild(new BatimentQuadMur(mn,mnh));
|
||||
addChild(new BatimentQuadMur(ms,msh));
|
||||
return true;
|
||||
}
|
||||
|
||||
void BatimentQuadBlock::triangulation() {
|
||||
addGPUOcto(c, c + Vertex(0,0,height), 0xF1, 0xE0, 0xE0);
|
||||
addGPUOcto(c,ch, 0xF1, 0xE0, 0xE0);
|
||||
}
|
||||
|
|
|
@ -7,10 +7,10 @@
|
|||
class BatimentQuadBlock : public Chose {
|
||||
private :
|
||||
Quad c;
|
||||
float height;
|
||||
Quad ch;
|
||||
|
||||
public :
|
||||
BatimentQuadBlock(Quad c, float height);
|
||||
BatimentQuadBlock(Quad c, Quad ch);
|
||||
virtual bool split();
|
||||
virtual void triangulation();
|
||||
virtual void getBoundingBoxPoints();
|
||||
|
|
|
@ -9,6 +9,17 @@ void BatimentQuadMaison::getBoundingBoxPoints() {
|
|||
addBBPoints(c + Vertex(0,0,maxHeight + maxHeight/2)); // TODO
|
||||
}
|
||||
|
||||
bool BatimentQuadMaison::split() {
|
||||
float h = floatInRange(seed,0,minHeight,maxHeight);
|
||||
float htoit = floatInRange(seed,0,minHeight/2,maxHeight/2);
|
||||
Quad ch = c + Vertex(0,0,h);
|
||||
Vertex toit = (ch[NE] + ch[SE] + ch[SW] + ch[NW]) / 4 + Vertex(0,0,htoit);
|
||||
|
||||
addChild(new BatimentQuadBlock(c,ch));
|
||||
addChild(new BatimentQuadToit(ch,1));
|
||||
return true;
|
||||
}
|
||||
|
||||
void BatimentQuadMaison::triangulation() {
|
||||
triangles.reserve(12);
|
||||
|
||||
|
@ -17,10 +28,9 @@ void BatimentQuadMaison::triangulation() {
|
|||
Quad ch = c + Vertex(0,0,h);
|
||||
Vertex toit = (ch[NE] + ch[SE] + ch[SW] + ch[NW]) / 4 + Vertex(0,0,htoit);
|
||||
|
||||
addGPUOcto(c,ch,0xf1,0xe3,0xad);
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
// Mur
|
||||
addGPUQuad(c[NE+i],c[SE+i],ch[SE+i],ch[NE+i],0xf1,0xe3,0xad);
|
||||
// Pan du toit
|
||||
addGPUTriangle(ch[SE+i],toit,ch[NE+i],0x96,0x16,0x18);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ class BatimentQuadMaison : public Chose {
|
|||
|
||||
BatimentQuadMaison(Quad c);
|
||||
virtual void triangulation();
|
||||
virtual bool split();
|
||||
virtual void getBoundingBoxPoints();
|
||||
};
|
||||
|
||||
|
|
|
@ -21,11 +21,11 @@ bool BatimentQuadMaisonPont::split() {
|
|||
Quad qh = q;
|
||||
|
||||
addChild(new BatimentQuadJardin(c));
|
||||
addChild(new BatimentQuadBlock(qa,partHeight));
|
||||
addChild(new BatimentQuadBlock(qb,partHeight));
|
||||
addChild(new BatimentQuadBlock((qh + Vertex(0,0,partHeight)),partHeight));
|
||||
addChild(new BatimentQuadBlock(qa,qa + Vertex(0,0,partHeight)));
|
||||
addChild(new BatimentQuadBlock(qb,qb + Vertex(0,0,partHeight)));
|
||||
addChild(new BatimentQuadBlock((qh + Vertex(0,0,partHeight)),qh + Vertex(0,0,2*partHeight)));
|
||||
addChild(new BatimentQuadPont(qc,partHeight));
|
||||
addChild(new BatimentQuadToit(qh + Vertex(0,0,2*partHeight),150));
|
||||
addChild(new BatimentQuadToit(qh + Vertex(0,0,2*partHeight),160));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
#include "all_includes.hh"
|
||||
|
||||
BatimentQuadMur::BatimentQuadMur(Quad _c, float _height) : Chose(), c(_c), height(_height) {
|
||||
BatimentQuadMur::BatimentQuadMur(Quad _c, Quad _ch) : Chose(), c(_c), ch(_ch) {
|
||||
addEntropy(c);
|
||||
addEntropy(ch);
|
||||
this->window = false;
|
||||
}
|
||||
|
||||
void BatimentQuadMur::getBoundingBoxPoints() {
|
||||
addBBPoints(c);
|
||||
addBBPoints(c + Vertex(0,0,height));
|
||||
addBBPoints(ch);
|
||||
}
|
||||
|
||||
void BatimentQuadMur::setWindow(Quad w) {
|
||||
|
@ -24,11 +25,11 @@ bool BatimentQuadMur::split() {
|
|||
Quad top = c;
|
||||
Quad bottom = c;
|
||||
|
||||
//addChild(BatimentQuadMur())
|
||||
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
void BatimentQuadMur::triangulation() {
|
||||
//addGPUOcto(c, c + Vertex(0,0,height), 0xF1, 0xE0, 0xE0);
|
||||
addGPUOcto(c, c + Vertex(0,0,height), 0x60, 0x60, 0xFF);
|
||||
addGPUOcto(c, ch, 0xf1,0xe3,0xad);
|
||||
}
|
||||
|
|
|
@ -6,13 +6,13 @@
|
|||
class BatimentQuadMur: public Chose {
|
||||
private :
|
||||
Quad c;
|
||||
float height;
|
||||
Quad ch;
|
||||
bool window; // Contient une fenêtre ou non.
|
||||
Quad windowPos;
|
||||
|
||||
public :
|
||||
|
||||
BatimentQuadMur(Quad c, float height);
|
||||
BatimentQuadMur(Quad c, Quad ch);
|
||||
virtual void triangulation();
|
||||
virtual bool split();
|
||||
virtual void getBoundingBoxPoints();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "all_includes.hh"
|
||||
|
||||
BatimentQuadToit::BatimentQuadToit(Quad _c, float _height) : Chose(), c(_c), height(_height) {
|
||||
BatimentQuadToit::BatimentQuadToit(Quad _c, int _type) : Chose(), c(_c), type(_type) {
|
||||
addEntropy(c);
|
||||
}
|
||||
|
||||
|
@ -10,12 +10,19 @@ void BatimentQuadToit::getBoundingBoxPoints() {
|
|||
}
|
||||
|
||||
void BatimentQuadToit::triangulation() {
|
||||
Vertex ce = c[SE] + (c[NE] - c[SE])/2 + Vertex(0,0,height / 3.f);
|
||||
Vertex cw = c[SW] + (c[NW] - c[SW])/2 + Vertex(0,0,height / 3.f);
|
||||
if(type == 1) {
|
||||
if(c.minLengthNS() < c.minLengthEW())
|
||||
c = c << 1;
|
||||
c = c.inset(S, -20).inset(S,-20);
|
||||
height = c.minLengthEW() / 5;
|
||||
Vertex ce = c[SE] + (c[NE] - c[SE])/2 + Vertex(0,0,height);
|
||||
Vertex cw = c[SW] + (c[NW] - c[SW])/2 + Vertex(0,0,height);
|
||||
|
||||
addGPUTriangle(c[NW],cw,c[SW],0xF1,0xE0,0xE0);
|
||||
addGPUTriangle(c[SE],ce,c[NE],0xF1,0xE0,0xE0);
|
||||
addGPUTriangle(c[NW],cw,c[SW],0xF1,0xE0,0xE0);
|
||||
addGPUTriangle(c[SE],ce,c[NE],0xF1,0xE0,0xE0);
|
||||
|
||||
addGPUQuad(c[NE],c[NW],cw,ce,0xE0,0x20,0x00);
|
||||
addGPUQuad(c[SW],c[SE],ce,cw,0xE0,0x20,0x00);
|
||||
addGPUQuad(c,0xF1,0xE0,0xE0);
|
||||
addGPUQuad(c[NE],c[NW],cw,ce,0xE0,0x20,0x00);
|
||||
addGPUQuad(c[SW],c[SE],ce,cw,0xE0,0x20,0x00);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,10 +8,11 @@ class BatimentQuadToit: public Chose {
|
|||
private :
|
||||
Quad c;
|
||||
float height;
|
||||
int type;
|
||||
|
||||
public :
|
||||
|
||||
BatimentQuadToit(Quad c, float height);
|
||||
BatimentQuadToit(Quad c, int type);
|
||||
virtual void triangulation();
|
||||
virtual void getBoundingBoxPoints();
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Block a user