|
Graphite Version 3
An experimental 3D geometry processing program
|
Implementation of RenderArea using ImGui. More...
#include <OGF/skin_imgui/widgets/render_area.h>
Public Member Functions | |
| RenderArea (index_t w, index_t h, index_t fb_w, index_t fb_h) | |
| RenderArea constructor. | |
| ~RenderArea () override | |
| RenderArea destructor. | |
| void | resize (index_t w, index_t h, index_t fb_w, index_t fb_h) |
| Resizes this RenderArea. | |
| bool | needs_to_redraw () const |
| Tests whether the window needs to be redrawn. | |
| void | update () |
| Invalidates the memorized frame so that it will be updated on the next call to draw(). | |
| void | update_memorized_frame () |
| Re-generates the memorized frame. | |
| void | draw_memorized_frame () |
| Draws the latest memorized frame. | |
| void | snapshot (const std::string &filename, bool make_current=true, bool with_gui=false) |
| Saves a snapshot of this rendering area to an image file. | |
| void | update_view_parameters () |
| Call this function if perspective mode is changed. | |
| void | update_background_image_from_data (Memory::pointer ptr, Image::ColorEncoding color_encoding, Image::ComponentEncoding component_encoding, index_t width, index_t height) |
| Updates the background image from raw image data. | |
| index_t | get_height () const |
| Gets the height of the window. | |
| index_t | get_frame_buffer_width () const |
| Gets the width of the window. | |
| index_t | get_frame_buffer_height () const |
| Gets the height of the window. | |
| void | set_projection_matrix (const mat4 &value) |
| Sets the projection matrix. | |
| const mat4 & | get_projection_matrix () const |
| Gets the projection matrix. | |
| void | set_viewing_matrix (const mat4 &value) |
| Sets the viewing matrix. | |
| const mat4 & | get_viewing_matrix () const |
| Gets the viewing matrix. | |
| void | set_background_color_1 (const Color &value) |
| Sets the primary background color. | |
| const Color & | get_background_color_1 () const |
| Gets the background color. | |
| void | set_background_color_2 (const Color &value) |
| Sets the secondary background color. | |
| const Color & | get_background_color_2 () const |
| Gets the secondary background color. | |
| void | set_background_image (const std::string &value) |
| Sets the background image. | |
| const std::string & | get_background_image () const |
| Gets the background image. | |
| void | set_lighting_matrix (const mat4 &value) |
| Sets the lighting matrix. | |
| const mat4 & | get_lighting_matrix () const |
| Gets the lighting matrix. | |
| RenderingContext * | get_rendering_context () const |
| Gets the rendering context. | |
| std::string | get_gpu_information () const |
| Gets the GPU information. | |
| std::string | get_gpu_extensions () const |
| Gets GPU extensions. | |
| const std::string & | get_clipping_config () const |
| Gets the current clipping configuration. | |
| void | set_clipping_config (const std::string &clipping_config) |
| Sets the current clipping configuration. | |
| void | resize_request (RenderingContext *rendering_context, int width, int height) |
| A signal that is triggered each time the render area is resized. | |
| void | mouse_down (RenderingContext *rendering_context, const vec2 &point_ndc, const vec2 &point_wc, int button, bool control, bool shift) |
| A signal that is triggered each time a mouse button is pushed. | |
| void | mouse_move (RenderingContext *rendering_context, const vec2 &point_ndc, const vec2 &point_wc, const vec2 &delta_ndc, double delta_x_ndc, double delta_y_ndc, const vec2 &delta_wc, int button, bool control, bool shift) |
| A signal that is triggered when the mouse is dragged with a pushed button. | |
| void | mouse_up (RenderingContext *rendering_context, const vec2 &point_ndc, const vec2 &point_wc, int button, bool control, bool shift) |
| A signal that is triggered each time a mouse button is released. | |
| void | key_down (const std::string &value) |
| A signal that is triggered each time a key is pushed. | |
| void | key_up (const std::string &value) |
| A signal that is triggered each time a key is released. | |
| void | button_down (int value) |
| A signal that is triggered each time a mouse button is pressed. | |
| void | button_up (int value) |
| A signal that is triggered each time a mouse button is released. | |
| void | dropped_file (const std::string &value) |
| A signal that is triggered whenever a file is drag-dropped into this RenderArea. | |
| void | mouse_button_callback (int button, int action, int mods) |
| void | scroll_callback (double xoffset, double yoffset) |
| void | cursor_pos_callback (double xf, double yf) |
| void | drop_callback (int nb, const char **p) |
| void | char_callback (unsigned int c) |
| void | key_callback (int key, int scancode, int action, int mods) |
Public Member Functions inherited from OGF::Object | |
| Object (bool transient=false) | |
| Object constructor. | |
| ~Object () override | |
| Object destructor. | |
| virtual MetaClass * | meta_class () const |
| Gets the meta class. | |
| virtual void | set_meta_class (MetaClass *mclass) |
| Sets the meta class. | |
| unsigned int | id () const |
| Gets the identifier of this object. | |
| std::string | string_id () const |
| Gets the unique string identifier. | |
| bool | has_method (const std::string &method_name) const |
| Tests whether a method is defined. | |
| virtual bool | invoke_method (const std::string &method_name, const ArgList &args, Any &ret_val) |
| Invokes a method by method name and argument list, and gets the return value. | |
| bool | invoke_method (const std::string &method_name, const ArgList &args) |
| Invokes a method by method name and argument list. | |
| bool | invoke_method (const std::string &method_name) |
| Invokes a method by method name. | |
| bool | has_property (const std::string &prop_name) const |
| Tests whether a property is defined. | |
| virtual bool | get_property (const std::string &prop_name, std::string &prop_value) const |
| Gets a property. | |
| virtual Connection * | connect_signal_to_slot (const std::string &signal_name, Object *to, const std::string &slot_name) |
| Connects a signal with a slot of another object. | |
| virtual void | add_connection (Connection *connection) |
| Adds a connection to this object. | |
| virtual void | remove_connection (Connection *connection) |
| Removes a connection to this object. | |
| virtual void | get_element (index_t i, Any &value) const |
| Gets an element by index. | |
| virtual void | set_element (index_t i, const Any &value) |
| Sets an element by index. | |
| void | get_element (index_t item, index_t component, Any &value) const |
| Gets an element by item and component. | |
| void | set_element (index_t item, index_t component, const Any &value) |
| Sets an element by item and component. | |
| virtual void | search (const std::string &needle, const std::string &path="") |
| Displays the names of all objects that contain a substring. | |
| virtual index_t | get_dimension () const |
| Gets the number of elements per item. | |
| bool | get_signals_enabled () const |
| Tests wheter signals are enabled. | |
| void | set_signals_enabled (bool value) |
| Enables or disables signals. | |
| bool | get_slots_enabled () const |
| Tests wheter slots are enabled. | |
| void | set_slots_enabled (bool value) |
| Enables or disables slots. | |
| MetaClass * | get_meta_class () const |
| Gets the meta class. | |
| std::string | get_string_id () const |
| Gets the unique string identifier. | |
| virtual std::string | get_doc () const |
| Gets the documentation. | |
| virtual Sign | compare (const Object *other) const |
| Compares this object with another one. | |
| virtual bool | is_a (const MetaType *type) const |
| Tests whether this object inherits a given type. | |
| void | disconnect () |
| Removes all connections from signals of this objects. | |
| void | enable_signals () |
| Enables signals. | |
| void | disable_signals () |
| Disables signals. | |
| void | enable_slots () |
| Enables slots. | |
| void | disable_slots () |
| Disables slots. | |
| void | set_properties (const ArgList &args) |
| Sets several properties in a single call. | |
| virtual bool | set_property (const std::string &name, const std::string &value) |
| Sets an individual property. | |
| void | help () const |
| Displays some help about this object. | |
| virtual bool | set_property (const std::string &name, const Any &value) |
| Sets an individual property. | |
| virtual bool | get_property (const std::string &prop_name, Any &prop_value) const |
| Gets a property. | |
Public Member Functions inherited from GEO::Counted | |
| void | ref () const |
| Increments the reference count. | |
| void | unref () const |
| Decrements the reference count. | |
| bool | is_shared () const |
| Check if the object is shared. | |
| int | nb_refs () const |
| Gets the number of references that point to this object. | |
Public Attributes | |
| : void draw() | |
| : index_t get_width() const { return width_ | |
| gom_signals | : void redraw_request(RenderingContext* rendering_context=nullptr) |
Public Attributes inherited from OGF::Object | |
| : virtual index_t get_nb_elements() const | |
| : bool equals(const Object* other) const | |
Protected Member Functions | |
| void | GL_initialize () |
| Initializes OpenGL and GLUP objects. | |
| void | GL_terminate () |
| Deallocates OpenGL and GLUP objects. | |
| void | update_clipping_config () |
Protected Member Functions inherited from OGF::Object | |
| virtual bool | emit_signal (const std::string &signal_name, const ArgList &args, bool called_from_slot=false) |
| Emits a signal and calls the slots it is connected to. | |
Protected Member Functions inherited from GEO::Counted | |
| Counted () | |
| Creates a reference counted object. | |
| virtual | ~Counted () |
| Destroys a reference counted object. | |
Additional Inherited Members | |
Static Public Member Functions inherited from OGF::Object | |
| static Object * | id_to_object (unsigned int id) |
| Gets an object from a unique object id. | |
Static Public Member Functions inherited from GEO::Counted | |
| static void | ref (const Counted *counted) |
| Increments the reference count. | |
| static void | unref (const Counted *counted) |
| Decrements the reference count. | |
Implementation of RenderArea using ImGui.
Definition at line 56 of file render_area.h.
RenderArea constructor.
| [in] | w,h | window width and height in pixels. |
| [in] | fb_w,fb_h | frame buffer width and height in pixels. |
| void OGF::RenderArea::button_down | ( | int | value | ) |
A signal that is triggered each time a mouse button is pressed.
| [in] | value | the button (see MouseButton) |
| void OGF::RenderArea::button_up | ( | int | value | ) |
A signal that is triggered each time a mouse button is released.
| [in] | value | the button (see MouseButton) |
| void OGF::RenderArea::dropped_file | ( | const std::string & | value | ) |
A signal that is triggered whenever a file is drag-dropped into this RenderArea.
| [in] | value | the name of the file that was dropped |
| const Color & OGF::RenderArea::get_background_color_1 | ( | ) | const |
Gets the background color.
| const Color & OGF::RenderArea::get_background_color_2 | ( | ) | const |
Gets the secondary background color.
If different from the (primary) background color, then a color-ramp between both is generated.
| const std::string & OGF::RenderArea::get_background_image | ( | ) | const |
Gets the background image.
|
inline |
Gets the current clipping configuration.
Definition at line 306 of file render_area.h.
|
inline |
Gets the height of the window.
Definition at line 187 of file render_area.h.
|
inline |
Gets the width of the window.
Definition at line 179 of file render_area.h.
| std::string OGF::RenderArea::get_gpu_extensions | ( | ) | const |
Gets GPU extensions.
| std::string OGF::RenderArea::get_gpu_information | ( | ) | const |
Gets the GPU information.
|
inline |
Gets the height of the window.
Definition at line 171 of file render_area.h.
| const mat4 & OGF::RenderArea::get_lighting_matrix | ( | ) | const |
Gets the lighting matrix.
| const mat4 & OGF::RenderArea::get_projection_matrix | ( | ) | const |
Gets the projection matrix.
| RenderingContext * OGF::RenderArea::get_rendering_context | ( | ) | const |
Gets the rendering context.
| const mat4 & OGF::RenderArea::get_viewing_matrix | ( | ) | const |
Gets the viewing matrix.
| void OGF::RenderArea::key_down | ( | const std::string & | value | ) |
A signal that is triggered each time a key is pushed.
| [in] | value | a string with the pressed key, or "shift", "control", "alt", "left", "right", "up", "down" for special keys. |
| void OGF::RenderArea::key_up | ( | const std::string & | value | ) |
A signal that is triggered each time a key is released.
| [in] | value | a string with the pressed key, or "shift", "control", "alt", "left", "right", "up", "down" for special keys. |
| void OGF::RenderArea::mouse_down | ( | RenderingContext * | rendering_context, |
| const vec2 & | point_ndc, | ||
| const vec2 & | point_wc, | ||
| int | button, | ||
| bool | control, | ||
| bool | shift | ||
| ) |
A signal that is triggered each time a mouse button is pushed.
| [in] | rendering_context | a pointer to the RenderingContext |
| [in] | point_ndc | the picked point, in normalized device coordinates |
| [in] | point_wc | the picked point, in world coordinates |
| [in] | button | the pushed button (see MouseButton) |
| [in] | control | true if the control key is pushed |
| [in] | shift | true if the shift key is pushed |
| void OGF::RenderArea::mouse_move | ( | RenderingContext * | rendering_context, |
| const vec2 & | point_ndc, | ||
| const vec2 & | point_wc, | ||
| const vec2 & | delta_ndc, | ||
| double | delta_x_ndc, | ||
| double | delta_y_ndc, | ||
| const vec2 & | delta_wc, | ||
| int | button, | ||
| bool | control, | ||
| bool | shift | ||
| ) |
A signal that is triggered when the mouse is dragged with a pushed button.
| [in] | rendering_context | a pointer to the RenderingContext |
| [in] | point_ndc | the picked point, in normalized device coordinates |
| [in] | point_wc | the picked point, in world coordinates |
| [in] | delta_ndc | the displacement vector in normalized device coordinates |
| [in] | delta_x_ndc | the x component of the displacement vector in normalized device coordinates |
| [in] | delta_y_ndc | the y component of the displacement vector in normalized device coordinates |
| [in] | delta_wc | the displacement vector in world coordinates |
| [in] | button | the pushed button (see MouseButton) |
| [in] | control | true if the control key is pushed |
| [in] | shift | true if the shift key is pushed |
| void OGF::RenderArea::mouse_up | ( | RenderingContext * | rendering_context, |
| const vec2 & | point_ndc, | ||
| const vec2 & | point_wc, | ||
| int | button, | ||
| bool | control, | ||
| bool | shift | ||
| ) |
A signal that is triggered each time a mouse button is released.
| [in] | rendering_context | a pointer to the RenderingContext |
| [in] | point_ndc | the picked point, in normalized device coordinates |
| [in] | point_wc | the picked point, in world coordinates |
| [in] | button | the pushed button (see MouseButton) |
| [in] | control | true if the control key is pushed |
| [in] | shift | true if the shift key is pushed |
|
inline |
Tests whether the window needs to be redrawn.
| true | if the window needs to be redrawn. |
| false | if the window is up to date. |
Definition at line 86 of file render_area.h.
Resizes this RenderArea.
| [in] | w,h | the new window width and height in pixels. |
| [in] | fb_w,fb_h | the new frame buffer width and height in pixels. May be different from w and h on retina displays. |
Called whenenver the size of the window does not match the current size.
| void OGF::RenderArea::resize_request | ( | RenderingContext * | rendering_context, |
| int | width, | ||
| int | height | ||
| ) |
A signal that is triggered each time the render area is resized.
| [in] | rendering_context | a pointer to the RenderingContext |
| [in] | width | the new width |
| [in] | height | the new height |
| void OGF::RenderArea::set_background_color_1 | ( | const Color & | value | ) |
Sets the primary background color.
| [in] | value | the background color |
| void OGF::RenderArea::set_background_color_2 | ( | const Color & | value | ) |
Sets the secondary background color.
If different from the (primary) background color, then a color-ramp between both is generated.
| [in] | value | the secondary background color |
| void OGF::RenderArea::set_background_image | ( | const std::string & | value | ) |
Sets the background image.
If a background image is specified, then it is used to fill the background (instead of the background color).
| [in] | value | the path to a file that contains the image or the empty string if no background image should be used |
|
inline |
Sets the current clipping configuration.
| [in] | clipping_config | a ';'-separated string with the following fields:
|
Definition at line 320 of file render_area.h.
| void OGF::RenderArea::set_lighting_matrix | ( | const mat4 & | value | ) |
Sets the lighting matrix.
The light source is transformed by the lighting matrix. This transform occurs in normalized device coordinates.
| [in] | value | a const reference to the 4x4 homongeneous coordinates lighting matrix to be used |
| void OGF::RenderArea::set_projection_matrix | ( | const mat4 & | value | ) |
Sets the projection matrix.
| [in] | value | the projection matrix, as a 4x4 homogeneous coordinates matrix. |
| void OGF::RenderArea::set_viewing_matrix | ( | const mat4 & | value | ) |
Sets the viewing matrix.
| [in] | value | the viewing matrix, as a 4x4 homogeneous coordinates matrix. |
| void OGF::RenderArea::snapshot | ( | const std::string & | filename, |
| bool | make_current = true, |
||
| bool | with_gui = false |
||
| ) |
Saves a snapshot of this rendering area to an image file.
| [in] | filename | a string with the name of the image file. |
| [in] | make_current | if true, makes the associated rendering context current, else use the current rendering context. |
| [in] | with_gui | if set, the gui of graphite is rendereed in the image with the 3D objects, else only the 3D objects are rendered |
| void OGF::RenderArea::update_background_image_from_data | ( | Memory::pointer | ptr, |
| Image::ColorEncoding | color_encoding, | ||
| Image::ComponentEncoding | component_encoding, | ||
| index_t | width, | ||
| index_t | height | ||
| ) |
Updates the background image from raw image data.
Image data is in Cairo format (ARGB). Note that it is different from the convention in Graphite (RGBA). Note also that the Y axis is flipped as compared to the rest of Graphite.
| [in] | ptr | a pointer to image data |
| [in] | color_encoding | the color encoding of the data |
| [in] | component_encoding | the data type used for the color components |
| [in] | width | image width |
| [in] | height | image height |
| OGF::RenderArea::__pad0__ |
Definition at line 86 of file render_area.h.
| OGF::RenderArea::__pad1__ |
Definition at line 151 of file render_area.h.
| gom_signals OGF::RenderArea::__pad2__ |
Definition at line 325 of file render_area.h.