Merge branch 'master' of github:jsmaniac/2011-m2s3-city-builder

Conflicts:
	geometry/quad.hh
This commit is contained in:
Georges Dupéron 2012-01-06 20:30:10 +01:00
commit ea5cc15c7e
4 changed files with 26 additions and 0 deletions

View File

@ -54,6 +54,19 @@ Quad Quad::makeParallelogram() {
return Quad(c[0],c[1],c[2],c[3]);
}
float Quad::length(Cardinal cn) {
if(cn == N)
return Segment(c[NW],c[NE]).length();
else if(cn == S)
return Segment(c[SW],c[SE]).length();
else if(cn == E)
return Segment(c[NE],c[SE]).length();
else if(cn == W)
return Segment(c[SW],c[NW]).length();
return 0;
}
float Quad::minLengthNS() {
return std::min(
Segment(c[NW],c[NE]).length(),

View File

@ -27,6 +27,7 @@ class Quad {
Quad inset(Cardinal side, float offset) const;
Quad insetNESW(float offsetN, float offsetE, float offsetS, float offsetW) const;
Quad insetNESW(float offset) const;
float length(Cardinal c);
float minLengthNS();
float minLengthEW();
float maxLengthNS();

View File

@ -9,6 +9,17 @@ void BatimentQuadBlock::getBoundingBoxPoints() {
addBBPoints(c + Vertex(0,0,height)); // TODO
}
bool BatimentQuadBlock::split() {
Quad me = c;
Quad ms = c;
Quad mw = c;
Quad mn = c;
me[NW] = me[NE] + ((me[NW] - me[NW]) / me.length(N))*150;
//TODO les autres côtés.
return false;
}
void BatimentQuadBlock::triangulation() {
addGPUOcto(c, c + Vertex(0,0,height), 0xF1, 0xE0, 0xE0);
}

View File

@ -11,6 +11,7 @@ class BatimentQuadBlock : public Chose {
public :
BatimentQuadBlock(Quad c, int height);
virtual bool split();
virtual void triangulation();
virtual void getBoundingBoxPoints();
};