\( \newcommand{\E}{\mathrm{E}} \) \( \newcommand{\A}{\mathrm{A}} \) \( \newcommand{\R}{\mathrm{R}} \) \( \newcommand{\N}{\mathrm{N}} \) \( \newcommand{\Q}{\mathrm{Q}} \) \( \newcommand{\Z}{\mathrm{Z}} \) \( \def\ccSum #1#2#3{ \sum_{#1}^{#2}{#3} } \def\ccProd #1#2#3{ \sum_{#1}^{#2}{#3} }\)
CGAL 5.0.2 - Three
CGAL::Three::Scene_item_rendering_helper Class Referenceabstract

#include <CGAL/Three/Scene_item_rendering_helper.h>

Inherits from

CGAL::Three::Scene_item.

Inherited by CGAL::Three::Scene_group_item.

Definition

The Scene_item_rendering_helper class is a convenience class for constructing an item.

It is more elaborated than a Scene_item and facilitates the process of creating an item that can be rendered.

Public Types

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...
 
- Public Types inherited from CGAL::Three::Scene_item
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...
 

Public Member Functions

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_containergetTriangleContainer (std::size_t id) const
 getTriangleContainer returns the idth Triangle_container.
 
CGAL::Three::Edge_containergetEdgeContainer (std::size_t id) const
 getEdgeContainer returns the idth Edge_container.
 
CGAL::Three::Point_containergetPointContainer (std::size_t id) const
 getPointContainer returns the idth Point_container.
 
void setTriangleContainer (std::size_t id, Triangle_container *tc)
 setTriangleContainer sets the idth Triangle_container to tc. More...
 
void setEdgeContainer (std::size_t id, Edge_container *tc)
 setEdgeContainer sets the idth Edge_container to tc. More...
 
void setPointContainer (std::size_t id, Point_container *tc)
 setPointContainer sets the idth 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 Vaos of viewer are ready for rendering.
 
void setBuffersInit (Viewer_interface *viewer, bool val) const
 setBuffersInit specifies if the Vbos 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...
 
- Public Member Functions inherited from CGAL::Three::Scene_item
 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_itemclone () 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 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_itemparentGroup () 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 Member Functions

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 Vbos with data.
 
virtual void initGL (CGAL::Three::Viewer_interface *viewer) const
 Creates the VAOs and VBOs for viewer.
 
virtual void compute_bbox () const Q_DECL_OVERRIDE=0
 Computes the items Bbox and stores the result. More...
 
void setBbox (Bbox b) const
 setBbox allows to set the Bbox in compute_bbox(); More...
 
- Protected Member Functions inherited from CGAL::Three::Scene_item
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...
 

Additional Inherited Members

- Public Slots inherited from CGAL::Three::Scene_item
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 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 inherited from CGAL::Three::Scene_item
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 Attributes inherited from CGAL::Three::Scene_item
int has_group
 Contains the number of group and subgroups containing this item.
 
- Static Public Attributes inherited from CGAL::Three::Scene_item
static const QColor defaultColor
 The default color of a scene_item. More...
 
- Protected Attributes inherited from CGAL::Three::Scene_item
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_itemparent_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.
 

Member Enumeration Documentation

◆ Gl_data_name

The Gl_data_name enum is used as a flag to specify what should be re-computed during computeElements().

The flag corresponding to this enum is Gl_data_names, and multiple flags can be combined whith the operator |. For instance, you can use GEOMETRY|COLORS as a single value.

Enumerator
GEOMETRY 

Invalidates the vertices, edges and faces.

COLORS 

Invalidates the color of each vertex.

NORMALS 

Invalidate the normal of each vertex.

NOT_INSTANCED 

Invalidate the centers/radius of each sphere.

ALL 

Invalidate everything.

◆ Gl_data_names

Flag interface for Scene_item::Gl_data_name.

Member Function Documentation

◆ alpha()

float CGAL::Three::Scene_item_rendering_helper::alpha ( ) const
protectedvirtual

Returns the float alpha value of an item.

This value is between 0.0f and 1.0f.

Reimplemented from CGAL::Three::Scene_item.

◆ bbox()

Scene_item::Bbox CGAL::Three::Scene_item_rendering_helper::bbox ( ) const
virtual

The item's bounding box.

If the Bbox has never been computed, computes it and saves the result for further calls.

Returns
the item's bounding box.

Reimplemented from CGAL::Three::Scene_item.

◆ compute_bbox()

virtual void CGAL::Three::Scene_item_rendering_helper::compute_bbox ( ) const
protectedpure virtual

Computes the items Bbox and stores the result.

Must be overridden.

Reimplemented from CGAL::Three::Scene_item.

◆ diagonalBbox()

virtual double CGAL::Three::Scene_item_rendering_helper::diagonalBbox ( ) const
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.

Returns
the item's bounding box's diagonal length.

Reimplemented from CGAL::Three::Scene_item.

◆ getBuffersFilled()

bool CGAL::Three::Scene_item_rendering_helper::getBuffersFilled ( ) const

getBuffersFilled returns false if the item rendering data needs to be re-computed., true otherwise.

See also
setBuffersFilled()

◆ newViewer()

void CGAL::Three::Scene_item_rendering_helper::newViewer ( Viewer_interface viewer)
virtual

newViewer adds Vaos for viewer.

Parameters
viewerthe new viewer.

Implements CGAL::Three::Scene_item.

◆ processData()

virtual void CGAL::Three::Scene_item_rendering_helper::processData ( Gl_data_names  name) const
virtual

processData calls computeElements()

◆ removeViewer()

void CGAL::Three::Scene_item_rendering_helper::removeViewer ( Viewer_interface viewer)
virtual

removeViewer removes the Vaos for viewer.

Parameters
viewerthe viewer to be removed.

Implements CGAL::Three::Scene_item.

◆ setAlpha()

void CGAL::Three::Scene_item_rendering_helper::setAlpha ( int  alpha)
virtual

setAlpha sets the integer value of the alpha channel of this item.

Also updates the slider value. It must be between 0 and 255.

Parameters
alphathe integer value for the alpha channel.

Reimplemented from CGAL::Three::Scene_item.

◆ setBbox()

void CGAL::Three::Scene_item_rendering_helper::setBbox ( Bbox  b) const
protected

setBbox allows to set the Bbox in compute_bbox();

Parameters
b

◆ setBuffersFilled()

void CGAL::Three::Scene_item_rendering_helper::setBuffersFilled ( bool  b) const

setBuffersFilled specifies if the data should be re-computed.

If called with false, the item rendering data will be re-computed at the next draw(). If called with true, the item rendering data is considered ready and will not be computed until setBuffersFilled() is called with false again.

◆ setBuffersInit()

void CGAL::Three::Scene_item_rendering_helper::setBuffersInit ( Viewer_interface viewer,
bool  val 
) const

setBuffersInit specifies if the Vbos need to be initialized.

If called with false, the item Vbos will be refilled at the next draw(). If called with true, the item Vbos are considered ready and will not be refilled until setBuffersInit() is called with false again.

This function should be called in the drawing functions, when getBuffersFilled() is true.

◆ setEdgeContainer()

void CGAL::Three::Scene_item_rendering_helper::setEdgeContainer ( std::size_t  id,
Edge_container tc 
)

setEdgeContainer sets the idth Edge_container to tc.

If id is bigger than the current size of the container vector, this vector is resized accordingly. This means that for optimisation reasons, containers should be created decreasingly.

◆ setPointContainer()

void CGAL::Three::Scene_item_rendering_helper::setPointContainer ( std::size_t  id,
Point_container tc 
)

setPointContainer sets the idth Point_container to tc.

If id is bigger than the current size of the container vector, this vector is resized accordingly. This means that for optimisation reasons, containers should be created decreasingly.

◆ setTriangleContainer()

void CGAL::Three::Scene_item_rendering_helper::setTriangleContainer ( std::size_t  id,
Triangle_container tc 
)

setTriangleContainer sets the idth Triangle_container to tc.

If id is bigger than the current size of the container vector, this vector is resized accordingly. This means that for optimisation reasons, containers should be created decreasingly.