2015-12-10 01:51:03 +08:00
|
|
|
/****************************************************************************
|
|
|
|
** gmio
|
|
|
|
** Copyright Fougue (2 Mar. 2015)
|
|
|
|
** contact@fougue.pro
|
|
|
|
**
|
|
|
|
** 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
|
|
|
|
** "http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html".
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/*! \file stl_infos.h
|
|
|
|
* TODO: description
|
|
|
|
*
|
|
|
|
* \addtogroup gmio_stl
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef GMIO_STL_INFOS_H
|
|
|
|
#define GMIO_STL_INFOS_H
|
|
|
|
|
|
|
|
#include "stl_global.h"
|
|
|
|
|
|
|
|
#include "../gmio_core/rwargs.h"
|
|
|
|
#include "../gmio_core/internal/helper_stream.h"
|
|
|
|
|
|
|
|
#include <stddef.h>
|
|
|
|
|
|
|
|
|
|
|
|
#include "stl_format.h"
|
|
|
|
#include "stlb_header.h"
|
|
|
|
|
2015-12-18 22:30:50 +08:00
|
|
|
/*! Informations retrieved by gmio_stl_infos_get() */
|
2015-12-10 01:51:03 +08:00
|
|
|
struct gmio_stl_infos
|
|
|
|
{
|
|
|
|
/*! Count of facets(triangles) */
|
|
|
|
uint32_t facet_count;
|
|
|
|
|
|
|
|
/*! Size of the STL data in bytes
|
|
|
|
*
|
|
|
|
* For STL ascii it includes the "endsolid" tag */
|
2015-12-17 19:03:45 +08:00
|
|
|
gmio_streamsize_t size;
|
2015-12-10 01:51:03 +08:00
|
|
|
|
2015-12-18 17:45:51 +08:00
|
|
|
/*! STL ascii only: name of the solid
|
|
|
|
*
|
|
|
|
* The pointer has to be set by the caller of gmio_stl_infos_get() */
|
2015-12-10 01:51:03 +08:00
|
|
|
char* stla_solidname;
|
|
|
|
|
2015-12-18 17:45:51 +08:00
|
|
|
/*! STL ascii only: maximum length(capacity) of stla_solidname
|
|
|
|
*
|
|
|
|
* The value has to be set by the caller of gmio_stl_infos_get()
|
2015-12-10 01:51:03 +08:00
|
|
|
*/
|
|
|
|
size_t stla_solidname_maxlen;
|
|
|
|
|
2015-12-18 17:45:51 +08:00
|
|
|
/*! STL binary only: header(80-bytes) of STL data */
|
2015-12-10 01:51:03 +08:00
|
|
|
struct gmio_stlb_header stlb_header;
|
|
|
|
};
|
|
|
|
|
|
|
|
/*! Flags(OR-combinations) for each STL info */
|
|
|
|
enum gmio_stl_info_flag
|
|
|
|
{
|
|
|
|
/*! -> gmio_stl_infos::facet_count */
|
|
|
|
GMIO_STL_INFO_FLAG_FACET_COUNT = 0x0001,
|
|
|
|
|
|
|
|
/*! -> gmio_stl_infos::size */
|
|
|
|
GMIO_STL_INFO_FLAG_SIZE = 0x0002,
|
|
|
|
|
|
|
|
/*! -> gmio_stl_infos::stla_solidname */
|
|
|
|
GMIO_STLA_INFO_FLAG_SOLIDNAME = 0x0004,
|
|
|
|
|
|
|
|
/*! -> gmio_stl_infos::stlb_header */
|
|
|
|
GMIO_STLB_INFO_FLAG_HEADER = 0x0008,
|
|
|
|
|
|
|
|
/*! -> gmio_stl_infos::stla_solidname or gmio_stl_infos::stlb_header */
|
|
|
|
GMIO_STL_INFO_FLAG_SOLIDNAME_OR_HEADER =
|
|
|
|
GMIO_STLA_INFO_FLAG_SOLIDNAME | GMIO_STLB_INFO_FLAG_HEADER,
|
|
|
|
|
|
|
|
/*! All infos */
|
|
|
|
GMIO_STL_INFO_FLAG_ALL = 0xFFFF
|
|
|
|
};
|
|
|
|
|
2015-12-18 22:30:50 +08:00
|
|
|
/*! Objects to be passed to gmio_stl_infos_get() */
|
2015-12-10 01:51:03 +08:00
|
|
|
struct gmio_stl_infos_get_args
|
|
|
|
{
|
2015-12-18 22:30:50 +08:00
|
|
|
/*! Input stream */
|
2015-12-10 01:51:03 +08:00
|
|
|
struct gmio_stream stream;
|
2015-12-18 22:30:50 +08:00
|
|
|
|
|
|
|
/*! Optional memory block used by the stream to bufferize read operations
|
|
|
|
*
|
|
|
|
* If null, then a temporary memblock is created with the global default
|
|
|
|
* constructor function (see gmio_memblock_default())
|
|
|
|
*/
|
2015-12-17 19:03:45 +08:00
|
|
|
struct gmio_memblock stream_memblock;
|
2015-12-18 22:30:50 +08:00
|
|
|
|
|
|
|
/*! Output informations */
|
2015-12-17 19:03:45 +08:00
|
|
|
struct gmio_stl_infos infos;
|
2015-12-10 01:51:03 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
GMIO_C_LINKAGE_BEGIN
|
|
|
|
|
2015-12-18 22:30:50 +08:00
|
|
|
/*! Finds informations about STL contents
|
|
|
|
*
|
|
|
|
* \return Error code (see gmio_core/error.h and stl_error.h)
|
|
|
|
*/
|
2015-12-10 01:51:03 +08:00
|
|
|
GMIO_LIBSTL_EXPORT
|
|
|
|
int gmio_stl_infos_get(
|
|
|
|
struct gmio_stl_infos_get_args* args,
|
2015-12-17 19:03:45 +08:00
|
|
|
enum gmio_stl_format format,
|
2015-12-10 01:51:03 +08:00
|
|
|
unsigned flags);
|
|
|
|
|
|
|
|
GMIO_C_LINKAGE_END
|
|
|
|
|
|
|
|
#endif /* GMIO_STL_INFOS_H */
|
|
|
|
/*! @} */
|