VTK  9.3.1
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 
24 VTK_ABI_NAMESPACE_BEGIN
26 class vtkCellArray;
27 class vtkDataArray;
28 
29 class VTKIOGEOMETRY_EXPORT vtkGLTFWriterUtils
30 {
31 public:
32  VTK_WRAPEXCLUDE static void WriteValues(vtkDataArray* ca, std::ostream& myFile);
33  VTK_WRAPEXCLUDE static void WriteValues(vtkDataArray* ca, vtkBase64OutputStream* ostr);
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 
62 const int GLTF_ARRAY_BUFFER = 34962;
63 const int GLTF_ELEMENT_ARRAY_BUFFER = 34963;
64 
65 VTK_ABI_NAMESPACE_END
66 #endif
67 
68 // VTK-HeaderTest-Exclude: vtkGLTFWriterUtils.h
const int GLTF_ELEMENT_ARRAY_BUFFER
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:44
const int GLTF_ARRAY_BUFFER
object to represent cell connectivity
Definition: vtkCellArray.h:175
#define VTK_WRAPEXCLUDE
Writes base64-encoded output to a stream.