VTK  9.0.1
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 =========================================================================*/
21 #ifndef vtkWebGLExporter_h
22 #define vtkWebGLExporter_h
23 
24 class vtkActor;
25 class vtkActor2D;
26 class vtkCellData;
27 class vtkMapper;
28 class vtkPointData;
29 class vtkPolyData;
30 class vtkRenderer;
32 class vtkTriangleFilter;
33 class vtkWebGLObject;
34 class vtkWebGLPolyData;
35 
36 #include "vtkObject.h"
37 #include "vtkWebGLExporterModule.h" // needed for export macro
38 
39 #include <string> // needed for internal structure
40 
41 typedef enum
42 {
46 } VTKParseType;
47 
48 class VTKWEBGLEXPORTER_EXPORT vtkWebGLExporter : public vtkObject
49 {
50 public:
51  static vtkWebGLExporter* New();
52  vtkTypeMacro(vtkWebGLExporter, vtkObject);
53  void PrintSelf(ostream& os, vtkIndent indent) override;
54 
56 
59  void parseScene(vtkRendererCollection* renderers, const char* viewId, int parseType);
60  // Generate and return the Metadata
61  void exportStaticScene(vtkRendererCollection* renderers, int width, int height, std::string path);
62  const char* GenerateMetadata();
63  const char* GetId();
64  vtkWebGLObject* GetWebGLObject(int index);
65  int GetNumberOfObjects();
66  bool hasChanged();
67  void SetCenterOfRotation(float a1, float a2, float a3);
68  void SetMaxAllowedSize(int mesh, int lines);
69  void SetMaxAllowedSize(int size);
71 
72  static void ComputeMD5(const unsigned char* content, int size, std::string& hash);
73 
74 protected:
76  ~vtkWebGLExporter() override;
77 
78  void parseRenderer(vtkRenderer* render, const char* viewId, bool onlyWidget, void* mapTime);
79  void generateRendererData(vtkRendererCollection* renderers, const char* viewId);
80  void parseActor(
81  vtkActor* actor, vtkMTimeType actorTime, size_t rendererId, int layer, bool isWidget);
82  void parseActor2D(
83  vtkActor2D* actor, vtkMTimeType actorTime, size_t renderId, int layer, bool isWidget);
84  const char* GenerateExportMetadata();
85 
86  // Get the dataset from the mapper
87  vtkTriangleFilter* GetPolyData(vtkMapper* mapper, vtkMTimeType& dataMTime);
88 
89  vtkTriangleFilter* TriangleFilter; // Last Polygon Dataset Parse
90  double CameraLookAt[10]; // Camera Look At (fov, position[3], up[3], eye[3])
91  bool GradientBackground; // If the scene use a gradient background
92  double Background1[3]; // Background color of the rendering screen (RGB)
93  double Background2[3]; // Scond background color
94  double SceneSize[3]; // Size of the bounding box of the scene
95  std::string SceneId; // Id of the parsed scene
96  float CenterOfRotation[3]; // Center Of Rotation
97  int meshObjMaxSize, lineObjMaxSize; // Max size of object allowed (faces)
99  bool hasWidget;
100 
101 private:
102  vtkWebGLExporter(const vtkWebGLExporter&) = delete;
103  void operator=(const vtkWebGLExporter&) = delete;
104 
105  class vtkInternal;
106  vtkInternal* Internal;
107 };
108 
109 #endif
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:45
abstract base class for most VTK objects
Definition: vtkObject.h:62
represent and manipulate point attribute data
Definition: vtkPointData.h:31
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
PolyData representation for WebGL.
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:293
VTKParseType
a actor that draws 2D data
Definition: vtkActor2D.h:39
represent and manipulate cell attribute data
Definition: vtkCellData.h:32
convert input polygons and strips to triangles
vtkWebGLObject represent and manipulate an WebGL object and its data.
abstract specification for renderers
Definition: vtkRenderer.h:67
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:84
vtkWebGLExporter export the data of the scene to be used in the WebGL.
an ordered list of renderers
a simple class to control print indentation
Definition: vtkIndent.h:33
std::string SceneId
abstract class specifies interface to map data to graphics primitives
Definition: vtkMapper.h:80
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
vtkTriangleFilter * TriangleFilter
std::string renderersMetaData