commit e7a6e93261db8e4a4afd4064ef72fc1b555f8aa6
parent 5a91abe732b2b7e8aafa9ad58b7b7406cc412c11
Author: Yoann <yoann.b87@voila.fr>
Date: Thu, 15 Dec 2011 11:33:01 +0100
Correction et ajout de classe lod, mais reste encore des erreurs.
Diffstat:
5 files changed, 34 insertions(+), 13 deletions(-)
diff --git a/all_includes.hh b/all_includes.hh
@@ -9,6 +9,7 @@ class Chose;
#include <cstdlib>
#include <cmath>
#include <vector>
+#include <map>
#include <SDL/SDL.h>
#include <GL/glew.h>
@@ -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
@@ -20,7 +20,7 @@ Abr::remove(int key, Chose* value) {
Abr::popIfLessThan(int key) {
std::multimap<int,Chose*>::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
@@ -1,9 +1,11 @@
+#ifndef _LOD_HH_
+#define _LOD_HH_
#include "all_includes.hh"
class Abr {
private :
std::multimap<int, Chose*> 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
@@ -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
@@ -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();