Mise à l'échelle de certains batiments.
This commit is contained in:
parent
40bb9aea8d
commit
c426c3bb3a
2
main.cpp
2
main.cpp
|
@ -5,7 +5,7 @@
|
|||
int main() {
|
||||
// Générer une tile de base
|
||||
std::cout << "Initial seed = " << Chose::initialSeed << std::endl;
|
||||
float size = 20000;
|
||||
float size = 22000;
|
||||
Vertex ne(size, size, 0);
|
||||
Vertex se(size, 0, 0);
|
||||
Vertex sw(0, 0, 0);
|
||||
|
|
|
@ -204,7 +204,7 @@ void QuartierTri::trapeze() {
|
|||
|
||||
void QuartierTri::batiments() {
|
||||
return;
|
||||
float hauteurTrottoir = 20; // TODO : factoriser + ajouter ça à la hauteur max d'un bâtiment dans les autres calculs.
|
||||
float hauteurTrottoir = 14; // TODO : factoriser + ajouter ça à la hauteur max d'un bâtiment dans les autres calculs.
|
||||
Triangle ttrottoir = c.insetLTR(250);
|
||||
Triangle tinterieur = ttrottoir.insetLTR(140);
|
||||
Triangle tbatiments = tinterieur.offsetNormal(hauteurTrottoir);
|
||||
|
|
|
@ -11,7 +11,7 @@ void BatimentQuad::getBoundingBoxPoints() {
|
|||
|
||||
bool BatimentQuad::split() {
|
||||
if(proba(seed, 0, 1, 10)) {
|
||||
addChild(new BatimentQuadMaisonPont(c,800));
|
||||
addChild(new BatimentQuadMaisonPont(c,3));
|
||||
} else {
|
||||
addChild(new BatimentQuadJardin(c));
|
||||
|
||||
|
|
|
@ -9,8 +9,8 @@ class BatimentQuadMaison : public Chose {
|
|||
Quad c;
|
||||
|
||||
public :
|
||||
static const int minHeight = 400;
|
||||
static const int maxHeight = 800;
|
||||
static const int minHeight = 250;
|
||||
static const int maxHeight = 350;
|
||||
|
||||
BatimentQuadMaison(Quad c);
|
||||
virtual void triangulation();
|
||||
|
|
|
@ -1,45 +1,48 @@
|
|||
#include "all_includes.hh"
|
||||
|
||||
BatimentQuadMaisonPont::BatimentQuadMaisonPont(Quad _c, float _height) : Chose(), c(_c), height(_height) {
|
||||
BatimentQuadMaisonPont::BatimentQuadMaisonPont(Quad _c, int level) : Chose(), c(_c), level(level) {
|
||||
addEntropy(c);
|
||||
levelHeight = 300;
|
||||
}
|
||||
|
||||
void BatimentQuadMaisonPont::getBoundingBoxPoints() {
|
||||
addBBPoints(c);
|
||||
addBBPoints(c + Vertex(0,0,height)); // TODO
|
||||
addBBPoints(c + Vertex(10,10,level*levelHeight)); // TODO
|
||||
}
|
||||
|
||||
bool BatimentQuadMaisonPont::split() {
|
||||
int ih;
|
||||
Quad q = c.makeParallelogram();
|
||||
if(Segment(q[NE],q[NW]).length() < Segment(q[NE],q[SE]).length())
|
||||
q = q << 1;
|
||||
float partLength = Segment(q[NE],q[NW]).length() / 3;
|
||||
float partHeight = 2.5f * height / 3.f;
|
||||
Quad qa = q.inset(E,2*partLength);
|
||||
Quad qb = q.inset(W,2*partLength);
|
||||
Quad qc = q.inset(E, partLength).inset(W, partLength);
|
||||
Quad qh = q;
|
||||
|
||||
addChild(new BatimentQuadJardin(c));
|
||||
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),160));
|
||||
addChild(new BatimentQuadBlock(qa,qa + Vertex(0,0,levelHeight)));
|
||||
addChild(new BatimentQuadBlock(qb,qb + Vertex(0,0,levelHeight)));
|
||||
for(ih=1;ih<level;ih++)
|
||||
addChild(new BatimentQuadBlock((qh + Vertex(0,0,ih*levelHeight)),qh + Vertex(0,0,(ih+1)*levelHeight)));
|
||||
//addChild(new BatimentQuadPont(qc,levelHeight));
|
||||
addChild(new BatimentQuadToit(qh + Vertex(0,0,(ih+1)*levelHeight),160));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void BatimentQuadMaisonPont::triangulation() {
|
||||
float h = 2.5f * height / 3.f;
|
||||
float h = level*levelHeight / 3.f;
|
||||
Quad q = c.makeParallelogram();
|
||||
Quad qh = q + Vertex(0,0,h);
|
||||
float htoit = Segment(q[SE],q[NE]).length() / 5;
|
||||
|
||||
addGPUQuad(c,0x808080);
|
||||
addGPUOcto(q,qh,Couleurs::mur);
|
||||
|
||||
Vertex ce = qh[SE] + (qh[NE] - qh[SE])/2 + Vertex(0,0,0.5f * height / 3.f);
|
||||
Vertex cw = qh[SW] + (qh[NW] - qh[SW])/2 + Vertex(0,0,0.5f * height / 3.f);
|
||||
Vertex ce = qh[SE] + (qh[NE] - qh[SE])/2 + Vertex(0,0,htoit);
|
||||
Vertex cw = qh[SW] + (qh[NW] - qh[SW])/2 + Vertex(0,0,htoit);
|
||||
|
||||
addGPUTriangle(qh[NW],cw,qh[SW],Couleurs::mur);
|
||||
addGPUTriangle(qh[SE],ce,qh[NE],Couleurs::mur);
|
||||
|
|
|
@ -7,11 +7,12 @@
|
|||
class BatimentQuadMaisonPont: public Chose {
|
||||
private :
|
||||
Quad c;
|
||||
float height;
|
||||
int level;
|
||||
float levelHeight;
|
||||
|
||||
public :
|
||||
|
||||
BatimentQuadMaisonPont(Quad c, float height);
|
||||
BatimentQuadMaisonPont(Quad c, int level);
|
||||
virtual bool split();
|
||||
virtual void triangulation();
|
||||
virtual void getBoundingBoxPoints();
|
||||
|
|
|
@ -17,7 +17,7 @@ void BatimentQuadMur::setWindow(bool val) {
|
|||
Quad q = Quad(ch[NE],c[NE],c[NW],ch[NW]);
|
||||
int lr = (q.length(S) - 120)/2;
|
||||
|
||||
Quad wFront = q.insetNESW(90,lr,120,lr);
|
||||
Quad wFront = q.insetNESW(40,lr,120,lr);
|
||||
Quad wBack = wFront.offsetNormal(28);
|
||||
windowPos = Quad(wFront[SE],wBack[SE],wBack[SW],wFront[SW]);
|
||||
windowPosh = Quad(wFront[NE],wBack[NE],wBack[NW],wFront[NW]);
|
||||
|
|
Loading…
Reference in New Issue
Block a user