vtkVertexBufferObjectMapper.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkVertexBufferObjectMapper.h
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00015 // .NAME vtkVertexBufferObjectMapper - map vtkPolyData to graphics primitives
00016 // .SECTION Description
00017 // vtkVertexBufferObjectMapper is a class that maps polygonal data (i.e., vtkPolyData)
00018 // to graphics primitives. vtkVertexBufferObjectMapper serves as a superclass for
00019 // device-specific poly data mappers, that actually do the mapping to the
00020 // rendering/graphics hardware/software.
00021 
00022 #ifndef __vtkVertexBufferObjectMapper_h
00023 #define __vtkVertexBufferObjectMapper_h
00024 
00025 #include <pcl/pcl_exports.h>
00026 
00027 #include "vtkMapper.h"
00028 #include "vtkSmartPointer.h"
00029 
00030 class vtkOpenGLRenderWindow;
00031 class vtkPolyData;
00032 class vtkRenderer;
00033 class vtkRenderWindow;
00034 class vtkShader2;
00035 class vtkShaderProgram2;
00036 class vtkVertexBufferObject;
00037 
00038 class PCL_EXPORTS vtkVertexBufferObjectMapper : public vtkMapper
00039 {
00040 public:
00041   static vtkVertexBufferObjectMapper *New();
00042   vtkTypeMacro(vtkVertexBufferObjectMapper, vtkMapper);
00043 //  void PrintSelf(ostream& os, vtkIndent indent);
00044 
00045   // Description:
00046   // Implemented by sub classes. Actual rendering is done here.
00047 //  virtual void RenderPiece(vtkRenderer *ren, vtkActor *act);
00048 
00049   // Description:
00050   // This calls RenderPiece (in a for loop is streaming is necessary).
00051   virtual void Render(vtkRenderer *ren, vtkActor *act);
00052 
00053   // Description:
00054   // Specify the input data to map.
00055   //void SetInputData(vtkPolyData *in);
00056   void SetInput(vtkPolyData *input);
00057   void SetInput(vtkDataSet *input);
00058   vtkPolyData *GetInput();
00059   
00060   void SetProgram(vtkSmartPointer<vtkShaderProgram2> program)
00061   {
00062     this->program = program;
00063   }
00064 
00065   // Description:
00066   // Update that sets the update piece first.
00067   void Update();
00068 
00069   // Description:
00070   // Return bounding box (array of six doubles) of data expressed as
00071   // (xmin,xmax, ymin,ymax, zmin,zmax).
00072   virtual double *GetBounds();
00073   virtual void GetBounds(double bounds[6]) 
00074     {this->Superclass::GetBounds(bounds);};
00075   
00076   // Description:
00077   // Make a shallow copy of this mapper.
00078 //  void ShallowCopy(vtkAbstractMapper *m);
00079 
00080   // Description:
00081   // Select a data array from the point/cell data
00082   // and map it to a generic vertex attribute. 
00083   // vertexAttributeName is the name of the vertex attribute.
00084   // dataArrayName is the name of the data array.
00085   // fieldAssociation indicates when the data array is a point data array or
00086   // cell data array (vtkDataObject::FIELD_ASSOCIATION_POINTS or
00087   // (vtkDataObject::FIELD_ASSOCIATION_CELLS).
00088   // componentno indicates which component from the data array must be passed as
00089   // the attribute. If -1, then all components are passed.
00090 //  virtual void MapDataArrayToVertexAttribute(
00091 //    const char* vertexAttributeName,
00092 //    const char* dataArrayName, int fieldAssociation, int componentno=-1);
00093 //
00094 //  virtual void MapDataArrayToMultiTextureAttribute(
00095 //    int unit,
00096 //    const char* dataArrayName, int fieldAssociation, int componentno=-1);
00097 
00098   // Description:
00099   // Remove a vertex attribute mapping.
00100 //  virtual void RemoveVertexAttributeMapping(const char* vertexAttributeName);
00101 //
00102 //  // Description:
00103 //  // Remove all vertex attributes.
00104 //  virtual void RemoveAllVertexAttributeMappings();
00105 
00106 protected:  
00107   vtkVertexBufferObjectMapper();
00108   ~vtkVertexBufferObjectMapper() {};
00109 
00110   // Description:
00111   // Called in GetBounds(). When this method is called, the consider the input
00112   // to be updated depending on whether this->Static is set or not. This method
00113   // simply obtains the bounds from the data-object and returns it.
00114   virtual void ComputeBounds();
00115 
00116   vtkVertexBufferObject *vertexVbo;
00117   vtkVertexBufferObject *indiceVbo;
00118   vtkVertexBufferObject *colorVbo;
00119   vtkVertexBufferObject *normalVbo;
00120 //  vtkVertexBufferObject *normalIndiceVbo;
00121 
00122   vtkSmartPointer<vtkShaderProgram2> program;
00123 
00124   virtual int FillInputPortInformation(int, vtkInformation*);
00125 
00126   void createShaders(vtkOpenGLRenderWindow* win);
00127   void createVBOs(vtkRenderWindow* win);
00128 
00129   bool initialized;
00130   bool shadersInitialized;
00131 
00132 private:
00133   vtkVertexBufferObjectMapper(const vtkVertexBufferObjectMapper&);  // Not implemented.
00134   void operator=(const vtkVertexBufferObjectMapper&);  // Not implemented.
00135 };
00136 
00137 #endif


pcl
Author(s): Open Perception
autogenerated on Wed Aug 26 2015 15:38:43