v0.3.0
Fast, portable C library for geometry input/output
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Modules
stl_io.h
Go to the documentation of this file.
1 /****************************************************************************
2 ** Copyright (c) 2016, Fougue Ltd. <http://www.fougue.pro>
3 ** All rights reserved.
4 **
5 ** Redistribution and use in source and binary forms, with or without
6 ** modification, are permitted provided that the following conditions
7 ** are met:
8 **
9 ** 1. Redistributions of source code must retain the above copyright
10 ** notice, this list of conditions and the following disclaimer.
11 **
12 ** 2. Redistributions in binary form must reproduce the above
13 ** copyright notice, this list of conditions and the following
14 ** disclaimer in the documentation and/or other materials provided
15 ** with the distribution.
16 **
17 ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 ****************************************************************************/
29 
37 #ifndef GMIO_STL_IO_H
38 #define GMIO_STL_IO_H
39 
40 #include "stl_global.h"
41 
42 #include "stl_format.h"
43 #include "stl_io_options.h"
44 #include "stl_mesh.h"
45 #include "stl_mesh_creator.h"
46 #include "../gmio_core/stream.h"
47 #include "../gmio_core/endian.h"
48 
50 
70  struct gmio_stream* stream,
71  struct gmio_stl_mesh_creator* mesh_creator,
72  const struct gmio_stl_read_options* options);
73 
91  const char* filepath,
92  struct gmio_stl_mesh_creator* mesh_creator,
93  const struct gmio_stl_read_options* options);
94 
107  struct gmio_stream* stream,
108  struct gmio_stl_mesh_creator* mesh_creator,
109  const struct gmio_stl_read_options* options);
110 
125  struct gmio_stream* stream,
126  struct gmio_stl_mesh_creator* mesh_creator,
127  enum gmio_endianness byte_order,
128  const struct gmio_stl_read_options* options);
129 
142  enum gmio_stl_format format,
143  struct gmio_stream* stream,
144  const struct gmio_stl_mesh* mesh,
145  const struct gmio_stl_write_options* options);
146 
162  enum gmio_stl_format format,
163  const char* filepath,
164  const struct gmio_stl_mesh* mesh,
165  const struct gmio_stl_write_options* options);
166 
179  struct gmio_stream* stream,
180  enum gmio_endianness byte_order,
181  const struct gmio_stlb_header* header,
182  uint32_t facet_count
183 );
184 
186 
187 #endif /* GMIO_STL_IO_H */
188 
Options of function gmio_stl_read()
Definition: stl_io_options.h:53
int gmio_stl_read(struct gmio_stream *stream, struct gmio_stl_mesh_creator *mesh_creator, const struct gmio_stl_read_options *options)
Reads STL mesh from stream, format is automatically guessed.
Declaration of gmio_stl_mesh.
#define GMIO_API
Expands either to GMIO_DECL_EXPORT or GMIO_DECL_IMPORT when respectively compiling/using the DLL...
Definition: global.h:90
Detection of STL format from input stream.
80-byte data at the beginning of any STL binary file
Definition: stlb_header.h:44
gmio_stl_format
This enums defines the various STL formats.
Definition: stl_format.h:48
int gmio_stl_write_file(enum gmio_stl_format format, const char *filepath, const struct gmio_stl_mesh *mesh, const struct gmio_stl_write_options *options)
Writes STL mesh to stream.
#define GMIO_C_LINKAGE_BEGIN
Expands to extern "C" { when building with a C++ compiler.
Definition: global.h:195
gmio_endianness
This enum identifies common endianness (byte order) of computer memory.
Definition: endian.h:43
Provides an interface for accessing the underlying(hidden) user mesh.
Definition: stl_mesh.h:44
int gmio_stl_write(enum gmio_stl_format format, struct gmio_stream *stream, const struct gmio_stl_mesh *mesh, const struct gmio_stl_write_options *options)
Writes STL mesh to stream.
Global declarations for the STL module.
Options of function gmio_stl_write()
Definition: stl_io_options.h:102
int gmio_stl_read_file(const char *filepath, struct gmio_stl_mesh_creator *mesh_creator, const struct gmio_stl_read_options *options)
Reads STL mesh from a file, format is automatically guessed.
#define GMIO_C_LINKAGE_END
Expands to } when building with a C++ compiler.
Definition: global.h:197
int gmio_stla_read(struct gmio_stream *stream, struct gmio_stl_mesh_creator *mesh_creator, const struct gmio_stl_read_options *options)
Reads mesh from STL ascii stream.
Declaration of gmio_stl_mesh_creator.
Provides an interface for the creation of the underlying(hidden) user mesh.
Definition: stl_mesh_creator.h:85
Stream that can get input from an arbitrary data source or can write output to an arbitrary data sink...
Definition: stream.h:79
Options for STL read/write functions.
int gmio_stlb_header_write(struct gmio_stream *stream, enum gmio_endianness byte_order, const struct gmio_stlb_header *header, uint32_t facet_count)
Writes STL binary header data to stream.
int gmio_stlb_read(struct gmio_stream *stream, struct gmio_stl_mesh_creator *mesh_creator, enum gmio_endianness byte_order, const struct gmio_stl_read_options *options)
Reads mesh from STL binary stream.
Fougue © 2016