Subversion Repositories gelsvn

Rev

Rev 601 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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