Subversion Repositories gelsvn

Rev

Rev 412 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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