VTK
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 {
45 } VTKParseType;
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();
63  vtkWebGLObject* GetWebGLObject(int index);
64  int GetNumberOfObjects();
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 protected:
74  ~vtkWebGLExporter() override;
75 
76  void parseRenderer(vtkRenderer* render, const char* viewId, bool onlyWidget, void* mapTime);
77  void generateRendererData(vtkRendererCollection* renderers, const char* viewId);
78  void parseActor(vtkActor* actor, vtkMTimeType actorTime, size_t rendererId, int layer, bool isWidget);
79  void parseActor2D(vtkActor2D* actor, vtkMTimeType actorTime, size_t renderId, int layer, bool isWidget);
80  const char* GenerateExportMetadata();
81 
82  // Get the dataset from the mapper
83  vtkTriangleFilter* GetPolyData(vtkMapper* mapper, vtkMTimeType& dataMTime);
84 
85  vtkTriangleFilter* TriangleFilter; // Last Polygon Dataset Parse
86  double CameraLookAt[10]; // Camera Look At (fov, position[3], up[3], eye[3])
87  bool GradientBackground; // If the scene use a gradient background
88  double Background1[3]; // Background color of the rendering screen (RGB)
89  double Background2[3]; // Scond background color
90  double SceneSize[3]; // Size of the bounding box of the scene
91  std::string SceneId; // Id of the parsed scene
92  float CenterOfRotation[3]; // Center Of Rotation
93  int meshObjMaxSize, lineObjMaxSize; // Max size of object allowed (faces)
94  std::string renderersMetaData;
95  bool hasWidget;
96 
97 private:
98  vtkWebGLExporter(const vtkWebGLExporter&) = delete;
99  void operator=(const vtkWebGLExporter&) = delete;
100 
101  class vtkInternal;
102  vtkInternal* Internal;
103 
104 };
105 
106 #endif
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:51
abstract base class for most VTK objects
Definition: vtkObject.h:59
represent and manipulate point attribute data
Definition: vtkPointData.h:37
PolyData representation for WebGL.
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:302
VTKParseType
a actor that draws 2D data
Definition: vtkActor2D.h:45
represent and manipulate cell attribute data
Definition: vtkCellData.h:38
convert input polygons and strips to triangles
vtkWebGLObject represent and manipulate an WebGL object and its data.
abstract specification for renderers
Definition: vtkRenderer.h:63
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:85
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:39
abstract class specifies interface to map data to graphics primitives
Definition: vtkMapper.h:86
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...