Graphite
Version 3
An experimental 3D geometry processing program
|
Classes | |
struct | ColormapInfo |
Public Member Functions | |
SimpleApplication (const std::string &name) | |
SimpleApplication constructor. More... | |
~SimpleApplication () override | |
SimpleApplication destructor. | |
void | draw_gui () override |
This function is called when the GUI should be redisplayed. More... | |
void | draw_graphics () override |
This function is called when the 3d content should be redisplayed. More... | |
virtual bool | save (const std::string &filename) |
Saves the current content to a file. More... | |
virtual bool | load (const std::string &filename) |
Loads a file. More... | |
TextEditor & | text_editor () |
Gets the text editor. More... | |
void | show_text_editor () |
Shows the text editor. | |
void | hide_text_editor () |
Hides the text editor. | |
void | show_console () |
Shows the console. | |
void | hide_console () |
Hides the console. | |
void | home () |
Restores default viewing parameters. | |
void | set_style (const std::string &style) override |
Sets the style of the application. More... | |
void | set_region_of_interest (double xmin, double ymin, double zmin, double xmax, double ymax, double zmax) |
Sets the region of interest. More... | |
void | get_region_of_interest (double &xmin, double &ymin, double &zmin, double &xmax, double &ymax, double &zmax) const |
Gets the region of interest. More... | |
void | zoom_in () |
void | zoom_out () |
void | set_clipping (bool x) |
void | set_lighting (bool x) |
void | set_background_color (const vec4f &color) |
virtual bool | exec_command (const char *command) |
vec3 | project (const vec3 &p) |
Projects a point from model space to window coordinates. More... | |
vec3 | unproject (const vec3 &p) |
Unprojects a 3d point from window coordinates to model space. More... | |
vec2 | unproject_2d (const vec2 &p) |
Unprojects a 2d point from window coordinates to model space. More... | |
void | drop_callback (int nb, const char **f) override |
Callback called whenever files are dropped in the window. More... | |
Public Member Functions inherited from GEO::Application | |
Application (const std::string &name) | |
Application constructor. More... | |
virtual | ~Application () |
Application destructor. | |
const std::string & | name () const |
Gets the name of this application. More... | |
virtual void | start (int argc=0, char **argv=nullptr) |
Starts the main event loop of the application. More... | |
virtual void | stop () |
Stops the application. | |
const std::string & | get_style () const |
Gets the style. More... | |
void | set_font_size (index_t value) |
Sets the font size. More... | |
index_t | get_font_size () const |
Gets the font size. More... | |
virtual void | update () |
Indicates that the main window should be redrawn. | |
void | draw_dock_space () |
Draws a dockspace that fills the current window. | |
void | lock_updates () |
Lock updates. More... | |
void | unlock_updates () |
Unlock updates. | |
virtual void | draw () |
Redraws the main window. More... | |
double | scaling () const |
Gets the global scaling to be applied to all GUI elements. More... | |
void | set_full_screen_mode (index_t w=0, index_t h=0, index_t hz=0, index_t monitor=0) |
Sets full-screen mode. More... | |
void | set_windowed_mode (index_t w=0, index_t h=0) |
Sets windowed mode. More... | |
void | list_video_modes () |
Lists the video modes that can be used for set_full_screen_mode() More... | |
void | iconify () |
Iconifies this application. | |
void | restore () |
Restores this application. | |
void | set_gui_state (std::string x) |
Sets the gui state. More... | |
std::string | get_gui_state () const |
Gets the gui state. More... | |
void | set_full_screen (bool x) |
Sets full-screen mode. More... | |
bool | get_full_screen () const |
Tests whether this application is in full-screen mode. More... | |
index_t | get_width () const |
Gets the width of the window. More... | |
index_t | get_height () const |
Gets the height of the window. More... | |
index_t | get_frame_buffer_width () const |
Gets the width of the window. More... | |
index_t | get_frame_buffer_height () const |
Gets the height of the window. More... | |
void | set_accept_drops (bool value) |
Sets whether drag and drop events should be taken into account. More... | |
bool | get_accept_drops () const |
Tests whether drag and drop events are taken into account. More... | |
void | set_window_icon (Image *image) |
Sets the icon of the window. More... | |
void | restart_gui () |
Restarts the gui. More... | |
ApplicationData * | impl_data () |
Gets a pointer to the implementation-specific data. More... | |
void * | impl_window () |
Gets a pointer to the implementation-specific window. More... | |
double | hidpi_scaling () const |
MacOS non-sense. More... | |
double | pixel_ratio () const |
More MacOS non-sense. More... | |
void | reset_soft_keyboard_flag () |
Used internally. | |
const char * | key_to_string (int key) |
Converts a key to a symbolic string with the name of the key. More... | |
virtual void | pre_draw () |
This function is called before starting drawing operations. More... | |
virtual bool | needs_to_redraw () const |
Tests whether the window needs to be redrawn. More... | |
virtual void | create_window () |
Creates the window using GLFW. | |
virtual void | delete_window () |
Deletes the window created by GLFW. | |
virtual void | one_frame () |
Draws one frame. More... | |
virtual void | main_loop () |
Enters the main application loop. More... | |
virtual void | ImGui_load_fonts () |
Loads the fonts in ImGui. | |
virtual void | ImGui_terminate () |
Deallocates objects used by the ImGui library. | |
virtual void | ImGui_new_frame () |
Notifies ImGui that a new frame has just started. | |
void | callbacks_initialize () |
Initializes the callbacks if not already initialized. | |
const std::vector< std::string > & | filenames () const |
Gets all the filenames specified on the command line. More... | |
bool | animate () const |
bool * | animate_ptr () |
void | start_animation () |
void | stop_animation () |
Static Public Member Functions | |
static SimpleApplication * | instance () |
Static Public Member Functions inherited from GEO::Application | |
static Application * | instance () |
Gets the instance. More... | |
static std::string | get_styles () |
Gets the possible styles. More... | |
Protected Types | |
enum | MouseOp { MOUSE_NOOP , MOUSE_ROTATE , MOUSE_TRANSLATE , MOUSE_ZOOM } |
enum | MouseTarget { MOUSE_NOTARGET , MOUSE_OBJECT , MOUSE_LIGHT , MOUSE_CLIP } |
Protected Member Functions | |
void | add_key_func (const std::string &key, std::function< void()> cb, const char *help=nullptr) |
Declares a function to be triggered when a key is pressed. More... | |
void | add_key_toggle (const std::string &key, bool *p_val, const char *help=nullptr) |
Declares a boolean to be toggled when a key is pressed. More... | |
void | char_callback (unsigned int c) override |
Callback called whenever a key is pushed (high level version) More... | |
void | key_callback (int key, int scancode, int action, int mods) override |
Callback called whenever a key is pushed (low level version) More... | |
void | mouse_button_callback (int button, int action, int mods, int source) override |
Callback called whenenver a mouse button changed. More... | |
void | cursor_pos_callback (double x, double y, int source) override |
Callback called whenever the mouse cursor is moved. More... | |
void | scroll_callback (double xoffset, double yoffset) override |
Callback called whenenver the mouse wheel is moved. More... | |
virtual void | draw_scene_begin () |
Setups OpenGL for scene drawing. | |
virtual void | draw_scene () |
Draws the scene. | |
virtual void | draw_scene_end () |
Cleanups OpenGL after scene drawing. | |
virtual void | draw_viewer_properties_window () |
Draws the viewer properties window frame and contents. | |
virtual void | draw_viewer_properties () |
Draws the contents of viewer properties window. | |
virtual void | draw_object_properties_window () |
Draw the object properties window frame and contents. | |
virtual void | draw_object_properties () |
Draws the contents of the object properties window. | |
virtual void | draw_command_window () |
Draws the active command window if any. | |
virtual void | draw_console () |
Draws the console. | |
virtual void | draw_menu_bar () |
Draws the menu bar. | |
virtual void | draw_load_menu () |
Draws the load menu and browser. | |
virtual void | draw_save_menu () |
Draws the save menu. | |
virtual void | draw_fileops_menu () |
Draws other file operation menu. More... | |
virtual void | draw_about () |
Draws the about box in the file menu. | |
virtual void | draw_help () |
Draws help info (accelarators) | |
virtual void | draw_windows_menu () |
Draws the windows menu. | |
virtual void | draw_application_menus () |
Draws the application menus. More... | |
virtual void | draw_application_icons () |
Draws the application icons on the menubar. More... | |
void | post_draw () override |
This function is called after all drawing operations. More... | |
virtual bool | can_load (const std::string &filename) |
Tests whether a file can be loaded. More... | |
virtual std::string | supported_read_file_extensions () |
Gets the list of supported file extensions for reading. More... | |
virtual std::string | supported_write_file_extensions () |
Gets the list of supported file extensions for writing. More... | |
ImTextureID | convert_to_ImTextureID (GLuint gl_texture_id_in) |
Converts an OpenGL texture ID into an ImGUI texture ID. More... | |
void | GL_initialize () override |
Initializes OpenGL and GLUP objects. More... | |
void | GL_terminate () override |
Deallocates OpenGL and GLUP objects. More... | |
void | browse (const std::string &path, bool subdirs=false) |
Recursively browses a directory and generates menu items. More... | |
void | geogram_initialize (int argc, char **argv) override |
void | set_default_filename (const std::string &filename) |
Sets the default filename used to save the current file. More... | |
void | init_colormap (const std::string &name, const char **xpm_data) |
Initializes a new colormap from name and xpm data. More... | |
void | init_colormaps () |
Initializes all the default colormaps. More... | |
void | ImGui_initialize () override |
Initializes the ImGui library. More... | |
void | set_2d () |
void | set_3d () |
void | set_default_layout () |
void | resize (index_t w, index_t h, index_t fb_w, index_t fb_h) override |
Called whenever window size changes. More... | |
virtual const char * | default_layout () const |
virtual const char * | default_layout_android_vertical () const |
virtual const char * | default_layout_android_horizontal () const |
Static Protected Member Functions | |
static void | replay_latest_command () |
Protected Attributes | |
bool | locked_ |
bool | lighting_ |
bool | edit_light_ |
bool | clipping_ |
GLUPclipMode | clip_mode_ |
bool | edit_clip_ |
bool | fixed_clip_ |
GLenum | effect_ |
vec4f | background_color_ |
bool | viewer_properties_visible_ |
bool | object_properties_visible_ |
bool | console_visible_ |
bool | text_editor_visible_ |
bool | use_text_editor_ |
Box | roi_ |
double | roi_radius_ |
vec3 | object_translation_ |
ArcBall | object_rotation_ |
ArcBall | light_rotation_ |
ArcBall | clip_rotation_ |
vec3 | clip_translation_ |
bool | three_D_ |
double | zoom_ |
double | zoom_down_ |
bool | props_pinned_ |
enum GEO::SimpleApplication::MouseOp | mouse_op_ |
enum GEO::SimpleApplication::MouseTarget | mouse_target_ |
vec2 | mouse_down_xy_ |
vec2 | mouse_xy_ |
GLint | viewport_ [4] |
mat4 | modelview_transpose_ |
mat4 | project_transpose_ |
std::string | path_ |
std::string | current_file_ |
char | filename_ [geo_imgui_string_length] |
GLuint | geogram_logo_texture_ |
Console_var | console_ |
StatusBar_var | status_bar_ |
TextEditor | text_editor_ |
std::map< std::string, std::function< void()> > | key_funcs_ |
std::map< std::string, std::string > | key_funcs_help_ |
vector< ColormapInfo > | colormaps_ |
FullScreenEffectImpl_var | full_screen_effect_ |
lua_State * | lua_state_ |
bool | lua_error_occured_ |
Protected Attributes inherited from GEO::Application | |
bool | ImGui_firsttime_init_ |
bool | menubar_visible_ |
bool | phone_screen_ |
bool | soft_keyboard_visible_ |
Definition at line 61 of file simple_application.h.
GEO::SimpleApplication::SimpleApplication | ( | const std::string & | name | ) |
SimpleApplication constructor.
[in] | name | the name of the application. |
|
protected |
Declares a function to be triggered when a key is pressed.
[in] | key | the key ("a" for a, "F1" for F1) |
[in] | cb | the function to be called |
[in] | help | an optional help string |
|
protected |
Declares a boolean to be toggled when a key is pressed.
[in] | key | the key ("a" for a, "F1" for F1) |
[in] | p_val | a pointer to the boolean |
[in] | help | an optional help string |
|
protected |
Recursively browses a directory and generates menu items.
[in] | path | the path to be browsed |
[in] | subdirs | if true, browse subdirectories as well |
|
protectedvirtual |
Tests whether a file can be loaded.
This function can be used to filter the files displayed in the "Load..." menu. Baseclass implementation always return true. Derived classes may overload it and return false for files with unknown extensions.
|
overrideprotectedvirtual |
Callback called whenever a key is pushed (high level version)
[in] | c | the ASCII code of the character that corresponds to the pushed key. |
Reimplemented from GEO::Application.
|
protected |
Converts an OpenGL texture ID into an ImGUI texture ID.
[in] | gl_texture_id_in | the OpenGL texture ID |
|
overrideprotectedvirtual |
Callback called whenever the mouse cursor is moved.
[in] | x,y | the new position of the mouse cursor. |
[in] | source | the event source (one of EVENT_SOURCE_MOUSE, EVENT_SOURCE_FINGER, EVENT_SOURCE_STYLUS) |
Reimplemented from GEO::Application.
|
protectedvirtual |
Draws the application icons on the menubar.
Meant to be overloaded by derived classes.
|
protectedvirtual |
Draws the application menus.
Meant to be overloaded by derived classes.
|
protectedvirtual |
Draws other file operation menu.
Default implementation does nothing. It can be overloaded to add other menu items in the file menu.
|
overridevirtual |
This function is called when the 3d content should be redisplayed.
This function is meant to be overloaded by subclasses. default implementation does nothing.
Reimplemented from GEO::Application.
|
overridevirtual |
This function is called when the GUI should be redisplayed.
This function is meant to be overloaded by subclasses. default implementation does nothing.
Reimplemented from GEO::Application.
|
overridevirtual |
Callback called whenever files are dropped in the window.
[in] | nb | number of files. |
[in] | f | the array of file names. |
Reimplemented from GEO::Application.
|
overrideprotectedvirtual |
Reimplemented from GEO::Application.
Reimplemented in GEO::SimpleMeshApplication.
void GEO::SimpleApplication::get_region_of_interest | ( | double & | xmin, |
double & | ymin, | ||
double & | zmin, | ||
double & | xmax, | ||
double & | ymax, | ||
double & | zmax | ||
) | const |
Gets the region of interest.
[out] | xmin,ymin,zmin,xmax,ymax,zmax | the bounds of the region of interest. |
|
overrideprotectedvirtual |
Initializes OpenGL and GLUP objects.
Reimplemented from GEO::Application.
Reimplemented in GEO::SimpleMeshApplication.
|
overrideprotectedvirtual |
Deallocates OpenGL and GLUP objects.
Reimplemented from GEO::Application.
Reimplemented in GEO::SimpleMeshApplication.
|
overrideprotectedvirtual |
Initializes the ImGui library.
Reimplemented from GEO::Application.
|
protected |
Initializes a new colormap from name and xpm data.
This function can be called only once the OpenGL context is ready, for instance in the init_graphics() function.
[in] | name | the name of the colormap |
[in] | xpm_data | the image data of the colormap. |
|
protected |
Initializes all the default colormaps.
This function can be called only once the OpenGL context is ready, for instance in the init_graphics() function.
|
overrideprotectedvirtual |
Callback called whenever a key is pushed (low level version)
[in] | key | key code (window system specific) |
[in] | scancode | scan code (window system specific) |
[in] | action | push or release (window system specific) |
[in] | mods | current key modifieds (window system specific) |
Reimplemented from GEO::Application.
|
virtual |
Loads a file.
Baseclass implementation does nothing. Derived classes may overload this function.
true | if the file could be sucessfully loaded |
false | otherwise |
Reimplemented in GEO::SimpleMeshApplication.
|
overrideprotectedvirtual |
Callback called whenenver a mouse button changed.
[in] | button | the button |
[in] | action | the action (one of EVENT_ACTION_UP, EVENT_ACTION_DOWN, EVENT_ACTION_DRAG) |
[in] | mods | the current key modifiers (not implemented yet) |
[in] | source | the event source (one of EVENT_SOURCE_MOUSE, EVENT_SOURCE_FINGER, EVENT_SOURCE_STYLUS) |
Reimplemented from GEO::Application.
|
overrideprotectedvirtual |
This function is called after all drawing operations.
It can be used to execute queued commands.
Reimplemented from GEO::Application.
Projects a point from model space to window coordinates.
[in] | p | the point in model space coordinates. |
|
overrideprotectedvirtual |
Called whenever window size changes.
[in] | w,h | the new window width and height in pixels. |
[in] | fb_w,fb_h | the new framebuffer width and height in pixels. |
Called whenenver the size of the window does not match the current size.
Reimplemented from GEO::Application.
|
virtual |
Saves the current content to a file.
Baseclass implementation does nothing. Derived classes may overload this function.
true | if the file could be sucessfully saved. |
false | otherwise |
Reimplemented in GEO::SimpleMeshApplication.
|
overrideprotectedvirtual |
Callback called whenenver the mouse wheel is moved.
[in] | xoffset,yoffset | wheel displacement |
Reimplemented from GEO::Application.
|
inlineprotected |
Sets the default filename used to save the current file.
[in] | filename | the default filename. |
Definition at line 449 of file simple_application.h.
void GEO::SimpleApplication::set_region_of_interest | ( | double | xmin, |
double | ymin, | ||
double | zmin, | ||
double | xmax, | ||
double | ymax, | ||
double | zmax | ||
) |
Sets the region of interest.
This defines the default target of the camera
[in] | xmin,ymin,zmin,xmax,ymax,zmax | the bounds of the region of interest. |
|
overridevirtual |
Sets the style of the application.
[in] | value | one of Dark, Light, DarkGray, LightGray |
Reimplemented from GEO::Application.
|
protectedvirtual |
Gets the list of supported file extensions for reading.
This function may be olverloaded by derived class. Base class implementation returns "". If this function returns "", then no "Load..." option is displayed in the "File" menu.
Reimplemented in GEO::SimpleMeshApplication.
|
protectedvirtual |
Gets the list of supported file extensions for writing.
This function may be olverloaded by derived class. Base class implementation returns "". If this function returns "", then no "Save..." option is displayed in the "File" menu. If it returns a colon-separated list of extensions, then the "Save..." option displays a list of possible file names for each supported extension.
Reimplemented in GEO::SimpleMeshApplication.
|
inline |
Gets the text editor.
Definition at line 107 of file simple_application.h.
Unprojects a 3d point from window coordinates to model space.
[in] | p | the 3d point in window coordinates, that is [0,width-1] x [0,height-1] |
Unprojects a 2d point from window coordinates to model space.
[in] | p | the 2d point in screen space coordinates. |
|
protected |
Zoom when mouse down.
Definition at line 519 of file simple_application.h.