-
Notifications
You must be signed in to change notification settings - Fork 0
/
wxglmodel.h
125 lines (90 loc) · 2.33 KB
/
wxglmodel.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
//
// Version: $Id: wxmodel.h 162 2014-01-08 15:09:14Z gk $
//
// WxWidgets GUI for visualization and demonstration purposes
//
#ifndef WXGLMODEL_H
#define WXGLMODEL_H
#include <wx/wx.h>
#include "wx/glcanvas.h"
#include <wx/thread.h>
#include <wx/event.h>
// extern
class LANetwork;
class LAApp: public wxApp
{
public:
LAWindow* window;
LANetwork* network;
virtual bool OnInit();
};
typedef map<int, wxPoint>::iterator pt_iterator;
class LAPanel: public wxPanel
{
public:
LANetwork* network;
bool hasStarted ;
map<int, wxPoint> nrnpoints;
LAPanel(wxFrame*);
protected:
void drawPyrCell(wxPaintDC& dc, LANeuron* n, int x , int y);
void drawInCell(wxPaintDC& dc, LANeuron* n, int x , int y);
void OnPaint(wxPaintEvent& event);
void OnTimer(wxCommandEvent& );
void OnClick(wxMouseEvent& );
};
class LAGLPane;
class LAWindow: public wxFrame
{
public:
LAPanel* network_panel;
LAGLPane* network_glpanel;
LANetwork* network;
wxTimer* timer;
int timersRun;
LAWindow(const wxString& title, LANetwork* net);
void OnRun(wxCommandEvent& ev);
void OnRefresh(wxCommandEvent& ev);
void OnQuit(wxCommandEvent& ev);
void UpdatePanel()
{
this->network_panel->Refresh();
this->SetStatusText(wxString::Format(wxT("T=%d"), this->network->T));
this->Update();
usleep(100000);
}
protected:
void OnTimer(wxCommandEvent& );
DECLARE_EVENT_TABLE()
};
class LAGLPane : public wxGLCanvas
{
wxGLContext* m_context;
GLUquadric* m_quadric;
GLUquadric* m_sphereq;
GLuint m_sphereTexture;
public:
LANetwork* m_network;
float angle;
LAGLPane(wxFrame* parent, LANetwork* net, int* args);
virtual ~LAGLPane();
void resized(wxSizeEvent& evt);
int getWidth();
int getHeight();
void render(wxPaintEvent& evt);
void prepare3DViewport(int topleft_x, int topleft_y, int bottomrigth_x, int bottomrigth_y);
void prepare2DViewport(int topleft_x, int topleft_y, int bottomrigth_x, int bottomrigth_y);
void drawPyrNeuron( LANeuron* n);
// events
//void mouseMoved(wxMouseEvent& event);
//void mouseDown(wxMouseEvent& event);
//void mouseWheelMoved(wxMouseEvent& event);
//void mouseReleased(wxMouseEvent& event);
//void rightClick(wxMouseEvent& event);
//void mouseLeftWindow(wxMouseEvent& event);
//void keyPressed(wxKeyEvent& event);
//void keyReleased(wxKeyEvent& event);
//
DECLARE_EVENT_TABLE()
};
#endif