merged hv7 mod
[goodguy/history.git] / cinelerra-5.1 / plugins / spherecam / spherecam.h.bak
1
2 /*
3  * CINELERRA
4  * Copyright (C) 2017 Adam Williams <broadcast at earthling dot net>
5  * 
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  * 
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  * 
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  * 
20  */
21
22 #ifndef FUSE360_H
23 #define FUSE360_H
24
25
26 #include "affine.inc"
27 #include "bchash.inc"
28 #include "guicast.h"
29 #include "loadbalance.h"
30 #include "pluginvclient.h"
31 #include "thread.h"
32
33
34 class Fuse360Engine;
35 class Fuse360GUI;
36 class Fuse360Main;
37 class Fuse360Text;
38
39
40 class Fuse360Slider : public BC_FSlider
41 {
42 public:
43         Fuse360Slider(Fuse360Main *client, 
44                 Fuse360GUI *gui,
45                 Fuse360Text *text,
46                 float *output, 
47                 int x, 
48                 int y, 
49                 float min,
50                 float max);
51         int handle_event();
52
53         Fuse360GUI *gui;
54         Fuse360Main *client;
55         Fuse360Text *text;
56         float *output;
57 };
58
59 class Fuse360Text : public BC_TextBox
60 {
61 public:
62         Fuse360Text(Fuse360Main *client, 
63                 Fuse360GUI *gui,
64                 Fuse360Slider *slider,
65                 float *output, 
66                 int x, 
67                 int y);
68         int handle_event();
69
70         Fuse360GUI *gui;
71         Fuse360Main *client;
72         Fuse360Slider *slider;
73         float *output;
74 };
75
76
77 class Fuse360Toggle : public BC_CheckBox
78 {
79 public:
80         Fuse360Toggle(Fuse360Main *client, 
81                 int *output, 
82                 int x, 
83                 int y,
84                 const char *text);
85         int handle_event();
86
87         Fuse360Main *client;
88         int *output;
89 };
90
91
92 class Fuse360Mode : public BC_PopupMenu
93 {
94 public:
95         Fuse360Mode(Fuse360Main *plugin,  
96                 Fuse360GUI *gui,
97                 int x,
98                 int y);
99         int handle_event();
100         void create_objects();
101         static int calculate_w(Fuse360GUI *gui);
102         static int from_text(char *text);
103         static const char* to_text(int mode);
104         void update(int mode);
105         Fuse360Main *plugin;
106         Fuse360GUI *gui;
107 };
108
109
110 class Fuse360GUI : public PluginClientWindow
111 {
112 public:
113         Fuse360GUI(Fuse360Main *client);
114         ~Fuse360GUI();
115         
116         void create_objects();
117
118         Fuse360Main *client;
119 //      Fuse360Slider *fov_slider;
120 //      Fuse360Text *fov_text;
121         Fuse360Slider *radiusx_slider;
122         Fuse360Text *radiusx_text;
123         Fuse360Slider *radiusy_slider;
124         Fuse360Text *radiusy_text;
125 //      Fuse360Slider *centerx_slider;
126 //      Fuse360Text *centerx_text;
127 //      Fuse360Slider *centery_slider;
128 //      Fuse360Text *centery_text;
129         Fuse360Slider *distancex_slider;
130         Fuse360Text *distancex_text;
131         Fuse360Slider *distancey_slider;
132         Fuse360Text *distancey_text;
133         Fuse360Slider *translatex_slider;
134         Fuse360Text *translatex_text;
135         Fuse360Slider *feather_slider;
136         Fuse360Text *feather_text;
137         Fuse360Slider *rotation_slider;
138         Fuse360Text *rotation_text;
139         
140         Fuse360Mode *mode;
141         Fuse360Toggle *draw_guides;
142 };
143
144 class Fuse360Config
145 {
146 public:
147         Fuse360Config();
148         int equivalent(Fuse360Config &that);
149         void copy_from(Fuse360Config &that);
150         void interpolate(Fuse360Config &prev, 
151                 Fuse360Config &next, 
152                 int64_t prev_frame, 
153                 int64_t next_frame, 
154                 int64_t current_frame);
155         void boundaries();
156
157
158
159         float fov;
160 // radius of each eye
161         float radius_x;
162         float radius_y;
163 // amount to feather eye edges
164         float feather;
165 // center of 2 eyes
166         float center_x;
167         float center_y;
168 // X distance between 2 eyes
169         float distance_x;
170 // Y offset between 2 eyes
171         float distance_y;
172 // translate output position
173         float translate_x;
174         float rotation;
175         int draw_guides;
176         int mode;
177         enum
178         {
179 // align guides only
180                 DO_NOTHING,
181 // rectilinear
182                 STRETCHXY,
183 // the standard blend
184                 STANDARD,
185 // don't stretch eyes
186                 BLEND
187         };
188 };
189
190
191
192
193
194 class Fuse360Package : public LoadPackage
195 {
196 public:
197         Fuse360Package();
198         int row1, row2;
199 };
200
201
202 class Fuse360Unit : public LoadClient
203 {
204 public:
205         Fuse360Unit(Fuse360Engine *engine, Fuse360Main *plugin);
206         ~Fuse360Unit();
207         
208         
209         void process_package(LoadPackage *package);
210         void process_stretch(Fuse360Package *pkg);
211         void process_blend(Fuse360Package *pkg);
212         void process_standard(Fuse360Package *pkg);
213         double calculate_max_z(double a, double r);
214
215         
216         Fuse360Engine *engine;
217         Fuse360Main *plugin;
218 };
219
220 class Fuse360Engine : public LoadServer
221 {
222 public:
223         Fuse360Engine(Fuse360Main *plugin);
224         ~Fuse360Engine();
225         
226         void init_packages();
227         LoadClient* new_client();
228         LoadPackage* new_package();
229         
230         Fuse360Main *plugin;
231 };
232
233 class Fuse360Main : public PluginVClient
234 {
235 public:
236         Fuse360Main(PluginServer *server);
237         ~Fuse360Main();
238
239         PLUGIN_CLASS_MEMBERS2(Fuse360Config)
240         int process_buffer(VFrame *frame,
241                 int64_t start_position,
242                 double frame_rate);
243         int is_realtime();
244         void update_gui();
245         void save_data(KeyFrame *keyframe);
246         void read_data(KeyFrame *keyframe);
247         void calculate_extents();
248         double calculate_max_z(double a, int r);
249
250         int w;
251         int h;
252         int center_x;
253         int center_y;
254         int center_x1;
255         int center_y1;
256         int center_x2;
257         int center_y2;
258         int radius_x;
259         int radius_y;
260         int distance_x;
261         int distance_y;
262         int feather;
263         int feather_x1;
264         int feather_x2;
265
266         Fuse360Engine *engine;
267         AffineEngine *affine;
268 };
269
270
271
272 #endif