VTK  9.3.20240423
vtkGLTFWriterUtils.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
3
14#ifndef vtkGLTFWriterUtils_h
15#define vtkGLTFWriterUtils_h
16
17#include "vtkIOGeometryModule.h" // For export macro
18#include "vtkWrappingHints.h"
19
20#include <vtk_nlohmannjson.h>
21#include VTK_NLOHMANN_JSON(json.hpp)
22#include <ostream>
23
24VTK_ABI_NAMESPACE_BEGIN
26class vtkCellArray;
27class vtkDataArray;
28
29class VTKIOGEOMETRY_EXPORT vtkGLTFWriterUtils
30{
31public:
32 VTK_WRAPEXCLUDE static void WriteValues(vtkDataArray* ca, std::ostream& myFile);
34 VTK_WRAPEXCLUDE static void WriteBufferAndView(vtkDataArray* inda, const char* fileName,
35 bool inlineData, nlohmann::json& buffers, nlohmann::json& bufferViews, int bufferViewTarget);
36 VTK_WRAPEXCLUDE static void WriteCellBufferAndView(vtkCellArray* ca, const char* fileName,
37 bool inlineData, nlohmann::json& buffers, nlohmann::json& bufferViews);
38};
39
40// gltf uses hard coded numbers to represent data types
41// they match the definitions from gl.h but for your convenience
42// some of the common values we use are listed below to make
43// the code more readable without including gl.h
44
45#define GL_BYTE 0x1400
46#define GL_UNSIGNED_BYTE 0x1401
47#define GL_SHORT 0x1402
48#define GL_UNSIGNED_SHORT 0x1403
49#define GL_INT 0x1404
50#define GL_UNSIGNED_INT 0x1405
51#define GL_FLOAT 0x1406
52
53#define GL_CLAMP_TO_EDGE 0x812F
54#define GL_REPEAT 0x2901
55
56#define GL_NEAREST 0x2600
57#define GL_LINEAR 0x2601
58
59#define ARRAY_BUFFER 34962
60#define ELEMENT_ARRAY_BUFFER 34963
61
62const int GLTF_ARRAY_BUFFER = 34962;
63const int GLTF_ELEMENT_ARRAY_BUFFER = 34963;
64
65VTK_ABI_NAMESPACE_END
66#endif
67
68// VTK-HeaderTest-Exclude: vtkGLTFWriterUtils.h
Writes base64-encoded output to a stream.
object to represent cell connectivity
abstract superclass for arrays of numeric data
static VTK_WRAPEXCLUDE void WriteValues(vtkDataArray *ca, std::ostream &myFile)
static VTK_WRAPEXCLUDE void WriteBufferAndView(vtkDataArray *inda, const char *fileName, bool inlineData, nlohmann::json &buffers, nlohmann::json &bufferViews, int bufferViewTarget)
static VTK_WRAPEXCLUDE void WriteValues(vtkDataArray *ca, vtkBase64OutputStream *ostr)
static VTK_WRAPEXCLUDE void WriteCellBufferAndView(vtkCellArray *ca, const char *fileName, bool inlineData, nlohmann::json &buffers, nlohmann::json &bufferViews)
const int GLTF_ELEMENT_ARRAY_BUFFER
const int GLTF_ARRAY_BUFFER
#define VTK_WRAPEXCLUDE