Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simple user interface for interacting with models #92

Open
mondus opened this issue Jul 14, 2022 · 4 comments
Open

Simple user interface for interacting with models #92

mondus opened this issue Jul 14, 2022 · 4 comments

Comments

@mondus
Copy link
Member

mondus commented Jul 14, 2022

Suggest a couple of utility functions which would add control to a movable UI window rendered with OpenGL.

addUISliderControl(name_of_env_var, min_range, max_range): This should create a slider element in the UI so that the environment property (float or int) can be varied interactively. E.g. Boids rule weights.

addUIToggleControl(callback): This should create a toggle button element in the UI so that the environment property (int or bool) can be varied interactively. E.g. Exit open/closed.

There are some nice simple libraries for this e.g. https://github.com/wjakob/nanogui Although this wouldn't be overly difficult to implement from scratch.

@mondus
Copy link
Member Author

mondus commented Jul 20, 2022

@MILeach Has used https://github.com/ocornut/imgui which seems like a good candidate library.

@Robadob
Copy link
Member

Robadob commented Aug 6, 2022

Sliders don't work, would require users to additionally specify min/max/step, alot of extra hassle.

Probably easier to just allow users to type in a new value.

Need to complete #17 first, shouldn't be too difficult after that.

@Robadob
Copy link
Member

Robadob commented Aug 18, 2022

cc @mondus

Main question is whether users should be able to create multiple distinct UI panels, or only one.

In both cases, probably want to move customisation into a distinct class to save cluttering ModelVis further.

All customisation should largely consist of a direct mapping to IMGUI features, with some extra fudge to pull in the correct data. Maybe I'm blind, but I can't find a clear documentation list of the UI elements supports (widgets), short of just reading the header imgui.h.

/**
 * This provides an interface for managing the render options for a specific CUDASimulation
 */
class ModelVis {
     ...
     /**
      * Add a customisable user interface panel to the visualisation
      *
      * Each panel can be moved around the screen/minimised with custom elements representing environment properties added
      * @param panel_title The string that will be visible in the title of the panel
      */
     PanelVis newUIPanel(const std::string &panel_title);
};
/**
 * This provides an interface for constructing visualisation UI panels.
 * Elements added will appear vertically in the same order that they are added
 */
class PanelVis {
     /**
      * Add a slider which displays the named environment property and allows it's value to be updated
      *
      * @param property_name Name of the affected environment property
      * @param min Minimum value of the slider
      * @param max Maximum value of the slider
      * @param steps Number of steps available on the slider
      * @throw exception::InvalidProperty When a slider has already been defined (in any UI for this property)
      */
     template<typename T>
     void newEnvironmentPropertySlider(const std::string &property_name, T min, T max, unsigned int steps);
     /**
      * Add a label which displays the named environment property's value 
      *
      * @param property_name Name of the affected environment property
      */
     void newEnvironmentPropertyLabel(const std::string &property_name);
     /**
      * Add a label containing a fixed string
      *
      * @param label_text Text of the label
      */
     void newStaticLabel(const std::string &label_text);
     ...  // Whatever other UI elements we decide to support
};

@mondus
Copy link
Member Author

mondus commented Aug 18, 2022

Interface looks good. I would suggest for now a single UI Panel only with the ability to toggle its view on or off using a keyboard binding. Label should support multi line to allow a model like description to be displayed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants