Subversion Repositories gelsvn

Rev

Rev 403 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 403 Rev 406
Line 80... Line 80...
80
	to initialize the shaders and then compile the display list yourself with the needed uniforms and
80
	to initialize the shaders and then compile the display list yourself with the needed uniforms and
81
	attributes - rather than calling compile_display_list which only puts vertices and normals in the list. 
81
	attributes - rather than calling compile_display_list which only puts vertices and normals in the list. 
82
 */
82
 */
83
class SimpleShaderRenderer: public ManifoldRenderer
83
class SimpleShaderRenderer: public ManifoldRenderer
84
	{
84
	{
85
	protected:
-
 
86
		GLuint prog,vs,fs;
-
 
87
 
-
 
88
		/// Compile the vertex and fragment shaders and link to form shader program.
85
		/// Compile the vertex and fragment shaders and link to form shader program.
89
		void init_shaders(const std::string& vss, 
86
		void init_shaders(const std::string& vss, 
90
						  const std::string& fss);
87
						  const std::string& fss);
91
		
88
		
92
		/// Produce a display list containing geometry and normals (which may be smooth or per face).
89
		/// Produce a display list containing geometry and normals (which may be smooth or per face).
93
		void compile_display_list(HMesh::Manifold& m, bool smooth);
90
		void compile_display_list(HMesh::Manifold& m, bool smooth);
-
 
91
 
-
 
92
	protected:
-
 
93
 
-
 
94
		GLuint prog,vs,fs;
-
 
95
 
94
	public:
96
	public:
95
		
97
		
96
		/// This constructor simply calls init_shaders and then compile_display_list.
98
		/// This constructor simply calls init_shaders and then compile_display_list.
97
		SimpleShaderRenderer(HMesh::Manifold& m, 
99
		SimpleShaderRenderer(HMesh::Manifold& m, 
98
							bool smooth, 
100
							bool smooth, 
Line 101... Line 103...
101
		{
103
		{
102
			init_shaders(vss,fss);
104
			init_shaders(vss,fss);
103
			compile_display_list(m, smooth);
105
			compile_display_list(m, smooth);
104
		}
106
		}
105
		
107
		
106
		/// This constructor does nothing. Use of you want to control shader program creation or display list generation
108
		/** This constructor simply initializes the shaders. It does not create the display list.
-
 
109
			Use if you shader has extra attributes. */
107
		SimpleShaderRenderer() {}
110
		SimpleShaderRenderer(const std::string& vss, 
-
 
111
							 const std::string& fss) {init_shaders(vss,fss);}
108
		
112
		
109
		/// Releases the program and shaders.
113
		/// Releases the program and shaders.
110
		~SimpleShaderRenderer()
114
		~SimpleShaderRenderer()
111
		{
115
		{
112
			glDeleteProgram(prog);
116
			glDeleteProgram(prog);
Line 180... Line 184...
180
	public:
184
	public:
181
		ScalarFieldRenderer(HMesh::Manifold& m, bool smooth,
185
		ScalarFieldRenderer(HMesh::Manifold& m, bool smooth,
182
							std::vector<double>& field, double max_val);
186
							std::vector<double>& field, double max_val);
183
	};
187
	};
184
 
188
 
-
 
189
/** Ambient occlusion renderer. Very similar to ScalarFieldRender. Simply assumes that the input values are
-
 
190
	mean curvatures which in some sense indicate how concave the surface is.*/
-
 
191
class AmbientOcclusionRenderer: public SimpleShaderRenderer
-
 
192
	{
-
 
193
		const static std::string vss;
-
 
194
		const static std::string fss;
-
 
195
	public:
-
 
196
		AmbientOcclusionRenderer(HMesh::Manifold& m, bool smooth,
-
 
197
							std::vector<double>& field, double max_val);
-
 
198
	};
-
 
199
 
-
 
200
/** Patina renderer. Very similar to ScalarFieldRender. Simply assumes that the input values are
-
 
201
 mean curvatures which in some sense indicate how concave the surface is.*/
-
 
202
class CopperRenderer: public SimpleShaderRenderer
-
 
203
	{
-
 
204
		const static std::string vss;
-
 
205
		const static std::string fss;
-
 
206
		float bsphere_rad;
-
 
207
	public:
-
 
208
		CopperRenderer(HMesh::Manifold& m, bool smooth,
-
 
209
								 std::vector<double>& field, double max_val, float _bsphere_rad);
-
 
210
		void draw();
-
 
211
	};
-
 
212
 
-
 
213
 
185
/** Line fields are rendered by convolving a noise function in the direction of the line.
214
/** Line fields are rendered by convolving a noise function in the direction of the line.
186
	This is useful, for instance, for curvature rendering. */
215
	This is useful, for instance, for curvature rendering. */
187
class LineFieldRenderer: public SimpleShaderRenderer
216
class LineFieldRenderer: public SimpleShaderRenderer
188
	{
217
	{
189
		const static std::string vss;
218
		const static std::string vss;