VTK  9.1.0
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 class vtkActor;
24 class vtkActor2D;
25 class vtkCellData;
26 class vtkMapper;
27 class vtkPointData;
28 class vtkPolyData;
29 class vtkRenderer;
31 class vtkTriangleFilter;
32 class vtkWebGLObject;
33 class vtkWebGLPolyData;
34 
35 #include "vtkObject.h"
36 #include "vtkWebGLExporterModule.h" // needed for export macro
37 
38 #include <string> // needed for internal structure
39 
40 typedef enum
41 {
44  VTK_PARSEALL = 2
46 
47 class VTKWEBGLEXPORTER_EXPORT vtkWebGLExporter : public vtkObject
48 {
49 public:
50  static vtkWebGLExporter* New();
51  vtkTypeMacro(vtkWebGLExporter, vtkObject);
52  void PrintSelf(ostream& os, vtkIndent indent) override;
53 
55 
58  void parseScene(vtkRendererCollection* renderers, const char* viewId, int parseType);
59  // Generate and return the Metadata
60  void exportStaticScene(vtkRendererCollection* renderers, int width, int height, std::string path);
61  const char* GenerateMetadata();
62  const char* GetId();
65  bool hasChanged();
66  void SetCenterOfRotation(float a1, float a2, float a3);
67  void SetMaxAllowedSize(int mesh, int lines);
70 
71  static void ComputeMD5(const unsigned char* content, int size, std::string& hash);
72 
73 protected:
75  ~vtkWebGLExporter() override;
76 
77  void parseRenderer(vtkRenderer* render, const char* viewId, bool onlyWidget, void* mapTime);
78  void generateRendererData(vtkRendererCollection* renderers, const char* viewId);
79  void parseActor(
80  vtkActor* actor, vtkMTimeType actorTime, size_t rendererId, int layer, bool isWidget);
82  vtkActor2D* actor, vtkMTimeType actorTime, size_t renderId, int layer, bool isWidget);
83  const char* GenerateExportMetadata();
84 
85  // Get the dataset from the mapper
87 
88  vtkTriangleFilter* TriangleFilter; // Last Polygon Dataset Parse
89  double CameraLookAt[10]; // Camera Look At (fov, position[3], up[3], eye[3])
90  bool GradientBackground; // If the scene use a gradient background
91  double Background1[3]; // Background color of the rendering screen (RGB)
92  double Background2[3]; // Scond background color
93  double SceneSize[3]; // Size of the bounding box of the scene
94  std::string SceneId; // Id of the parsed scene
95  float CenterOfRotation[3]; // Center Of Rotation
96  int meshObjMaxSize, lineObjMaxSize; // Max size of object allowed (faces)
98  bool hasWidget;
99 
100 private:
101  vtkWebGLExporter(const vtkWebGLExporter&) = delete;
102  void operator=(const vtkWebGLExporter&) = delete;
103 
104  class vtkInternal;
105  vtkInternal* Internal;
106 };
107 
108 #endif
a actor that draws 2D data
Definition: vtkActor2D.h:40
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:46
represent and manipulate cell attribute data
Definition: vtkCellData.h:33
a simple class to control print indentation
Definition: vtkIndent.h:34
abstract class specifies interface to map data to graphics primitives
Definition: vtkMapper.h:82
abstract base class for most VTK objects
Definition: vtkObject.h:63
represent and manipulate point attribute data
Definition: vtkPointData.h:33
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:86
an ordered list of renderers
abstract specification for renderers
Definition: vtkRenderer.h:73
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:308
@ height
Definition: vtkX3D.h:260
@ size
Definition: vtkX3D.h:259
@ index
Definition: vtkX3D.h:252
@ string
Definition: vtkX3D.h:496
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:287
VTKParseType
@ VTK_ONLYWIDGET
@ VTK_PARSEALL
@ VTK_ONLYCAMERA