2011-m2s3-city-builder/rules/quartier/quartiertri.cpp
2012-01-08 22:54:34 +01:00

34 lines
724 B
C++

#include "all_includes.hh"
QuartierTri::QuartierTri(Triangle c) : Chose(), c(c) {
addEntropy(c);
}
void QuartierTri::getBoundingBoxPoints() {
addBBPoints(c);
addBBPoints(c + Vertex(0,0,1000)); // TODO
}
Chose* QuartierTri::factory(int seed, int n, Triangle c) {
bool small = c.minLength() < 2500;
bool big = c.maxLength() >= 5000;
if (small && !big) {
return new BatimentTri(c);
} else if (!small && proba(seed, n, 1, 2)) {
return new QuartierTriHauteur(c);
} else if (!small) {
return new QuartierTriTrapeze(c);
} else {
return new TerrainTriHerbe(c);
}
}
bool QuartierTri::split() {
return false;
}
void QuartierTri::triangulation() {
triangles.reserve(1);
addGPUTriangle(c, 0xf0, 0xc0, 0xc0);
}