1 /*=========================================================================
2 
3   Program:   Visualization Toolkit
4   Module:    vtkWebGLObject.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 =========================================================================*/
15 /**
16  * @class   vtkWebGLObject
17  *
18  * vtkWebGLObject represent and manipulate an WebGL object and its data.
19 */
20 
21 #ifndef vtkWebGLObject_h
22 #define vtkWebGLObject_h
23 
24 #include "vtkObject.h"
25 #include "vtkWebGLExporterModule.h" // needed for export macro
26 
27 #include <string> // needed for ID and md5 storing
28 
29 class vtkMatrix4x4;
30 class vtkUnsignedCharArray;
31 
32 enum WebGLObjectTypes {
33   wPOINTS = 0,
34   wLINES = 1,
35   wTRIANGLES = 2
36 };
37 
38 class VTKWEBGLEXPORTER_EXPORT vtkWebGLObject : public vtkObject
39 {
40 public:
41   static vtkWebGLObject* New();
42   vtkTypeMacro(vtkWebGLObject, vtkObject)
43   void PrintSelf(ostream &os, vtkIndent indent) override;
44 
45   virtual void GenerateBinaryData();
46   virtual unsigned char* GetBinaryData(int part);
47   virtual int GetBinarySize(int part);
48   virtual int GetNumberOfParts();
49 
50   /**
51    * This is a wrapper friendly method for access the binary data.
52    * The binary data for the requested part will be copied into the
53    * given vtkUnsignedCharArray.
54    */
55   void GetBinaryData(int part, vtkUnsignedCharArray* buffer);
56 
57   void SetLayer(int l);
58   void SetRendererId(size_t i);
59   void SetId(const std::string& i);
60   void SetWireframeMode(bool wireframe);
61   void SetVisibility(bool vis);
62   void SetTransformationMatrix(vtkMatrix4x4* m);
63   void SetIsWidget(bool w);
64   void SetHasTransparency(bool t);
65   void SetInteractAtServer(bool i);
66   void SetType(WebGLObjectTypes t);
67   bool isWireframeMode();
68   bool isVisible();
69   bool HasChanged();
70   bool isWidget();
71   bool HasTransparency();
72   bool InteractAtServer();
73 
74   std::string GetMD5();
75   std::string GetId();
76 
77   size_t GetRendererId();
78   int GetLayer();
79 
80 protected:
81     vtkWebGLObject();
82     ~vtkWebGLObject() override;
83 
84     float Matrix[16];
85     size_t rendererId;
86     int layer;                  // Renderer Layer
87     std::string id;          // Id of the object
88     std::string MD5;
89     bool hasChanged;
90     bool iswireframeMode;
91     bool isvisible;
92     WebGLObjectTypes webGlType;
93     bool hasTransparency;
94     bool iswidget;
95     bool interactAtServer;
96 
97 private:
98   vtkWebGLObject(const vtkWebGLObject&) = delete;
99   void operator=(const vtkWebGLObject&) = delete;
100 };
101 
102 #endif
103