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

stl_import_binary_reader.hh « importer « stl « io « blender « source - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 71d5dbbbe585c5fabd2d54f6f8d672dbea5ecd1a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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