Introduce GMIO_STL_FORMAT_TAG_BINARY

This commit is contained in:
Hugues Delorme 2016-03-08 10:29:49 +01:00
parent 363b38bf2d
commit 37c4a2a576
3 changed files with 15 additions and 16 deletions

View File

@ -232,15 +232,11 @@ void bmk_gmio_stl_infos_get_all(const void* filepath)
(const char*)filepath, (const char*)filepath,
infos.size / 1024, infos.size / 1024,
infos.facet_count); infos.facet_count);
if (infos.format == GMIO_STL_FORMAT_ASCII) { if (infos.format == GMIO_STL_FORMAT_ASCII)
printf(" [STLA]Solid name: %s\n", infos.stla_solidname); printf(" [STLA]Solid name: %s\n", infos.stla_solidname);
} else if (infos.format & GMIO_STL_FORMAT_TAG_BINARY)
else if (infos.format == GMIO_STL_FORMAT_BINARY_LE
|| infos.format == GMIO_STL_FORMAT_BINARY_BE)
{
printf(" [STLB]Header: %80.80s\n", infos.stlb_header.data); printf(" [STLB]Header: %80.80s\n", infos.stlb_header.data);
} }
}
already_exec = true; already_exec = true;
} }

View File

@ -38,14 +38,10 @@ static void print_stl_infos(const struct gmio_stl_infos* infos)
gmio_stl_format_to_str(infos->format), gmio_stl_format_to_str(infos->format),
infos->size / 1024, infos->size / 1024,
infos->facet_count); infos->facet_count);
if (infos->format == GMIO_STL_FORMAT_ASCII) { if (infos->format == GMIO_STL_FORMAT_ASCII)
printf("Solid name: %s\n", infos->stla_solidname); printf("Solid name: %s\n", infos->stla_solidname);
} else if (infos->format & GMIO_STL_FORMAT_TAG_BINARY)
else if (infos->format == GMIO_STL_FORMAT_BINARY_LE
|| infos->format == GMIO_STL_FORMAT_BINARY_BE)
{
printf("Header: %80.80s\n", infos->stlb_header.data); printf("Header: %80.80s\n", infos->stlb_header.data);
}
} }
int main(int argc, char** argv) int main(int argc, char** argv)

View File

@ -26,13 +26,20 @@
#include "stl_global.h" #include "stl_global.h"
#include "../gmio_core/stream.h" #include "../gmio_core/stream.h"
/*! A byte-mask to tag(identify) STL binary formats */
enum { GMIO_STL_FORMAT_TAG_BINARY = 0x10 };
/*! This enums defines the various STL formats */ /*! This enums defines the various STL formats */
enum gmio_stl_format enum gmio_stl_format
{ {
GMIO_STL_FORMAT_UNKNOWN = 0, /*!< Unknown STL format */ /*! Unknown STL format */
GMIO_STL_FORMAT_ASCII, /*!< STL ASCII (text) */ GMIO_STL_FORMAT_UNKNOWN = 0,
GMIO_STL_FORMAT_BINARY_LE, /*!< STL binary (little-endian) */ /*! STL ASCII (text) */
GMIO_STL_FORMAT_BINARY_BE /*!< STL binary (big-endian) */ GMIO_STL_FORMAT_ASCII = 0x01,
/*! STL binary (little-endian) */
GMIO_STL_FORMAT_BINARY_LE = GMIO_STL_FORMAT_TAG_BINARY | 0x01,
/*! STL binary (big-endian) */
GMIO_STL_FORMAT_BINARY_BE = GMIO_STL_FORMAT_TAG_BINARY | 0x02
}; };
GMIO_C_LINKAGE_BEGIN GMIO_C_LINKAGE_BEGIN