40 #ifdef RINGMESH_WITH_GRAPHICS 44 #include <geogram_gfx/glup_viewer/glup_viewer_gui.h> 57 #define COMMON_GEOGRAM_GFX_IMPLEMENTATION( Class ) \ 59 void draw_vertices() override \ 61 mesh_gfx_.draw_vertices(); \ 63 void set_vertex_color( float r, float g, float b ) override \ 65 mesh_gfx_.set_points_color( r, g, b ); \ 67 void set_vertex_size( index_t s ) override \ 69 mesh_gfx_.set_points_size( static_cast< float >( s ) ); \ 71 void set_scalar_attribute( GEO::MeshElementsFlags subelements, \ 72 const std::string& name, double attr_min, double attr_max, \ 73 GLuint colormap_texture ) override \ 75 mesh_gfx_.set_scalar_attribute( \ 76 subelements, name, attr_min, attr_max, colormap_texture ); \ 78 void unset_scalar_attribute() override \ 80 mesh_gfx_.unset_scalar_attribute(); \ 84 GEO::MeshGfx mesh_gfx_ 86 template < index_t DIMENSION >
87 class GeogramPointSetMeshGfx :
public PointSetMeshGfx< DIMENSION >
89 COMMON_GEOGRAM_GFX_IMPLEMENTATION( GeogramPointSetMeshGfx );
92 explicit GeogramPointSetMeshGfx(
const PointSetMesh< DIMENSION >& mesh )
95 &
dynamic_cast< const GeogramPointSetMesh< DIMENSION >&
>( mesh )
97 set_vertex_color( 1, 0, 0 );
102 template < index_t DIMENSION >
103 class GeogramLineMeshGfx :
public LineMeshGfx< DIMENSION >
105 COMMON_GEOGRAM_GFX_IMPLEMENTATION( GeogramLineMeshGfx );
108 explicit GeogramLineMeshGfx(
const LineMesh< DIMENSION >& mesh )
111 &
dynamic_cast< const GeogramLineMesh< DIMENSION >&
>( mesh )
113 set_vertex_color( 1, 1, 1 );
114 set_edge_color( 1, 1, 1 );
117 void draw_edges()
override 119 mesh_gfx_.draw_edges();
122 void set_edge_color(
float r,
float g,
float b )
override 124 mesh_gfx_.set_mesh_color( r, g, b );
127 void set_edge_width( index_t s )
override 129 mesh_gfx_.set_mesh_width( s );
134 template < index_t DIMENSION >
135 class GeogramSurfaceMeshGfx :
public SurfaceMeshGfx< DIMENSION >
137 COMMON_GEOGRAM_GFX_IMPLEMENTATION( GeogramSurfaceMeshGfx );
140 explicit GeogramSurfaceMeshGfx(
const SurfaceMesh< DIMENSION >& mesh )
143 &
dynamic_cast< const GeogramSurfaceMesh< DIMENSION >&
>( mesh )
147 void draw_surface()
override 149 mesh_gfx_.draw_surface();
152 void set_surface_color(
float r,
float g,
float b )
override 154 mesh_gfx_.set_surface_color( r, g, b );
157 void set_backface_surface_color(
float r,
float g,
float b )
override 159 mesh_gfx_.set_backface_surface_color( r, g, b );
162 void set_mesh_color(
float r,
float g,
float b )
override 164 mesh_gfx_.set_mesh_color( r, g, b );
167 void set_mesh_visibility(
bool b )
override 169 mesh_gfx_.set_show_mesh( b );
172 void set_mesh_width( index_t s )
override 174 mesh_gfx_.set_mesh_width( s );
179 template < index_t DIMENSION >
180 class GeogramVolumeMeshGfx :
public VolumeMeshGfx< DIMENSION >
182 COMMON_GEOGRAM_GFX_IMPLEMENTATION( GeogramVolumeMeshGfx );
185 explicit GeogramVolumeMeshGfx(
const VolumeMesh< DIMENSION >& mesh )
188 &
dynamic_cast< const GeogramVolumeMesh< DIMENSION >&
>( mesh )
192 void draw_volume()
override 194 mesh_gfx_.draw_volume();
197 void set_draw_cells(
CellType type,
bool x )
override 199 mesh_gfx_.set_draw_cells(
200 static_cast< GEO::MeshCellType >( type ), x );
203 void set_cell_colors_by_type()
override 205 mesh_gfx_.set_cells_colors_by_type();
208 void set_cells_color(
float r,
float g,
float b )
override 210 mesh_gfx_.set_cells_color( r, g, b );
213 void set_mesh_color(
float r,
float g,
float b )
override 215 mesh_gfx_.set_mesh_color( r, g, b );
218 void set_mesh_visibility(
bool b )
override 220 mesh_gfx_.set_show_mesh( b );
223 void set_mesh_width( index_t s )
override 225 mesh_gfx_.set_mesh_width( s );
228 void set_shrink(
double s )
override 230 mesh_gfx_.set_shrink( s );
233 using GeogramVolumeMeshGfx3D = GeogramVolumeMeshGfx< 3 >;
235 void register_geogram_mesh_gfx();
Classes to build GeoModel from various inputs.