gmio_stl: let gmio_stl_read_file() accept a gmio_task_iface object

This commit is contained in:
Hugues Delorme 2015-04-02 16:09:08 +02:00
parent ef3beb2b50
commit 5302ff1ac6
5 changed files with 11 additions and 5 deletions

View File

@ -153,7 +153,7 @@ static void bench_gmio_stl_read(const char* filepath)
mesh_creator.add_triangle_func = gmio_assimp_add_triangle; mesh_creator.add_triangle_func = gmio_assimp_add_triangle;
mesh_creator.end_solid_func = gmio_assimp_end_solid; mesh_creator.end_solid_func = gmio_assimp_end_solid;
int error = gmio_stl_read_file(filepath, &mesh_creator); int error = gmio_stl_read_file(filepath, &mesh_creator, NULL);
if (error != GMIO_ERROR_OK) if (error != GMIO_ERROR_OK)
printf("GeomIO error: 0x%X\n", error); printf("GeomIO error: 0x%X\n", error);
} }

View File

@ -25,7 +25,7 @@ static void bench_gmio_stl_read(const char* filepath)
mesh_creator.cookie = &cookie; mesh_creator.cookie = &cookie;
mesh_creator.add_triangle_func = dummy_process_triangle; mesh_creator.add_triangle_func = dummy_process_triangle;
error = gmio_stl_read_file(filepath, &mesh_creator); error = gmio_stl_read_file(filepath, &mesh_creator, NULL);
if (error != GMIO_ERROR_OK) if (error != GMIO_ERROR_OK)
printf("GeomIO error: 0x%X\n", error); printf("GeomIO error: 0x%X\n", error);
} }

View File

@ -17,7 +17,7 @@ static void bench_gmio_stl_read(const char* filepath)
{ {
Handle_StlMesh_Mesh mesh = new StlMesh_Mesh; Handle_StlMesh_Mesh mesh = new StlMesh_Mesh;
gmio_stl_mesh_creator_t mesh_creator = gmio_stl_occmesh_creator(mesh); gmio_stl_mesh_creator_t mesh_creator = gmio_stl_occmesh_creator(mesh);
int error = gmio_stl_read_file(filepath, &mesh_creator); int error = gmio_stl_read_file(filepath, &mesh_creator, NULL);
if (error != GMIO_ERROR_OK) if (error != GMIO_ERROR_OK)
printf("GeomIO error: 0x%X\n", error); printf("GeomIO error: 0x%X\n", error);
} }

View File

@ -24,7 +24,8 @@
int gmio_stl_read_file( int gmio_stl_read_file(
const char* filepath, const char* filepath,
gmio_stl_mesh_creator_t* creator) gmio_stl_mesh_creator_t* creator,
gmio_task_iface_t* task_iface)
{ {
int error = GMIO_ERROR_OK; int error = GMIO_ERROR_OK;
FILE* file = NULL; FILE* file = NULL;
@ -34,6 +35,8 @@ int gmio_stl_read_file(
gmio_transfer_t trsf = { 0 }; gmio_transfer_t trsf = { 0 };
trsf.stream = gmio_stream_stdio(file); trsf.stream = gmio_stream_stdio(file);
trsf.buffer = gmio_buffer_default(); trsf.buffer = gmio_buffer_default();
if (task_iface != NULL)
trsf.task_iface = *task_iface;
error = gmio_stl_read(&trsf, creator); error = gmio_stl_read(&trsf, creator);
fclose(file); fclose(file);

View File

@ -35,6 +35,8 @@ GMIO_C_LINKAGE_BEGIN
* \param filepath Path to the STL file. A stream is opened with fopen() so * \param filepath Path to the STL file. A stream is opened with fopen() so
* the string has to be encoded using the system's charset (locale-8bit) * the string has to be encoded using the system's charset (locale-8bit)
* \param creator Defines the callbacks for the mesh creation * \param creator Defines the callbacks for the mesh creation
* \param task_iface The interface object by which the read operation can be
* controlled. Optional, can be safely set to NULL
* *
* Internally, it uses: * Internally, it uses:
* \li the builtin stream wrapper around FILE* (see gmio_stream_stdio()) * \li the builtin stream wrapper around FILE* (see gmio_stream_stdio())
@ -46,7 +48,8 @@ GMIO_C_LINKAGE_BEGIN
GMIO_LIBSTL_EXPORT GMIO_LIBSTL_EXPORT
int gmio_stl_read_file( int gmio_stl_read_file(
const char* filepath, const char* filepath,
gmio_stl_mesh_creator_t* creator); gmio_stl_mesh_creator_t* creator,
gmio_task_iface_t* task_iface);
/*! Reads STL data from stream, format is automatically guessed /*! Reads STL data from stream, format is automatically guessed
* *