Subversion Repositories gelsvn

Rev

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

Rev 635 Rev 638
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 = GLGraphics::GLViewController(WINX,WINY, CGLA::Vec3f(0), 1.0);
29
		GLGraphics::GLViewController view_ctrl;
30
		bool create_display_list = true;
30
		bool create_display_list;
31
        
31
        
32
		HMesh::Manifold mani;
32
		HMesh::Manifold mani;
33
		HMesh::Manifold old_mani;
33
		HMesh::Manifold old_mani;
34
		
34
		
35
		Harmonics* harmonics = nullptr;
35
		Harmonics* harmonics;
36
        GLGraphics::ManifoldRenderer* renderer = nullptr;
36
    GLGraphics::ManifoldRenderer* renderer;
37
		CGLA::Vec3d bsphere_center;
37
		CGLA::Vec3d bsphere_center;
38
		float bsphere_radius;
38
		float bsphere_radius;
39
	public:
39
	public:
40
		VisObj() {}
40
		VisObj() 
-
 
41
    { 
-
 
42
      file = "";
-
 
43
      view_ctrl = GLGraphics::GLViewController(WINX,WINY, CGLA::Vec3f(0), 1.0);
-
 
44
      create_display_list =true;
-
 
45
      harmonics = nullptr;
-
 
46
      renderer = nullptr;
-
 
47
 
-
 
48
    }
41
		
49
		
42
		float get_bsphere_radius() const { return bsphere_radius;}
50
		float get_bsphere_radius() const { return bsphere_radius;}
43
		
51
		
44
		HMesh::Manifold& mesh() {return mani;}
52
		HMesh::Manifold& mesh() {return mani;}
45
		
53
		
46
		void save_old() {old_mani = mani;}
54
		void save_old() {old_mani = mani;}
47
		void restore_old() {mani = old_mani;}
55
		void restore_old() {mani = old_mani;}
48
		
56
		
49
		GLGraphics::GLViewController& view_control() {return view_ctrl;}
57
		GLGraphics::GLViewController& view_control() {return view_ctrl;}
50
        
58
        
51
        void refit();
59
        void refit();
52
		
60
		
53
		bool reload(std::string _file);
61
		bool reload(std::string _file);
54
 
62
 
55
		bool add_mesh(std::string _file);
63
		bool add_mesh(std::string _file);
56
		
64
		
57
		void display(const std::string& display_method , GLGraphics::Console& cs, bool smooth, float gamma);
65
		void display(const std::string& display_method , GLGraphics::Console& cs, bool smooth, float gamma);
58
		
66
		
59
		void post_create_display_list()
67
		void post_create_display_list()
60
		{
68
		{
61
			create_display_list = true;
69
			create_display_list = true;
62
		}
70
		}
63
		
71
		
64
		void harmonics_analyze_mesh(GLGraphics::Console& cs)
72
		void harmonics_analyze_mesh(GLGraphics::Console& cs)
65
		{
73
		{
66
			delete harmonics;
74
			delete harmonics;
67
			harmonics = new Harmonics(mani, cs);
75
			harmonics = new Harmonics(mani, cs);
68
		}
76
		}
69
		
77
		
70
		void harmonics_reset_shape()
78
		void harmonics_reset_shape()
71
		{
79
		{
72
			if(harmonics)
80
			if(harmonics)
73
				harmonics->reset_shape();
81
				harmonics->reset_shape();
74
		}
82
		}
75
		
83
		
76
		void harmonics_parse_key(unsigned char key)
84
		void harmonics_parse_key(unsigned char key)
77
		{
85
		{
78
			harmonics->parse_key(key);
86
			harmonics->parse_key(key);
79
		}
87
		}
80
		
88
		
81
		void harmonics_partial_reconstruct(int eig0, int eig1, float scale)
89
		void harmonics_partial_reconstruct(int eig0, int eig1, float scale)
82
		{
90
		{
83
			if(harmonics)
91
			if(harmonics)
84
				harmonics->partial_reconstruct(eig0, eig1, scale);
92
				harmonics->partial_reconstruct(eig0, eig1, scale);
85
		}
93
		}
86
		
94
		
87
	};
95
	};
88
 
96
 
89
#endif
97
#endif
90
 
98