Subversion Repositories gelsvn

Rev

Rev 657 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 657 Rev 662
Line 7... Line 7...
7
//
7
//
8
 
8
 
9
#ifndef __GEL__MeshEditor__
9
#ifndef __GEL__MeshEditor__
10
#define __GEL__MeshEditor__
10
#define __GEL__MeshEditor__
11
 
11
 
-
 
12
#include <mutex>
12
#include <string>
13
#include <string>
13
#include "../GLGraphics/Console.h"
14
#include "../GLGraphics/Console.h"
14
#include "../GLGraphics/VisObj.h"
15
#include "../GLGraphics/VisObj.h"
15
#include "../GLGraphics/GLViewController.h"
16
#include "../GLGraphics/GLViewController.h"
16
 
17
 
-
 
18
 
17
namespace GLGraphics {
19
namespace GLGraphics {
-
 
20
    extern std::mutex parallel_work;
18
    
21
    
19
    class MeshEditor
22
    class MeshEditor
20
    {
23
    {
21
        bool console_visible = false;
24
        bool console_visible = false;
22
        
25
        
Line 26... Line 29...
26
        HMesh::VertexAttributeVector<float> weight_vector;
29
        HMesh::VertexAttributeVector<float> weight_vector;
27
        HMesh::VertexAttributeVector<CGLA::Vec3d> orig_pos;
30
        HMesh::VertexAttributeVector<CGLA::Vec3d> orig_pos;
28
 
31
 
29
        static const int NO_MESHES = 9;
32
        static const int NO_MESHES = 9;
30
        std::array<VisObj,NO_MESHES> vo;
33
        std::array<VisObj,NO_MESHES> vo;
-
 
34
        
-
 
35
    public:
31
        VisObj& active_visobj() { return vo[active]; }
36
        VisObj& active_visobj() { return vo[active]; }
32
        const VisObj& active_visobj() const { return vo[active]; }
37
        const VisObj& active_visobj() const { return vo[active]; }
-
 
38
    private:
33
        GLViewController& active_view_control() {
39
        GLViewController& active_view_control() {
34
            return active_visobj().view_control();
40
            return active_visobj().view_control();
35
        }
41
        }
36
 
42
 
37
        Console theConsole;
43
        Console theConsole;
Line 75... Line 81...
75
        void reshape(int w, int h);
81
        void reshape(int w, int h);
76
        void grab_ball(TrackBallAction action, const CGLA::Vec2i& pos);
82
        void grab_ball(TrackBallAction action, const CGLA::Vec2i& pos);
77
        void roll_ball(const CGLA::Vec2i& pos);
83
        void roll_ball(const CGLA::Vec2i& pos);
78
        void release_ball();
84
        void release_ball();
79
        bool try_spinning_ball();
85
        bool try_spinning_ball();
-
 
86
        void save_ball();
-
 
87
        void load_ball();
80
        
88
        
81
        /// Align means that we sync view controllers.
89
        /// Align means that we sync view controllers.
82
        void align(int src, int dst)
90
        void align(int src, int dst)
83
        {
91
        {
84
            vo[dst].view_control() =
92
            vo[dst].view_control() =
Line 121... Line 129...
121
        void key_home();
129
        void key_home();
122
        void key_end();
130
        void key_end();
123
 
131
 
124
        /// Returns a reference to active mesh.
132
        /// Returns a reference to active mesh.
125
        HMesh::Manifold& active_mesh() { return active_visobj().mesh(); }
133
        HMesh::Manifold& active_mesh() { return active_visobj().mesh(); }
-
 
134
 
126
        
135
        /// Returns a reference to mesh i
-
 
136
        HMesh::Manifold& get_mesh(int i) { return vo[i].mesh(); }
-
 
137
 
127
       /// Add a file to the next empty slot.
138
       /// Add a file to the next empty slot.
128
        bool add_file(const std::string& str);
139
        bool add_file(const std::string& str);
129
        
140
        
130
        /// Load the mesh given as argument to the current slot.
141
        /// Load the mesh given as argument to the current slot.
131
        bool reload_active_from_file(const std::string& str);
142
        bool reload_active_from_file(const std::string& str);