star-geometry-3d

Clean and decorate 3D geometries
git clone git://git.meso-star.fr/star-geometry-3d.git
Log | Files | Refs | README | LICENSE

commit 29afe82d8167ae8d49ed31fea228c1951a6b0429
parent 6592a4000866ce401a86ad528a6da11873266862
Author: Christophe Coustet <christophe.coustet@meso-star.com>
Date:   Wed,  5 Feb 2020 14:14:20 +0100

Additional renaming

Diffstat:
Mcmake/CMakeLists.txt | 6+++---
Msrc/sg3d_senc_helper.h | 6+++---
Msrc/sgX3d.h | 180++++++++++++++++++++++++++++++++++++++++----------------------------------------
3 files changed, 96 insertions(+), 96 deletions(-)

diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt @@ -14,7 +14,7 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. cmake_minimum_required(VERSION 3.1) -project(star-geometry3D C) +project(star-geometry-3d C) enable_testing() include(CMakeDependentOption) @@ -110,7 +110,7 @@ set_target_properties(sg3d PROPERTIES SOVERSION ${VERSION_MAJOR}) rcmake_copy_runtime_libraries(sg3d) -rcmake_setup_devel(sg3d StarGeom ${VERSION} star/sg3d_version.h) +rcmake_setup_devel(sg3d StarGeom3D ${VERSION} star/sg3d_version.h) ################################################################################ # Add tests @@ -185,4 +185,4 @@ install(TARGETS sg3d LIBRARY DESTINATION lib RUNTIME DESTINATION bin) install(FILES ${SG3D_FILES_INC_API} DESTINATION include/star) -install(FILES ${SG3D_FILES_DOC} DESTINATION share/doc/star-geometry3D) +install(FILES ${SG3D_FILES_DOC} DESTINATION share/doc/star-geometry-3d) diff --git a/src/sg3d_senc_helper.h b/src/sg3d_senc_helper.h @@ -24,7 +24,7 @@ /* Get vertex indices for the itri_th triangle. * Suitable for use as get_indices callback in senc_scene_create calls. */ static FINLINE void -sg3_senc_geometry_get_indices +sg3d_senc_geometry_get_indices (const unsigned itri, unsigned indices[SG3D_GEOMETRY_DIMENSION], void* ctx) @@ -39,7 +39,7 @@ sg3_senc_geometry_get_indices /* Get vertex indices for the itri_th triangle. * Suitable for use as get_media callback in senc_scene_create calls. */ static FINLINE void -sg3_senc_geometry_get_media +sg3d_senc_geometry_get_media (const unsigned itri, unsigned media[2], void* ctx) @@ -59,7 +59,7 @@ sg3_senc_geometry_get_media /* Get vertex indices for the itri_th triangle. * Suitable for use as get_position callback in senc_scene_create calls. */ static FINLINE void -sg3_senc_geometry_get_position +sg3d_senc_geometry_get_position (const unsigned ivert, double coord[SG3D_GEOMETRY_DIMENSION], void* ctx) diff --git a/src/sgX3d.h b/src/sgX3d.h @@ -17,7 +17,7 @@ #define STAR_GEOMETRY3D_X_H__ #include <star/sg3d.h> -#include <star/sg3_senc_helper.h> +#include <star/sg3d_senc_helper.h> #include <star/sg3d_s3d_helper.h> #include <rsys/rsys.h> @@ -28,16 +28,16 @@ * the following pattern: * * #if (DIM==2) - * #include <star/sgX2.h> + * #include <star/sgX2d.h> * #elif (DIM==3) - * #include <star/sgX3.h> + * #include <star/sgX3d.h> * #else * #error DIM should be defined; possible values are 2 and 3 * #endif * - * Then use the sgX_... types and functions in your code. + * Then use the sgXd_... types and functions in your code. * - * Definitions from sgX2.h and sgX3.h cannot be visible at the same time + * Definitions from sgX2d.h and sgX3d.h cannot be visible at the same time * as some of them conflict. */ @@ -45,9 +45,9 @@ * `Func' returns an error. One should use this macro on StarEnc function calls * for which no explicit error checking is performed. */ #ifndef NDEBUG -#define SGX(Func) ASSERT(sgX_ ## Func == RES_OK) +#define SGXD(Func) ASSERT(sgXd_ ## Func == RES_OK) #else -#define SGX(Func) sgX_ ## Func +#define SGXD(Func) sgXd_ ## Func #endif /* Forward declaration of the star-geometry opaque data types. These data @@ -56,40 +56,40 @@ * functions get or release a reference on the data, i.e. they increment or * decrement the reference counter, respectively. When this counter reaches 0, * the object is silently destroyed and cannot be used anymore. */ -typedef struct sg3d_device sgX_device; -typedef struct sg3d_geometry sgX_geometry; +typedef struct sg3d_device sgXd_device; +typedef struct sg3d_geometry sgXd_geometry; /****************************************************************************** * The dimension of the geometry used in the library. *****************************************************************************/ -#define SGX_GEOMETRY_DIMENSION SG3D_GEOMETRY_DIMENSION +#define SGXD_GEOMETRY_DIMENSION SG3D_GEOMETRY_DIMENSION /****************************************************************************** * A type to list the different user properties attached to triangles. *****************************************************************************/ -enum sgX_property_type { - SGX_FRONT = SG3D_FRONT, - SGX_BACK = SG3D_BACK, - SGX_INTFACE = SG3D_INTFACE, - SGX_PROP_TYPES_COUNT__ = SG3D_PROP_TYPES_COUNT__ +enum sgXd_property_type { + SGXD_FRONT = SG3D_FRONT, + SGXD_BACK = SG3D_BACK, + SGXD_INTFACE = SG3D_INTFACE, + SGXD_PROP_TYPES_COUNT__ = SG3D_PROP_TYPES_COUNT__ }; /****************************************************************************** * A type to list the different possible partitions of triangles. *****************************************************************************/ -enum sgX_obj_dump_content { - SGX_OBJ_DUMP_MERGE_CONFLICTS = SG3D_OBJ_DUMP_MERGE_CONFLICTS, - SGX_OBJ_DUMP_PROPERTY_CONFLICTS = SG3D_OBJ_DUMP_PROPERTY_CONFLICTS, - SGX_OBJ_DUMP_VALID_PRIMITIVE = SG3D_OBJ_DUMP_VALID_PRIMITIVE, - SGX_OBJ_DUMP_ALL = SG3D_OBJ_DUMP_ALL +enum sgXd_obj_dump_content { + SGXD_OBJ_DUMP_MERGE_CONFLICTS = SG3D_OBJ_DUMP_MERGE_CONFLICTS, + SGXD_OBJ_DUMP_PROPERTY_CONFLICTS = SG3D_OBJ_DUMP_PROPERTY_CONFLICTS, + SGXD_OBJ_DUMP_VALID_PRIMITIVE = SG3D_OBJ_DUMP_VALID_PRIMITIVE, + SGXD_OBJ_DUMP_ALL = SG3D_OBJ_DUMP_ALL }; /****************************************************************************** * A type to list the different qualifiers of C code variable output. *****************************************************************************/ -enum sgX_c_dump_qualifiers { - SGX_C_DUMP_CONST = SG3D_C_DUMP_CONST, - SGX_C_DUMP_STATIC = SG3D_C_DUMP_STATIC +enum sgXd_c_dump_qualifiers { + SGXD_C_DUMP_CONST = SG3D_C_DUMP_CONST, + SGXD_C_DUMP_STATIC = SG3D_C_DUMP_STATIC }; /****************************************************************************** @@ -98,13 +98,13 @@ enum sgX_c_dump_qualifiers { * SG3D_UNSPECIFIED_PROPERTY can be used for a property that has already been * defined; in this case the previous value will remain. *****************************************************************************/ -#define SGX_UNSPECIFIED_PROPERTY SG3D_UNSPECIFIED_PROPERTY +#define SGXD_UNSPECIFIED_PROPERTY SG3D_UNSPECIFIED_PROPERTY /***************************************************************************** * A type to hold callbacks for sg3d_geometry_add. ****************************************************************************/ -typedef struct sg3d_geometry_add_callbacks sgX_geometry_add_callbacks; -#define SGX_ADD_CALLBACKS_NULL__ SG3D_ADD_CALLBACKS_NULL__ +typedef struct sg3d_geometry_add_callbacks sgXd_geometry_add_callbacks; +#define SGXD_ADD_CALLBACKS_NULL__ SG3D_ADD_CALLBACKS_NULL__ BEGIN_DECLS @@ -112,7 +112,7 @@ BEGIN_DECLS * A helper function on properties compatibility. *****************************************************************************/ static FINLINE int -sgX_compatible_property +sgXd_compatible_property (const unsigned p1, const unsigned p2) { @@ -124,25 +124,25 @@ sgX_compatible_property * It manages the star-geometry resources. *****************************************************************************/ static FINLINE res_T -sgX_device_create +sgXd_device_create (struct logger* logger, /* Can be NULL <=> use default logger */ struct mem_allocator* allocator, /* Can be NULL <=> use default allocator */ const int verbose, /* Verbosity level */ - sgX_device** dev) + sgXd_device** dev) { return sg3d_device_create(logger, allocator, verbose, dev); } static FINLINE res_T -sgX_device_ref_get - (sgX_device* dev) +sgXd_device_ref_get + (sgXd_device* dev) { return sg3d_device_ref_get(dev); } static FINLINE res_T -sgX_device_ref_put - (sgX_device* dev) +sgXd_device_ref_put + (sgXd_device* dev) { return sg3d_device_ref_put(dev); } @@ -156,17 +156,17 @@ sgX_device_ref_put /* Create a geometry that can be used to accumulate vertices and triangles * decorated with properties. */ static FINLINE res_T -sgX_geometry_create - (sgX_device* dev, - sgX_geometry** geometry) +sgXd_geometry_create + (sgXd_device* dev, + sgXd_geometry** geometry) { return sg3d_geometry_create(dev, geometry); } /* Reserve memory according to anticipated geometry size. */ static FINLINE res_T -sgX_geometry_reserve - (sgX_geometry* geometry, +sgXd_geometry_reserve + (sgXd_geometry* geometry, const unsigned vertices_count, const unsigned triangles_count, const unsigned properties_count) @@ -204,11 +204,11 @@ sgX_geometry_reserve * step consists in rewriting SG3D_UNSPECIFIED_PROPERTY properties if the merged * property is defined. */ static FINLINE res_T -sgX_geometry_add - (sgX_geometry* geometry, +sgXd_geometry_add + (sgXd_geometry* geometry, const unsigned vertices_count, const unsigned triangles_count, - const sgX_geometry_add_callbacks* callbacks, + const sgXd_geometry_add_callbacks* callbacks, void* context) /* Can be NULL */ { return sg3d_geometry_add( @@ -225,11 +225,11 @@ sgX_geometry_add * If validation is processed again, the properties conflict count is reset, * as well as the properties_conflict_status status of the triangles. */ static FINLINE res_T -sgX_geometry_validate_properties - (sgX_geometry* geometry, +sgXd_geometry_validate_properties + (sgXd_geometry* geometry, res_T(*validate) (const unsigned itri, - const unsigned properties[SGX_PROP_TYPES_COUNT__], + const unsigned properties[SGXD_PROP_TYPES_COUNT__], void* context, int* properties_conflict_status), void* context) /* Can be NULL */ @@ -239,8 +239,8 @@ sgX_geometry_validate_properties /* Get the number of unique vertices. */ static FINLINE res_T -sgX_geometry_get_unique_vertices_count - (const sgX_geometry* geometry, +sgXd_geometry_get_unique_vertices_count + (const sgXd_geometry* geometry, unsigned* count) { return sg3d_geometry_get_unique_vertices_count(geometry, count); @@ -248,18 +248,18 @@ sgX_geometry_get_unique_vertices_count /* Get the ivtx_th vertex. */ static FINLINE res_T -sgX_geometry_get_unique_vertex - (const sgX_geometry* geometry, +sgXd_geometry_get_unique_vertex + (const sgXd_geometry* geometry, const unsigned ivtx, - double coord[SGX_GEOMETRY_DIMENSION]) + double coord[SGXD_GEOMETRY_DIMENSION]) { return sg3d_geometry_get_unique_vertex(geometry, ivtx, coord); } /* Get the number of triangles added to the geometry, regardless of unicity. */ static FINLINE res_T -sgX_geometry_get_added_primitives_count - (const sgX_geometry* geometry, +sgXd_geometry_get_added_primitives_count + (const sgXd_geometry* geometry, unsigned* count) { return sg3d_geometry_get_added_triangles_count(geometry, count); @@ -267,8 +267,8 @@ sgX_geometry_get_added_primitives_count /* Get the number of unique triangles. */ static FINLINE res_T -sgX_geometry_get_unique_primitives_count - (const sgX_geometry* geometry, +sgXd_geometry_get_unique_primitives_count + (const sgXd_geometry* geometry, unsigned* count) { return sg3d_geometry_get_unique_triangles_count(geometry, count); @@ -276,18 +276,18 @@ sgX_geometry_get_unique_primitives_count /* Get the vertex indices of the itri_th unique triangle. */ static FINLINE res_T -sgX_geometry_get_unique_primitive_vertices - (const sgX_geometry* geometry, +sgXd_geometry_get_unique_primitive_vertices + (const sgXd_geometry* geometry, const unsigned itri, - unsigned indices[SGX_GEOMETRY_DIMENSION]) + unsigned indices[SGXD_GEOMETRY_DIMENSION]) { return sg3d_geometry_get_unique_triangle_vertices(geometry, itri, indices); } /* Get the properties of the itri_th unique triangle. */ static FINLINE res_T -sgX_geometry_get_unique_primitive_properties - (const sgX_geometry* geometry, +sgXd_geometry_get_unique_primitive_properties + (const sgXd_geometry* geometry, const unsigned itri, unsigned properties[SG3D_PROP_TYPES_COUNT__]) { @@ -301,8 +301,8 @@ sgX_geometry_get_unique_primitive_properties * submitted to sg3d_geometry_add calls, regardless of duplication or * sg3d_geometry_add failures (non-RES_OK return value). */ static FINLINE res_T -sgX_geometry_get_unique_primitive_user_id - (const sgX_geometry* geometry, +sgXd_geometry_get_unique_primitive_user_id + (const sgXd_geometry* geometry, const unsigned itri, unsigned* user_id) { @@ -311,8 +311,8 @@ sgX_geometry_get_unique_primitive_user_id /* Get the number of triangles with (at least) one unspecified side. */ static FINLINE res_T -sgX_geometry_get_unique_primitives_with_unspecified_side_count - (const sgX_geometry* geometry, +sgXd_geometry_get_unique_primitives_with_unspecified_side_count + (const sgXd_geometry* geometry, unsigned* count) { return sg3d_geometry_get_unique_triangles_with_unspecified_side_count( @@ -321,8 +321,8 @@ sgX_geometry_get_unique_primitives_with_unspecified_side_count /* Get the number of triangles with unspecified interface. */ static FINLINE res_T -sgX_geometry_get_unique_primitives_with_unspecified_interface_count - (const sgX_geometry* geometry, +sgXd_geometry_get_unique_primitives_with_unspecified_interface_count + (const sgXd_geometry* geometry, unsigned* count) { return sg3d_geometry_get_unique_triangles_with_unspecified_interface_count( @@ -331,8 +331,8 @@ sgX_geometry_get_unique_primitives_with_unspecified_interface_count /* Get the number of triangles flagged with a merge conflict. */ static FINLINE res_T -sgX_geometry_get_unique_primitives_with_merge_conflict_count - (const sgX_geometry* geometry, +sgXd_geometry_get_unique_primitives_with_merge_conflict_count + (const sgXd_geometry* geometry, unsigned* count) { return sg3d_geometry_get_unique_triangles_with_merge_conflict_count( @@ -342,8 +342,8 @@ sgX_geometry_get_unique_primitives_with_merge_conflict_count /* Get the number of triangles flagged with a property conflict. Only * meaningful after sg3d_geometry_validate_properties has been called. */ static FINLINE res_T -sgX_geometry_get_unique_primitives_with_properties_conflict_count - (const sgX_geometry* geometry, +sgXd_geometry_get_unique_primitives_with_properties_conflict_count + (const sgXd_geometry* geometry, unsigned* count) { return sg3d_geometry_get_unique_triangles_with_properties_conflict_count( @@ -360,8 +360,8 @@ sgX_geometry_get_unique_primitives_with_properties_conflict_count * - Merge_conflicts * - Property_conflict */ static FINLINE res_T -sgX_geometry_dump_as_obj - (const sgX_geometry* geometry, +sgXd_geometry_dump_as_obj + (const sgXd_geometry* geometry, FILE* stream, const int flags) { @@ -382,8 +382,8 @@ sgX_geometry_dump_as_obj * - Created_at_sg3d_geometry_add (rank of the sg3d_geometry_add that created the * triangle) */ static FINLINE res_T -sgX_geometry_dump_as_vtk - (const sgX_geometry* geometry, +sgXd_geometry_dump_as_vtk + (const sgXd_geometry* geometry, FILE* stream) { return sg3d_geometry_dump_as_vtk(geometry, stream); @@ -401,8 +401,8 @@ sgX_geometry_dump_as_vtk * The two qualifiers static and const are output or not according to flags; * flags must be ORed enum sg3d_c_dump_qualifiers values. */ static FINLINE res_T -sgX_geometry_dump_as_c_code - (const sgX_geometry* geometry, +sgXd_geometry_dump_as_c_code + (const sgXd_geometry* geometry, FILE* stream, const char* name_prefix, /* Can be NULL or "" */ const int flags) @@ -411,15 +411,15 @@ sgX_geometry_dump_as_c_code } static FINLINE res_T -sgX_geometry_ref_get - (sgX_geometry* geometry) +sgXd_geometry_ref_get + (sgXd_geometry* geometry) { return sg3d_geometry_ref_get(geometry); } static FINLINE res_T -sgX_geometry_ref_put - (sgX_geometry* geometry) +sgXd_geometry_ref_put + (sgXd_geometry* geometry) { return sg3d_geometry_ref_put(geometry); } @@ -431,34 +431,34 @@ sgX_geometry_ref_put /* Get vertex indices for the itri_th triangle. * Suitable for use as get_indices callback in senc_scene_create calls. */ static FINLINE void -sgX_sencX_geometry_get_indices +sgXd_sencX_geometry_get_indices (const unsigned itri, - unsigned indices[SGX_GEOMETRY_DIMENSION], + unsigned indices[SGXD_GEOMETRY_DIMENSION], void* ctx) { - sg3_senc_geometry_get_indices(itri, indices, ctx); + sg3d_senc_geometry_get_indices(itri, indices, ctx); } /* Get vertex indices for the itri_th triangle. * Suitable for use as get_media callback in senc_scene_create calls. */ static FINLINE void -sgX_sencX_geometry_get_media +sgXd_sencX_geometry_get_media (const unsigned itri, unsigned media[2], void* ctx) { - sg3_senc_geometry_get_media(itri, media, ctx); + sg3d_senc_geometry_get_media(itri, media, ctx); } /* Get vertex indices for the itri_th triangle. * Suitable for use as get_position callback in senc_scene_create calls. */ static FINLINE void -sgX_sencX_geometry_get_position +sgXd_sencX_geometry_get_position (const unsigned ivert, - double coord[SGX_GEOMETRY_DIMENSION], + double coord[SGXD_GEOMETRY_DIMENSION], void* ctx) { - sg3_senc_geometry_get_position(ivert, coord, ctx); + sg3d_senc_geometry_get_position(ivert, coord, ctx); } /****************************************************************************** @@ -469,9 +469,9 @@ sgX_sencX_geometry_get_position * Suitable for use as get_indice callback in s3d_mesh_setup_indexed_vertices * calls. */ static FINLINE void -sgX_sXd_geometry_get_indices +sgXd_sXd_geometry_get_indices (const unsigned itri, - unsigned indices[SGX_GEOMETRY_DIMENSION], + unsigned indices[SGXD_GEOMETRY_DIMENSION], void* ctx) { sg3d_s3d_geometry_get_indices(itri, indices, ctx); @@ -481,9 +481,9 @@ sgX_sXd_geometry_get_indices * Suitable for use as s3d_vertex_data getter for S3D_POSITION s3d_attrib_usage * in s3d_mesh_setup_indexed_vertices calls. */ static FINLINE void -sgX_sXd_geometry_get_position +sgXd_sXd_geometry_get_position (const unsigned ivert, - float coord[SGX_GEOMETRY_DIMENSION], + float coord[SGXD_GEOMETRY_DIMENSION], void* ctx) { sg3d_s3d_geometry_get_position(ivert, coord, ctx);