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
23class vtkActor;
24class vtkActor2D;
25class vtkCellData;
26class vtkMapper;
27class vtkPointData;
28class vtkPolyData;
29class vtkRenderer;
32class vtkWebGLObject;
34
35#include "vtkObject.h"
36#include "vtkWebGLExporterModule.h" // needed for export macro
37
38#include <string> // needed for internal structure
39
40typedef enum
41{
44 VTK_PARSEALL = 2
46
47class VTKWEBGLEXPORTER_EXPORT vtkWebGLExporter : public vtkObject
48{
49public:
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);
68 void SetMaxAllowedSize(int size);
70
71 static void ComputeMD5(const unsigned char* content, int size, std::string& hash);
72
73protected:
76
77 void parseRenderer(vtkRenderer* render, const char* viewId, bool onlyWidget, void* mapTime);
78 void generateRendererData(vtkRendererCollection* renderers, const char* viewId);
80 vtkActor* actor, vtkMTimeType actorTime, size_t rendererId, int layer, bool isWidget);
82 vtkActor2D* actor, vtkMTimeType actorTime, size_t renderId, int layer, bool isWidget);
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)
97 std::string renderersMetaData;
99
100private:
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:149
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:155
represent and manipulate cell attribute data
Definition: vtkCellData.h:142
a simple class to control print indentation
Definition: vtkIndent.h:113
abstract class specifies interface to map data to graphics primitives
Definition: vtkMapper.h:171
abstract base class for most VTK objects
Definition: vtkObject.h:82
represent and manipulate point attribute data
Definition: vtkPointData.h:142
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:195
an ordered list of renderers
abstract specification for renderers
Definition: vtkRenderer.h:182
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.
vtkTriangleFilter * GetPolyData(vtkMapper *mapper, vtkMTimeType &dataMTime)
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 * GenerateExportMetadata()
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.
int GetNumberOfObjects()
Get all the needed information from the vtkRenderer.
void parseActor(vtkActor *actor, vtkMTimeType actorTime, size_t rendererId, int layer, bool isWidget)
const char * GetId()
Get all the needed information from the vtkRenderer.
static vtkWebGLExporter * New()
std::string renderersMetaData
const char * GenerateMetadata()
Get all the needed information from the vtkRenderer.
void SetMaxAllowedSize(int mesh, int lines)
Get all the needed information from the vtkRenderer.
vtkTriangleFilter * TriangleFilter
~vtkWebGLExporter() override
vtkWebGLObject * GetWebGLObject(int index)
Get all the needed information from the vtkRenderer.
vtkWebGLObject represent and manipulate an WebGL object and its data.
PolyData representation for WebGL.
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:287
VTKParseType
@ VTK_ONLYWIDGET
@ VTK_PARSEALL
@ VTK_ONLYCAMERA