Subversion Repositories gelsvn

Rev

Rev 596 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 596 Rev 614
Line 39... Line 39...
39
using namespace HMesh;
39
using namespace HMesh;
40
using namespace Geometry;
40
using namespace Geometry;
41
using namespace GLGraphics;
41
using namespace GLGraphics;
42
using namespace LinAlg;
42
using namespace LinAlg;
43
 
43
 
44
bool Harmonics::is_initialized=false;
-
 
45
GLuint Harmonics::prog_P0;
-
 
46
 
-
 
47
 
-
 
48
namespace
44
namespace
49
{
45
{
50
	
46
	
51
	string vss =
47
	string vss =
52
	"#version 120\n"
48
	"#version 120\n"
Line 263... Line 259...
263
			Q[i][i] = -a_sum;
259
			Q[i][i] = -a_sum;
264
		}
260
		}
265
	EigenSolutionsSym(Q,V);
261
	EigenSolutionsSym(Q,V);
266
}
262
}
267
 
263
 
268
Harmonics::Harmonics(Manifold& _mani):mani(_mani), vtouched(_mani.allocated_vertices(), 0) 
264
Harmonics::Harmonics(HMesh::Manifold& _mani, GLGraphics::Console& cs):mani(_mani), vtouched(_mani.allocated_vertices(), 0)
269
{
265
{
-
 
266
    string shader_path = "/Users/jab/GEL/apps/MeshEdit/";
-
 
267
	GLuint vs = create_glsl_shader(GL_VERTEX_SHADER, vss);
-
 
268
	GLuint fs = create_glsl_shader(GL_FRAGMENT_SHADER, fss);
-
 
269
	
-
 
270
	// Create the program
-
 
271
	prog_P0 = glCreateProgram();
-
 
272
	
-
 
273
	// Attach all shaders
-
 
274
	if(vs) glAttachShader(prog_P0, vs);
-
 
275
	if(fs) glAttachShader(prog_P0, fs);
-
 
276
	
-
 
277
	// Link the program object and print out the info log
270
	assert(is_initialized);
278
	glLinkProgram(prog_P0);
-
 
279
	print_glsl_program_log(prog_P0);
-
 
280
	
-
 
281
	// Install program object as part of current state
-
 
282
	glUseProgram(0);
-
 
283
	
-
 
284
    display_harmonics_diffuse.reg(cs, "display.harmonics.diffuse", "");
-
 
285
    display_harmonics_time.reg(cs, "display.harmonics.time", "");
-
 
286
    display_harmonics_highlight.reg(cs, "display.harmonics.highlight", "");
271
	
287
	
272
	triangulate_by_edge_face_split(mani);
288
	triangulate_by_edge_face_split(mani);
273
 
289
 
274
    int i = 0;
290
    int i = 0;
275
    for(VertexIDIterator v = mani.vertices_begin(); v != mani.vertices_end(); ++v, ++i)
291
    for(VertexIDIterator v = mani.vertices_begin(); v != mani.vertices_end(); ++v, ++i)
Line 314... Line 330...
314
{
330
{
315
	for(int es=E0;es<=E1;++es)
331
	for(int es=E0;es<=E1;++es)
316
		add_frequency(es, scale);
332
		add_frequency(es, scale);
317
}
333
}
318
 
334
 
319
Console::variable<float> display_harmonics_time;
-
 
320
Console::variable<int> display_harmonics_diffuse;
-
 
321
Console::variable<int> display_harmonics_highlight;
-
 
322
 
-
 
323
void Harmonics::parse_key(unsigned char key)
335
void Harmonics::parse_key(unsigned char key)
324
{
336
{
325
	switch(key) {
337
	switch(key) {
326
		case '+': 
338
		case '+': 
327
			display_harmonics_time = display_harmonics_time+0.001; 
339
			display_harmonics_time = display_harmonics_time+0.001; 
Line 370... Line 382...
370
	}
382
	}
371
	glFrontFace(GL_CCW);
383
	glFrontFace(GL_CCW);
372
	glUseProgram(0);
384
	glUseProgram(0);
373
}
385
}
374
 
386
 
375
void Harmonics::init(Console& cs)
-
 
376
{
-
 
377
	is_initialized = true;
-
 
378
	string shader_path = "/Users/jab/GEL/apps/MeshEdit/";
-
 
379
	GLuint vs = create_glsl_shader(GL_VERTEX_SHADER, vss);
-
 
380
	GLuint fs = create_glsl_shader(GL_FRAGMENT_SHADER, fss);
-
 
381
	
-
 
382
	// Create the program
-
 
383
	prog_P0 = glCreateProgram();
-
 
384
	
-
 
385
	// Attach all shaders
-
 
386
	if(vs) glAttachShader(prog_P0, vs);
-
 
387
	if(fs) glAttachShader(prog_P0, fs);
-
 
388
	
-
 
389
	// Link the program object and print out the info log
-
 
390
	glLinkProgram(prog_P0);
-
 
391
	print_glsl_program_log(prog_P0);
-
 
392
	
-
 
393
	// Install program object as part of current state
-
 
394
	glUseProgram(0);
-
 
395
	
-
 
396
    display_harmonics_diffuse.reg(cs, "display.harmonics.diffuse", "");    
-
 
397
    display_harmonics_time.reg(cs, "display.harmonics.time", ""); 
-
 
398
    display_harmonics_highlight.reg(cs, "display.harmonics.highlight", "");
-
 
399
    
-
 
400
 
-
 
401
}
-