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 =========================================================================*/
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 {
44  } VTKParseType;
45 
47 {
48 public:
49  static vtkWebGLExporter* New();
50  vtkTypeMacro(vtkWebGLExporter, vtkObject)
51  void PrintSelf(ostream& os, vtkIndent indent);
52 
54 
55  void parseScene(vtkRendererCollection* renderers, const char* viewId, int parseType);
56  // Generate and return the Metadata
57  void exportStaticScene(vtkRendererCollection* renderers, int width, int height, std::string path);
58  const char* GenerateMetadata();
59  const char* GetId();
60  vtkWebGLObject* GetWebGLObject(int index);
61  int GetNumberOfObjects();
62  bool hasChanged();
63  void SetCenterOfRotation(float a1, float a2, float a3);
64  void SetMaxAllowedSize(int mesh, int lines);
65  void SetMaxAllowedSize(int size);
67 
68  //BTX
69  static void ComputeMD5(const unsigned char* content, int size, std::string &hash);
70 protected:
72  ~vtkWebGLExporter();
73 
74  void parseRenderer(vtkRenderer* render, const char* viewId, bool onlyWidget, void* mapTime);
75  void generateRendererData(vtkRendererCollection* renderers, const char* viewId);
76  void parseActor(vtkActor* actor, unsigned long actorTime, size_t rendererId, int layer, bool isWidget);
77  void parseActor2D(vtkActor2D* actor, long actorTime, size_t renderId, int layer, bool isWidget);
78  const char* GenerateExportMetadata();
79 
80  // Get the dataset from the mapper
81  vtkTriangleFilter* GetPolyData(vtkMapper* mapper, unsigned long& dataMTime);
82 
83  vtkTriangleFilter* TriangleFilter; // Last Polygon Dataset Parse
84  double CameraLookAt[10]; // Camera Look At (fov, position[3], up[3], eye[3])
85  bool GradientBackground; // If the scene use a gradient background
86  double Background1[3]; // Background color of the rendering screen (RGB)
87  double Background2[3]; // Scond background color
88  double SceneSize[3]; // Size of the bounding box of the scene
89  std::string SceneId; // Id of the parsed scene
90  float CenterOfRotation[3]; // Center Of Rotation
91  int meshObjMaxSize, lineObjMaxSize; // Max size of object allowed (faces)
92  std::string renderersMetaData;
93  bool hasWidget;
94 
95 private:
96  vtkWebGLExporter(const vtkWebGLExporter&); // Not implemented
97  void operator=(const vtkWebGLExporter&); // Not implemented
98 
99  class vtkInternal;
100  vtkInternal* Internal;
101  //ETX
102 };
103 
104 #endif
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:50
abstract base class for most VTK objects
Definition: vtkObject.h:61
represent and manipulate point attribute data
Definition: vtkPointData.h:36
VTKParseType
a actor that draws 2D data
Definition: vtkActor2D.h:44
represent and manipulate cell attribute data
Definition: vtkCellData.h:37
convert input polygons and strips to triangles
abstract specification for renderers
Definition: vtkRenderer.h:62
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:84
a list of renderers
a simple class to control print indentation
Definition: vtkIndent.h:38
#define VTKWEBGLEXPORTER_EXPORT
abstract class specifies interface to map data to graphics primitives
Definition: vtkMapper.h:89
static vtkObject * New()