Subversion Repositories gelsvn

Rev

Rev 630 | 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
	{
635 janba 28
		std::string file = "";
29
		GLGraphics::GLViewController view_ctrl = GLGraphics::GLViewController(WINX,WINY, CGLA::Vec3f(0), 1.0);
30
		bool create_display_list = true;
31
 
399 jab 32
		HMesh::Manifold mani;
596 jab 33
		HMesh::Manifold old_mani;
34
 
635 janba 35
		Harmonics* harmonics = nullptr;
36
        GLGraphics::ManifoldRenderer* renderer = nullptr;
596 jab 37
		CGLA::Vec3d bsphere_center;
403 jab 38
		float bsphere_radius;
399 jab 39
	public:
635 janba 40
		VisObj() {}
399 jab 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;}
618 jab 50
 
51
        void refit();
399 jab 52
 
53
		bool reload(std::string _file);
596 jab 54
 
55
		bool add_mesh(std::string _file);
399 jab 56
 
596 jab 57
		void display(const std::string& display_method , GLGraphics::Console& cs, bool smooth, float gamma);
399 jab 58
 
59
		void post_create_display_list()
60
		{
61
			create_display_list = true;
62
		}
63
 
614 jab 64
		void harmonics_analyze_mesh(GLGraphics::Console& cs)
399 jab 65
		{
66
			delete harmonics;
614 jab 67
			harmonics = new Harmonics(mani, cs);
399 jab 68
		}
69
 
70
		void harmonics_reset_shape()
71
		{
72
			if(harmonics)
73
				harmonics->reset_shape();
74
		}
75
 
76
		void harmonics_parse_key(unsigned char key)
77
		{
78
			harmonics->parse_key(key);
79
		}
80
 
81
		void harmonics_partial_reconstruct(int eig0, int eig1, float scale)
82
		{
83
			if(harmonics)
84
				harmonics->partial_reconstruct(eig0, eig1, scale);
85
		}
86
 
87
	};
88
 
89
#endif