Subversion Repositories gelsvn

Rev

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

Rev 614 Rev 618
1
/*
1
/*
2
 *  VisObj.h
2
 *  VisObj.h
3
 *  GEL
3
 *  GEL
4
 *
4
 *
5
 *  Created by J. Andreas Bærentzen on 20/09/08.
5
 *  Created by J. Andreas Bærentzen on 20/09/08.
6
 *  Copyright 2008 __MyCompanyName__. All rights reserved.
6
 *  Copyright 2008 __MyCompanyName__. All rights reserved.
7
 *
7
 *
8
 */
8
 */
9
#ifndef __MESHEDIT_VISOBJ_H__
9
#ifndef __MESHEDIT_VISOBJ_H__
10
#define __MESHEDIT_VISOBJ_H__
10
#define __MESHEDIT_VISOBJ_H__
11
 
11
 
12
 
12
 
13
#include <string>
13
#include <string>
14
#include <GL/glew.h>
14
#include <GL/glew.h>
15
#include <HMesh/Manifold.h>
15
#include <HMesh/Manifold.h>
16
#include <CGLA/Vec3d.h>
16
#include <CGLA/Vec3d.h>
17
#include <GLGraphics/draw.h>
17
#include <GLGraphics/draw.h>
18
#include <GLGraphics/Console.h>
18
#include <GLGraphics/Console.h>
19
#include <GLGraphics/GLViewController.h>
19
#include <GLGraphics/GLViewController.h>
20
#include <GLGraphics/ManifoldRenderer.h>
20
#include <GLGraphics/ManifoldRenderer.h>
21
#include "harmonics.h"
21
#include "harmonics.h"
22
 
22
 
23
extern int WINX;
23
extern int WINX;
24
extern int WINY;
24
extern int WINY;
25
 
25
 
26
class VisObj
26
class VisObj
27
	{
27
	{
28
		std::string file;
28
		std::string file;
29
		GLGraphics::GLViewController view_ctrl;
29
		GLGraphics::GLViewController view_ctrl;
30
		bool create_display_list;
30
		bool create_display_list;
31
		HMesh::Manifold mani;
31
		HMesh::Manifold mani;
32
		HMesh::Manifold old_mani;
32
		HMesh::Manifold old_mani;
33
		
33
		
34
		Harmonics* harmonics;
34
		Harmonics* harmonics;
35
        GLGraphics::ManifoldRenderer* renderer;
35
        GLGraphics::ManifoldRenderer* renderer;
36
		CGLA::Vec3d bsphere_center;
36
		CGLA::Vec3d bsphere_center;
37
		float bsphere_radius;
37
		float bsphere_radius;
38
	public:
38
	public:
39
		VisObj():
39
		VisObj():
40
        file(""), view_ctrl(WINX,WINY, CGLA::Vec3f(0), 1.0), create_display_list(true), harmonics(0) {}
40
        file(""), view_ctrl(WINX,WINY, CGLA::Vec3f(0), 1.0), create_display_list(true), harmonics(0) {}
41
		
41
		
42
		float get_bsphere_radius() const { return bsphere_radius;}
42
		float get_bsphere_radius() const { return bsphere_radius;}
43
		
43
		
44
		HMesh::Manifold& mesh() {return mani;}
44
		HMesh::Manifold& mesh() {return mani;}
45
		
45
		
46
		void save_old() {old_mani = mani;}
46
		void save_old() {old_mani = mani;}
47
		void restore_old() {mani = old_mani;}
47
		void restore_old() {mani = old_mani;}
48
		
48
		
49
		GLGraphics::GLViewController& view_control() {return view_ctrl;}
49
		GLGraphics::GLViewController& view_control() {return view_ctrl;}
-
 
50
        
-
 
51
        void refit();
50
		
52
		
51
		bool reload(std::string _file);
53
		bool reload(std::string _file);
52
 
54
 
53
		bool add_mesh(std::string _file);
55
		bool add_mesh(std::string _file);
54
		
56
		
55
		void display(const std::string& display_method , GLGraphics::Console& cs, bool smooth, float gamma);
57
		void display(const std::string& display_method , GLGraphics::Console& cs, bool smooth, float gamma);
56
		
58
		
57
		void post_create_display_list()
59
		void post_create_display_list()
58
		{
60
		{
59
			create_display_list = true;
61
			create_display_list = true;
60
		}
62
		}
61
		
63
		
62
		void harmonics_analyze_mesh(GLGraphics::Console& cs)
64
		void harmonics_analyze_mesh(GLGraphics::Console& cs)
63
		{
65
		{
64
			delete harmonics;
66
			delete harmonics;
65
			harmonics = new Harmonics(mani, cs);
67
			harmonics = new Harmonics(mani, cs);
66
		}
68
		}
67
		
69
		
68
		void harmonics_reset_shape()
70
		void harmonics_reset_shape()
69
		{
71
		{
70
			if(harmonics)
72
			if(harmonics)
71
				harmonics->reset_shape();
73
				harmonics->reset_shape();
72
		}
74
		}
73
		
75
		
74
		void harmonics_parse_key(unsigned char key)
76
		void harmonics_parse_key(unsigned char key)
75
		{
77
		{
76
			harmonics->parse_key(key);
78
			harmonics->parse_key(key);
77
		}
79
		}
78
		
80
		
79
		void harmonics_partial_reconstruct(int eig0, int eig1, float scale)
81
		void harmonics_partial_reconstruct(int eig0, int eig1, float scale)
80
		{
82
		{
81
			if(harmonics)
83
			if(harmonics)
82
				harmonics->partial_reconstruct(eig0, eig1, scale);
84
				harmonics->partial_reconstruct(eig0, eig1, scale);
83
		}
85
		}
84
		
86
		
85
	};
87
	};
86
 
88
 
87
#endif
89
#endif
88
 
90