From 8dff16887ee344ad97fda09f763990a6933caaae Mon Sep 17 00:00:00 2001 From: Yoann Date: Mon, 9 Jan 2012 19:46:17 +0100 Subject: [PATCH 1/2] =?UTF-8?q?Transformation=20des=20block=20en=20six=20m?= =?UTF-8?q?urs=20ind=C3=A9pendants=20lors=20de=20du=20split.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rules/batiment/batimentquadblock.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/rules/batiment/batimentquadblock.cpp b/rules/batiment/batimentquadblock.cpp index d4608ad..2882bcd 100644 --- a/rules/batiment/batimentquadblock.cpp +++ b/rules/batiment/batimentquadblock.cpp @@ -15,9 +15,22 @@ bool BatimentQuadBlock::split() { 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; + me[NW] = me[NE] + ((me[NW] - me[NE]) / me.length(N))*28; + me[SW] = me[SE] + ((me[SW] - me[SE]) / me.length(S))*28; + mw[NE] = mw[NW] + ((mw[NE] - mw[NW]) / mw.length(N))*28; + mw[SE] = mw[SW] + ((mw[SE] - mw[SW]) / mw.length(S))*28; + mn.inset(W,-28); mn.inset(E,-28); + mn[SW] = mn[NW] + ((mn[SW] - mn[NW]) / mn.length(W))*28; + mn[SE] = mn[NE] + ((mn[SE] - mn[NE]) / mn.length(E))*28; + ms.inset(W,-28); ms.inset(E,-28); + ms[NW] = ms[SW] + ((ms[NW] - ms[SW]) / ms.length(W))*28; + ms[NE] = ms[SE] + ((ms[NE] - ms[SE]) / ms.length(E))*28; + + addChild(new BatimentQuadMur(me,height)); + addChild(new BatimentQuadMur(mw,height)); + addChild(new BatimentQuadMur(mn,height)); + addChild(new BatimentQuadMur(ms,height)); + return true; } void BatimentQuadBlock::triangulation() { From a8e6da67577ca16a6fd0efbc1ba35fcd201befe1 Mon Sep 17 00:00:00 2001 From: Yoann Date: Mon, 9 Jan 2012 20:35:41 +0100 Subject: [PATCH 2/2] =?UTF-8?q?D=C3=A9but=20de=20la=20division=20des=20mur?= =?UTF-8?q?s=20pour=20placer=20un=20fen=C3=AAtre.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rules/batiment/batimentquadmur.cpp | 24 ++++++++++++++++++++++-- rules/batiment/batimentquadmur.hh | 4 ++++ 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/rules/batiment/batimentquadmur.cpp b/rules/batiment/batimentquadmur.cpp index db32a96..4deda99 100644 --- a/rules/batiment/batimentquadmur.cpp +++ b/rules/batiment/batimentquadmur.cpp @@ -2,6 +2,7 @@ BatimentQuadMur::BatimentQuadMur(Quad c, float height) : Chose(), c(c), height(height) { addEntropy(c); + this->window = false; } void BatimentQuadMur::getBoundingBoxPoints() { @@ -9,6 +10,25 @@ void BatimentQuadMur::getBoundingBoxPoints() { addBBPoints(c + Vertex(0,0,height)); } -void BatimentQuadMur::triangulation() { - addGPUOcto(c, c + Vertex(0,0,height), 0xF1, 0xE0, 0xE0); +void BatimentQuadMur::setWindow(Quad w) { + this->windowPos = w; + this->window = true; +} + +bool BatimentQuadMur::split() { + if(!window) + return false; + + Quad left = c; + Quad right = c; + Quad top = c; + Quad bottom = c; + + + return true; +} + +void BatimentQuadMur::triangulation() { + //addGPUOcto(c, c + Vertex(0,0,height), 0xF1, 0xE0, 0xE0); + addGPUOcto(c, c + Vertex(0,0,height), 0x60, 0x60, 0xFF); } diff --git a/rules/batiment/batimentquadmur.hh b/rules/batiment/batimentquadmur.hh index 2be5581..331d7eb 100644 --- a/rules/batiment/batimentquadmur.hh +++ b/rules/batiment/batimentquadmur.hh @@ -7,12 +7,16 @@ class BatimentQuadMur: public Chose { private : Quad c; float height; + bool window; // Contient une fenêtre ou non. + Quad windowPos; public : BatimentQuadMur(Quad c, float height); virtual void triangulation(); + virtual bool split(); virtual void getBoundingBoxPoints(); + void setWindow(Quad); }; #endif