]> git.sesse.net Git - movit/blob - effect.h
623915b8cd5fea8e4d3ed90fe70679d55ee7d336
[movit] / effect.h
1 #ifndef _EFFECT_H
2 #define _EFFECT_H 1
3
4 #include <map>
5 #include <string>
6
7 // Can alias on a float[3].
8 struct RGBTriplet {
9         RGBTriplet(float r, float g, float b)
10                 : r(r), g(g), b(b) {}
11
12         float r, g, b;
13 };
14
15 class Effect {
16 public: 
17         virtual bool needs_linear_light() { return true; }
18         virtual bool needs_srgb_primaries() { return true; }
19         virtual bool needs_many_samples() { return false; }
20         virtual bool needs_mipmaps() { return false; }
21         virtual std::string output_glsl() = 0;
22
23         // Neither of these take ownership.
24         bool set_int(const std::string&, int value);
25         bool set_float(const std::string &key, float value);
26         bool set_vec3(const std::string &key, const float *values);
27
28 protected:
29         // Neither of these take ownership.
30         void register_int(const std::string &key, int *value);
31         void register_float(const std::string &key, float *value);
32         void register_vec3(const std::string &key, float *values);
33         
34 private:
35         std::map<std::string, int *> params_int;
36         std::map<std::string, float *> params_float;
37         std::map<std::string, float *> params_vec3;
38 };
39
40 #endif // !defined(_EFFECT_H)