shader-demo: change easing and adjust zoom location

pull/3471/head
kallaballa 2 years ago
parent 4ccb64de0d
commit 24bd0af08c
  1. 10
      src/shader/shader-demo.cpp

@ -24,8 +24,8 @@ float alpha = 1.0f; //0.0-1.0
//contrast boost
int contrast_boost = 15; //0.0-255
int max_iterations = 500;
float center_x = -0.12;
float center_y = 0.132;
float center_x = -0.1196;
float center_y = 0.1325;
float zoom = 1.0;
float zoom_add = 0.99;
long iterations = 0;
@ -247,6 +247,10 @@ void load_shader(){
shader_program_hdl = init_shader(vert.c_str(), frag.c_str(), "fragColor");
}
float easeInOutQuint(float x) {
return x < 0.5f ? 16.0f * x * x * x * x * x : 1.0f - std::pow(-2.0f * x + 2.0f, 5.0f) / 2.0f;
}
float easeInOutQubic(float x) {
return x < 0.5f ? 4.0f * x * x * x : 1.0f - std::pow(-2.0f * x + 2.0f, 3.0f) / 2.0f;
}
@ -285,7 +289,7 @@ void render_scene(const cv::Size& sz) {
glUniform1i(max_iterations_hdl, max_iterations);
glUniform1f(center_y_hdl, center_y);
glUniform1f(center_x_hdl, center_x);
glUniform1f(zoom_hdl, easeInOutSine(zoom+=zoom_add));
glUniform1f(zoom_hdl, easeInOutQuint(zoom+=zoom_add));
#ifndef __EMSCRIPTEN__
glBindVertexArray(VAO);

Loading…
Cancel
Save