Developer Documentation
DrawMesh.hh
1 /*===========================================================================*\
2  * *
3  * OpenFlipper *
4  * Copyright (c) 2001-2015, RWTH-Aachen University *
5  * Department of Computer Graphics and Multimedia *
6  * All rights reserved. *
7  * www.openflipper.org *
8  * *
9  *---------------------------------------------------------------------------*
10  * This file is part of OpenFlipper. *
11  *---------------------------------------------------------------------------*
12  * *
13  * Redistribution and use in source and binary forms, with or without *
14  * modification, are permitted provided that the following conditions *
15  * are met: *
16  * *
17  * 1. Redistributions of source code must retain the above copyright notice, *
18  * this list of conditions and the following disclaimer. *
19  * *
20  * 2. Redistributions in binary form must reproduce the above copyright *
21  * notice, this list of conditions and the following disclaimer in the *
22  * documentation and/or other materials provided with the distribution. *
23  * *
24  * 3. Neither the name of the copyright holder nor the names of its *
25  * contributors may be used to endorse or promote products derived from *
26  * this software without specific prior written permission. *
27  * *
28  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
29  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
30  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
31  * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
32  * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
33  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
34  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
35  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
36  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
37  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
38  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
39  * *
40 \*===========================================================================*/
41 
42 
43 
44 
45 
46 //=============================================================================
47 //
48 // CLASS DrawMeshT
49 //
50 //=============================================================================
51 
52 
53 #ifndef ACG_DRAW_MESH_HH
54 #define ACG_DRAW_MESH_HH
55 
56 
57 //== INCLUDES =================================================================
58 
59 #include <vector>
60 #include <list>
61 #include <OpenMesh/Core/Utils/Property.hh>
62 #include <OpenMesh/Core/Utils/color_cast.hh>
63 
64 #include <ACG/GL/globjects.hh>
65 #include <ACG/GL/GLState.hh>
66 #include <ACG/GL/IRenderer.hh>
67 #include <ACG/GL/MeshCompiler.hh>
68 #include <ACG/ShaderUtils/GLSLShader.hh>
69 
70 #include <ACG/Config/ACGDefines.hh>
71 
72 //== FORWARDDECLARATIONS ======================================================
73 
74 
75 //== NAMESPACES ===============================================================
76 
77 namespace ACG {
78 
79 //== CLASS DEFINITION =========================================================
80 
85 class ACGDLLEXPORT DrawMeshBase {
86  protected:
87  DrawMeshBase();
88  ~DrawMeshBase();
89 
90  void deleteIbo();
91  void bindVbo();
92  void bindIbo();
93  void bindLineIbo();
94  void bindHEVbo();
95  void unbindHEVbo();
96  void bindPickVertexIbo();
97 
98  void createIndexBuffer();
99  void fillLineBuffer(size_t n_edges, void *data);
100  void fillHEVBO(size_t numberOfElements_, size_t sizeOfElements_, void* data_);
101  void fillVertexBuffer();
102  void fillInvVertexMap(size_t n_vertices, void *data);
103 
104  public:
105  size_t getNumTris() const { return numTris_; }
106  size_t getNumVerts() const { return numVerts_; }
107 
110  MeshCompiler* getMeshCompiler() {return meshComp_;}
111  unsigned int getNumSubsets() const {return meshComp_->getNumSubsets();}
112 
115  GLenum getIndexType() const {return indexType_;}
116 
121  GLuint pickVertexIBO_opt() {return pickVertexIBO_;} // does not work
122 
123 
124 
125  protected:
126  GLuint vbo_, ibo_;
127  size_t numTris_, numVerts_;
128  MeshCompiler* meshComp_;
129 
131  GLuint lineIBO_;
133  GLuint heVBO_;
134  //previously bound buffer
135  GLint prevVBO_;
136 
138  GLenum indexType_;
139 
143  std::vector<char> vertices_;
144 
147 
150 
153 
156 
159 
160 };
161 
162 
172 template <class Mesh>
173 class DrawMeshT : public DrawMeshBase
174 {
175 private:
176 
177  struct Subset
178  {
179  int materialID;
180  unsigned long startIndex;
181  unsigned long numTris;
182  };
183 
184  enum REBUILD_TYPE {REBUILD_NONE = 0, REBUILD_FULL = 1, REBUILD_GEOMETRY = 2, REBUILD_TOPOLOGY = 4, REBUILD_TEXTURES = 8};
185 
186 
187 public:
188 
189  explicit DrawMeshT(Mesh& _mesh);
190  virtual ~DrawMeshT();
191 
192  void disableColors() {colorMode_ = 0;}
193  void usePerVertexColors() {colorMode_ = 1;}
194  void usePerFaceColors() {colorMode_ = 2;}
195 
196  void setFlatShading() {flatMode_ = 1;}
197  void setSmoothShading() {flatMode_ = 0;}
198 
199  void usePerVertexTexcoords() {textureMode_ = 0;}
200  void usePerHalfedgeTexcoords() {textureMode_ = 1;}
201  void usePerVertexNormals() {halfedgeNormalMode_ = 0;}
202  void usePerHalfedgeNormals() {halfedgeNormalMode_ = 1;}
203 
206  void bindBuffers();
207 
210  GLuint getVBO();
211 
214  GLuint getIBO();
215 
220  GLuint getHEVBO(){return heVBO_;}
221 
224  VertexDeclaration* getVertexDeclaration();
225 
230  unsigned int mapVertexToVBOIndex(unsigned int _v);
231 
232 
235  void bindBuffersToRenderObject(RenderObject* _obj);
236 
239  void unbindBuffers();
240 
246  void draw(std::map< int, GLuint>* _textureMap, bool _nonindexed = false);
247 
256  void addTriRenderObjects(IRenderer* _renderer, const RenderObject* _baseObj, std::map< int, GLuint>* _textureMap, bool _nonindexed = false);
257 
260  void drawLines();
261 
264  void addLineRenderObjects(IRenderer* _renderer, const RenderObject* _baseObj);
265 
266 
269  void drawVertices();
270 
273  void addPointRenderObjects(IRenderer* _renderer, const RenderObject* _baseObj);
274 
275 
276 
280  unsigned int getMemoryUsage(bool _printReport = false);
281 
282  // The updateX functions give a hint on what to update.
283  // may perform a full rebuild internally!
284 
287  void updateTopology() {rebuild_ |= REBUILD_TOPOLOGY;}
288 
291  void updateGeometry() {rebuild_ |= REBUILD_GEOMETRY;}
292 
295  void updateTextures() {rebuild_ |= REBUILD_TEXTURES;}
296 
300  void updateFull() {rebuild_ |= REBUILD_FULL;}
301 
306  unsigned int getNumTextures();
307 
316  void setTextureIndexPropertyName( std::string _indexPropertyName );
317 
322  const std::string& getTextureIndexPropertyName() const { return textureIndexPropertyName_; };
323 
332  void setPerFaceTextureCoordinatePropertyName( std::string _perFaceTextureCoordinatePropertyName );
333 
340  int perFaceTextureCoordinateAvailable();
341 
349  int perFaceTextureIndexAvailable();
350 
351 
352  enum PropertySource
353  {
354  PROPERTY_SOURCE_VERTEX = 0,
355  PROPERTY_SOURCE_HALFEDGE,
356  PROPERTY_SOURCE_FACE,
357  };
358 
364  void addVertexElement( const std::string& _propertyName, PropertySource _source = PROPERTY_SOURCE_VERTEX );
365 
376  bool scanVertexShaderForInput( const std::string& _vertexShaderFile );
377 
378 private:
379  // processing pipeline:
380 
384  void rebuild();
385 
386 
394  void readVertex(size_t _vertex,
395  const typename Mesh::VertexHandle& _vh,
396  const typename Mesh::HalfedgeHandle& _hh,
397  const typename Mesh::FaceHandle& _fh);
398 
403  unsigned int getVertexColor(const typename Mesh::VertexHandle& _vh);
404 
409  unsigned int getFaceColor(const typename Mesh::FaceHandle& _fh);
410 
414  void updateGPUBuffers();
415 
419  void createVBO();
420 
424  void createIBO();
425 
429  void createVertexDeclaration();
430 
431 public:
432  // color picking
433 
441  void updatePickingVertices(ACG::GLState& _state , uint _offset = 0);
442 
452  if ( !pickVertColBuf_.empty() )
453  return &(pickVertColBuf_)[0];
454  else {
455  std::cerr << "Illegal request to pickVertexColorBuffer when buffer is empty!" << std::endl;
456  return 0;
457  }
458  };
459 
469  if ( !pickVertBuf_.empty() )
470  return &(pickVertBuf_)[0];
471  else {
472  std::cerr << "Illegal request to pickVertexBuffer when buffer is empty!" << std::endl;
473  return 0;
474  }
475  };
476 
477 
483  void drawPickingVertices_opt(const GLMatrixf& _mvp, size_t _pickOffset);
484 
485 
489  bool supportsPickingVertices_opt();
490 
495  void updatePickingVertices_opt(ACG::GLState& _state);
496 
497 
498  TextureBuffer* pickVertexMap_opt(){
499  if ( pickVertexMapTBO_.is_valid() )
500  return &pickVertexMapTBO_;
501  else {
502  std::cerr << "Illegal request to pickVertexMap_opt when buffer is empty!" << std::endl;
503  return 0;
504  }
505  }
506 
507 
508 private:
509 
511  std::vector< ACG::Vec3f > pickVertBuf_;
513  std::vector< ACG::Vec4uc > pickVertColBuf_;
514 
515 
516  // map from vbo vertex id to openmesh vertex id
517  TextureBuffer pickVertexMapTBO_;
518 
519  // vertex picking shader
520  GLSL::Program* pickVertexShader_;
521 
522 
523  // selected shader picking method:
524  // 0 -> use texturebuffer which maps from vbo id to openmesh vertex id
525  // 1 -> draw with indexbuffer mapping from openmesh vertex id to vbo vertex
526  int pickVertexMethod_;
527 
528 public:
529 
539  void updatePickingEdges(ACG::GLState& _state , uint _offset = 0 );
540 
550  if ( !pickEdgeBuf_.empty() )
551  return &(pickEdgeBuf_)[0];
552  else {
553  std::cerr << "Illegal request to pickEdgeColorBuffer when buffer is empty!" << std::endl;
554  return 0;
555  }
556  }
557 
558 
564  void drawPickingEdges_opt(const GLMatrixf& _mvp, size_t _pickOffset);
565 
566 
570  bool supportsPickingEdges_opt();
571 
576  void updatePickingEdges_opt(ACG::GLState& _state );
577 
578 private:
579 
580  std::vector< ACG::Vec4uc > pickEdgeBuf_;
581 
582  // edge picking shader
583  GLSL::Program* pickEdgeShader_;
584 
585 
586 public:
587 
592  void updatePickingFaces(ACG::GLState& _state );
593 
603  if ( !pickFaceColBuf_.empty() )
604  return &(pickFaceColBuf_)[0];
605  else {
606  std::cerr << "Illegal request to pickFaceColorBuffer when buffer is empty!" << std::endl;
607  return 0;
608  }
609  }
610 
620  if ( !pickFaceVertexBuf_.empty() )
621  return &(pickFaceVertexBuf_)[0];
622  else {
623  std::cerr << "Illegal request to pickFaceVertexBuffer when buffer is empty!" << std::endl;
624  return 0;
625  }
626  }
627 
633  void drawPickingFaces_opt(const GLMatrixf& _mvp, size_t _pickOffset);
634 
635 
639  bool supportsPickingFaces_opt();
640 
645  void updatePickingFaces_opt(ACG::GLState& _state );
646 
647 
648  TextureBuffer* pickFaceTriangleMap_opt(){
649  if ( pickFaceTriToFaceMapTBO_.is_valid() )
650  return &pickFaceTriToFaceMapTBO_;
651  else {
652  std::cerr << "Illegal request to pickFaceTriangleMap_opt when buffer is empty!" << std::endl;
653  return 0;
654  }
655  }
656 
657 private:
658 
659  // unoptimized picking buffers
660  std::vector< ACG::Vec3f > pickFaceVertexBuf_;
661  std::vector< ACG::Vec4uc > pickFaceColBuf_;
662 
663  // optimized picking with shaders: maps from triangle id in draw vbo to face id in openmesh
664  TextureBuffer pickFaceTriToFaceMapTBO_;
665 
668 
669 public:
677  void updatePickingAny(ACG::GLState& _state );
678 
688  if ( !pickAnyFaceColBuf_.empty() )
689  return &(pickAnyFaceColBuf_)[0];
690  else {
691  std::cerr << "Illegal request to pickAnyFaceColorBuffer when buffer is empty!" << std::endl;
692  return 0;
693  }
694  }
695 
705  if ( !pickAnyEdgeColBuf_.empty() )
706  return &(pickAnyEdgeColBuf_)[0];
707  else {
708  std::cerr << "Illegal request to pickAnyEdgeColorBuffer when buffer is empty!" << std::endl;
709  return 0;
710  }
711  }
712 
722  if ( !pickAnyVertexColBuf_.empty() )
723  return &(pickAnyVertexColBuf_)[0];
724  else {
725  std::cerr << "Illegal request to pickAnyVertexColorBuffer when buffer is empty!" << std::endl;
726  return 0;
727  }
728  }
729 
735  void drawPickingAny_opt(const GLMatrixf& _mvp, size_t _pickOffset);
736 
740  bool supportsPickingAny_opt();
741 
746  void updatePickingAny_opt(ACG::GLState& _state );
747 
748 private:
749 
750  std::vector< ACG::Vec4uc > pickAnyFaceColBuf_;
751  std::vector< ACG::Vec4uc > pickAnyEdgeColBuf_;
752  std::vector< ACG::Vec4uc > pickAnyVertexColBuf_;
753 
754 
755 private:
756 
757  // small helper functions
758 
769  unsigned int countTris(unsigned int* _pOutMaxPolyVerts = 0, unsigned int* _pOutNumIndices = 0);
770 
778  int getTextureIDofTri(unsigned int _tri);
779 
785  int getTextureIDofFace(unsigned int _face);
786 
795  const void* getMeshPropertyType(OpenMesh::BaseProperty* _prop, GLuint* _outType, unsigned int* _outSize) const;
796 
806  template<class T>
807  const void* testMeshPropertyTypeT(const OpenMesh::BaseProperty* _prop, unsigned int* _outSize) const;
808 
809 
810 public:
811 
816  void dumpObj(const char* _filename) const;
817 
818 private:
819 
822 
824  unsigned int* indices_;
825 
827  unsigned int rebuild_;
828 
832  size_t prevNumFaces_,prevNumVerts_;
833 
834 
837 
840 
843 
846 
849 
852 
855 
858 
859 
863  unsigned int* invVertexMap_;
864 
865 
866 
867  //========================================================================
868  // flexible vertex layout
869  //========================================================================
870 
871 
873  {
874  // get property from vertex, face or halfedge array
875  PropertySource source_;
876 
878  std::string name_;
879 
882 
885 
888 
890  const void* propDataPtr_;
891 
894  };
895 
897  const size_t offsetPos_,
898  offsetNormal_,
899  offsetTexc_,
900  offsetColor_;
901 
903  std::vector<VertexProperty> additionalElements_;
904 
905  //========================================================================
906  // texture handling
907  //========================================================================
908 
917 
924 
925 
926 private:
927  //========================================================================
928  // write functions for flexible vertex format
929 
930  void writeVertexElement(void* _dstBuf, size_t _vertex, size_t _stride, size_t _elementOffset, size_t _elementSize, const void* _elementData);
931 
932  void writePosition(size_t _vertex, const ACG::Vec3d& _p);
933 
934  void writeNormal(size_t _vertex, const ACG::Vec3d& _n);
935 
936  void writeTexcoord(size_t _vertex, const ACG::Vec2f& _uv);
937 
938  void writeColor(size_t _vertex, unsigned int _color);
939 
940  void writeVertexProperty(size_t _vertex, const VertexElement* _elementDesc, const ACG::Vec4f& _propf);
941 
942  void writeVertexProperty(size_t _vertex, const VertexElement* _elementDesc, const ACG::Vec4d& _propd);
943 
944 
950  void readVertexFromVBO(unsigned int _vertex, void* _dst);
951 
952 
953 public:
954 
955  //===========================================================================
956  // fully expanded vbo
957  //===========================================================================
958 
959 
964  void invalidateFullVBO();
965 
971  void updateFullVBO();
972 
973 
974 private:
975  // fully expanded mesh vbo (not indexed)
976  // this is only used for drawmodes with incompatible combinations of interpolation modes (ex. smooth gouraud lighting with flat face colors)
977  GeometryBuffer vboFull_;
978 
979  // full vbo has been invalidated
980  bool updateFullVBO_;
981 
982 
983 
984 
985 public:
986  //========================================================================
987  // per edge buffers
988 
994  void invalidatePerEdgeBuffers() {updatePerEdgeBuffers_ = 1;}
995 
1000  void updatePerEdgeBuffers();
1001 
1006  ACG::Vec3f* perEdgeVertexBuffer();
1007 
1012  ACG::Vec4f* perEdgeColorBuffer();
1013 
1019  void invalidatePerHalfedgeBuffers() {updatePerHalfedgeBuffers_ = 1;}
1020 
1025  template<typename Mesh::Normal (DrawMeshT::*NormalLookup)(typename Mesh::FaceHandle)>
1026  void updatePerHalfedgeBuffers();
1027 
1032  ACG::Vec3f* perHalfedgeVertexBuffer();
1033 
1038  ACG::Vec4f* perHalfedgeColorBuffer();
1039 
1040 
1043  void updateEdgeHalfedgeVertexDeclarations();
1044 
1045 
1048  const VertexDeclaration* getEdgeColoredVertexDeclaration() const {return vertexDeclEdgeCol_;}
1049 
1052  const VertexDeclaration* getHalfedgeVertexDeclaration() const {return vertexDeclHalfedgePos_;}
1053 
1056  const VertexDeclaration* getHalfedgeColoredVertexDeclaration() const {return vertexDeclHalfedgeCol_;}
1057 
1058 
1059 private:
1060  int updatePerEdgeBuffers_;
1061  std::vector<ACG::Vec3f> perEdgeVertexBuf_;
1062  std::vector<ACG::Vec4f> perEdgeColorBuf_;
1063 
1064  int updatePerHalfedgeBuffers_;
1065  std::vector<ACG::Vec3f> perHalfedgeVertexBuf_;
1066  std::vector<ACG::Vec4f> perHalfedgeColorBuf_;
1067 
1075  template<typename Mesh::Normal (DrawMeshT::*NormalLookup)(typename Mesh::FaceHandle)>
1076  typename Mesh::Point halfedge_point(const typename Mesh::HalfedgeHandle _heh);
1077 
1078  inline
1079  typename Mesh::Normal cachedNormalLookup(typename Mesh::FaceHandle fh) {
1080  return mesh_.normal(fh);
1081  }
1082 
1083  inline
1084  typename Mesh::Normal computedTriMeshNormal(typename Mesh::FaceHandle fh) {
1085  typename Mesh::FVIter fv_iter = mesh_.fv_begin(fh);
1086  const typename Mesh::Point p1 = mesh_.point(*fv_iter);
1087  const typename Mesh::Point p2 = mesh_.point(*(++fv_iter));
1088  const typename Mesh::Point p3 = mesh_.point(*(++fv_iter));
1089  return ( p1 + p2 + p3 ) / 3.0;
1090  }
1091 
1092  inline
1093  typename Mesh::Normal computedNormal(typename Mesh::FaceHandle fh) {
1094  unsigned int count = 0;
1095  typename Mesh::Normal normal(0, 0, 0);
1096  for (typename Mesh::FVIter fv_it = mesh_.fv_begin(fh), fv_end = mesh_.fv_end(fh); fv_it != fv_end; ++fv_it) {
1097  normal += mesh_.point(*fv_it);
1098  ++count;
1099  }
1100  normal /= count;
1101  return normal;
1102  }
1103 
1104  typename Mesh::HalfedgeHandle mapToHalfedgeHandle(size_t _vertexId);
1105 
1106 };
1107 
1108 
1109 //=============================================================================
1110 } // namespace ACG
1111 //=============================================================================
1112 #if defined(INCLUDE_TEMPLATES) && !defined(ACG_DRAW_MESH_TCC)
1113 #define ACG_DRAW_MESH_TEMPLATES
1114 #include "DrawMeshT_impl.hh"
1115 #endif
1116 //=============================================================================
1117 #endif // ACG_DRAW_MESH_HH defined
1118 //=============================================================================
Namespace providing different geometric functions concerning angles.
ACG::Vec4uc * pickFaceColorBuffer()
get a pointer to the per face picking color buffer
Definition: DrawMesh.hh:602
Class to define the vertex input layout.
unsigned int * indices_
final index buffer used for rendering
Definition: DrawMesh.hh:824
std::string textureIndexPropertyName_
Property for the per face texture index.
Definition: DrawMesh.hh:916
Kernel::Point Point
Coordinate type.
Definition: PolyMeshT.hh:112
int textureMode_
per vertex / halfedge texture mode toggle: 0: per vertex, 1: per halfedge
Definition: DrawMesh.hh:848
int curVBOColorMode_
Color Mode of vbo.
Definition: DrawMesh.hh:839
const VertexDeclaration * getHalfedgeVertexDeclaration() const
getter for vertex declarations
Definition: DrawMesh.hh:1052
void updateFull()
request a full rebuild of the mesh
Definition: DrawMesh.hh:300
std::vector< char > vertices_
Definition: DrawMesh.hh:143
ACG::Vec4uc * pickEdgeColorBuffer()
get a pointer to the per edge picking color buffer
Definition: DrawMesh.hh:549
GLuint heVBO_
vbo for halfedge rendering, as they are offset
Definition: DrawMesh.hh:133
void invalidatePerHalfedgeBuffers()
Update of the buffers.
Definition: DrawMesh.hh:1019
size_t prevNumFaces_
Definition: DrawMesh.hh:832
GLSL::Program * pickFaceShader_
optimized face picking shader
Definition: DrawMesh.hh:667
GLuint pickVertexIBO_
map from openmesh vertex to vbo vertex id
Definition: DrawMesh.hh:158
std::string perFaceTextureCoordinatePropertyName_
Property for the per face texture coordinates.
Definition: DrawMesh.hh:923
const VertexDeclaration * getEdgeColoredVertexDeclaration() const
getter for vertex declarations
Definition: DrawMesh.hh:1048
GLuint lineIBO_
index buffer used in Wireframe / Hiddenline mode
Definition: DrawMesh.hh:131
Interface class between scenegraph and renderer.
Definition: RenderObject.hh:98
GLSL program class.
Definition: GLSLShader.hh:211
Kernel::VertexHandle VertexHandle
Handle for referencing the corresponding item.
Definition: PolyMeshT.hh:136
int declElementID_
element id in vertex declaration
Definition: DrawMesh.hh:893
int colorMode_
Color Mode: 0: none, 1: per vertex, else: per face.
Definition: DrawMesh.hh:836
VertexDeclaration * vertexDeclEdgeCol_
vertex buffer layout declaration with per edge colors
Definition: DrawMesh.hh:149
void updateGeometry()
request an update for the mesh vertices
Definition: DrawMesh.hh:291
std::string name_
property name in openmesh
Definition: DrawMesh.hh:878
std::vector< ACG::Vec3f > pickVertBuf_
The vertex buffer used for vertex picking.
Definition: DrawMesh.hh:511
int halfedgeNormalMode_
per vertex / halfedge normals mode toggle: 0: per vertex, 1: per halfedge
Definition: DrawMesh.hh:854
unsigned int * invVertexMap_
Definition: DrawMesh.hh:863
unsigned int rebuild_
hint on what to rebuild
Definition: DrawMesh.hh:827
VertexElement destType_
property type as stored in vbo
Definition: DrawMesh.hh:887
VertexElement sourceType_
property type as stored in openmesh
Definition: DrawMesh.hh:884
void updateTextures()
request an update for the textures
Definition: DrawMesh.hh:295
int bVBOinFlatMode_
normals in VBO currently in flat / smooth mode
Definition: DrawMesh.hh:845
const VertexDeclaration * getHalfedgeColoredVertexDeclaration() const
getter for vertex declarations
Definition: DrawMesh.hh:1056
Kernel::Normal Normal
Normal type.
Definition: PolyMeshT.hh:114
GLuint getHEVBO()
getHEVBO get VBO which stores Halfedges with offset
Definition: DrawMesh.hh:220
ACG::Vec4uc * pickVertexColorBuffer()
get a pointer to the per vertex picking color buffer
Definition: DrawMesh.hh:451
std::vector< ACG::Vec4uc > pickVertColBuf_
The color buffer used for vertex picking.
Definition: DrawMesh.hh:513
Description of one vertex element.
int bVBOinHalfedgeTexMode_
texcoords in VBO currently in per vertex / halfedge mode toggle
Definition: DrawMesh.hh:851
int flatMode_
flat / smooth shade mode toggle
Definition: DrawMesh.hh:842
int bVBOinHalfedgeNormalMode_
normals in VBO currently in per vertex / halfedge mode toggle
Definition: DrawMesh.hh:857
const std::string & getTextureIndexPropertyName() const
get the name of the texture index property
Definition: DrawMesh.hh:322
Mesh & mesh_
OpenMesh object to be rendered.
Definition: DrawMesh.hh:821
VertexDeclaration * vertexDecl_
vertex buffer layout declaration with per vertex colors
Definition: DrawMesh.hh:146
MeshCompiler * getMeshCompiler()
get mesh compiler used to create the draw mesh
Definition: DrawMesh.hh:110
GLenum indexType_
support for 2 and 4 byte unsigned integers
Definition: DrawMesh.hh:138
ACG::Vec3f * pickFaceVertexBuffer()
get a pointer to the per vertex picking color buffer
Definition: DrawMesh.hh:619
const void * propDataPtr_
memory address of property data
Definition: DrawMesh.hh:890
ACG::Vec3f * pickVertexBuffer()
get a pointer to the per vertex picking vertex buffer
Definition: DrawMesh.hh:468
std::vector< VertexProperty > additionalElements_
additional optional elements
Definition: DrawMesh.hh:903
ACG::Vec4uc * pickAnyEdgeColorBuffer()
get a pointer to the any picking color buffer
Definition: DrawMesh.hh:704
ACG::Vec4uc * pickAnyFaceColorBuffer()
get a pointer to the any picking color buffer
Definition: DrawMesh.hh:687
int getNumSubsets() const
Get the number of subsets.
const size_t offsetPos_
fixed vertex elements:
Definition: DrawMesh.hh:897
ACG::Vec4uc * pickAnyVertexColorBuffer()
get a pointer to the any picking color buffer
Definition: DrawMesh.hh:721
VertexDeclaration * vertexDeclHalfedgeCol_
vertex buffer layout declaration with per halfedge colors
Definition: DrawMesh.hh:152
VertexDeclaration * vertexDeclHalfedgePos_
vertex buffer layout declaration with halfedge positions only
Definition: DrawMesh.hh:155
GLuint pickVertexIBO_opt()
get an index buffer mapping from openmesh vertices to drawmesh vbo vertices
Definition: DrawMesh.hh:121
void invalidatePerEdgeBuffers()
Update of the buffers.
Definition: DrawMesh.hh:994
Mesh Drawing Class.
Definition: DrawMesh.hh:173
std::string vertexShaderInputName_
input name id in vertex shader
Definition: DrawMesh.hh:881
void updateTopology()
request an update for the mesh topology
Definition: DrawMesh.hh:287
GLenum getIndexType() const
get index type of index buffer
Definition: DrawMesh.hh:115