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