Merge branch 'master' of github:jsmaniac/2011-m2s3-city-builder
This commit is contained in:
commit
4a69a391f6
|
@ -36,7 +36,7 @@ Vertex Vertex::setNorm(float n) const {
|
|||
|
||||
float Vertex::cosAngle(Vertex v) const {
|
||||
// http://www.developpez.net/forums/d202580/applications/developpement-2d-3d-jeux/contribuez/faq-mat-quat-ajout-calculs-vectoriels/
|
||||
return ((this->x*v.x + this->y*v.y) / (norm()*v.norm()));
|
||||
return ((this->x*v.x + this->y*v.y + this->z*v.z) / (norm()*v.norm()));
|
||||
}
|
||||
|
||||
float Vertex::angle(Vertex v) const {
|
||||
|
|
|
@ -24,7 +24,7 @@ bool BatimentQuadMaisonPont::split() {
|
|||
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 BatimentQuadPont(qc,partHeight));
|
||||
addChild(new BatimentQuadToit(qh + Vertex(0,0,2*partHeight),160));
|
||||
|
||||
return true;
|
||||
|
|
|
@ -13,18 +13,23 @@ void BatimentQuadMur::getBoundingBoxPoints() {
|
|||
|
||||
void BatimentQuadMur::setWindow(bool val) {
|
||||
val = val;
|
||||
/*this->window = val;
|
||||
this->window = val;
|
||||
Quad q = Quad(ch[SE],c[SE],c[SW],ch[SW]);
|
||||
int lr = (q.length(S) - 100)/40;
|
||||
std::cout << q.inset(E,60).surface() << std::endl;
|
||||
Quad wFront = q.insetNESW(40,100,lr,lr);
|
||||
int lr = (q.length(S) - 100)/2;
|
||||
|
||||
Quad wFront = q.insetNESW(40,lr,110,lr);
|
||||
Quad wBack = wFront.offsetNormal(28);
|
||||
windowPos = Quad(wBack[SE],wFront[SE],wFront[SW],wBack[SW]);
|
||||
windowPosh = Quad(wBack[NE],wFront[NE],wFront[NW],wBack[NW]);
|
||||
*/
|
||||
|
||||
//addGPUQuad(wFront,0xFF,0xFF,0x00);
|
||||
//addGPUQuad(wBack,0xFF,0xFF,0x00);
|
||||
//addGPUQuad(windowPos,0x90,0x90,0xFF);
|
||||
//addGPUQuad(windowPosh,0x90,0x90,0xFF);
|
||||
|
||||
//std::cout << "lr" << lr << std::endl;
|
||||
//std::cout << wFront[NE] << std::endl;
|
||||
//std::cout << q[SE] << std::endl;
|
||||
//std::cout << windowPos[NE] << std::endl;
|
||||
//std::cout << windowPos[SE] << std::endl;
|
||||
//std::cout << q[SW] << std::endl;
|
||||
//std::cout << q[NW] << std::endl << std::endl;
|
||||
}
|
||||
|
@ -33,15 +38,16 @@ bool BatimentQuadMur::split() {
|
|||
if(!window)
|
||||
return false;
|
||||
|
||||
Quad left = c;
|
||||
Quad right = c;
|
||||
Quad top = c;
|
||||
Quad bottom = c;
|
||||
Quad left = Quad(windowPos[NW],windowPos[SW],c[SW],c[NW]);
|
||||
Quad lefth = Quad(windowPosh[NW],windowPosh[SW],ch[SW],ch[NW]);
|
||||
Quad right = Quad(c[NE],c[SE],windowPos[SE],windowPos[NE]);
|
||||
Quad righth = Quad(ch[NE],ch[SE],windowPosh[SE],windowPosh[NE]);
|
||||
|
||||
|
||||
/*addChild(new BatimentQuadMur(c,windowPos));
|
||||
addChild(new BatimentQuadMur(c,windowPos));
|
||||
addChild(new BatimentQuadMur(windowPosh,ch));
|
||||
*/
|
||||
addChild(new BatimentQuadMur(left,lefth));
|
||||
addChild(new BatimentQuadMur(right,righth));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -49,5 +55,6 @@ void BatimentQuadMur::triangulation() {
|
|||
if(!window)
|
||||
addGPUOcto(c, ch, 0xf1,0xe3,0xad);
|
||||
else
|
||||
addGPUOcto(c, ch, 0xFF,0x10,0x00);
|
||||
//addGPUOcto(c, ch, 0xFF,0x10,0x00);
|
||||
addGPUQuad(windowPosh,0xFF,0xFF,0x00);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user