2 #define _FLAT_INPUT_H 1
6 // A FlatInput is the normal, “classic” case of an input, where everything
7 // comes from a single 2D array with chunky pixels.
8 class FlatInput : public Input {
10 FlatInput(ImageFormat format, unsigned width, unsigned height);
12 // Create the texture itself. We cannot do this in the constructor,
13 // because we don't necessarily know all the settings (sRGB texture,
14 // mipmap generation) at that point.
17 std::string output_fragment_shader();
19 // Uploads the texture if it has changed since last time.
20 void set_gl_state(GLuint glsl_program_num, const std::string& prefix, unsigned *sampler_num);
22 ColorSpace get_color_space() { return image_format.color_space; }
23 GammaCurve get_gamma_curve() { return image_format.gamma_curve; }
25 // Tells the input where to fetch the actual pixel data. Note that if you change
26 // this data, you must either call set_pixel_data() again (using the same pointer
27 // is fine), or invalidate_pixel_data(). Otherwise, the texture won't be re-uploaded
28 // on subsequent frames.
29 void set_pixel_data(const unsigned char *pixel_data)
31 this->pixel_data = pixel_data;
32 invalidate_pixel_data();
35 void invalidate_pixel_data()
40 const unsigned char *get_pixel_data() const
45 void set_pitch(unsigned pitch) {
50 unsigned get_pitch() {
55 ImageFormat image_format;
57 GLuint pbo, texture_num;
58 bool needs_update, finalized;
59 int use_srgb_texture_format, needs_mipmaps;
60 unsigned width, height, pitch, bytes_per_pixel;
61 const unsigned char *pixel_data;
64 #endif // !defined(_FLAT_INPUT_H)