X-Git-Url: https://git.sesse.net/?p=movit;a=blobdiff_plain;f=slice_effect.h;h=9886df7e5c4e463b2c99cefc48b3d74d8987bed9;hp=1c363ea7b104c19ccd31a6e82a74b50f95ec16c1;hb=eff011224abc5dc81f801f3ea44572287a55bcac;hpb=97f04cf3de39851ba0808aace31866afa9a9f500 diff --git a/slice_effect.h b/slice_effect.h index 1c363ea..9886df7 100644 --- a/slice_effect.h +++ b/slice_effect.h @@ -7,8 +7,8 @@ // discard roles, where one does convolutions by means of many small FFTs, but // could also work as a (relatively boring) video effect on its own. // -// Note that vertical slices happen from the bottom, not the top, due to the -// OpenGL coordinate system. +// Note that vertical slices happen from the top, consistent with the rest of +// Movit. #include #include @@ -20,16 +20,17 @@ namespace movit { class SliceEffect : public Effect { public: SliceEffect(); - virtual std::string effect_type_id() const { return "SliceEffect"; } - std::string output_fragment_shader(); - virtual bool needs_texture_bounce() const { return true; } - virtual bool changes_output_size() const { return true; } - virtual void inform_input_size(unsigned input_num, unsigned width, unsigned height); - virtual void get_output_size(unsigned *width, unsigned *height, - unsigned *virtual_width, unsigned *virtual_height) const; - - void set_gl_state(GLuint glsl_program_num, const std::string &prefix, unsigned *sampler_num); - virtual void inform_added(EffectChain *chain) { this->chain = chain; } + std::string effect_type_id() const override { return "SliceEffect"; } + std::string output_fragment_shader() override; + bool needs_texture_bounce() const override { return true; } + bool changes_output_size() const override { return true; } + bool sets_virtual_output_size() const override { return false; } + void inform_input_size(unsigned input_num, unsigned width, unsigned height) override; + void get_output_size(unsigned *width, unsigned *height, + unsigned *virtual_width, unsigned *virtual_height) const override; + + void set_gl_state(GLuint glsl_program_num, const std::string &prefix, unsigned *sampler_num) override; + void inform_added(EffectChain *chain) override { this->chain = chain; } enum Direction { HORIZONTAL = 0, VERTICAL = 1 }; @@ -37,7 +38,11 @@ private: EffectChain *chain; int input_width, input_height; int input_slice_size, output_slice_size; + int offset; Direction direction; + + float uniform_output_coord_to_slice_num, uniform_slice_num_to_input_coord; + float uniform_slice_offset_to_input_coord, uniform_offset; }; } // namespace movit