Rename gmio_stl_geom->gmio_stl_mesh and gmio_stl_geom_creator->gmio_stl_mesh_creator

This commit is contained in:
Hugues Delorme 2014-03-31 15:52:04 +02:00
parent 121181bf15
commit f1e0b1a169
11 changed files with 41 additions and 43 deletions

View File

@ -35,7 +35,9 @@ HEADERS += \
../src/gmio_core/internal/convert.h \
../src/gmio_core/internal/ascii_parse.h \
../src/gmio_core/internal/byte_swap.h \
../src/gmio_core/internal/byte_codec.h
../src/gmio_core/internal/byte_codec.h \
../src/gmio_stl/stl_mesh.h \
../src/gmio_stl/stl_mesh_creator.h
SOURCES += \
../src/gmio_core/endian.c \
@ -61,8 +63,6 @@ contains(GMIO, stl) {
HEADERS += \
../src/gmio_stl/stl_error.h \
../src/gmio_stl/stl_format.h \
../src/gmio_stl/stl_geom.h \
../src/gmio_stl/stl_geom_creator.h \
../src/gmio_stl/stl_global.h \
../src/gmio_stl/stl_io.h \
../src/gmio_stl/stl_triangle.h \

View File

@ -18,10 +18,10 @@ gmio_bool_t gmio_check_transfer(int *error, const gmio_transfer_t* trsf)
return gmio_no_error(*error);
}
gmio_bool_t gmio_stl_check_geom(int *error, const gmio_stl_geom_t* geom)
gmio_bool_t gmio_stl_check_mesh(int *error, const gmio_stl_mesh_t* mesh)
{
if (geom == NULL
|| (geom->triangle_count > 0 && geom->get_triangle_func == NULL))
if (mesh == NULL
|| (mesh->triangle_count > 0 && mesh->get_triangle_func == NULL))
{
*error = GMIO_STL_WRITE_NULL_GET_TRIANGLE_FUNC_ERROR;
}

View File

@ -4,7 +4,7 @@
#include "../../gmio_core/global.h"
#include "../../gmio_core/endian.h"
#include "../../gmio_core/transfer.h"
#include "../stl_geom.h"
#include "../stl_mesh.h"
#include "../stl_triangle.h"
struct gmio_stlb_readwrite_helper
@ -17,7 +17,7 @@ typedef struct gmio_stlb_readwrite_helper gmio_stlb_readwrite_helper_t;
gmio_bool_t gmio_check_transfer(int* error, const gmio_transfer_t* trsf);
gmio_bool_t gmio_stl_check_geom(int* error, const gmio_stl_geom_t* geom);
gmio_bool_t gmio_stl_check_mesh(int* error, const gmio_stl_mesh_t *mesh);
gmio_bool_t gmio_stlb_check_params(int* error,
const gmio_transfer_t* trsf,

View File

@ -7,7 +7,7 @@
/*! This enum defines the various error codes reported by STL read/write functions */
enum gmio_stl_error
{
/*! Common STL write error indicating gmio_stl_geom::get_triangle_func() pointer is NULL */
/*! Common STL write error indicating gmio_stl_mesh::get_triangle_func() pointer is NULL */
GMIO_STL_WRITE_NULL_GET_TRIANGLE_FUNC_ERROR = GMIO_STL_ERROR_TAG + 1,
/* Specific error codes returned by STL_ascii read function */

View File

@ -2,8 +2,8 @@
#define GMIO_LIBSTL_STL_IO_H
#include "stl_global.h"
#include "stl_geom.h"
#include "stl_geom_creator.h"
#include "stl_mesh.h"
#include "stl_mesh_creator.h"
#include "../gmio_core/endian.h"
#include "../gmio_core/transfer.h"
@ -14,12 +14,12 @@ GMIO_C_LINKAGE_BEGIN
*/
/*! Read geometry from STL ascii stream */
GMIO_LIBSTL_EXPORT int gmio_stla_read(gmio_stl_geom_creator_t* creator,
GMIO_LIBSTL_EXPORT int gmio_stla_read(gmio_stl_mesh_creator_t* creator,
gmio_transfer_t* trsf,
size_t data_size_hint);
/*! Write geometry in the STL ascii format */
GMIO_LIBSTL_EXPORT int gmio_stla_write(const gmio_stl_geom_t* geom,
GMIO_LIBSTL_EXPORT int gmio_stla_write(const gmio_stl_mesh_t* mesh,
gmio_transfer_t* trsf,
const char* solid_name,
uint8_t real32_prec);
@ -29,12 +29,12 @@ GMIO_LIBSTL_EXPORT int gmio_stla_write(const gmio_stl_geom_t* geom,
*/
/*! Read geometry from STL binary stream */
GMIO_LIBSTL_EXPORT int gmio_stlb_read(gmio_stl_geom_creator_t* creator,
GMIO_LIBSTL_EXPORT int gmio_stlb_read(gmio_stl_mesh_creator_t* creator,
gmio_transfer_t* trsf,
gmio_endianness_t byte_order);
/*! Write geometry in the STL binary format */
GMIO_LIBSTL_EXPORT int gmio_stlb_write(const gmio_stl_geom_t* geom,
GMIO_LIBSTL_EXPORT int gmio_stlb_write(const gmio_stl_mesh_t* mesh,
gmio_transfer_t* trsf,
const uint8_t* header_data,
gmio_endianness_t byte_order);

View File

@ -1,11 +1,11 @@
#ifndef GMIO_LIBSTL_STL_GEOM_H
#define GMIO_LIBSTL_STL_GEOM_H
#ifndef GMIO_LIBSTL_STL_MESH_H
#define GMIO_LIBSTL_STL_MESH_H
#include "stl_global.h"
#include "stl_triangle.h"
/*! Provides an interface for accessing the underlying(hidden) user mesh */
struct gmio_stl_geom
struct gmio_stl_mesh
{
/*! Opaque pointer on the user mesh, passed as first argument to hook functions */
const void* cookie;
@ -17,6 +17,6 @@ struct gmio_stl_geom
void (*get_triangle_func)(const void* cookie, uint32_t tri_id, gmio_stl_triangle_t* triangle);
};
typedef struct gmio_stl_geom gmio_stl_geom_t;
typedef struct gmio_stl_mesh gmio_stl_mesh_t;
#endif /* GMIO_LIBSTL_STL_GEOM_H */
#endif /* GMIO_LIBSTL_STL_MESH_H */

View File

@ -1,11 +1,11 @@
#ifndef GMIO_LIBSTL_STL_GEOM_CREATOR_H
#define GMIO_LIBSTL_STL_GEOM_CREATOR_H
#ifndef GMIO_LIBSTL_STL_MESH_CREATOR_H
#define GMIO_LIBSTL_STL_MESH_CREATOR_H
#include "stl_global.h"
#include "stl_triangle.h"
/*! Provides an interface for the creation of the underlying(hidden) user mesh */
struct gmio_stl_geom_creator
struct gmio_stl_mesh_creator
{
/*! Opaque pointer on the user mesh, passed as first argument to hook functions */
void* cookie;
@ -43,6 +43,6 @@ struct gmio_stl_geom_creator
void (*end_solid_func)(void* cookie);
};
typedef struct gmio_stl_geom_creator gmio_stl_geom_creator_t;
typedef struct gmio_stl_mesh_creator gmio_stl_mesh_creator_t;
#endif /* GMIO_LIBSTL_STL_GEOM_CREATOR_H */
#endif /* GMIO_LIBSTL_STL_MESH_CREATOR_H */

View File

@ -93,7 +93,7 @@ typedef struct
gmio_ascii_stream_fwd_iterator_t stream_iterator;
_internal_gmio_fwd_iterator_cookie_t stream_iterator_cookie;
gmio_ascii_string_buffer_t string_buffer;
gmio_stl_geom_creator_t* creator;
gmio_stl_mesh_creator_t* creator;
} gmio_stla_parse_data_t;
static void gmio_stream_fwd_iterator_stla_read_hook(void* cookie,
@ -381,7 +381,7 @@ static void parse_solid(gmio_stla_parse_data_t* data)
#define GMIO_STLA_READ_STRING_BUFFER_LEN 512
int gmio_stla_read(gmio_stl_geom_creator_t *creator,
int gmio_stla_read(gmio_stl_mesh_creator_t *creator,
gmio_transfer_t *trsf,
size_t data_size_hint)
{

View File

@ -96,9 +96,7 @@ static gmio_bool_t gmio_transfer_flush_buffer(gmio_transfer_t* trsf, size_t n)
#define _GMIO_INTERNAL_MIN(v1, v2) ((v1) < (v2) ? (v1) : (v2))
/*! \fn int gmio_stla_write(gmio_stl_geom_t*, gmio_transfer_t*, const char*, uint8_t)
*
* \param geom Defines the custom geometry to write
/*! \param geom Defines the custom geometry to write
* \param trsf Defines needed objects (stream, buffer, ...) for the writing operation
* \param solid_name May be NULL to generate default name
* \param real32_prec The maximum number of significant digits
@ -107,12 +105,12 @@ static gmio_bool_t gmio_transfer_flush_buffer(gmio_transfer_t* trsf, size_t n)
*
* \retval GMIO_NO_ERROR If operation successful
*/
int gmio_stla_write(const gmio_stl_geom_t* geom,
int gmio_stla_write(const gmio_stl_mesh_t *mesh,
gmio_transfer_t* trsf,
const char* solid_name,
uint8_t real32_prec)
{
const uint32_t total_facet_count = geom != NULL ? geom->triangle_count : 0;
const uint32_t total_facet_count = mesh != NULL ? mesh->triangle_count : 0;
uint32_t written_facet_count = 0;
const uint32_t buffer_facet_count = trsf != NULL ? trsf->buffer_size / GMIO_STLA_FACET_SIZE_P2 : 0;
uint32_t ifacet = 0;
@ -122,7 +120,7 @@ int gmio_stla_write(const gmio_stl_geom_t* geom,
/* Check validity of input parameters */
gmio_check_transfer(&error, trsf);
gmio_stl_check_geom(&error, geom);
gmio_stl_check_mesh(&error, mesh);
if (real32_prec == 0 || real32_prec > 9)
error = GMIO_STLA_WRITE_INVALID_REAL32_PREC_ERROR;
if (trsf->buffer_size < GMIO_STLA_FACET_SIZE_P2)
@ -162,7 +160,7 @@ int gmio_stla_write(const gmio_stl_geom_t* geom,
/* Writing of facets is buffered */
buffer_iterator = trsf->buffer;
for (ibuffer_facet = ifacet; ibuffer_facet < clamped_facet_count; ++ibuffer_facet) {
geom->get_triangle_func(geom->cookie, ibuffer_facet, &tri);
mesh->get_triangle_func(mesh->cookie, ibuffer_facet, &tri);
buffer_iterator = gmio_write_string(buffer_iterator, "facet normal ");
buffer_iterator = gmio_write_coords(buffer_iterator, coords_format, &tri.normal);
buffer_iterator = gmio_write_eol(buffer_iterator);

View File

@ -18,7 +18,7 @@ GMIO_INLINE static void read_triangle_memcpy(const uint8_t* buffer,
memcpy(triangle, buffer, GMIO_STLB_TRIANGLE_RAWSIZE);
}
static void gmio_stlb_read_facets(gmio_stl_geom_creator_t* creator,
static void gmio_stlb_read_facets(gmio_stl_mesh_creator_t* creator,
const uint8_t* buffer,
const gmio_stlb_readwrite_helper_t* rparams)
{
@ -44,7 +44,7 @@ static void gmio_stlb_read_facets(gmio_stl_geom_creator_t* creator,
}
}
int gmio_stlb_read(gmio_stl_geom_creator_t *creator,
int gmio_stlb_read(gmio_stl_mesh_creator_t *creator,
gmio_transfer_t* trsf,
gmio_endianness_t byte_order)
{

View File

@ -16,7 +16,7 @@ GMIO_INLINE static void write_triangle_memcpy(const gmio_stl_triangle_t* triangl
memcpy(buffer, triangle, GMIO_STLB_TRIANGLE_RAWSIZE);
}
static void gmio_stlb_write_facets(const gmio_stl_geom_t* geom,
static void gmio_stlb_write_facets(const gmio_stl_mesh_t* mesh,
uint8_t* buffer,
const gmio_stlb_readwrite_helper_t* wparams)
{
@ -26,12 +26,12 @@ static void gmio_stlb_write_facets(const gmio_stl_geom_t* geom,
uint32_t buffer_offset = 0;
uint32_t i_facet = 0;
if (geom == NULL || geom->get_triangle_func == NULL)
if (mesh == NULL || mesh->get_triangle_func == NULL)
return;
triangle.attribute_byte_count = 0;
for (i_facet = i_facet_offset; i_facet < (i_facet_offset + facet_count); ++i_facet) {
geom->get_triangle_func(geom->cookie, i_facet, &triangle);
mesh->get_triangle_func(mesh->cookie, i_facet, &triangle);
if (wparams->fix_endian_func != NULL)
wparams->fix_endian_func(&triangle);
@ -42,18 +42,18 @@ static void gmio_stlb_write_facets(const gmio_stl_geom_t* geom,
} /* end for */
}
int gmio_stlb_write(const gmio_stl_geom_t *geom,
int gmio_stlb_write(const gmio_stl_mesh_t *mesh,
gmio_transfer_t* trsf,
const uint8_t *header_data,
gmio_endianness_t byte_order)
{
gmio_stlb_readwrite_helper_t wparams;
const uint32_t facet_count = geom != NULL ? geom->triangle_count : 0;
const uint32_t facet_count = mesh != NULL ? mesh->triangle_count : 0;
uint32_t i_facet = 0;
int error = GMIO_NO_ERROR;
/* Check validity of input parameters */
gmio_stl_check_geom(&error, geom);
gmio_stl_check_mesh(&error, mesh);
gmio_stlb_check_params(&error, trsf, byte_order);
if (gmio_error(error))
return error;
@ -90,7 +90,7 @@ int gmio_stlb_write(const gmio_stl_geom_t *geom,
if (wparams.facet_count > (facet_count - wparams.i_facet_offset))
wparams.facet_count = facet_count - wparams.i_facet_offset;
gmio_stlb_write_facets(geom, trsf->buffer, &wparams);
gmio_stlb_write_facets(mesh, trsf->buffer, &wparams);
wparams.i_facet_offset += wparams.facet_count;
/* Write buffer to stream */