mur.cpp (2787B)
1 #include "all_includes.hh" 2 3 MurQuad::MurQuad(Quad _c, Quad _ch, bool _window, bool _top, bool _bottom, bool _door) 4 : Chose(), c(_c), ch(_ch), window(_window), top(_top), bottom(_bottom), door(_door) { 5 addEntropy(c); 6 addEntropy(ch); 7 addEntropy((int)top); 8 addEntropy((int)bottom); 9 if(_window || _door) 10 setWindowOrDoor(); 11 } 12 13 void MurQuad::getBoundingBoxPoints() { 14 addBBPoints(c); 15 addBBPoints(ch); 16 } 17 18 void MurQuad::setWindowOrDoor() { 19 Quad q = Quad(ch[NE],c[NE],c[NW],ch[NW]); 20 float lr = (q.length(S) - 120)/2.f; 21 22 Quad wFront = q.insetNESW(40,lr,(window ? 120 : 0),lr); 23 Quad wBack = wFront.offsetNormal(28); 24 windowPos = Quad(wFront[SE],wBack[SE],wBack[SW],wFront[SW]); 25 windowPosh = Quad(wFront[NE],wBack[NE],wBack[NW],wFront[NW]); 26 } 27 28 void MurQuad::split() { 29 if(!(window || door)) 30 return; 31 32 float length = c.maxLengthNS(); 33 34 //if(length > 660) { 35 if(false) { 36 Quad qa = c.insetOpp(W,length/2); 37 Quad qb = c.insetOpp(E,length-(length/2)); 38 Quad qah = ch.insetOpp(W,length/2); 39 Quad qbh = ch.insetOpp(E,length-(length/2)); 40 41 addChild(new MurQuad(qa,qah,window)); 42 addChild(new MurQuad(qb,qbh,window)); 43 } else { 44 Quad right = Quad(windowPos[NW],windowPos[SW],c[SW],c[NW]); 45 Quad righth = Quad(windowPosh[NW],windowPosh[SW],ch[SW],ch[NW]); 46 Quad left = Quad(c[NE],c[SE],windowPos[SE],windowPos[NE]); 47 Quad lefth = Quad(ch[NE],ch[SE],windowPosh[SE],windowPosh[NE]); 48 ////Quad top = Quad(windowPosh[NE],windowPosh[NW],windowPosh[SW],windowPosh[SE]); // Started to work again on the project, a new warning detected this. 49 50 if (!door) addChild(new MurQuad(c,windowPos,false, true, false)); 51 addChild(new MurQuad(windowPosh,ch, false, false, true)); 52 addChild(new MurQuad(left,lefth,false)); 53 addChild(new MurQuad(right,righth,false)); 54 } 55 } 56 57 void MurQuad::triangulation() { 58 if (bottom) addGPUQuad(c, Couleurs::mur); 59 if (top) addGPUQuad(ch, Couleurs::mur); 60 addGPUFourQuads(c, ch, Couleurs::mur); 61 } 62 63 PlancherPlafond::PlancherPlafond(Quad _c, Type _type) : Chose(), c(_c), type(_type) { 64 addEntropy(c); 65 addEntropy((int)type); 66 } 67 68 void PlancherPlafond::triangulation() { 69 unsigned int clr = Couleurs::plancher; 70 if (type == PLAFOND) 71 clr = Couleurs::plafond; 72 addGPUQuad(c, clr); 73 } 74 75 void PlancherPlafond::getBoundingBoxPoints() { 76 addBBPoints(c); 77 } 78 79 PlancherPlafondTri::PlancherPlafondTri(Triangle _c, Type _type) : Chose(), c(_c), type(_type) { 80 addEntropy(c); 81 addEntropy((int)type); 82 } 83 84 void PlancherPlafondTri::triangulation() { 85 unsigned int clr = Couleurs::plancher; 86 if (type == PLAFOND) 87 clr = Couleurs::plafond; 88 addGPUTriangle(c, clr); 89 } 90 91 void PlancherPlafondTri::getBoundingBoxPoints() { 92 addBBPoints(c); 93 }