commit d56b058c870ebd60994dd3e04a011dde65ddc906
parent 6944c0383b8b71242cc4cf37fe1423d0d94a25ee
Author: Georges Dupéron <jahvascriptmaniac+github@free.fr>
Date: Fri, 20 Jan 2012 12:11:17 +0100
Corrections sur les arches.
Diffstat:
3 files changed, 30 insertions(+), 7 deletions(-)
diff --git a/rules/arche.cpp b/rules/arche.cpp
@@ -27,12 +27,22 @@ bool ArcheQuad::split() {
}
void ArcheQuad::triangulation() {
- Quad ch = c.offsetNormal(height);
- Quad che = c.offsetNormal(f(end) * height * 0.9f);
- Quad chw = c.offsetNormal(f(start) * height * 0.9f);
- addGPUQuad(Quad(ch[NW], chw[NW], che[NE], ch[NE]), Couleurs::mur);
- addGPUQuad(Quad(ch[SE], che[SE], chw[SW], ch[SW]), Couleurs::mur);
- addGPUQuad(Quad(che[SE], che[NE], chw[NW], chw[SW]), Couleurs::mur);
+ if (type == PLAT) {
+ Quad chh = c.offsetNormal(height);
+ Quad ch = c.offsetNormal(height * 0.9);
+ addGPUQuad(ch, Couleurs::mur);
+ addGPUQuad(Quad(chh[NW], ch[NW], ch[NE], chh[NE]), Couleurs::mur);
+ addGPUQuad(Quad(chh[SE], ch[SE], ch[SW], chh[SW]), Couleurs::mur);
+ addGPUQuad(Quad(ch[NW], c[NW], c[SW], ch[SW]), Couleurs::mur);
+ addGPUQuad(Quad(ch[SE], c[SE], c[NE], ch[NE]), Couleurs::mur);
+ } else {
+ Quad ch = c.offsetNormal(height);
+ Quad che = c.offsetNormal(f(end) * height * 0.9f);
+ Quad chw = c.offsetNormal(f(start) * height * 0.9f);
+ addGPUQuad(Quad(ch[NW], chw[NW], che[NE], ch[NE]), Couleurs::mur);
+ addGPUQuad(Quad(ch[SE], che[SE], chw[SW], ch[SW]), Couleurs::mur);
+ addGPUQuad(Quad(che[SE], che[NE], chw[NW], chw[SW]), Couleurs::mur);
+ }
}
void ArcheQuad::getBoundingBoxPoints() {
diff --git a/rules/etage.cpp b/rules/etage.cpp
@@ -13,7 +13,7 @@ void EtageQuad::getBoundingBoxPoints() {
}
bool EtageQuad::split() {
- if (nbEtages > 1 && etage == 0 && ((w[N] && w[S]) || (w[E] && w[W])) && c.minLengthEW() > 800 && proba(seed, 0, 0.4)) {
+ if (nbEtages > 1 && etage == 0 && ((w[N] && w[S]) || (w[E] && w[W])) && c.minLengthEW() > 800 && proba(seed, 0, 0.8)) {
Quad q = c << ((w[N] && w[S]) ? 0 : 1);
Quad qh = ch << ((w[N] && w[S]) ? 0 : 1);
Vertex n = (q[NW] + q[NE]) / 2.f;
diff --git a/view.cpp b/view.cpp
@@ -246,6 +246,18 @@ void Camera::mouseMotion(const SDL_MouseMotionEvent &event) {
void Camera::keyboard(const SDL_KeyboardEvent &eventKey) {
switch(eventKey.keysym.sym) {
case SDLK_UP:
+ case SDLK_DOWN:
+ case SDLK_LEFT:
+ case SDLK_RIGHT:
+ case SDLK_PAGEUP:
+ case SDLK_PAGEDOWN:
+ if (moveSensitivity == 0) moveSensitivity = 300;
+ break;
+ default:
+ break;
+ }
+ switch(eventKey.keysym.sym) {
+ case SDLK_UP:
up = (eventKey.type == SDL_KEYDOWN);
break;
case SDLK_DOWN:
@@ -284,6 +296,7 @@ void Camera::keyboard(const SDL_KeyboardEvent &eventKey) {
exit(0);
break;
case 'a' :
+ if (moveSensitivity == 0) moveSensitivity = 300;
up = true;
break;
case 'z' :