env_render.h 1.21 KB
Newer Older
Pierre Kraemer's avatar
Pierre Kraemer committed
1 2 3 4 5 6 7
#ifndef ENVMAP_RENDER
#define ENVMAP_RENDER

#include "env_map.h"
#include <GL/glut.h>


8 9 10 11 12 13 14
//static void renderPoint(EnvMap& m, Dart& d)
//{
//	PFP::VEC3 p = m.position[d];
//	glBegin(GL_POINTS);
//		glVertex3f(p[0],p[1],p[2]);
//	glEnd();
//}
Pierre Kraemer's avatar
Pierre Kraemer committed
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35

static void renderDart(EnvMap& m, Dart d)
{
	PFP::VEC3 p1 = m.position[d];
	PFP::VEC3 p2 = m.position[m.map.phi1(d)];

	glBegin(GL_LINES);
		glVertex3f(p1[0],p1[1],p1[2]);
		glVertex3f(p2[0],p2[1],p2[2]);
	glEnd();
}

static void renderFace(EnvMap& m, Dart& d)
{
	Dart dd=d;
	do {
		renderDart(m,dd);
		dd = m.map.phi1(dd);
	}while(dd!=d);
}

36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
//static void renderCellOfDim(EnvMap& m,Dart d, unsigned int dim)
//{
//	switch(dim) {
//		case 0 : renderPoint(m,d); break;
//		case 1 : renderDart(m,d);  break;
//		case 2 : renderFace(m,d);  break;
//	}
//}
//
//static void renderAllPoints(EnvMap& m)
//{
//	glBegin(GL_POINTS);
//	for(Dart d=m.map.begin();d!=m.map.end();m.map.next(d)) {
//		PFP::VEC3 p = m.position[d];
//		glVertex3f(p[0],p[1],p[2]);
//	}
//	glEnd();
//}
Pierre Kraemer's avatar
Pierre Kraemer committed
54 55 56 57 58 59 60 61 62 63 64 65

static void renderPredictionTriangle(EnvMap& m, Dart d, PFP::VEC3 p)
{
	glBegin(GL_LINE_LOOP);
		glVertex3fv(&p[0]);
		glVertex3fv(& m.position[d][0]);
		glVertex3fv(& m.position[m.map.phi1(d)][0]);
	glEnd();
}


#endif