1 #ifndef PRESET_FRAME_IO_HPP
2 #define PRESET_FRAME_IO_HPP
3 #include <vector>
4 #include "Renderer/MilkdropWaveform.hpp"
5 #include "Renderer/Pipeline.hpp"
6 #include "Renderer/Filters.hpp"
7 #include "CustomShape.hpp"
8 #include "CustomWave.hpp"
9 #include "Renderer/VideoEcho.hpp"
10 
11 
12 /// Container for all *read only* engine variables a preset requires to
13 /// evaluate milkdrop equations. Every preset object needs a reference to one of these.
14 class PresetInputs : public PipelineContext {
15 
16 public:
17     /* PER_PIXEL VARIBLES BEGIN */
18 
19     float x_per_pixel;
20     float y_per_pixel;
21     float rad_per_pixel;
22     float ang_per_pixel;
23 
24     /* PER_PIXEL VARIBLES END */
25 
26     float bass;
27     float mid;
28     float treb;
29     float bass_att;
30     float mid_att;
31     float treb_att;
32 
33     /* variables were added in milkdrop 1.04 */
34     int gx, gy;
35 
36     float **x_mesh;
37     float **y_mesh;
38     float **rad_mesh;
39     float **theta_mesh;
40 
41     float **origtheta;  //grid containing interpolated mesh reference values
42     float **origrad;
43     float **origx;  //original mesh
44     float **origy;
45 
46     void resetMesh();
47 
48     ~PresetInputs();
49     PresetInputs();
50 
51     /// Initializes this preset inputs given a mesh size.
52     /// \param gx the width of the mesh
53     /// \param gy the height of the mesh
54     /// \note This must be called before reading values from this class
55     void Initialize(int gx, int gy);
56 
57     /// Updates this preset inputs with the latest values from the
58     /// the pipeline context and beat detection unit
59     void update (const BeatDetect & music, const PipelineContext & context);
60 
61     private:
62 };
63 
64 
65 /// Container class for all preset writeable engine variables. This is the important glue
66 /// between the presets and renderer to facilitate smooth preset switching
67 /// Every preset object needs a reference to one of these.
68 class PresetOutputs : public Pipeline {
69 public:
70     typedef std::vector<CustomWave*> cwave_container;
71     typedef std::vector<CustomShape*> cshape_container;
72 
73     cwave_container customWaves;
74     cshape_container customShapes;
75 
76     void Initialize(int gx, int gy);
77     PresetOutputs();
78     ~PresetOutputs();
79     virtual void Render(const BeatDetect &music, const PipelineContext &context);
80     void PerPixelMath( const PipelineContext &context);
81     /* PER FRAME VARIABLES BEGIN */
82 
83     float zoom;
84     float zoomexp;
85     float rot;
86     float warp;
87 
88     float sx;
89     float sy;
90     float dx;
91     float dy;
92     float cx;
93     float cy;
94 
95     VideoEcho videoEcho;
96 
97     MilkdropWaveform wave;
98     Border border;
99     MotionVectors mv;
100     DarkenCenter darkenCenter;
101 
102     Brighten brighten;
103     Darken darken;
104     Invert invert;
105     Solarize solarize;
106 
107 
108     int gy,gx;
109     /* PER_FRAME VARIABLES END */
110 
111     float fRating;
112     float fGammaAdj;
113 
114     bool bDarkenCenter;
115     bool bRedBlueStereo;
116     bool bBrighten;
117     bool bDarken;
118     bool bSolarize;
119     bool bInvert;
120     bool bMotionVectorsOn;
121 
122     float fWarpAnimSpeed;
123     float fWarpScale;
124     float fShader;
125 
126     float **zoom_mesh;
127     float **zoomexp_mesh;
128     float **rot_mesh;
129 
130     float **sx_mesh;
131     float **sy_mesh;
132     float **dx_mesh;
133     float **dy_mesh;
134     float **cx_mesh;
135     float **cy_mesh;
136     float **warp_mesh;
137 
138     float **orig_x;  //original mesh
139     float **orig_y;
140     float **rad_mesh;
141 };
142 
143 
144 #endif
145