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