VTK  9.3.20240418
vtkWebGLExporter.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
8 #ifndef vtkWebGLExporter_h
9 #define vtkWebGLExporter_h
10 
11 #include "vtkObject.h"
12 #include "vtkWebGLExporterModule.h" // needed for export macro
13 
14 VTK_ABI_NAMESPACE_BEGIN
15 class vtkActor;
16 class vtkActor2D;
17 class vtkCellData;
18 class vtkMapper;
19 class vtkPointData;
20 class vtkPolyData;
21 class vtkRenderer;
23 class vtkTriangleFilter;
24 class vtkWebGLObject;
25 class vtkWebGLPolyData;
26 
27 VTK_ABI_NAMESPACE_END
28 
29 #include <string> // needed for internal structure
30 
31 VTK_ABI_NAMESPACE_BEGIN
32 typedef enum
33 {
36  VTK_PARSEALL = 2
38 
39 class VTKWEBGLEXPORTER_EXPORT vtkWebGLExporter : public vtkObject
40 {
41 public:
42  static vtkWebGLExporter* New();
43  vtkTypeMacro(vtkWebGLExporter, vtkObject);
44  void PrintSelf(ostream& os, vtkIndent indent) override;
45 
47 
50  void parseScene(vtkRendererCollection* renderers, const char* viewId, int parseType);
51  // Generate and return the Metadata
52  void exportStaticScene(vtkRendererCollection* renderers, int width, int height, std::string path);
53  const char* GenerateMetadata();
54  const char* GetId();
57  bool hasChanged();
58  void SetCenterOfRotation(float a1, float a2, float a3);
59  void SetMaxAllowedSize(int mesh, int lines);
62 
63  static void ComputeMD5(const unsigned char* content, int size, std::string& hash);
64 
65 protected:
67  ~vtkWebGLExporter() override;
68 
69  void parseRenderer(vtkRenderer* render, const char* viewId, bool onlyWidget, void* mapTime);
70  void generateRendererData(vtkRendererCollection* renderers, const char* viewId);
71  void parseActor(
72  vtkActor* actor, vtkMTimeType actorTime, size_t rendererId, int layer, bool isWidget);
74  vtkActor2D* actor, vtkMTimeType actorTime, size_t renderId, int layer, bool isWidget);
75  const char* GenerateExportMetadata();
76 
77  // Get the dataset from the mapper
79 
80  vtkTriangleFilter* TriangleFilter; // Last Polygon Dataset Parse
81  double CameraLookAt[10]; // Camera Look At (fov, position[3], up[3], eye[3])
82  bool GradientBackground; // If the scene use a gradient background
83  double Background1[3]; // Background color of the rendering screen (RGB)
84  double Background2[3]; // Scond background color
85  double SceneSize[3]; // Size of the bounding box of the scene
86  std::string SceneId; // Id of the parsed scene
87  float CenterOfRotation[3]; // Center Of Rotation
88  int meshObjMaxSize, lineObjMaxSize; // Max size of object allowed (faces)
90  bool hasWidget;
91 
92 private:
93  vtkWebGLExporter(const vtkWebGLExporter&) = delete;
94  void operator=(const vtkWebGLExporter&) = delete;
95 
96  class vtkInternal;
97  vtkInternal* Internal;
98 };
99 
100 VTK_ABI_NAMESPACE_END
101 #endif
a actor that draws 2D data
Definition: vtkActor2D.h:145
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:151
represent and manipulate cell attribute data
Definition: vtkCellData.h:141
a simple class to control print indentation
Definition: vtkIndent.h:108
abstract class specifies interface to map data to graphics primitives
Definition: vtkMapper.h:137
abstract base class for most VTK objects
Definition: vtkObject.h:162
represent and manipulate point attribute data
Definition: vtkPointData.h:140
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:181
an ordered list of renderers
abstract specification for renderers
Definition: vtkRenderer.h:172
convert input polygons and strips to triangles
vtkWebGLExporter export the data of the scene to be used in the WebGL.
void parseActor2D(vtkActor2D *actor, vtkMTimeType actorTime, size_t renderId, int layer, bool isWidget)
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
std::string SceneId
void exportStaticScene(vtkRendererCollection *renderers, int width, int height, std::string path)
Get all the needed information from the vtkRenderer.
bool hasChanged()
Get all the needed information from the vtkRenderer.
void generateRendererData(vtkRendererCollection *renderers, const char *viewId)
void SetCenterOfRotation(float a1, float a2, float a3)
Get all the needed information from the vtkRenderer.
const char * GenerateMetadata()
Get all the needed information from the vtkRenderer.
static vtkWebGLExporter * New()
const char * GetId()
Get all the needed information from the vtkRenderer.
static void ComputeMD5(const unsigned char *content, int size, std::string &hash)
void parseRenderer(vtkRenderer *render, const char *viewId, bool onlyWidget, void *mapTime)
void SetMaxAllowedSize(int size)
Get all the needed information from the vtkRenderer.
void parseScene(vtkRendererCollection *renderers, const char *viewId, int parseType)
Get all the needed information from the vtkRenderer.
vtkWebGLObject * GetWebGLObject(int index)
Get all the needed information from the vtkRenderer.
int GetNumberOfObjects()
Get all the needed information from the vtkRenderer.
void parseActor(vtkActor *actor, vtkMTimeType actorTime, size_t rendererId, int layer, bool isWidget)
std::string renderersMetaData
void SetMaxAllowedSize(int mesh, int lines)
Get all the needed information from the vtkRenderer.
const char * GenerateExportMetadata()
vtkTriangleFilter * TriangleFilter
vtkTriangleFilter * GetPolyData(vtkMapper *mapper, vtkMTimeType &dataMTime)
~vtkWebGLExporter() override
vtkWebGLObject represent and manipulate an WebGL object and its data.
PolyData representation for WebGL.
@ content
Definition: vtkX3D.h:302
@ height
Definition: vtkX3D.h:254
@ size
Definition: vtkX3D.h:253
@ index
Definition: vtkX3D.h:246
@ string
Definition: vtkX3D.h:490
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:270
VTKParseType
@ VTK_ONLYWIDGET
@ VTK_PARSEALL
@ VTK_ONLYCAMERA