VTK
/Users/kitware/Dashboards/MyTests/VTK_BLD_Release_docs/Utilities/Doxygen/dox/Web/WebGLExporter/vtkWebGLExporter.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkWebGLExporter.h
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00020 #ifndef vtkWebGLExporter_h
00021 #define vtkWebGLExporter_h
00022 
00023 class vtkActor;
00024 class vtkActor2D;
00025 class vtkCellData;
00026 class vtkMapper;
00027 class vtkPointData;
00028 class vtkPolyData;
00029 class vtkRenderer;
00030 class vtkRendererCollection;
00031 class vtkTriangleFilter;
00032 class vtkWebGLObject;
00033 class vtkWebGLPolyData;
00034 
00035 #include "vtkObject.h"
00036 #include "vtkWebGLExporterModule.h" // needed for export macro
00037 
00038 #include <string> // needed for internal structure
00039 
00040 typedef enum {
00041   VTK_ONLYCAMERA = 0,
00042   VTK_ONLYWIDGET = 1,
00043   VTK_PARSEALL   = 2
00044   } VTKParseType;
00045 
00046 class VTKWEBGLEXPORTER_EXPORT vtkWebGLExporter : public vtkObject
00047 {
00048 public:
00049   static vtkWebGLExporter* New();
00050   vtkTypeMacro(vtkWebGLExporter, vtkObject)
00051   void PrintSelf(ostream& os, vtkIndent indent);
00052 
00054 
00055   void parseScene(vtkRendererCollection* renderers, const char* viewId, int parseType);
00056   // Generate and return the Metadata
00057   void exportStaticScene(vtkRendererCollection* renderers, int width, int height, std::string path);
00058   const char* GenerateMetadata();
00059   const char* GetId();
00060   vtkWebGLObject* GetWebGLObject(int index);
00061   int GetNumberOfObjects();
00062   bool hasChanged();
00063   void SetCenterOfRotation(float a1, float a2, float a3);
00064   void SetMaxAllowedSize(int mesh, int lines);
00065   void SetMaxAllowedSize(int size);
00067 
00068   //BTX
00069   static void ComputeMD5(const unsigned char* content, int size, std::string &hash);
00070 protected:
00071   vtkWebGLExporter();
00072   ~vtkWebGLExporter();
00073 
00074   void parseRenderer(vtkRenderer* render, const char* viewId, bool onlyWidget, void* mapTime);
00075   void generateRendererData(vtkRendererCollection* renderers, const char* viewId);
00076   void parseActor(vtkActor* actor, unsigned long actorTime, long rendererId, int layer, bool isWidget);
00077   void parseActor2D(vtkActor2D* actor, long actorTime, long renderId, int layer, bool isWidget);
00078   const char* GenerateExportMetadata();
00079 
00080   // Get the dataset from the mapper
00081   vtkTriangleFilter* GetPolyData(vtkMapper* mapper, unsigned long& dataMTime);
00082 
00083   vtkTriangleFilter* TriangleFilter;         // Last Polygon Dataset Parse
00084   double CameraLookAt[10];                   // Camera Look At (fov, position[3], up[3], eye[3])
00085   bool GradientBackground;                   // If the scene use a gradient background
00086   double Background1[3];                     // Background color of the rendering screen (RGB)
00087   double Background2[3];                     // Scond background color
00088   double SceneSize[3];                       // Size of the bounding box of the scene
00089   std::string SceneId;                       // Id of the parsed scene
00090   float CenterOfRotation[3];                 // Center Of Rotation
00091   int meshObjMaxSize, lineObjMaxSize;        // Max size of object allowed (faces)
00092   std::string renderersMetaData;
00093   bool hasWidget;
00094 
00095 private:
00096   vtkWebGLExporter(const vtkWebGLExporter&); // Not implemented
00097   void operator=(const vtkWebGLExporter&);   // Not implemented
00098 
00099   class vtkInternal;
00100   vtkInternal* Internal;
00101   //ETX
00102 };
00103 
00104 #endif