1 /*=========================================================================
2 
3   Program:   Visualization Toolkit
4   Module:    vtkWebGLDataSet.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   vtkWebGLDataSet
17  *
18  * vtkWebGLDataSet represent vertices, lines, polygons, and triangles.
19 */
20 
21 #ifndef vtkWebGLDataSet_h
22 #define vtkWebGLDataSet_h
23 
24 #include "vtkObject.h"
25 #include "vtkWebGLExporterModule.h" // needed for export macro
26 
27 #include "vtkWebGLObject.h" // Needed for the enum
28 #include <string> // needed for md5
29 
30 class VTKWEBGLEXPORTER_EXPORT vtkWebGLDataSet : public vtkObject
31 {
32 public:
33   static vtkWebGLDataSet* New();
34   vtkTypeMacro(vtkWebGLDataSet, vtkObject)
35   void PrintSelf(ostream &os, vtkIndent indent) override;
36 
37   void SetVertices(float* v, int size);
38   void SetIndexes(short* i, int size);
39   void SetNormals(float* n);
40   void SetColors(unsigned char* c);
41   void SetPoints(float* p, int size);
42   void SetTCoords(float *t);
43   void SetMatrix(float* m);
44   void SetType(WebGLObjectTypes t);
45 
46   unsigned char* GetBinaryData();
47   int GetBinarySize();
48   void GenerateBinaryData();
49   bool HasChanged();
50 
51   std::string GetMD5();
52 
53 protected:
54   vtkWebGLDataSet();
55   ~vtkWebGLDataSet() override;
56 
57   int NumberOfVertices;
58   int NumberOfPoints;
59   int NumberOfIndexes;
60   WebGLObjectTypes webGLType;
61 
62   float* Matrix;
63   float* vertices;
64   float* normals;
65   short* indexes;
66   float* points;
67   float* tcoords;
68   unsigned char* colors;
69   unsigned char* binary;   // Data in binary
70   int binarySize;          // Size of the data in binary
71   bool hasChanged;
72   std::string MD5;
73 
74 private:
75   vtkWebGLDataSet(const vtkWebGLDataSet&) = delete;
76   void operator=(const vtkWebGLDataSet&) = delete;
77 };
78 
79 #endif
80