VTK
vtkTransformFeedback.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkTransformFeedback.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
27#ifndef vtkTransformFeedback_h
28#define vtkTransformFeedback_h
29
30#include "vtkRenderingOpenGL2Module.h" // For export macro
31#include "vtkObject.h"
32
33#include <string> // For string
34#include <vector> // For vector
35
37class vtkWindow;
38
39class VTKRENDERINGOPENGL2_EXPORT vtkTransformFeedback : public vtkObject
40{
41public:
44 virtual void PrintSelf(ostream &os, vtkIndent indent);
45
50 {
51 Vertex_ClipCoordinate_F, // Projected XYZW
52 Color_RGBA_F
53 };
54
56 {
58 : Role(role), Identifier(id) {}
61 };
62
67
71 void AddVarying(VaryingRole role, const std::string &var);
72
76 const std::vector<VaryingMetaData>& GetVaryings() const
77 {
78 return this->Varyings;
79 }
80
84 static size_t GetBytesPerVertex(VaryingRole role);
85
89 size_t GetBytesPerVertex() const;
90
92
102 vtkSetMacro(NumberOfVertices, size_t)
103 void SetNumberOfVertices(int drawMode, size_t inputVerts);
104 vtkGetMacro(NumberOfVertices, size_t)
106
111 size_t GetBufferSize() const;
112
126 void BindVaryings(vtkShaderProgram *prog);
127
129
133 vtkGetMacro(BufferHandle, int)
135
137
142 vtkSetMacro(PrimitiveMode, int)
143 vtkGetMacro(PrimitiveMode, int)
145
151 void BindBuffer();
152
158 void ReadBuffer();
159
161
165 vtkGetMacro(BufferData, void*)
167
171 void ReleaseGraphicsResources();
172
178 void ReleaseBufferData(bool freeBuffer = true);
179
180protected:
183
184private:
185 vtkTransformFeedback(const vtkTransformFeedback &) VTK_DELETE_FUNCTION;
186 void operator=(const vtkTransformFeedback &) VTK_DELETE_FUNCTION;
187
188 bool VaryingsBound;
189
190 std::vector<VaryingMetaData> Varyings;
191 size_t NumberOfVertices;
192 int BufferMode;
193
194 int BufferHandle;
195 int PrimitiveMode;
196
197 unsigned char *BufferData;
198};
199
200//------------------------------------------------------------------------------
201inline size_t vtkTransformFeedback::GetBytesPerVertex(
203{
204 switch (role)
205 {
206 case Vertex_ClipCoordinate_F:
207 return 4 * sizeof(float);
208 case Color_RGBA_F:
209 return 4 * sizeof(float);
210 }
211
212 vtkGenericWarningMacro("Unknown role enum value: " << role);
213 return 0;
214}
215
216#endif // vtkTransformFeedback_h
a simple class to control print indentation
Definition: vtkIndent.h:40
abstract base class for most VTK objects
Definition: vtkObject.h:60
The ShaderProgram uses one or more Shader objects.
Manages a TransformFeedback buffer.
void AddVarying(VaryingRole role, const std::string &var)
Capture the varying 'var' with the indicated role.
VaryingRole
The role a captured varying fills.
const std::vector< VaryingMetaData > & GetVaryings() const
Get the list of captured varyings,.
size_t GetBytesPerVertex() const
Returns the number of bytes per vertexs, accounting for all roles.
void ClearVaryings()
Clear the list of varying attributes to capture.
static vtkTransformFeedback * New()
window superclass for vtkRenderWindow
Definition: vtkWindow.h:35
@ vector
Definition: vtkX3D.h:237
@ string
Definition: vtkX3D.h:490
VaryingMetaData(VaryingRole role, const std::string &id)
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.