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
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
vtkPointData
represent and manipulate point attribute data
Definition: vtkPointData.h:31
vtkWebGLExporter::SceneId
std::string SceneId
Definition: vtkWebGLExporter.h:95
vtkObject::New
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:53
vtkX3D::content
Definition: vtkX3D.h:308
vtkRendererCollection
an ordered list of renderers
Definition: vtkRendererCollection.h:34
vtkWebGLExporter::GradientBackground
bool GradientBackground
Definition: vtkWebGLExporter.h:91
VTKParseType
VTKParseType
Definition: vtkWebGLExporter.h:41
vtkWebGLExporter::TriangleFilter
vtkTriangleFilter * TriangleFilter
Definition: vtkWebGLExporter.h:89
vtkWebGLExporter::hasWidget
bool hasWidget
Definition: vtkWebGLExporter.h:99
vtkX3D::height
Definition: vtkX3D.h:260
vtkMapper
abstract class specifies interface to map data to graphics primitives
Definition: vtkMapper.h:80
vtkWebGLExporter
Definition: vtkWebGLExporter.h:48
vtkCellData
represent and manipulate cell attribute data
Definition: vtkCellData.h:32
vtkActor
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:45
vtkWebGLExporter::renderersMetaData
std::string renderersMetaData
Definition: vtkWebGLExporter.h:98
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkTriangleFilter
convert input polygons and strips to triangles
Definition: vtkTriangleFilter.h:31
vtkX3D::size
Definition: vtkX3D.h:259
vtkObject::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkWebGLObject
Definition: vtkWebGLObject.h:39
vtkObject.h
VTK_ONLYWIDGET
Definition: vtkWebGLExporter.h:44
vtkWebGLPolyData
Definition: vtkWebGLPolyData.h:34
vtkX3D::string
Definition: vtkX3D.h:496
vtkActor2D
a actor that draws 2D data
Definition: vtkActor2D.h:39
vtkRenderer
abstract specification for renderers
Definition: vtkRenderer.h:58
vtkPolyData
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:84
vtkWebGLExporter::meshObjMaxSize
int meshObjMaxSize
Definition: vtkWebGLExporter.h:97
VTK_PARSEALL
Definition: vtkWebGLExporter.h:45
vtkX3D::index
Definition: vtkX3D.h:252
vtkMTimeType
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:304
VTK_ONLYCAMERA
Definition: vtkWebGLExporter.h:43