Subversion Repositories gelsvn

Rev

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