|
KiCad PCB EDA Suite
|
#include "glb_utils.h"#include <cstdint>#include <cstring>#include <fstream>#include <map>#include <vector>#include <json_common.h>#include <kiplatform/io.h>Go to the source code of this file.
Functions | |
| bool | FixGlbLinesPrimitives (const wxString &aFilePath) |
| Fix LINES primitives in a GLB file that have odd index counts. | |
Variables | |
| static constexpr uint32_t | GLB_MAGIC = 0x46546C67 |
| static constexpr uint32_t | GLB_CHUNK_JSON = 0x4E4F534A |
| static constexpr int | GLTF_LINES_MODE = 1 |
| bool FixGlbLinesPrimitives | ( | const wxString & | aFilePath | ) |
Fix LINES primitives in a GLB file that have odd index counts.
OCCT 7.9+ can emit glTF LINES primitives with odd index counts for degenerate BSpline edges. The glTF spec requires LINES (mode 1) to have an even number of indices since each pair defines one line segment. Blender and other strict importers reject files that violate this constraint.
This function reads the GLB, adjusts any offending accessor counts to be even, and rewrites the file in place.
| aFilePath | path to the GLB file to fix |
Definition at line 42 of file glb_utils.cpp.
References KIPLATFORM::IO::AtomicWriteFile(), GLB_CHUNK_JSON, GLB_MAGIC, and GLTF_LINES_MODE.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and STEP_PCB_MODEL::WriteGLTF().
|
staticconstexpr |
Definition at line 38 of file glb_utils.cpp.
Referenced by FixGlbLinesPrimitives(), ValidateGlbFile(), and WriteTempGlb().
|
staticconstexpr |
Definition at line 37 of file glb_utils.cpp.
Referenced by FixGlbLinesPrimitives(), ValidateGlbFile(), and WriteTempGlb().
|
staticconstexpr |
Definition at line 39 of file glb_utils.cpp.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), FixGlbLinesPrimitives(), and ValidateGlbFile().