2015-03-03 00:38:33 +08:00
|
|
|
/****************************************************************************
|
2015-05-28 15:40:24 +08:00
|
|
|
** gmio
|
2015-05-01 00:19:45 +08:00
|
|
|
** Copyright Fougue (2 Mar. 2015)
|
2015-07-13 17:42:03 +08:00
|
|
|
** contact@fougue.pro
|
2015-03-03 00:38:33 +08:00
|
|
|
**
|
|
|
|
** This software is a reusable library whose purpose is to provide complete
|
|
|
|
** I/O support for various CAD file formats (eg. STL)
|
|
|
|
**
|
|
|
|
** This software is governed by the CeCILL-B license under French law and
|
|
|
|
** abiding by the rules of distribution of free software. You can use,
|
|
|
|
** modify and/ or redistribute the software under the terms of the CeCILL-B
|
|
|
|
** license as circulated by CEA, CNRS and INRIA at the following URL
|
2015-03-30 15:05:25 +08:00
|
|
|
** "http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html".
|
2015-03-03 00:38:33 +08:00
|
|
|
****************************************************************************/
|
|
|
|
|
2015-03-05 01:25:51 +08:00
|
|
|
/*! \file stl_mesh_creator.h
|
|
|
|
* Declaration of gmio_stl_mesh_creator
|
2015-09-09 17:44:34 +08:00
|
|
|
*
|
|
|
|
* \addtogroup gmio_stl
|
|
|
|
* @{
|
2015-03-05 01:25:51 +08:00
|
|
|
*/
|
|
|
|
|
2015-04-02 16:41:41 +08:00
|
|
|
#ifndef GMIO_STL_MESH_CREATOR_H
|
|
|
|
#define GMIO_STL_MESH_CREATOR_H
|
2014-01-29 23:59:19 +08:00
|
|
|
|
|
|
|
#include "stl_global.h"
|
|
|
|
#include "stl_triangle.h"
|
2015-05-28 22:19:07 +08:00
|
|
|
#include "stlb_header.h"
|
2015-11-06 20:43:03 +08:00
|
|
|
#include "../gmio_core/stream.h"
|
2014-01-29 23:59:19 +08:00
|
|
|
|
2015-03-24 01:21:04 +08:00
|
|
|
#include <stddef.h>
|
|
|
|
|
2015-03-03 18:35:15 +08:00
|
|
|
/*! Provides an interface for the creation of the underlying(hidden)
|
|
|
|
* user mesh */
|
2014-03-31 21:52:04 +08:00
|
|
|
struct gmio_stl_mesh_creator
|
2014-01-29 23:59:19 +08:00
|
|
|
{
|
2015-03-03 18:35:15 +08:00
|
|
|
/*! Opaque pointer on the user mesh, passed as first argument to hook
|
|
|
|
* functions */
|
2015-03-03 17:35:36 +08:00
|
|
|
void* cookie;
|
2014-01-29 23:59:19 +08:00
|
|
|
|
2015-03-03 17:35:36 +08:00
|
|
|
/* All function pointers are optional (ie can be set to NULL) */
|
2014-01-29 23:59:19 +08:00
|
|
|
|
2015-03-03 18:35:15 +08:00
|
|
|
/*! Pointer on a function that handles declaration of a solid of
|
|
|
|
* name \p solid_name
|
|
|
|
*
|
|
|
|
* Optional function useful only with STL ascii (ie. gmio_stla_read())
|
2015-05-28 15:52:56 +08:00
|
|
|
*
|
|
|
|
* The argument \p stream_size is the total size (in bytes) of the input
|
|
|
|
* stream
|
2015-03-03 18:35:15 +08:00
|
|
|
*/
|
2015-07-10 17:33:05 +08:00
|
|
|
void (*func_ascii_begin_solid)(
|
2015-12-10 01:51:03 +08:00
|
|
|
void* cookie,
|
|
|
|
gmio_streamsize_t stream_size,
|
|
|
|
const char* solid_name);
|
2014-01-29 23:59:19 +08:00
|
|
|
|
2015-03-03 18:35:15 +08:00
|
|
|
/*! Pointer on a function that handles declaration of a mesh with
|
|
|
|
* \p tri_count number of triangles
|
|
|
|
*
|
|
|
|
* Optional function useful only with STL binary (ie. gmio_stlb_read()).
|
|
|
|
*
|
|
|
|
* The argument \p header contains the header data(80 bytes)
|
|
|
|
*/
|
2015-07-10 17:33:05 +08:00
|
|
|
void (*func_binary_begin_solid)(
|
2015-12-04 01:00:25 +08:00
|
|
|
void* cookie,
|
|
|
|
uint32_t tri_count,
|
|
|
|
const struct gmio_stlb_header* header);
|
2014-03-13 21:37:55 +08:00
|
|
|
|
2015-03-03 18:35:15 +08:00
|
|
|
/*! Pointer on a function that adds a triangle to the user mesh
|
|
|
|
*
|
|
|
|
* The argument \p triangle is the triangle to be added, note that
|
2015-12-10 01:51:03 +08:00
|
|
|
* struct gmio_stl_triangle::attribute_byte_count is meaningless for STL
|
|
|
|
* ascii.
|
2015-03-03 18:35:15 +08:00
|
|
|
*
|
|
|
|
* The argument \p tri_id is the index of the mesh triangle
|
|
|
|
*/
|
2015-07-10 17:33:05 +08:00
|
|
|
void (*func_add_triangle)(
|
2015-12-04 01:00:25 +08:00
|
|
|
void* cookie,
|
|
|
|
uint32_t tri_id,
|
|
|
|
const struct gmio_stl_triangle* triangle);
|
2014-03-13 21:37:55 +08:00
|
|
|
|
2015-03-03 18:35:15 +08:00
|
|
|
/*! Pointer on a function that finalizes creation of the user mesh
|
|
|
|
*
|
|
|
|
* Optional function called at the end of the read process, ie. after all
|
|
|
|
* triangles have been added
|
|
|
|
*/
|
2015-07-10 17:33:05 +08:00
|
|
|
void (*func_end_solid)(void* cookie);
|
2014-02-13 19:02:40 +08:00
|
|
|
};
|
|
|
|
|
2015-04-02 16:41:41 +08:00
|
|
|
#endif /* GMIO_STL_MESH_CREATOR_H */
|
2015-09-09 17:44:34 +08:00
|
|
|
/*! @} */
|