From e7a6e93261db8e4a4afd4064ef72fc1b555f8aa6 Mon Sep 17 00:00:00 2001 From: Yoann Date: Thu, 15 Dec 2011 11:33:01 +0100 Subject: [PATCH] Correction et ajout de classe lod, mais reste encore des erreurs. --- all_includes.hh | 2 ++ lod.cpp | 13 +++++++++---- lod.hh | 17 +++++++++++------ main.cpp | 6 +++++- view.hh | 9 +++++++-- 5 files changed, 34 insertions(+), 13 deletions(-) diff --git a/all_includes.hh b/all_includes.hh index f362c65..fe5a5ba 100644 --- a/all_includes.hh +++ b/all_includes.hh @@ -9,6 +9,7 @@ class Chose; #include #include #include +#include #include #include @@ -24,6 +25,7 @@ class Chose; #include "hash.hh" #include "view.hh" +#include "lod.hh" #include "rules/chose.hh" diff --git a/lod.cpp b/lod.cpp index bc4f98e..324f003 100644 --- a/lod.cpp +++ b/lod.cpp @@ -20,7 +20,7 @@ Abr::remove(int key, Chose* value) { Abr::popIfLessThan(int key) { std::multimap::iterator it = map.begin(); - + if((*it).first < key) { map.erase(it); return (*it).second; @@ -30,15 +30,20 @@ Abr::popIfLessThan(int key) { } + + #define NegateEven(v, i) ((v)*(((i)&1) ? 1 : -1)) -Lod::Lod(float[3] camera) { +Lod::Lod(){}; + +merde +Lod::Lod(float camera[3]) { this->camera = camera; } void Lod::setCamera(float[3] camera) { this->camera = camera; - + // Merge. for(int i = 0; i < 6; i++) { Chose* c; @@ -69,7 +74,7 @@ void Lod::setCamera(float[3] camera) { } } } - + // Split in vers split out. for(int i = 0; i < 6; i++) { Chose* c; diff --git a/lod.hh b/lod.hh index b570908..777672b 100644 --- a/lod.hh +++ b/lod.hh @@ -1,9 +1,11 @@ +#ifndef _LOD_HH_ +#define _LOD_HH_ #include "all_includes.hh" class Abr { private : std::multimap map; - + public : Abr(); void insert(int key, Chose* value); //TODO Retourne un item*. @@ -17,10 +19,13 @@ class Lod { Abr merge[6]; // {xMin, xMax, yMin, yMax, zMin, zMax}. Abr split[12]; // {xMinIn, xMinOut, xMaxIn, xMaxOut, yMinIn, yMaxOut, yMaxIn, yMaxOut, zMinIn, zMinOut, zMaxIn, zMaxOut}. float camera[3]; - + public : - Lod(float[3] camera); - void addMergeCube(Chose* chose, int[6] limits); - void addSplitCube(Chose* chose, int[6] limits); - void setCamera(float[3] camera); + Lod(); + Lod(float camera[3]); + void addMergeCube(Chose* chose, int limits[6]); + void addSplitCube(Chose* chose, int limits[6]); + void setCamera(float camera[3]); }; + +#endif diff --git a/main.cpp b/main.cpp index 2f1221b..a7b0079 100644 --- a/main.cpp +++ b/main.cpp @@ -30,7 +30,11 @@ int main() { // c->subdivide(); recursiveSubdivide(c); - new View(c); + View *v = new View(c); + Vertex cc = v->camera.cameraCenter; + float camera[3] = {cc.x, cc.y, cc.z}; + camera[0] = camera[0]; + Lod lod; // tile.subdivide tant qu'on n'a pas le niveau de détail désiré. return 0; } diff --git a/view.hh b/view.hh index f28a759..65b015e 100644 --- a/view.hh +++ b/view.hh @@ -10,9 +10,11 @@ // Prendre en compte tous les évènements X en attente avant de relancer le rendu. class Camera { - private : + public : Vertexf cameraCenter; Vertexf cameraSight; + + private : float xAngle; float yAngle; int moveDist; @@ -36,13 +38,16 @@ class Camera { class View { - private : + private : Chose* root; + + public : Camera camera; static const int windowWidth = 1024; static const int windowHeight = 768; + public : View(Chose* root); void initWindow();