Blender  V3.3
stl_import_binary_reader.hh
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
7 #pragma once
8 
9 #include <cstdio>
10 
11 #include "BKE_mesh.h"
12 
13 /* Binary STL spec.:
14  * UINT8[80] – Header - 80 bytes
15  * UINT32 – Number of triangles - 4 bytes
16  * For each triangle - 50 bytes:
17  * REAL32[3] – Normal vector - 12 bytes
18  * REAL32[3] – Vertex 1 - 12 bytes
19  * REAL32[3] – Vertex 2 - 12 bytes
20  * REAL32[3] – Vertex 3 - 12 bytes
21  * UINT16 – Attribute byte count - 2 bytes
22  */
23 
24 namespace blender::io::stl {
25 
26 const size_t BINARY_HEADER_SIZE = 80;
27 const size_t BINARY_STRIDE = 12 * 4 + 2;
28 
29 Mesh *read_stl_binary(FILE *file, Main *bmain, char *mesh_name, bool use_custom_normals);
30 
31 } // namespace blender::io::stl
FILE * file
Mesh * read_stl_binary(FILE *file, Main *bmain, char *mesh_name, bool use_custom_normals)
Definition: BKE_main.h:121