Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/io/stl/importer/stl_import_binary_reader.hh')
-rw-r--r--source/blender/io/stl/importer/stl_import_binary_reader.hh31
1 files changed, 31 insertions, 0 deletions
diff --git a/source/blender/io/stl/importer/stl_import_binary_reader.hh b/source/blender/io/stl/importer/stl_import_binary_reader.hh
new file mode 100644
index 00000000000..71d5dbbbe58
--- /dev/null
+++ b/source/blender/io/stl/importer/stl_import_binary_reader.hh
@@ -0,0 +1,31 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+/** \file
+ * \ingroup stl
+ */
+
+#pragma once
+
+#include <cstdio>
+
+#include "BKE_mesh.h"
+
+/* Binary STL spec.:
+ * UINT8[80] – Header - 80 bytes
+ * UINT32 – Number of triangles - 4 bytes
+ * For each triangle - 50 bytes:
+ * REAL32[3] – Normal vector - 12 bytes
+ * REAL32[3] – Vertex 1 - 12 bytes
+ * REAL32[3] – Vertex 2 - 12 bytes
+ * REAL32[3] – Vertex 3 - 12 bytes
+ * UINT16 – Attribute byte count - 2 bytes
+ */
+
+namespace blender::io::stl {
+
+const size_t BINARY_HEADER_SIZE = 80;
+const size_t BINARY_STRIDE = 12 * 4 + 2;
+
+Mesh *read_stl_binary(FILE *file, Main *bmain, char *mesh_name, bool use_custom_normals);
+
+} // namespace blender::io::stl