40 #ifndef GEOGRAM_GFX_GLUP_GLUP_MARCHING_CELLS
41 #define GEOGRAM_GFX_GLUP_GLUP_MARCHING_CELLS
45 #include <geogram/basic/logger.h>
115 return edge_[e*2+lv];
127 return config_size_[config];
135 return max_config_size_;
148 return config_ + config * nb_edges_;
157 return GLSL_uniform_state_declaration_.c_str();
166 return GLSL_compute_intersections_.c_str();
176 return uniform_binding_point_;
222 lv = (lv+1) % desc_->nb_vertices_in_facet[f];
234 return desc_->facet_vertex[f][lv];
247 return origin_vertex(f, lv);
259 index_t v1 = origin_vertex(f, lv);
260 index_t v2 = destination_vertex(f, lv);
261 index_t result = vv_to_e_[v1*desc_->nb_vertices+v2];
288 index_t v1 = origin_vertex(f, lv);
289 index_t v2 = destination_vertex(f, lv);
290 bool v1_in = ((config & 1u<<v1) != 0);
291 bool v2_in = ((config & 1u<<v2) != 0);
292 return (v1_in != v2_in);
343 std::string GLSL_uniform_state_declaration_;
344 std::string GLSL_compute_intersections_;
345 GLuint uniform_binding_point_;
347 GLuint elements_VBO_;
GLUP: GL Useful Primitives.
GLUPprimitive
Symbolic values corresponding to GLUP primitive types.
#define geo_debug_assert(x)
Verifies that a condition is met.
Implements the MarchingCells algorithm.
GLuint create_UBO()
Creates a Uniform Buffer Object that contains the tables for the marching cell.
index_t nb_edges() const
Gets the number of edges.
index_t origin_vertex(index_t f, index_t lv)
Gets the origin vertex of a halfedge.
index_t nb_vertices() const
Gets the number of vertices.
void move_to_opposite(index_t &f, index_t &lv)
Moves from a given halfedge to the opposite halfege.
MarchingCell(GLUPprimitive prim)
MarchingCell constructor.
bool get_first_edge(index_t &f, index_t &lv, index_t config)
Gets the first intersected halfedge given a vertex configuration.
GLuint uniform_binding_point() const
Gets the binding point of the uniform buffer that contains the tables for the marching cell.
void move_to_next(index_t &f, index_t &lv)
Moves from a given halfedge to the next halfege.
index_t config_size(index_t config) const
Gets the number of intersected edges in a configuration.
GLuint create_elements_VBO()
Creates a Vertex Buffer Object with the indices for all configurations.
bool edge_is_intersected(index_t f, index_t lv, index_t config)
Tests whether a given edge is intersected.
const char * GLSL_uniform_state_declaration() const
Gets the GLSL declaration of marching cell uniform state.
index_t max_config_size() const
Gets the maximum configuration size.
index_t destination_vertex(index_t f, index_t lv)
Gets the destination vertex of a halfedge.
void bind_uniform_state(GLuint program)
Binds the uniform state marching cell variables to a given program.
const char * GLSL_compute_intersections() const
Gets the GLSL declaration of the function that computes the intersections.
index_t edge_vertex(index_t e, index_t lv) const
Gets a vertex by edge index and local vertex index.
index_t nb_configs() const
Gets the number of configurations.
index_t edge(index_t f, index_t lv)
Gets the edge index that corresponds to a given halfedge.
const index_t * config_edges(index_t config) const
Gets the list of intersected edges in a configuration.
~MarchingCell()
MarchingCell destructor.
bool config_is_ambiguous(index_t config)
Tests whether a vertex configuration bitcode is ambiguous.
void compute_config(index_t config)
Computes the intersection polygon for a configuration.
Common include file, providing basic definitions. Should be included before anything else by all head...
The class that represents a mesh.
Global Vorpaline namespace.
geo_index_t index_t
The type for storing and manipulating indices.
Lookup tables that describe the combinatorics of each cell type.