Point Cloud Library (PCL)  1.8.0
vtkVertexBufferObjectMapper.h
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkVertexBufferObjectMapper.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 // .NAME vtkVertexBufferObjectMapper - map vtkPolyData to graphics primitives
16 // .SECTION Description
17 // vtkVertexBufferObjectMapper is a class that maps polygonal data (i.e., vtkPolyData)
18 // to graphics primitives. vtkVertexBufferObjectMapper serves as a superclass for
19 // device-specific poly data mappers, that actually do the mapping to the
20 // rendering/graphics hardware/software.
21 
22 #ifndef __vtkVertexBufferObjectMapper_h
23 #define __vtkVertexBufferObjectMapper_h
24 
25 #include <pcl/pcl_exports.h>
26 
27 #include "vtkMapper.h"
28 #include "vtkSmartPointer.h"
29 
30 class vtkOpenGLRenderWindow;
31 class vtkPolyData;
32 class vtkRenderer;
33 class vtkRenderWindow;
34 class vtkShader2;
35 class vtkShaderProgram2;
37 
38 class PCL_EXPORTS vtkVertexBufferObjectMapper : public vtkMapper
39 {
40 public:
41  static vtkVertexBufferObjectMapper *New();
42  vtkTypeMacro(vtkVertexBufferObjectMapper, vtkMapper);
43 // void PrintSelf(ostream& os, vtkIndent indent);
44 
45  // Description:
46  // Implemented by sub classes. Actual rendering is done here.
47 // virtual void RenderPiece(vtkRenderer *ren, vtkActor *act);
48 
49  // Description:
50  // This calls RenderPiece (in a for loop is streaming is necessary).
51  virtual void Render(vtkRenderer *ren, vtkActor *act);
52 
53  // Description:
54  // Specify the input data to map.
55  //void SetInputData(vtkPolyData *in);
56  void SetInput(vtkPolyData *input);
57  void SetInput(vtkDataSet *input);
58  vtkPolyData *GetInput();
59 
61  {
62  this->program = program;
63  }
64 
65  // Description:
66  // Update that sets the update piece first.
67  void Update();
68 
69  // Description:
70  // Return bounding box (array of six doubles) of data expressed as
71  // (xmin,xmax, ymin,ymax, zmin,zmax).
72  virtual double *GetBounds();
73  virtual void GetBounds(double bounds[6])
74  {this->Superclass::GetBounds(bounds);};
75 
76  // Description:
77  // Make a shallow copy of this mapper.
78 // void ShallowCopy(vtkAbstractMapper *m);
79 
80  // Description:
81  // Select a data array from the point/cell data
82  // and map it to a generic vertex attribute.
83  // vertexAttributeName is the name of the vertex attribute.
84  // dataArrayName is the name of the data array.
85  // fieldAssociation indicates when the data array is a point data array or
86  // cell data array (vtkDataObject::FIELD_ASSOCIATION_POINTS or
87  // (vtkDataObject::FIELD_ASSOCIATION_CELLS).
88  // componentno indicates which component from the data array must be passed as
89  // the attribute. If -1, then all components are passed.
90 // virtual void MapDataArrayToVertexAttribute(
91 // const char* vertexAttributeName,
92 // const char* dataArrayName, int fieldAssociation, int componentno=-1);
93 //
94 // virtual void MapDataArrayToMultiTextureAttribute(
95 // int unit,
96 // const char* dataArrayName, int fieldAssociation, int componentno=-1);
97 
98  // Description:
99  // Remove a vertex attribute mapping.
100 // virtual void RemoveVertexAttributeMapping(const char* vertexAttributeName);
101 //
102 // // Description:
103 // // Remove all vertex attributes.
104 // virtual void RemoveAllVertexAttributeMappings();
105 
106 protected:
109 
110  // Description:
111  // Called in GetBounds(). When this method is called, the consider the input
112  // to be updated depending on whether this->Static is set or not. This method
113  // simply obtains the bounds from the data-object and returns it.
114  virtual void ComputeBounds();
115 
120 // vtkVertexBufferObject *normalIndiceVbo;
121 
123 
124  virtual int FillInputPortInformation(int, vtkInformation*);
125 
126  void createShaders(vtkOpenGLRenderWindow* win);
127  void createVBOs(vtkRenderWindow* win);
128 
131 
132 private:
133  vtkVertexBufferObjectMapper(const vtkVertexBufferObjectMapper&); // Not implemented.
134  void operator=(const vtkVertexBufferObjectMapper&); // Not implemented.
135 };
136 
137 #endif
void SetProgram(vtkSmartPointer< vtkShaderProgram2 > program)
virtual void GetBounds(double bounds[6])
vtkSmartPointer< vtkShaderProgram2 > program