Correction et ajout de classe lod, mais reste encore des erreurs.

This commit is contained in:
Yoann 2011-12-15 11:33:01 +01:00
parent 5a91abe732
commit e7a6e93261
5 changed files with 34 additions and 13 deletions

View File

@ -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"

13
lod.cpp
View File

@ -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;

17
lod.hh
View File

@ -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

View File

@ -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;
}

View File

@ -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();