Julia fractal x,y slider labels
This commit is contained in:
@@ -51,6 +51,8 @@ inline void Lerped<float>::Update(float elapsed) { current = Math::Lerp(current,
|
||||
template <>
|
||||
inline void Lerped<Vector2>::Update(float elapsed) { current = Vector2::Lerp(current, goal, elapsed*rate); }
|
||||
|
||||
|
||||
|
||||
/// This class represents the FractalApp program state.
|
||||
class FractalInspectorApp : public ReWindow::OpenGLWindow {
|
||||
protected:
|
||||
@@ -67,6 +69,12 @@ protected:
|
||||
JGL::Shader mandelbrot_shader;
|
||||
JGL::Shader julia_shader;
|
||||
JGL::RenderTarget *canvas;
|
||||
|
||||
JUI::Slider* julia_x_slider;
|
||||
JUI::Slider* julia_y_slider;
|
||||
JUI::Text* julia_x_label;
|
||||
JUI::Text* julia_y_label;
|
||||
|
||||
float u_time;
|
||||
float u_scale = 2.f;
|
||||
float u_scale_goal = 2.f;
|
||||
@@ -196,7 +204,6 @@ public:
|
||||
}
|
||||
|
||||
void TakeScreenshot();
|
||||
|
||||
protected:
|
||||
private:
|
||||
};
|
||||
|
@@ -358,21 +358,36 @@ void FractalInspectorApp::CreateMenu() {
|
||||
juliaset_dialog->Size({900_px, 70_px});
|
||||
juliaset_dialog->Close(); // Defaults to close.
|
||||
|
||||
auto* julia_x_slider = new JUI::Slider(juliaset_dialog->Content());
|
||||
julia_x_slider = new JUI::Slider(juliaset_dialog->Content());
|
||||
julia_x_label = new JUI::Text(julia_x_slider);
|
||||
|
||||
julia_x_label->AlignCenterHorizontally();
|
||||
julia_x_label->AlignTop();
|
||||
julia_x_label->SetTextColor(Colors::Black);
|
||||
julia_x_label->SetContent("X: 0");
|
||||
|
||||
julia_x_slider->Size({900_px, 25_px});
|
||||
julia_x_slider->Interval(1e-5f); julia_x_slider->Minimum(0); julia_x_slider->Maximum(1);
|
||||
julia_x_slider->ValueChanged += [this] (double value) {
|
||||
julia_x_label->SetContent(std::format("X: {}", Math::FloorInt(value*360)));
|
||||
value = value * 2;
|
||||
value = value - 1;
|
||||
u_julia_set.x = value;
|
||||
};
|
||||
|
||||
auto* julia_y_slider = new JUI::Slider(juliaset_dialog->Content());
|
||||
julia_y_slider = new JUI::Slider(juliaset_dialog->Content());
|
||||
julia_y_label = new JUI::Text(julia_y_slider);
|
||||
|
||||
julia_y_label->AlignCenterHorizontally();
|
||||
julia_y_label->AlignTop();
|
||||
julia_y_label->SetTextColor(Colors::Black);
|
||||
julia_y_label->SetContent("Y: 0");
|
||||
|
||||
julia_y_slider->Size({900_px, 25_px});
|
||||
julia_y_slider->Position({0_px, 30_px});
|
||||
julia_y_slider->Interval(1e-5f); julia_y_slider->Minimum(0); julia_y_slider->Maximum(1);
|
||||
julia_y_slider->ValueChanged += [this] (double value) {
|
||||
julia_y_label->SetContent(std::format("Y: {}", Math::FloorInt(value*360)));
|
||||
value = value * 2;
|
||||
value = value - 1;
|
||||
u_julia_set.y = value;
|
||||
@@ -601,6 +616,7 @@ void FractalInspectorApp::Draw() {
|
||||
J2D::DrawRenderTarget(canvas, {0, 0});
|
||||
J2D::End();
|
||||
|
||||
// This is annoying, leaving note here to comment it out when I work on this - maxine
|
||||
J2D::Begin();
|
||||
|
||||
const float N = 512.f;
|
||||
|
Reference in New Issue
Block a user