4 * Copyright (C) 2017 Adam Williams <broadcast at earthling dot net>
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.
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.
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
29 #include "loadbalance.h"
30 #include "pluginvclient.h"
34 class SphereCamEngine;
41 class SphereCamSlider : public BC_FSlider
44 SphereCamSlider(SphereCamMain *client,
55 SphereCamMain *client;
60 class SphereCamText : public BC_TextBox
63 SphereCamText(SphereCamMain *client,
65 SphereCamSlider *slider,
72 SphereCamMain *client;
73 SphereCamSlider *slider;
78 class SphereCamToggle : public BC_CheckBox
81 SphereCamToggle(SphereCamMain *client,
88 SphereCamMain *client;
93 class SphereCamMode : public BC_PopupMenu
96 SphereCamMode(SphereCamMain *plugin,
101 void create_objects();
102 static int calculate_w(SphereCamGUI *gui);
103 static int from_text(char *text);
104 static const char* to_text(int mode);
105 void update(int mode);
106 SphereCamMain *plugin;
111 class SphereCamGUI : public PluginClientWindow
114 SphereCamGUI(SphereCamMain *client);
117 void create_objects();
119 SphereCamMain *client;
120 SphereCamToggle *enabled[EYES];
121 SphereCamSlider *fov_slider[EYES];
122 SphereCamText *fov_text[EYES];
123 SphereCamSlider *radius_slider[EYES];
124 SphereCamText *radius_text[EYES];
125 SphereCamSlider *centerx_slider[EYES];
126 SphereCamText *centerx_text[EYES];
127 SphereCamSlider *centery_slider[EYES];
128 SphereCamText *centery_text[EYES];
129 SphereCamSlider *rotatex_slider[EYES];
130 SphereCamText *rotatex_text[EYES];
131 SphereCamSlider *rotatey_slider[EYES];
132 SphereCamText *rotatey_text[EYES];
133 SphereCamSlider *rotatez_slider[EYES];
134 SphereCamText *rotatez_text[EYES];
135 SphereCamSlider *feather_slider;
136 SphereCamText *feather_text;
139 SphereCamToggle *draw_guides;
142 class SphereCamConfig
146 int equivalent(SphereCamConfig &that);
147 void copy_from(SphereCamConfig &that);
148 void interpolate(SphereCamConfig &prev,
149 SphereCamConfig &next,
152 int64_t current_frame);
159 // radius of each eye 1-150
161 // center of 2 eyes 0-100
162 float center_x[EYES];
163 float center_y[EYES];
165 float rotate_x[EYES];
166 float rotate_y[EYES];
167 float rotate_z[EYES];
168 // amount to feather eye edges 0-50
176 // the standard algorithm
187 class SphereCamPackage : public LoadPackage
195 class SphereCamUnit : public LoadClient
198 SphereCamUnit(SphereCamEngine *engine, SphereCamMain *plugin);
202 void process_package(LoadPackage *package);
203 void process_equirect(SphereCamPackage *pkg);
204 void process_align(SphereCamPackage *pkg);
205 double calculate_max_z(double a, double r);
208 SphereCamEngine *engine;
209 SphereCamMain *plugin;
212 class SphereCamEngine : public LoadServer
215 SphereCamEngine(SphereCamMain *plugin);
218 void init_packages();
219 LoadClient* new_client();
220 LoadPackage* new_package();
222 SphereCamMain *plugin;
225 class SphereCamMain : public PluginVClient
228 SphereCamMain(PluginServer *server);
231 PLUGIN_CLASS_MEMBERS2(SphereCamConfig)
232 int process_buffer(VFrame *frame,
233 int64_t start_position,
235 void draw_feather(int left, int right, int eye, int y);
238 void save_data(KeyFrame *keyframe);
239 void read_data(KeyFrame *keyframe);
240 void calculate_extents();
241 double calculate_max_z(double a, int r);
243 // config values converted to pixels
247 // the center of the output regions, shifted by the rotations
250 // The output of each eye is split into 2 halves so it can wrap around
259 // the center of the input regions
262 // radius of the input regions for drawing the guide only
264 // pixels to add to the output regions
267 SphereCamEngine *engine;
268 AffineEngine *affine;