CGAL 5.0.2 - Three
|
#include <CGAL/Three/Scene_item.h>
QObject.
Inherited by CGAL::Three::Scene_item_rendering_helper.
This class represents an object in the OpenGL scene.
It contains all the functions called by the Scene. It acts like a mix between an interface and a helper.
Classes | |
struct | Header_data |
Contains the header for the table in the statistics dialog. More... | |
Public Slots | |
virtual void | invalidateOpenGLBuffers () |
Notifies the program that the internal data or the properties of an item has changed, and that it must be computed again. More... | |
virtual void | setColor (QColor c) |
Setter for the color of the item. | |
void | setRgbColor (int r, int g, int b) |
Setter for the RGB color of the item. More... | |
virtual void | setName (QString n) |
Sets the name of the item. | |
virtual void | setVisible (bool b) |
Sets the visibility of the item. | |
virtual void | moveToGroup (Scene_group_item *group) |
Set the parent group. More... | |
virtual void | setRenderingMode (RenderingMode m) |
Sets the rendering mode of the item. More... | |
void | setPointsMode () |
Sets the RenderingMode to Points. | |
void | setShadedPointsMode () |
Sets the RenderingMode to Points. | |
void | setWireframeMode () |
Sets the RenderingMode to Wireframe. | |
void | setFlatMode () |
Sets the RenderingMode to Flat. | |
void | setFlatPlusEdgesMode () |
Set the RenderingMode to FlatPlusEdges. | |
void | setGouraudMode () |
Sets the RenderingMode to Gouraud. | |
void | setPointsPlusNormalsMode () |
Sets the RenderingMode to PointsPlusNormals. | |
void | setGouraudPlusEdgesMode () |
Sets the RenderingMode to GouraudPlusEdges. | |
virtual void | itemAboutToBeDestroyed (Scene_item *) |
Emits an aboutToBeDestroyed() signal. More... | |
virtual float | alpha () const |
Returns the alpha value for the item. More... | |
virtual void | setAlpha (int alpha) |
Sets the value of the aplha Slider for this item. More... | |
virtual void | select (double orig_x, double orig_y, double orig_z, double dir_x, double dir_y, double dir_z) |
Selects a point through raycasting. | |
Signals | |
void | itemChanged () |
Is emitted to notify a change in the item's data. | |
void | itemVisibilityChanged () |
Is emitted when the item is shown to notify a change in the item's visibility. More... | |
void | aboutToBeDestroyed () |
Is emitted to notify that the item is about to be deleted. | |
void | redraw () |
Is emitted to require a new display. | |
Public Member Functions | |
Scene_item (int buffers_size=20, int vaos_size=10) | |
The Constructor. More... | |
void | setNbIsolatedvertices (std::size_t nb) |
Sets the number of isolated vertices. More... | |
std::size_t | getNbIsolatedvertices () const |
Getter for the number of isolated vertices. More... | |
virtual Scene_item * | clone () const =0 |
Duplicates the item. More... | |
virtual bool | supportsRenderingMode (RenderingMode m) const =0 |
Indicates if m is supported. More... | |
virtual void | draw () const |
Deprecated. Does nothing. | |
virtual void | draw (CGAL::Three::Viewer_interface *) const |
The drawing function for faces. More... | |
virtual void | drawEdges () const |
Deprecated. Does nothing. | |
virtual void | drawEdges (CGAL::Three::Viewer_interface *viewer) const |
The drawing function for the edges. More... | |
virtual void | drawPoints () const |
Deprecated. Does nothing. | |
virtual void | drawPoints (CGAL::Three::Viewer_interface *) const |
The drawing function for the points. More... | |
virtual void | selection_changed (bool b) |
Called by the scene. If b is true, then this item is currently selected. | |
virtual QString | toolTip () const =0 |
Contains meta-data about the item. More... | |
virtual QPixmap | graphicalToolTip () const |
Contains graphical meta-data about the item. More... | |
virtual QFont | font () const |
Contains the font used for the data of the item. More... | |
virtual bool | isFinite () const |
Determines if the item is finite or not. More... | |
virtual bool | isEmpty () const |
Specifies if the item is empty or null. More... | |
virtual Bbox | bbox () const |
The item's bounding box. More... | |
virtual double | diagonalBbox () const |
the item's bounding box's diagonal length. More... | |
virtual bool | manipulatable () const |
Returns true if the item has a ManipulatedFrame. More... | |
virtual ManipulatedFrame * | manipulatedFrame () |
The manipulatedFrame of the item. More... | |
virtual QColor | color () const |
Getter for the item's color. More... | |
virtual QString | name () const |
Getter for the item's name. More... | |
virtual bool | visible () const |
If the item is not visible, it is not drawn and its Bbox is ignored in the computation of the scene's. More... | |
virtual RenderingMode | renderingMode () const |
Getter for the item's rendering mode. More... | |
virtual QString | renderingModeName () const |
The renderingMode's name. More... | |
virtual QMenu * | contextMenu () |
Context menu. More... | |
void | setId (int id) |
setId informs the item of its current index in the scene entries. | |
int | getId () const |
getId returns the current index of this item in the scene entries. | |
void | resetMenu () |
invalidates the context menu. More... | |
virtual bool | keyPressEvent (QKeyEvent *) |
Handles key press events. | |
Scene_group_item * | parentGroup () const |
The group containing the item. More... | |
virtual Header_data | header () const |
Returns a Header_data struct containing the header information. | |
virtual bool | has_stats () const |
Returns true if the item has statistics. | |
virtual QString | computeStats (int i) |
Returns a QString containing the requested value for the the table in the statistics dialog. More... | |
virtual void | newViewer (CGAL::Three::Viewer_interface *viewer)=0 |
newViewer adds Vaos for viewer . More... | |
virtual void | removeViewer (CGAL::Three::Viewer_interface *viewer)=0 |
removeViewer removes the Vaos fo viewer . More... | |
virtual QString | defaultSaveName () const |
defaultSaveName returns the name to be used as default when saving this item. More... | |
Public Attributes | |
int | has_group |
Contains the number of group and subgroups containing this item. | |
Static Public Attributes | |
static const QColor | defaultColor |
The default color of a scene_item. More... | |
Protected Member Functions | |
void | addVaos (int i) |
Adds a VAO to the Map. | |
void | initializeBuffers () |
Fills the VBOs with data. | |
void | attribBuffers (CGAL::Three::Viewer_interface *, int program_name) const |
Passes all the uniform data to the shaders. More... | |
virtual QOpenGLShaderProgram * | getShaderProgram (int name, CGAL::Three::Viewer_interface *viewer=0) const |
Compatibility function. More... | |
Protected Attributes | |
Bbox | _bbox |
Holds the BBox of the item. | |
QString | name_ |
The name of the item. | |
QColor | color_ |
The color of the item. | |
bool | visible_ |
The visibility of the item. | |
Scene_group_item * | parent_group |
The parent group, or 0 if the item is not in a group. | |
bool | is_selected |
Specifies if the item is currently selected. | |
std::size_t | nb_isolated_vertices |
Holds the number of vertices that are not linked to the polyhedron from the OFF file. More... | |
bool | are_buffers_filled |
Decides if the draw function must call initializeBuffers() or not. More... | |
RenderingMode | rendering_mode |
The rendering mode of the item. More... | |
QMenu * | defaultContextMenu |
The default context menu. | |
RenderingMode | prev_shading |
Contains the previous RenderingMode. More... | |
RenderingMode | cur_shading |
Contains the current RenderingMode. More... | |
int | buffersSize |
Contains the size of the vector of VBOs. | |
int | vaosSize |
Contains the size of the map of VAOs. | |
std::vector< QOpenGLBuffer > | buffers |
Contains the VBOs. | |
std::vector< QOpenGLVertexArrayObject * > | vaos |
Contains the VAOs. | |
The OpenGL_program_IDs enum.
This enum holds the OpenGL programs IDs that are given to getShaderProgram() and attribBuffers().
CGAL::Three::Scene_item::Scene_item | ( | int | buffers_size = 20 , |
int | vaos_size = 10 |
||
) |
The Constructor.
This is where the vectors of VBOs and VAOs are initialized.
|
virtualslot |
Returns the alpha value for the item.
Must be called within a valid openGl context.
Reimplemented in CGAL::Three::Scene_item_rendering_helper.
|
protected |
Passes all the uniform data to the shaders.
According to program_name, this data may change.
|
virtual |
The item's bounding box.
If the Bbox has never been computed, computes it and saves the result for further calls.
Reimplemented in CGAL::Three::Scene_group_item, and CGAL::Three::Scene_item_rendering_helper.
|
pure virtual |
Duplicates the item.
Creates a new item as a copy of this one.
Implemented in CGAL::Three::Scene_group_item.
|
virtual |
Getter for the item's color.
|
virtual |
Returns a QString containing the requested value for the the table in the statistics dialog.
* Example : * ____________________________ * | |Name |Cube | * | |_______|_____| * |General Info | #Edges|12 | * |_____________|_______|_____| * ComputeStats(0) should return "Cube" and computeStats(1) should return QString::number(12); * The numbers must be coherent with the order of declaration of the titles in the header. *
|
virtual |
Context menu.
Contains the list of the supported rendering modes, the Operations menu, actions to save or clone the item if it is supported and any contextual action for the item.
|
virtual |
defaultSaveName returns the name to be used as default when saving this item.
Default is name()
.
|
virtual |
the item's bounding box's diagonal length.
If the diagonal's length has never been computed, computes it and saves the result for further calls.
Reimplemented in CGAL::Three::Scene_item_rendering_helper.
|
virtual |
The drawing function for faces.
Draws the faces of the item in the viewer. The data for the drawing is gathered in computeElements(), and is sent to buffers in initializeBuffers().
Reimplemented in CGAL::Three::Scene_group_item.
|
virtual |
The drawing function for the edges.
Draws the edges and lines of the item in the viewer. The data for the drawing is gathered in computeElements(), and is sent to buffers in initializeBuffers().
Reimplemented in CGAL::Three::Scene_group_item.
|
virtual |
The drawing function for the points.
Draws the points of the item in the viewer. The data for the drawing is gathered in computeElements(), and is sent to buffers in initializeBuffers().
Reimplemented in CGAL::Three::Scene_group_item.
|
virtual |
Contains the font used for the data of the item.
std::size_t CGAL::Three::Scene_item::getNbIsolatedvertices | ( | ) | const |
Getter for the number of isolated vertices.
|
protectedvirtual |
Compatibility function.
Calls viewer->getShaderProgram()
.
|
virtual |
Contains graphical meta-data about the item.
|
virtualslot |
Notifies the program that the internal data or the properties of an item has changed, and that it must be computed again.
It is important to call this function whenever the internal data is changed, or the displayed item will not be updated.
|
virtual |
Specifies if the item is empty or null.
If true, the BBox is not computed.
Reimplemented in CGAL::Three::Scene_group_item.
|
virtual |
Determines if the item is finite or not.
For example, a plane is not finite. If false, the BBox is not computed.
Reimplemented in CGAL::Three::Scene_group_item.
|
virtualslot |
Emits an aboutToBeDestroyed() signal.
Override this function to delete what needs to be deleted on destruction. This might be needed as items are not always deleted right away by Qt and this behaviour may cause a simily memory leak, for example when multiple items are created at the same time.
|
signal |
Is emitted when the item is shown to notify a change in the item's visibility.
Typically used to update the scene's bbox;
|
virtual |
Returns true if the item has a ManipulatedFrame.
|
virtual |
The manipulatedFrame of the item.
A manipulated frame is an independent system that can be translated or rotated using the Ctrl key and the mouse.
|
virtualslot |
Set the parent group.
If group==0
, then the item has no parent. This function is called by Scene::changeGroup
and should not be called manually.
|
virtual |
Getter for the item's name.
|
pure virtual |
newViewer adds Vaos for viewer
.
Must be overriden;
Implemented in CGAL::Three::Scene_item_rendering_helper.
Scene_group_item* CGAL::Three::Scene_item::parentGroup | ( | ) | const |
The group containing the item.
|
pure virtual |
removeViewer removes the Vaos fo viewer
.
Must be overriden;
Implemented in CGAL::Three::Scene_item_rendering_helper.
|
virtual |
Getter for the item's rendering mode.
|
virtual |
The renderingMode's name.
void CGAL::Three::Scene_item::resetMenu | ( | ) |
invalidates the context menu.
Call it when supportsRenderingMode() changes, for example.
|
virtualslot |
Sets the value of the aplha Slider for this item.
Must be overriden;
alpha | must be between 0 and 255 |
Reimplemented in CGAL::Three::Scene_group_item, and CGAL::Three::Scene_item_rendering_helper.
void CGAL::Three::Scene_item::setNbIsolatedvertices | ( | std::size_t | nb | ) |
Sets the number of isolated vertices.
This number will be displayed in a warning box at loading.
|
virtualslot |
Sets the rendering mode of the item.
Reimplemented in CGAL::Three::Scene_group_item.
|
slot |
|
pure virtual |
Indicates if m
is supported.
If it is, it will be displayed in the context menu of the item.
Implemented in CGAL::Three::Scene_group_item.
|
pure virtual |
Contains meta-data about the item.
Implemented in CGAL::Three::Scene_group_item.
|
virtual |
If the item is not visible, it is not drawn and its Bbox is ignored in the computation of the scene's.
|
mutableprotected |
Decides if the draw function must call initializeBuffers() or not.
It is set to true in the end of initializeBuffers() and to false in invalidateOpenGLBuffers(). The need of this boolean comes from the need of a context from the OpenGLFunctions used in initializeBuffers().
|
protected |
Contains the current RenderingMode.
This is used to determine if invalidateOpenGLBuffers should be called or not in certain cases.
|
static |
The default color of a scene_item.
This color is the one that will be displayed if none is specified after its creation.
|
protected |
Holds the number of vertices that are not linked to the polyhedron from the OFF file.
|
protected |
Contains the previous RenderingMode.
This is used to determine if invalidateOpenGLBuffers should be called or not in certain cases.
|
protected |
The rendering mode of the item.