CGAL 5.0.2 - Three
|
#include <CGAL/Three/Scene_group_item.h>
CGAL::Three::Scene_item_rendering_helper.
A Scene_group_item is a special Scene_item that does not draw anything, but regroups other items as its children.
It allows the user to apply several actions to multiple items at the same time. A custom Scene_item can derive from it to have children. They appear hierarchically in the Geometric Objects list.
Public Slots | |
void | resetDraw () |
Redraws children. More... | |
void | adjustIds (Scene_interface::Item_id removed_id) |
adjustIds maintains the list of children up to date when an item has been erased. More... | |
![]() | |
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... | |
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 | moveToGroup (Scene_group_item *group) |
Set the parent group. 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 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. | |
Public Member Functions | |
bool | isFinite () const Q_DECL_OVERRIDE |
Returns false to avoid disturbing the BBox of the scene. | |
bool | isEmpty () const Q_DECL_OVERRIDE |
Returns true to avoid disturbing the BBox of the scene. | |
void | lockChild (CGAL::Three::Scene_item *) |
Locks a child. More... | |
void | lockChild (Scene_interface::Item_id id) |
Locks a child. More... | |
void | unlockChild (CGAL::Three::Scene_item *) |
Unlocks a child. More... | |
void | unlockChild (Scene_interface::Item_id id) |
Unlocks a child. More... | |
bool | isChildLocked (CGAL::Three::Scene_item *) |
Tells if a child is locked. More... | |
bool | isChildLocked (Scene_interface::Item_id id) |
Tells if a child is locked. More... | |
bool | isExpanded () const |
Returns if the group_item is currently expanded or collapsed in the Geometric Objects list. More... | |
void | setExpanded (bool) |
Makes the group_item expanded or collapsed in the view. More... | |
Bbox | bbox () const Q_DECL_OVERRIDE |
Returns an empty Bbox to avoid disturbing the Bbox of the scene. | |
Scene_item * | clone () const Q_DECL_OVERRIDE |
Not supported. | |
bool | supportsRenderingMode (RenderingMode m) const Q_DECL_OVERRIDE |
Indicates if the rendering mode is supported. More... | |
QString | toolTip () const Q_DECL_OVERRIDE |
void | addChild (Scene_item *new_item) |
Adds a CGAL::Three::Scene_item* to the list of children. More... | |
void | addChild (Scene_interface::Item_id new_id) |
Adds a CGAL::Three::Scene_item* to the list of children from its id. More... | |
Scene_item * | getChild (Scene_interface::Item_id id) |
getChild gives access to the Scene_item of the wanted index. More... | |
void | setColor (QColor c) Q_DECL_OVERRIDE |
Sets all the children to the specified color. | |
void | setRenderingMode (RenderingMode m) Q_DECL_OVERRIDE |
Sets all the children in the specified rendering mode. | |
void | setVisible (bool b) Q_DECL_OVERRIDE |
Sets all the children to the specified visibility. | |
void | setPointsMode () |
Sets all the children in points mode. | |
void | setWireframeMode () |
Sets all the children in wireframe rendering. | |
void | setWireframe () |
Sets all the children in wireframe rendering. | |
void | setFlat () |
Sets all the children in flat rendering. | |
void | setFlatMode () |
Sets all the children in flat rendering. | |
void | setFlatPlusEdgesMode () |
Sets all the children in flat rendering with edges. | |
void | setGouraudMode () |
Sets all the children in smooth rendering. | |
void | setPointsPlusNormalsMode () |
Sets all the children in point rendering with normals. | |
virtual void | setAlpha (int) Q_DECL_OVERRIDE |
Sets the alpha value for the froup and all its children. | |
QList< Scene_interface::Item_id > | getChildren () const |
Returns a list of all the direct children. More... | |
virtual QList< Scene_interface::Item_id > | getChildrenForSelection () const |
getChildrenForSelection returns the list of children to select along with the group. More... | |
void | removeChild (Scene_item *item) |
Removes a Scene_item from the list of children. More... | |
void | removeChild (Scene_interface::Item_id id) |
Removes a Scene_item from the list of children using its index. More... | |
void | moveUp (int) |
Moves a child up in the list. | |
void | moveDown (int) |
Moves a child down in the list. | |
![]() | |
virtual void | processData (Gl_data_names name) const |
processData calls computeElements() More... | |
void | setAlpha (int alpha) Q_DECL_OVERRIDE |
setAlpha sets the integer value of the alpha channel of this item. More... | |
Scene_item::Bbox | bbox () const Q_DECL_OVERRIDE |
The item's bounding box. More... | |
CGAL::Three::Triangle_container * | getTriangleContainer (std::size_t id) const |
getTriangleContainer returns the id th Triangle_container . | |
CGAL::Three::Edge_container * | getEdgeContainer (std::size_t id) const |
getEdgeContainer returns the id th Edge_container . | |
CGAL::Three::Point_container * | getPointContainer (std::size_t id) const |
getPointContainer returns the id th Point_container . | |
void | setTriangleContainer (std::size_t id, Triangle_container *tc) |
setTriangleContainer sets the id th Triangle_container to tc . More... | |
void | setEdgeContainer (std::size_t id, Edge_container *tc) |
setEdgeContainer sets the id th Edge_container to tc . More... | |
void | setPointContainer (std::size_t id, Point_container *tc) |
setPointContainer sets the id th Point_container to tc . More... | |
void | setBuffersFilled (bool b) const |
setBuffersFilled specifies if the data should be re-computed. More... | |
bool | getBuffersFilled () const |
getBuffersFilled returns false if the item rendering data needs to be re-computed., true otherwise. More... | |
bool | getBuffersInit (Viewer_interface *viewer) const |
getBuffersInit returns true if the Vao s of viewer are ready for rendering. | |
void | setBuffersInit (Viewer_interface *viewer, bool val) const |
setBuffersInit specifies if the Vbo s need to be initialized. More... | |
virtual double | diagonalBbox () const Q_DECL_OVERRIDE |
the item's bounding box's diagonal length. More... | |
void | newViewer (Viewer_interface *viewer) Q_DECL_OVERRIDE |
newViewer adds Vaos for viewer . More... | |
void | removeViewer (Viewer_interface *viewer) Q_DECL_OVERRIDE |
removeViewer removes the Vaos for viewer . More... | |
![]() | |
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 void | draw () const |
Deprecated. Does nothing. | |
virtual void | drawEdges () const |
Deprecated. Does nothing. | |
virtual void | drawPoints () const |
Deprecated. Does nothing. | |
virtual void | selection_changed (bool b) |
Called by the scene. If b is true, then this item is currently selected. | |
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 | 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... | |
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 QString | defaultSaveName () const |
defaultSaveName returns the name to be used as default when saving this item. More... | |
Protected Attributes | |
QList< Scene_interface::Item_id > | children |
Contains a reference to all the children of this group. | |
![]() | |
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. | |
virtual void | draw (CGAL::Three::Viewer_interface *) const Q_DECL_OVERRIDE |
Draw functions Scene_group_item's children are not drawn by the scene, they are drawn by the group. More... | |
virtual void | drawEdges (CGAL::Three::Viewer_interface *) const Q_DECL_OVERRIDE |
draws all the children More... | |
virtual void | drawPoints (CGAL::Three::Viewer_interface *) const Q_DECL_OVERRIDE |
draws all the children More... | |
virtual void | renderChildren (Viewer_interface *, QMap< float, int > &picked_item_IDs, const QPoint &picked_pixel, bool with_names) |
deals with the rendering, selecting and picking of the group's children. More... | |
Additional Inherited Members | |
![]() | |
enum | Gl_data_name { GEOMETRY = 0x1, COLORS = 0x2, NORMALS = 0x4, NOT_INSTANCED = 0x8, ALL = GEOMETRY|COLORS|NORMALS|NOT_INSTANCED } |
The Gl_data_name enum is used as a flag to specify what should be re-computed during computeElements() . More... | |
enum | Gl_data_names |
Flag interface for Scene_item::Gl_data_name. More... | |
![]() | |
enum | OpenGL_program_IDs { , PROGRAM_WITHOUT_LIGHT, PROGRAM_NO_SELECTION, PROGRAM_WITH_TEXTURE, PROGRAM_PLANE_TWO_FACES, PROGRAM_WITH_TEXTURED_EDGES, PROGRAM_INSTANCED, PROGRAM_INSTANCED_WIRE, PROGRAM_C3T3, PROGRAM_C3T3_EDGES, PROGRAM_CUTPLANE_SPHERES, PROGRAM_SPHERES, PROGRAM_DARK_SPHERES, PROGRAM_FLAT, PROGRAM_OLD_FLAT, PROGRAM_SOLID_WIREFRAME, PROGRAM_NO_INTERPOLATION, PROGRAM_HEAT_INTENSITY, NB_OF_PROGRAMS } |
The OpenGL_program_IDs enum. More... | |
![]() | |
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. | |
![]() | |
int | has_group |
Contains the number of group and subgroups containing this item. | |
![]() | |
static const QColor | defaultColor |
The default color of a scene_item. More... | |
![]() | |
QSlider * | alphaSlider () |
Returns a pointer to the slider initialized in initGL();. | |
bool | isInit (CGAL::Three::Viewer_interface *viewer) const |
Returnstrue if initGL() was called for viewer . | |
float | alpha () const Q_DECL_OVERRIDE |
Returns the float alpha value of an item. More... | |
virtual void | initializeBuffers (Viewer_interface *) const |
Fills the Vbo s with data. | |
virtual void | initGL (CGAL::Three::Viewer_interface *viewer) const |
Creates the VAOs and VBOs for viewer. | |
void | setBbox (Bbox b) const |
setBbox allows to set the Bbox in compute_bbox(); More... | |
![]() | |
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... | |
void CGAL::Three::Scene_group_item::addChild | ( | Scene_item * | new_item | ) |
Adds a CGAL::Three::Scene_item* to the list of children.
void CGAL::Three::Scene_group_item::addChild | ( | Scene_interface::Item_id | new_id | ) |
Adds a CGAL::Three::Scene_item* to the list of children from its id.
//!
|
slot |
adjustIds maintains the list of children up to date when an item has been erased.
removed_id | the index of the item that has been erased. |
|
virtual |
Draw functions Scene_group_item's children are not drawn by the scene, they are drawn by the group.
draws all the children
Calls Scene_item::draw()
, then calls Scene_item::drawEdges()
and Scene_item::drawPoints
for each child if its current rendering mode is adequat.
Reimplemented from CGAL::Three::Scene_item.
|
virtual |
draws all the children
Calls Scene_item::drawEdges()
, then calls Scene_item::draw()
and Scene_item::drawPoints
for each child if its current rendering mode is adequat.
Reimplemented from CGAL::Three::Scene_item.
|
virtual |
draws all the children
Calls Scene_item::drawPoints()
, then calls Scene_item::draw()
and Scene_item::drawEdges()
for each child if its current rendering mode is adequat.
Reimplemented from CGAL::Three::Scene_item.
Scene_item* CGAL::Three::Scene_group_item::getChild | ( | Scene_interface::Item_id | id | ) |
getChild gives access to the Scene_item of the wanted index.
CGAL::Three::Scene_item
which index is id
. QList<Scene_interface::Item_id> CGAL::Three::Scene_group_item::getChildren | ( | ) | const |
Returns a list of all the direct children.
Only returns children that have this item as a parent. Children of these children are not returned.
|
virtual |
getChildrenForSelection returns the list of children to select along with the group.
When a Scene_group_item
is added to the selection of the scene, this function defines which of its children will be added too. Typically overriden to allow applying an operation from the Operation menu only to the parent item and not to its children.
bool CGAL::Three::Scene_group_item::isChildLocked | ( | CGAL::Three::Scene_item * | ) |
bool CGAL::Three::Scene_group_item::isChildLocked | ( | Scene_interface::Item_id | id | ) |
bool CGAL::Three::Scene_group_item::isExpanded | ( | ) | const |
Returns if the group_item is currently expanded or collapsed in the Geometric Objects list.
True means expanded, false means collapsed.
void CGAL::Three::Scene_group_item::lockChild | ( | CGAL::Three::Scene_item * | ) |
Locks a child.
A locked child cannot be moved out of the group nor can it be deleted. Use it to prevent a child to be destroyed without its parent.
void CGAL::Three::Scene_group_item::lockChild | ( | Scene_interface::Item_id | id | ) |
Locks a child.
A locked child cannot be moved out of the group nor can it be deleted. Use it to prevent a child to be destroyed without its parent.
void CGAL::Three::Scene_group_item::removeChild | ( | Scene_item * | item | ) |
Removes a Scene_item from the list of children.
void CGAL::Three::Scene_group_item::removeChild | ( | Scene_interface::Item_id | id | ) |
Removes a Scene_item from the list of children using its index.
|
virtual |
deals with the rendering, selecting and picking of the group's children.
picked_item_IDs | the depth-index map |
picked_pixel | the screen point that has been picked. |
with_names | should be true if a picking is being performed. |
|
slot |
Redraws children.
As each drawing function of a group draws all parts of its children, once any of these functions is called, we skip all drawing calls until resetDraw()
is called. This keeps children from being drawn several times. It is automatically called at the end of the scene's draw()
function.
void CGAL::Three::Scene_group_item::setExpanded | ( | bool | ) |
Makes the group_item expanded or collapsed in the view.
True means expanded, false means collapsed.
|
virtual |
Indicates if the rendering mode is supported.
Implements CGAL::Three::Scene_item.
|
virtual |
Implements CGAL::Three::Scene_item.
void CGAL::Three::Scene_group_item::unlockChild | ( | CGAL::Three::Scene_item * | ) |
Unlocks a child.
void CGAL::Three::Scene_group_item::unlockChild | ( | Scene_interface::Item_id | id | ) |
Unlocks a child.