VTK  9.2.20230328
vtkWebGLExporter.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkWebGLExporter.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
20 #ifndef vtkWebGLExporter_h
21 #define vtkWebGLExporter_h
22 
23 #include "vtkObject.h"
24 #include "vtkWebGLExporterModule.h" // needed for export macro
25 
26 VTK_ABI_NAMESPACE_BEGIN
27 class vtkActor;
28 class vtkActor2D;
29 class vtkCellData;
30 class vtkMapper;
31 class vtkPointData;
32 class vtkPolyData;
33 class vtkRenderer;
35 class vtkTriangleFilter;
36 class vtkWebGLObject;
37 class vtkWebGLPolyData;
38 
39 VTK_ABI_NAMESPACE_END
40 
41 #include <string> // needed for internal structure
42 
43 VTK_ABI_NAMESPACE_BEGIN
44 typedef enum
45 {
48  VTK_PARSEALL = 2
50 
51 class VTKWEBGLEXPORTER_EXPORT vtkWebGLExporter : public vtkObject
52 {
53 public:
54  static vtkWebGLExporter* New();
55  vtkTypeMacro(vtkWebGLExporter, vtkObject);
56  void PrintSelf(ostream& os, vtkIndent indent) override;
57 
59 
62  void parseScene(vtkRendererCollection* renderers, const char* viewId, int parseType);
63  // Generate and return the Metadata
64  void exportStaticScene(vtkRendererCollection* renderers, int width, int height, std::string path);
65  const char* GenerateMetadata();
66  const char* GetId();
69  bool hasChanged();
70  void SetCenterOfRotation(float a1, float a2, float a3);
71  void SetMaxAllowedSize(int mesh, int lines);
74 
75  static void ComputeMD5(const unsigned char* content, int size, std::string& hash);
76 
77 protected:
79  ~vtkWebGLExporter() override;
80 
81  void parseRenderer(vtkRenderer* render, const char* viewId, bool onlyWidget, void* mapTime);
82  void generateRendererData(vtkRendererCollection* renderers, const char* viewId);
83  void parseActor(
84  vtkActor* actor, vtkMTimeType actorTime, size_t rendererId, int layer, bool isWidget);
86  vtkActor2D* actor, vtkMTimeType actorTime, size_t renderId, int layer, bool isWidget);
87  const char* GenerateExportMetadata();
88 
89  // Get the dataset from the mapper
91 
92  vtkTriangleFilter* TriangleFilter; // Last Polygon Dataset Parse
93  double CameraLookAt[10]; // Camera Look At (fov, position[3], up[3], eye[3])
94  bool GradientBackground; // If the scene use a gradient background
95  double Background1[3]; // Background color of the rendering screen (RGB)
96  double Background2[3]; // Scond background color
97  double SceneSize[3]; // Size of the bounding box of the scene
98  std::string SceneId; // Id of the parsed scene
99  float CenterOfRotation[3]; // Center Of Rotation
100  int meshObjMaxSize, lineObjMaxSize; // Max size of object allowed (faces)
102  bool hasWidget;
103 
104 private:
105  vtkWebGLExporter(const vtkWebGLExporter&) = delete;
106  void operator=(const vtkWebGLExporter&) = delete;
107 
108  class vtkInternal;
109  vtkInternal* Internal;
110 };
111 
112 VTK_ABI_NAMESPACE_END
113 #endif
a actor that draws 2D data
Definition: vtkActor2D.h:156
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:162
represent and manipulate cell attribute data
Definition: vtkCellData.h:152
a simple class to control print indentation
Definition: vtkIndent.h:120
abstract class specifies interface to map data to graphics primitives
Definition: vtkMapper.h:178
abstract base class for most VTK objects
Definition: vtkObject.h:83
represent and manipulate point attribute data
Definition: vtkPointData.h:151
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:201
an ordered list of renderers
abstract specification for renderers
Definition: vtkRenderer.h:183
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:314
@ height
Definition: vtkX3D.h:266
@ size
Definition: vtkX3D.h:265
@ index
Definition: vtkX3D.h:258
@ string
Definition: vtkX3D.h:502
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:282
VTKParseType
@ VTK_ONLYWIDGET
@ VTK_PARSEALL
@ VTK_ONLYCAMERA