Geogram  Version 1.9.1
A programming library of geometric algorithms
GEO::MeshGfx Class Reference

Draws a mesh using OpenGL. More...

#include <geogram_gfx/mesh/mesh_gfx.h>

Classes

struct  Filter
 Filters primitives based on their id and on an attribute. More...
 

Public Member Functions

 MeshGfx ()
 MeshGfx constructor.
 
 ~MeshGfx ()
 MeshGfx destructor.
 
 MeshGfx (const MeshGfx &rhs)=delete
 Forbids MeshGfx copy..
 
MeshGfxoperator= (const MeshGfx &rhs)=delete
 Forbids MeshGfx copy..
 
void draw_vertices ()
 Draws the vertices of the mesh. More...
 
void draw_edges ()
 Draws the edges of the mesh.
 
void draw_surface ()
 Draws the surfacic part of the mesh.
 
void draw_surface_borders ()
 Draws the borders of the surfacic part of the mesh.
 
void draw_volume ()
 Draws the volumetric part of the mesh.
 
bool get_show_mesh () const
 Gets the mesh visibility flag. More...
 
void set_show_mesh (bool x)
 Sets the mesh visibility flag. More...
 
index_t get_mesh_width () const
 Gets the mesh width. More...
 
void set_mesh_width (index_t x)
 Sets the mesh width. More...
 
index_t get_mesh_border_width () const
 Gets the mesh border width. More...
 
void set_mesh_border_width (index_t x)
 Sets the mesh border width. More...
 
double get_shrink () const
 Gets the cells shrink coefficient. More...
 
void set_shrink (double x)
 Sets the cells shrink coefficient. More...
 
bool get_animate () const
 Gets the animate flag. More...
 
void set_animate (bool x)
 Gets the animate flag. More...
 
double get_time () const
 Gets the time of the animation. More...
 
void set_time (double x)
 Gets the time of the animation. More...
 
bool get_draw_cells (MeshCellType type) const
 Gets the cell visibility flag. More...
 
void set_draw_cells (MeshCellType type, bool x)
 Sets the cell visibility flag. More...
 
void set_points_color (float r, float g, float b, float a=1.0f)
 Sets the points color. More...
 
void get_points_color (float &r, float &g, float &b, float &a) const
 Gets the points color. More...
 
void set_points_size (float x)
 Sets the point size. More...
 
float get_points_size () const
 Gets the point size. More...
 
void set_mesh_color (float r, float g, float b, float a=1.0f)
 Sets the mesh color. More...
 
void get_mesh_color (float &r, float &g, float &b, float &a) const
 Gets the mesh color. More...
 
void set_surface_color (float r, float g, float b, float a=1.0f)
 Sets the surface color. More...
 
void get_surface_color (float &r, float &g, float &b, float &a) const
 Gets the surface color. More...
 
void set_backface_surface_color (float r, float g, float b, float a=1.0f)
 Sets the surface color for backfacing faces. More...
 
void set_cells_color (float r, float g, float b, float a=1.0f)
 Sets the color used to display mesh cells. More...
 
void get_cells_color (float &r, float &g, float &b, float &a) const
 Gets the cells color. More...
 
void set_cells_colors_by_type ()
 Sets a different color for each mesh cell type. More...
 
bool get_lighting () const
 Gets the lighing flag. More...
 
void set_lighting (bool x)
 Sets the lighting flag. More...
 
void set_mesh (const Mesh *M)
 Sets the mesh. More...
 
const Meshmesh () const
 Gets the mesh. More...
 
void set_picking_mode (MeshElementsFlags what)
 Sets picking mode. More...
 
MeshElementsFlags get_picking_mode () const
 Gets the current picking mode. More...
 
void set_object_picking_id (index_t id)
 Sets the object-wide picking id. More...
 
index_t get_object_picking_id () const
 Gets the object-wide picking id. More...
 
void set_vertices_selection (const std::string &name)
 Sets the vertices selection. More...
 
const std::string & get_vertices_selection () const
 Gets the vertices selection. More...
 
void set_scalar_attribute (MeshElementsFlags subelements, const std::string &name, double attr_min, double attr_max, GLuint colormap_texture, index_t repeat=1)
 Sets the parameters for displaying a scalar attribute using texture mapping. More...
 
void set_texturing (MeshElementsFlags subelements, const std::string &attribute_name, GLuint texture, index_t texture_dim, index_t repeat=1)
 Sets the parameters for texture mapping. More...
 
void unset_scalar_attribute ()
 Unsets scalar attribute display.
 
void set_filter (MeshElementsFlags subelements, const std::string &name="filter")
 Sets primitive filtering. More...
 
void unset_filters ()
 Unset primitive filtering.
 
void cleanup ()
 Deallocates OpenGL objects.
 

Protected Member Functions

void draw_vertices_array ()
 
void draw_vertices_immediate_plain ()
 
void draw_vertices_immediate_attrib ()
 
void draw_vertices_selection ()
 
void draw_edges_array ()
 
void draw_edges_immediate_plain ()
 
void draw_edges_immediate_attrib ()
 
void draw_triangles ()
 
void draw_triangles_array ()
 
void draw_triangles_immediate_plain ()
 
void draw_triangles_immediate_attrib ()
 
void draw_quads ()
 
void draw_quads_array ()
 
void draw_quads_immediate_plain ()
 
void draw_quads_immediate_attrib ()
 
void draw_triangles_and_quads ()
 
void draw_triangles_and_quads_array ()
 
void draw_triangles_and_quads_immediate_plain ()
 
void draw_triangles_and_quads_immediate_attrib ()
 
void draw_polygons ()
 
void draw_polygons_plain ()
 
void draw_polygons_attrib ()
 
void draw_tets ()
 
void draw_tets_array ()
 
void draw_tets_immediate_plain ()
 
void draw_tets_immediate_attrib ()
 
void draw_hybrid ()
 
void draw_hybrid_array ()
 
void draw_hybrid_immediate_plain ()
 
void draw_hybrid_immediate_attrib ()
 
void set_cells_color (MeshCellType type, float r, float g, float b)
 
void draw_attribute_as_tex_coord (index_t element)
 
void draw_vertex_with_attribute (index_t vertex)
 
void draw_surface_vertex_with_attribute (index_t vertex, index_t facet, index_t corner)
 
void draw_volume_vertex_with_attribute (index_t vertex, index_t cell, index_t cell_corner)
 
void draw_vertex (index_t v)
 
void draw_surface_mesh_with_lines ()
 
void set_GLUP_parameters ()
 Sets GLUP drawing parameters.
 
void set_GLUP_picking (MeshElementsFlags what)
 Sets GLUP picking mode for drawing primitives of a given type, or deactivates GLUP picking if MeshGfx picking mode is deactivated. More...
 
void set_GLUP_vertex_color_from_picking_id (index_t id)
 Encodes an id as the current vertex color. More...
 
void update_buffer_objects_if_needed ()
 Updates the Vertex Buffer Objects and Vertex Array Objects. More...
 
void update_attribute_buffer_objects_if_needed ()
 Updates the buffer objects used to display attributes. More...
 
void bind_attribute_buffer_object (GLuint VAO)
 Binds the attribute buffer object to a Vertex Array Object. More...
 
void unbind_attribute_buffer_object (GLuint VAO)
 Unbinds the attribute buffer object from a Vertex Array Object. More...
 
void bind_vertices_VBO ()
 Binds the vertices VBO to the current VAO.
 
void begin_attributes ()
 Setups drawing for attributes. More...
 
void end_attributes ()
 Deactivates drawing for attributes.
 
bool can_use_array_mode (GLUPprimitive prim) const
 Tests whether array mode can be used to draw a specified GLUP primitive. More...
 
void update_surface_elements ()
 
void update_volume_elements ()
 
bool hw_filtering_supported () const
 Tests whether hardware primitive filtering is supported. More...
 
void draw_sequences (const MeshSubElementsStore &elements, std::function< void(index_t, index_t)> draw)
 Generic function to extract element sequences to draw. More...
 
void draw_sequences_if (const MeshSubElementsStore &elements, std::function< bool(index_t)> predicate, std::function< void(index_t, index_t)> draw)
 Generic function to extract element sequences to draw. More...
 

Protected Attributes

bool show_mesh_
 
index_t mesh_width_
 
index_t mesh_border_width_
 
double shrink_
 
bool animate_
 
double time_
 
bool draw_cells_ [MESH_NB_CELL_TYPES]
 
float points_size_
 
float points_color_ [4]
 
float mesh_color_ [4]
 
float surface_color_ [4]
 
float backface_surface_color_ [4]
 
float cells_color_ [MESH_NB_CELL_TYPES][4]
 
bool cells_colors_by_type_
 
bool lighting_
 
MeshElementsFlags picking_mode_
 
index_t object_picking_id_
 
std::string vertices_selection_
 
bool do_animation_
 
const Meshmesh_
 
bool triangles_and_quads_
 
bool quads_
 
bool has_cells_ [MESH_NB_CELL_TYPES]
 
bool buffer_objects_dirty_
 
bool attributes_buffer_objects_dirty_
 
bool long_vector_attribute_
 
GLuint vertices_VAO_
 
GLuint edges_VAO_
 
GLuint facets_VAO_
 
GLuint cells_VAO_
 
GLuint vertices_VBO_
 
GLuint edge_indices_VBO_
 
GLuint facet_indices_VBO_
 
GLuint cell_indices_VBO_
 
GLuint vertices_attribute_VBO_
 
MeshElementsFlags attribute_subelements_
 
std::string attribute_name_
 
index_t attribute_dim_
 
double attribute_min_
 
double attribute_max_
 
GLuint attribute_texture_
 
index_t attribute_texture_dim_
 
index_t attribute_repeat_
 
ReadOnlyScalarAttributeAdapter scalar_attribute_
 
ReadOnlyScalarAttributeAdapter tex_coord_attribute_ [3]
 
bool ES_profile_
 
Filter vertices_filter_
 
Filter facets_filter_
 
Filter cells_filter_
 

Detailed Description

Draws a mesh using OpenGL.

Definition at line 60 of file mesh_gfx.h.

Member Function Documentation

◆ begin_attributes()

void GEO::MeshGfx::begin_attributes ( )
protected

Setups drawing for attributes.

If no attribute is bound, does nothing.

◆ bind_attribute_buffer_object()

void GEO::MeshGfx::bind_attribute_buffer_object ( GLuint  VAO)
protected

Binds the attribute buffer object to a Vertex Array Object.

Parameters
[in]VAOone of vertices_VAO_, edges_VAO_, facets_VAO_ or cells_VAO_. If zero, the function does nothing.
Precondition
attribute_.is_bound()

◆ can_use_array_mode()

bool GEO::MeshGfx::can_use_array_mode ( GLUPprimitive  prim) const
protected

Tests whether array mode can be used to draw a specified GLUP primitive.

Parameters
[in]primthe GLUP primitive

◆ draw_sequences()

void GEO::MeshGfx::draw_sequences ( const MeshSubElementsStore elements,
std::function< void(index_t, index_t)>  draw 
)
inlineprotected

Generic function to extract element sequences to draw.

Tests the filter if set, and finds all intervals of primitives to render. For each interval, it calls glupBasePickingId(GLUPuint64(begin)) so that picking Ids are correct.

Parameters
[in]elementsthe MeshSubElementsStore to render
[in]drawthe function to be called for each (begin,end) sequence of elements to be drawn, where begin is the index of the first element, and end one position past the index of the last element.

Definition at line 1023 of file mesh_gfx.h.

◆ draw_sequences_if()

void GEO::MeshGfx::draw_sequences_if ( const MeshSubElementsStore elements,
std::function< bool(index_t)>  predicate,
std::function< void(index_t, index_t)>  draw 
)
inlineprotected

Generic function to extract element sequences to draw.

Tests the filter if set, and finds all intervals of primitives to render. For each interval, it calls glupBasePickingId(GLUPuint64(begin)) so that picking Ids are correct.

Parameters
[in]elementsthe MeshSubElementsStore to render
[in]predicatea function that tests which elements should be drawn or not
[in]drawthe function to be called for each (begin,end) sequence of elements to be drawn, where begin is the index of the first element, and end one position past the index of the last element.

Definition at line 1077 of file mesh_gfx.h.

◆ draw_vertices()

void GEO::MeshGfx::draw_vertices ( )

Draws the vertices of the mesh.

If a vertices selection is set, only the vertices in the selection are drawn

See also
set_vertices_selection()

◆ get_animate()

bool GEO::MeshGfx::get_animate ( ) const
inline

Gets the animate flag.

When animate mode is activated and the mesh has 6d vertices, then an animation is displayed. The first three coordinates correspond to the vertex position at initial time (t=0). The last three coordinates correspond to the vertex position at final time (t=1).

Return values
trueif animation is used
falseotherwise
See also
get_time(), set_time()

Definition at line 220 of file mesh_gfx.h.

◆ get_cells_color()

void GEO::MeshGfx::get_cells_color ( float &  r,
float &  g,
float &  b,
float &  a 
) const
inline

Gets the cells color.

Parameters
[out]r,g,b,athe components of the cells color, in (0.0 .. 1.0)
See also
set_cells_colors_by_type(), draw_volume()

Definition at line 434 of file mesh_gfx.h.

◆ get_draw_cells()

bool GEO::MeshGfx::get_draw_cells ( MeshCellType  type) const
inline

Gets the cell visibility flag.

It is possible to specify cell visibility flags for each individual cell type.

Parameters
[in]typeone of MESH_TET, MESH_HEX, MESH_PRISM, MESH_PYRAMID
Return values
trueif the cells of type should be displayed
falseotherwise

Definition at line 273 of file mesh_gfx.h.

◆ get_lighting()

bool GEO::MeshGfx::get_lighting ( ) const
inline

Gets the lighing flag.

Return values
trueif lighting should be used
falseotherwise

Definition at line 464 of file mesh_gfx.h.

◆ get_mesh_border_width()

index_t GEO::MeshGfx::get_mesh_border_width ( ) const
inline

Gets the mesh border width.

The mesh border width is the one used by draw_surface_borders()

Returns
the mesh border width

Definition at line 165 of file mesh_gfx.h.

◆ get_mesh_color()

void GEO::MeshGfx::get_mesh_color ( float &  r,
float &  g,
float &  b,
float &  a 
) const
inline

Gets the mesh color.

Parameters
[out]r,g,b,athe components of the mesh color, in (0.0 .. 1.0)
See also
set_show_mesh(), draw_surface(), draw_volume()

Definition at line 356 of file mesh_gfx.h.

◆ get_mesh_width()

index_t GEO::MeshGfx::get_mesh_width ( ) const
inline

Gets the mesh width.

The mesh width is taken into account when the mesh visibility flag is set (by set_show_mesh()), when drawing facets and cells.

Returns
the mesh width

Definition at line 143 of file mesh_gfx.h.

◆ get_object_picking_id()

index_t GEO::MeshGfx::get_object_picking_id ( ) const
inline

Gets the object-wide picking id.

Returns
the object-wide picking id, or index_t(-1) if normal per-primitive picking should be used.

Definition at line 534 of file mesh_gfx.h.

◆ get_picking_mode()

MeshElementsFlags GEO::MeshGfx::get_picking_mode ( ) const
inline

Gets the current picking mode.

Returns
a bitwise or ('|') combination of MESH_VERTICES, MESH_EDGES, MESH_FACETS, MESH_CELLS, or MESH_NONE if picking mode is deactivated

Definition at line 513 of file mesh_gfx.h.

◆ get_points_color()

void GEO::MeshGfx::get_points_color ( float &  r,
float &  g,
float &  b,
float &  a 
) const
inline

Gets the points color.

Parameters
[out]r,g,b,athe components of the points color, in (0.0 .. 1.0)
See also
draw_points()

Definition at line 310 of file mesh_gfx.h.

◆ get_points_size()

float GEO::MeshGfx::get_points_size ( ) const
inline

Gets the point size.

Returns
the point size
See also
draw_points()

Definition at line 331 of file mesh_gfx.h.

◆ get_show_mesh()

bool GEO::MeshGfx::get_show_mesh ( ) const
inline

Gets the mesh visibility flag.

The mesh visibility flags specifies whether mesh edges should be drawn. The used color can be specified by set_mesh_color()

Return values
trueif mesh edges should be displayed
falseotherwise

Definition at line 120 of file mesh_gfx.h.

◆ get_shrink()

double GEO::MeshGfx::get_shrink ( ) const
inline

Gets the cells shrink coefficient.

The cells shrink coefficient is used to display cells slighly smaller than what they are. Cells shrinking is only supported in GLSL mode.

Returns
the cells shrink coefficient, betwe 0.0 (no shrink) and 1.0 (full shrink)

Definition at line 187 of file mesh_gfx.h.

◆ get_surface_color()

void GEO::MeshGfx::get_surface_color ( float &  r,
float &  g,
float &  b,
float &  a 
) const
inline

Gets the surface color.

Parameters
[out]r,g,b,athe components of the surface color, in (0.0 .. 1.0)
See also
draw_surface()

Definition at line 389 of file mesh_gfx.h.

◆ get_time()

double GEO::MeshGfx::get_time ( ) const
inline

Gets the time of the animation.

Used if animate mode is set.

Returns
the time of the animation, betwe 0.0 (initial) and 1.0 (final)
See also
get_animate(), set_animate()

Definition at line 245 of file mesh_gfx.h.

◆ get_vertices_selection()

const std::string& GEO::MeshGfx::get_vertices_selection ( ) const
inline

Gets the vertices selection.

Returns
the name of the vertices selection, or an empty string if no vertices selection is set.

Definition at line 555 of file mesh_gfx.h.

◆ hw_filtering_supported()

bool GEO::MeshGfx::hw_filtering_supported ( ) const
protected

Tests whether hardware primitive filtering is supported.

On some higher profiles (GLUP150, GLUP440), it is possible to filter primitives in the shaders. It reduces GPU transfers by making it possible to reuse the same VBOs even when the list of objects to display changes.

◆ mesh()

const Mesh* GEO::MeshGfx::mesh ( ) const
inline

Gets the mesh.

Returns
a pointer to the mesh that will be displayed.

Definition at line 488 of file mesh_gfx.h.

◆ set_animate()

void GEO::MeshGfx::set_animate ( bool  x)
inline

Gets the animate flag.

When animate mode is activated and the mesh has 6d vertices, then an animation is displayed. The first three coordinates correspond to the vertex position at initial time (t=0). The last three coordinates correspond to the vertex position at final time (t=1).

Parameters
[in]xtrue if animation should be used, false otherwise
See also
get_time(), set_time()

Definition at line 234 of file mesh_gfx.h.

◆ set_backface_surface_color()

void GEO::MeshGfx::set_backface_surface_color ( float  r,
float  g,
float  b,
float  a = 1.0f 
)
inline

Sets the surface color for backfacing faces.

Specifies the color used to display the backfaces of the surfacic part of the mesh.

Parameters
[in]r,g,b,athe components of the surface color, in (0.0 .. 1.0)
See also
set_show_mesh(), draw_surface(), draw_volume()

Definition at line 404 of file mesh_gfx.h.

◆ set_cells_color()

void GEO::MeshGfx::set_cells_color ( float  r,
float  g,
float  b,
float  a = 1.0f 
)
inline

Sets the color used to display mesh cells.

Parameters
[in]r,g,b,athe components of the cells color, in (0.0 .. 1.0)
See also
set_cells_colors_by_type(), draw_volume()

Definition at line 419 of file mesh_gfx.h.

◆ set_cells_colors_by_type()

void GEO::MeshGfx::set_cells_colors_by_type ( )
inline

Sets a different color for each mesh cell type.

it uses the following colors:

Definition at line 450 of file mesh_gfx.h.

◆ set_draw_cells()

void GEO::MeshGfx::set_draw_cells ( MeshCellType  type,
bool  x 
)
inline

Sets the cell visibility flag.

It is possible to specify cell visibility flags for each individual cell type.

Parameters
[in]typeone of MESH_TET, MESH_HEX, MESH_PRISM, MESH_PYRAMID
[in]xtrue if mesh cells of type type should be displayed, false otherwise.

Definition at line 286 of file mesh_gfx.h.

◆ set_filter()

void GEO::MeshGfx::set_filter ( MeshElementsFlags  subelements,
const std::string &  name = "filter" 
)

Sets primitive filtering.

Primitive filtering deactivates display of some primitives based on their id and an attribute. The attribute is of type Numeric::uint8. If the attribute value is zero, then the corresponding primitive is not displayed.

Parameters
[in]subelementsone of MESH_VERTICES, MESH_FACETS, MESH_CELLS, MESH_ALL_ELEMENTS
[in]namethe name of the attribute with the filter. Default is "filter"

◆ set_GLUP_picking()

void GEO::MeshGfx::set_GLUP_picking ( MeshElementsFlags  what)
protected

Sets GLUP picking mode for drawing primitives of a given type, or deactivates GLUP picking if MeshGfx picking mode is deactivated.

Parameters
[in]whatone of MESH_VERTICES, MESH_EDGES, MESH_FACETS, MESH_CELLS.

◆ set_GLUP_vertex_color_from_picking_id()

void GEO::MeshGfx::set_GLUP_vertex_color_from_picking_id ( index_t  id)
protected

Encodes an id as the current vertex color.

This is required for drawing polygons, that cannot use standard GLUP primitives and picking.

◆ set_lighting()

void GEO::MeshGfx::set_lighting ( bool  x)
inline

Sets the lighting flag.

Parameters
[in]xtrue if lighting should be used, false otherwise.

Definition at line 473 of file mesh_gfx.h.

◆ set_mesh()

void GEO::MeshGfx::set_mesh ( const Mesh M)

Sets the mesh.

Parameters
[in]Ma pointer to the mesh that should be displayed.

◆ set_mesh_border_width()

void GEO::MeshGfx::set_mesh_border_width ( index_t  x)
inline

Sets the mesh border width.

The mesh border width is the one used by draw_surface_borders()

Parameters
[in]xthe mesh width (minimum is 1)

Definition at line 175 of file mesh_gfx.h.

◆ set_mesh_color()

void GEO::MeshGfx::set_mesh_color ( float  r,
float  g,
float  b,
float  a = 1.0f 
)
inline

Sets the mesh color.

Specifies the mesh color to be used if mesh edges should be displayed.

Parameters
[in]r,g,b,athe components of the mesh color, in (0.0 .. 1.0)
See also
set_show_mesh(), draw_surface(), draw_volume()

Definition at line 343 of file mesh_gfx.h.

◆ set_mesh_width()

void GEO::MeshGfx::set_mesh_width ( index_t  x)
inline

Sets the mesh width.

The mesh width is taken into account when the mesh visibility flag is set (by set_show_mesh()), when drawing facets and cells.

Parameters
[in]xthe mesh width (minimum is 1)

Definition at line 155 of file mesh_gfx.h.

◆ set_object_picking_id()

void GEO::MeshGfx::set_object_picking_id ( index_t  id)
inline

Sets the object-wide picking id.

When the object-wide picking id is set, it is used to draw all primitives in the picking buffer.

Parameters
[in]idthe object-wide picking id, or index_t(-1) if normal per-primitive picking should be used.

Definition at line 525 of file mesh_gfx.h.

◆ set_picking_mode()

void GEO::MeshGfx::set_picking_mode ( MeshElementsFlags  what)
inline

Sets picking mode.

If picking mode is MESH_NONE, then normal drawing is activated, else the color is replaced with the index of the elements.

Parameters
[in]whata bitwise or ('|') combination of MESH_VERTICES, MESH_EDGES, MESH_FACETS, MESH_CELLS, or MESH_NONE if picking mode should be deactivated
Note
Picking mode is currently only implemented with GLSL support at least v1.5.

Definition at line 503 of file mesh_gfx.h.

◆ set_points_color()

void GEO::MeshGfx::set_points_color ( float  r,
float  g,
float  b,
float  a = 1.0f 
)
inline

Sets the points color.

Specifies the color used to display points

Parameters
[in]r,g,b,athe components of the points color, in (0.0 .. 1.0)
See also
draw_points()

Definition at line 297 of file mesh_gfx.h.

◆ set_points_size()

void GEO::MeshGfx::set_points_size ( float  x)
inline

Sets the point size.

Parameters
[in]xthe point size (minimum 1)
See also
draw_points()

Definition at line 322 of file mesh_gfx.h.

◆ set_scalar_attribute()

void GEO::MeshGfx::set_scalar_attribute ( MeshElementsFlags  subelements,
const std::string &  name,
double  attr_min,
double  attr_max,
GLuint  colormap_texture,
index_t  repeat = 1 
)

Sets the parameters for displaying a scalar attribute using texture mapping.

Parameters
[in]subelementsone of MESH_VERTICES, MESH_FACETS, MESH_FACET_CORNERS, MESH_CELLS, MESH_CELL_CORNERS, MESH_CELL_FACETS
[in]namename of the attribute with an optional index, for instance, "foobar[5]" refers to the 5th coordinate of the "foobar" vector attribute.
[in]attr_minvalue of the attribute that is bound to the leftmost color in the colormap
[in]attr_maxvalue of the attribute that is bound to the rightmost color in the colormap
[in]colormap_texturethe texture to be used to display the attribute colors
[in]repeatthe number of times the colorramp should be repeated within the specified range.

◆ set_show_mesh()

void GEO::MeshGfx::set_show_mesh ( bool  x)
inline

Sets the mesh visibility flag.

Parameters
[in]xthe new value of the mesh visibility flag.

The mesh visibility flags specifies whether mesh edges should be drawn. The used color can be specified by set_mesh_color()

Definition at line 131 of file mesh_gfx.h.

◆ set_shrink()

void GEO::MeshGfx::set_shrink ( double  x)
inline

Sets the cells shrink coefficient.

The cells shrink coefficient is used to display cells slighly smaller than what they are. Cells shrinking is only supported in GLSL mode.

Parameters
[in]xthe cells shrink coefficient, betwe 0.0 (no shrink) and 1.0 (full shrink)

Definition at line 199 of file mesh_gfx.h.

◆ set_surface_color()

void GEO::MeshGfx::set_surface_color ( float  r,
float  g,
float  b,
float  a = 1.0f 
)
inline

Sets the surface color.

Specifies the color used to display the surfacic part of the mesh. It specifies the color of both frontfacing and backfacing faces.

Parameters
[in]r,g,b,athe components of the surface color, in (0.0 .. 1.0)
See also
draw_surface(), set_backface_surface_color()

Definition at line 372 of file mesh_gfx.h.

◆ set_texturing()

void GEO::MeshGfx::set_texturing ( MeshElementsFlags  subelements,
const std::string &  attribute_name,
GLuint  texture,
index_t  texture_dim,
index_t  repeat = 1 
)

Sets the parameters for texture mapping.

Parameters
[in]subelementsthe subelements that have texture coordinates.
[in]attribute_namethe name of the attribute that has the texture coordinates. Can be a 2d or 3d vector attribute.
[in]texturethe texture.
[in]repeatthe number of times the texture should be repeated in the unit square in texture space.

◆ set_time()

void GEO::MeshGfx::set_time ( double  x)
inline

Gets the time of the animation.

Used if animate mode is set.

Parameters
[in]xthe time of the animation, betwe 0.0 (initial) and 1.0 (final)
See also
get_animate(), set_animate()

Definition at line 256 of file mesh_gfx.h.

◆ set_vertices_selection()

void GEO::MeshGfx::set_vertices_selection ( const std::string &  name)
inline

Sets the vertices selection.

If set, the vertices selection is used to determine which vertices should be drawn by draw_vertices().

Parameters
[in]namethe name of a Property<bool> bound to the vertices of the mesh.
See also
draw_vertices()

Definition at line 546 of file mesh_gfx.h.

◆ unbind_attribute_buffer_object()

void GEO::MeshGfx::unbind_attribute_buffer_object ( GLuint  VAO)
protected

Unbinds the attribute buffer object from a Vertex Array Object.

Parameters
[in]VAOone of vertices_VAO_, edges_VAO_, facets_VAO_ or cells_VAO_. If zero, the function does nothing.

◆ update_attribute_buffer_objects_if_needed()

void GEO::MeshGfx::update_attribute_buffer_objects_if_needed ( )
protected

Updates the buffer objects used to display attributes.

The buffer objects are updated if attribute_buffer_objects_dirty_ is set, then attribute_buffer_objects_dirty_ is reset. If attribute_buffer_objects_dirty_ is not set, it checks whether the sizes of the buffer objects match the size of the mesh arrays.

◆ update_buffer_objects_if_needed()

void GEO::MeshGfx::update_buffer_objects_if_needed ( )
protected

Updates the Vertex Buffer Objects and Vertex Array Objects.

The buffer objects are updated if buffer_objects_dirty_ is set, then buffer_objects_dirty_ is reset. If buffer_objects_dirty_ is not set, it checks whether the sizes of the buffer objects match the size of the mesh arrays.


The documentation for this class was generated from the following file: