Subversion Repositories gelsvn

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
594 jab 1
/* ----------------------------------------------------------------------- *
2
 * This file is part of GEL, http://www.imm.dtu.dk/GEL
3
 * Copyright (C) the authors and DTU Informatics
4
 * For license and list of authors, see ../../doc/intro.pdf
5
 * ----------------------------------------------------------------------- */
6
 
7
/**
8
 * @file IDBufferWireFrameRenderer.h
9
 * @brief Render a Manifold in wireframe. Not fast - but general.
10
 */
11
 
396 jab 12
#ifndef __GLGRAPHICS_IDBUFFERWIREFRAMERENDERER_H__
13
#define __GLGRAPHICS_IDBUFFERWIREFRAMERENDERER_H__
14
 
601 jab 15
#include "../GL/glew.h"
16
#include "../CGLA/Vec3uc.h"
17
#include "../CGLA/Vec3f.h"
18
#include "../HMesh/Manifold.h"
396 jab 19
 
20
namespace GLGraphics
21
{
400 jab 22
	/// Class for ID buffer based wireframe rendering. Handles all types of gons. Use with Manifold
396 jab 23
	class IDBufferWireframeRenderer
24
		{
594 jab 25
			HMesh::Manifold* mesh;
396 jab 26
 
27
			GLint id_attrib;
28
			GLint popp_attrib;
29
			GLint disp_attrib;
30
			int XSZ, YSZ;
31
			float thickness;
32
			float transition;
33
 
34
			GLuint vs,fs;
35
			GLuint line_prog;
36
			GLuint idmap;
37
 
38
			GLuint vertex_buffername;
39
			GLuint colors_buffername;			
40
			GLuint line_id_attrib;
41
			GLuint line_vertex_pos;
42
			GLuint line_disp_attrib;
43
			GLuint line_opp_attrib;
44
 
45
			int triangles, quads;
46
		public:
47
 
48
			CGLA::Vec3uc id_get(unsigned int i)
49
			{
50
				i = i+1;
51
				return CGLA::Vec3uc(i&0xff, (i&0xff00)/256, (i&0xff0000)/65536);
52
			}
53
 
54
			IDBufferWireframeRenderer(int _XSZ, int _YSZ, 
55
							  HMesh::Manifold& mesh,
56
							  float _thickness=0.0, 
57
							  float _transition=1.8,
58
							  int atten_mode=0);
59
 
60
			~IDBufferWireframeRenderer();
61
 
62
			void draw(const CGLA::Vec3f& color, 
63
					const CGLA::Vec3f& clear_color);
64
		};
65
 
66
}
67
#endif