\( \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::Triangle_container Struct Reference

#include <CGAL/Three/Triangle_container.h>

Inherits from

CGAL::Three::Primitive_container.

Definition

The Triangle_container struct wraps the OpenGL data for drawing triangles.

Public Types

enum  vbosName {
  Flat_vertices = 0, Smooth_vertices, Vertex_indices, Flat_normals,
  Smooth_normals, Facet_centers, Radius, VColors,
  FColors, Texture_map , NbOfVbos
}
 The vbosName enum. More...
 

Public Member Functions

 Triangle_container (int program, bool indexed)
 The constructor. More...
 
void initGL (CGAL::Three::Viewer_interface *viewer) Q_DECL_OVERRIDE
 initGL creates the Vbos and Vaos of this Triangle_container. More...
 
void draw (CGAL::Three::Viewer_interface *viewer, bool is_color_uniform) Q_DECL_OVERRIDE
 draw is the function that actually renders the data. More...
 
- Public Member Functions inherited from CGAL::Three::Primitive_container
 Primitive_container (int program, bool indexed)
 Primitive_container ructor. More...
 
void bindUniformValues (CGAL::Three::Viewer_interface *viewer)
 bindUniformValues sets the uniform variables for the concerned shaders. More...
 
void removeViewer (CGAL::Three::Viewer_interface *viewer)
 removeViewer deletes and removes the Vao assigned to viewer from Vaos. More...
 
void reset_vbos (Scene_item_rendering_helper::Gl_data_names)
 reset_vbos de-allocates the Vbos. More...
 
void setFlatDataSize (std::size_t)
 setFlatDataSize sets the number of un-indexed vertices of this container. More...
 
void setIdxSize (std::size_t)
 setIdxDataSize sets the number of indexed vertices of this container. More...
 
void setCenterSize (std::size_t)
 setCenterSize sets the number of instances of the item in this container. More...
 
bool isGLInit (Viewer_interface *viewer) const
 Returns true if the container Vaos and Vbos are created in the context of viewer. More...
 
void allocate (std::size_t vbo_id, void *data, int datasize)
 allocate sets the data for a Vbo. More...
 
void setVao (Viewer_interface *viewer, Vao *)
 setVao sets the Vao corresponding to viewer of this container.
 
void setVbos (std::vector< Vbo *>)
 setVbos sets the vector of Vbos for this container. More...
 
void setVbo (std::size_t vbo_id, Vbo *vbo)
 setVbo sets the vbo_idth Vbo of this container to vbo. More...
 
void setGLInit (Viewer_interface *viewer, bool)
 Use this to specify if the container Vaos and Vbos are created in the context of viewer.
 
void setTexture (Texture *)
 setter for the texture.
 
void setTextureSize (const QSize &size)
 setter for the texture size.
 
void setTextureData (int i, int j, int r, int g, int b)
 setter for the texture data at UV coordinates (i,j).
 
VaogetVao (Viewer_interface *viewer) const
 Returns the Vao bound to viewer.
 
VbogetVbo (std::size_t id) const
 getVbo returns the idth Vbo of this container.
 
int getProgram () const
 getProgram returns the OpenGL_program_IDs used with this container.
 
bool isDataIndexed ()
 isDataIndexed specifies if the data is indexed or not. More...
 
TexturegetTexture () const
 getter for the texture.
 
GLuint getTextureId () const
 getter for the texture id.
 
QSize getTextureSize () const
 getter for the size of the texture.
 
bool getClipping () const
 getter for the clipping. Default is true.
 
void setInit (Viewer_interface *viewer, bool)
 Use this to specify if the container Vbos are filled for viewer.
 
bool isInit (Viewer_interface *viewer) const
 isInit returns true if the container Vbos are filled for viewer. More...
 
std::size_t getFlatDataSize () const
 getFlatDataSize returns the number of un-indexed vertices. More...
 
std::size_t getIdxSize () const
 getIdxSize returns the number of indexed vertices. More...
 
int getTupleSize () const
 getTupleSize returns the number of coordinates in one vertex. More...
 
std::size_t getCenterSize () const
 getCenterSize returns the number of instances of the item in this container. More...
 
void setSelected (bool)
 Setter for the "selected" uniform parameter.
 
void setColor (QColor)
 Setter for the "color" parameter.
 
void setStride (std::size_t id, int stride)
 Setter for the "stride" parameter.
 
void setOffset (std::size_t id, int offset)
 Setter for the "offset" parameter.
 
void setTupleSize (int ts)
 setter for the tuple size: the number of coordinates of one vertex.
 
void setClipping (bool b)
 setter for the clipping. If b is false, then the clipping box will have no effect.
 
bool isSelected () const
 getter for the "selected" parameter
 
QColor getColor () const
 getter for the "color" parameter
 

Getters and Setters for the shaders parameters.

Each of those depends of the OpenGL_program_IDs this container is using.

If the shaders of this program doesn't need one, you can ignore it. The others should be filled at each draw() from the item.

float getShrinkFactor ()
 getter for the "shrink_factor" parameter
 
QVector4D getPlane ()
 getter for the "plane" parameter
 
float getAlpha ()
 getter for the "alpha" parameter
 
QMatrix4x4 getFrameMatrix () const
 getter for the "f_matrix" parameter
 
QMatrix4x4 getMvMatrix () const
 getter for the "mv_matrix" parameter
 
void setShrinkFactor (const float &)
 setter for the "shrink_factor" parameter
 
void setPlane (const QVector4D &)
 setter for the "plane" parameter
 
void setAlpha (const float &)
 setter for the "alpha" parameter
 
void setFrameMatrix (const QMatrix4x4 &)
 setter for the "f_matrix" parameter
 
void setMvMatrix (const QMatrix4x4 &)
 setter for the "mv_matrix" parameter
 
void setIsSurface (const bool)
 setter for the "is_surface" attribute. Used in PROGRAM_C3T3
 

Member Enumeration Documentation

◆ vbosName

The vbosName enum.

Holds the Vbo Ids of this container.

Enumerator
Flat_vertices 

Designates the buffer that contains the flat vertex coordinates (not indexed).

Smooth_vertices 

Designates the buffer that contains the smooth vertex coordinates (indexed).

Vertex_indices 

Designates the buffer that contains the indices for the smooth vertices.

Flat_normals 

Designates the buffer that contains the normals for the flat vertices.

Smooth_normals 

Designates the buffer that contains the normals for the smooth vertices.

Facet_centers 

Designates the buffer that contains the barycenters of the c3t3 facets or the center of the spheres.

Radius 

Designates the buffer that contains the radius of the spheres.

VColors 

Designates the buffer that contains the colors of the smooth vertices.

FColors 

Designates the buffer that contains the colors of the flat vertices.

Texture_map 

Designates the buffer that contains the UV map for the texture.

NbOfVbos 

Designates the size of the VBOs vector for Triangle_containers.

Constructor & Destructor Documentation

◆ Triangle_container()

CGAL::Three::Triangle_container::Triangle_container ( int  program,
bool  indexed 
)

The constructor.

Parameters
programis the QOpenGLShaderProgram that is used by this Triangle_container Vao.
indexedmust be true if the data is indexed, false otherwise. If true, VBOs[Vertex_indices] must be filled.

Member Function Documentation

◆ draw()

void CGAL::Three::Triangle_container::draw ( CGAL::Three::Viewer_interface viewer,
bool  is_color_uniform 
)
virtual

draw is the function that actually renders the data.

Parameters
viewerthe active Viewer_interface.
is_color_uniformmust be false if the color buffers are not empty, true otherwise.

Implements CGAL::Three::Primitive_container.

◆ initGL()

void CGAL::Three::Triangle_container::initGL ( CGAL::Three::Viewer_interface viewer)
virtual

initGL creates the Vbos and Vaos of this Triangle_container.

Attention
It must be called within a valid OpenGL context. The draw() function of an item is always a safe place to call this.
Parameters
viewerthe active Viewer_interface.

Implements CGAL::Three::Primitive_container.