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 * $Revision$ *
45 * $LastChangedBy$ *
46 * $Date$ *
47 * *
48 \*===========================================================================*/
49 
50 
51 
52 //=============================================================================
53 //
54 // CLASS DrawMeshT
55 //
56 //=============================================================================
57 
58 
59 #ifndef ACG_DRAW_MESH_HH
60 #define ACG_DRAW_MESH_HH
61 
62 
63 //== INCLUDES =================================================================
64 
65 #include <vector>
66 #include <list>
67 #include <OpenMesh/Core/Utils/Property.hh>
68 #include <OpenMesh/Core/IO/MeshIO.hh>
69 
70 #include <ACG/GL/globjects.hh>
71 #include <ACG/GL/GLState.hh>
72 #include <ACG/GL/IRenderer.hh>
73 #include <ACG/GL/MeshCompiler.hh>
74 #include <ACG/ShaderUtils/GLSLShader.hh>
75 
76 #include <ACG/Config/ACGDefines.hh>
77 
78 //== FORWARDDECLARATIONS ======================================================
79 
80 
81 //== NAMESPACES ===============================================================
82 
83 namespace ACG {
84 
85 //== CLASS DEFINITION =========================================================
86 
91 class ACGDLLEXPORT DrawMeshBase {
92  protected:
93  DrawMeshBase();
94  ~DrawMeshBase();
95 
96  void deleteIbo();
97  void bindVbo();
98  void bindIbo();
99  void bindLineIbo();
100  void bindPickVertexIbo();
101 
102  void createIndexBuffer();
103  void fillLineBuffer(size_t n_edges, void *data);
104  void fillVertexBuffer();
105  void fillInvVertexMap(size_t n_vertices, void *data);
106 
107  public:
108  unsigned int getNumTris() const { return numTris_; }
109  unsigned int getNumVerts() const { return numVerts_; }
110 
113  MeshCompiler* getMeshCompiler() {return meshComp_;}
114  unsigned int getNumSubsets() const {return meshComp_->getNumSubsets();}
115 
118  GLenum getIndexType() const {return indexType_;}
119 
124  GLuint pickVertexIBO_opt() {return pickVertexIBO_;} // does not work
125 
126 
127 
128  protected:
129  GLuint vbo_, ibo_;
130  size_t numTris_, numVerts_;
131  MeshCompiler* meshComp_;
132 
134  GLuint lineIBO_;
135 
137  GLenum indexType_;
138 
142  std::vector<char> vertices_;
143 
146 
149 
152 
155 
158 
159 };
160 
161 
171 template <class Mesh>
172 class DrawMeshT : public DrawMeshBase
173 {
174 private:
175 
176  struct Subset
177  {
178  int materialID;
179  unsigned long startIndex;
180  unsigned long numTris;
181  };
182 
183  enum REBUILD_TYPE {REBUILD_NONE = 0, REBUILD_FULL = 1, REBUILD_GEOMETRY = 2, REBUILD_TOPOLOGY = 4, REBUILD_TEXTURES = 8};
184 
185 
186 public:
187 
188  DrawMeshT(Mesh& _mesh);
189  virtual ~DrawMeshT();
190 
191  void disableColors() {colorMode_ = 0;}
192  void usePerVertexColors() {colorMode_ = 1;}
193  void usePerFaceColors() {colorMode_ = 2;}
194 
195  void setFlatShading() {flatMode_ = 1;}
196  void setSmoothShading() {flatMode_ = 0;}
197 
198  void usePerVertexTexcoords() {textureMode_ = 0;}
199  void usePerHalfedgeTexcoords() {textureMode_ = 1;}
200  void usePerVertexNormals() {halfedgeNormalMode_ = 0;}
201  void usePerHalfedgeNormals() {halfedgeNormalMode_ = 1;}
202 
205  void bindBuffers();
206 
209  GLuint getVBO();
210 
213  GLuint getIBO();
214 
215 
218  VertexDeclaration* getVertexDeclaration();
219 
224  unsigned int mapVertexToVBOIndex(unsigned int _v);
225 
226 
229  void bindBuffersToRenderObject(RenderObject* _obj);
230 
233  void unbindBuffers();
234 
240  void draw(std::map< int, GLuint>* _textureMap, bool _nonindexed = false);
241 
250  void addTriRenderObjects(IRenderer* _renderer, const RenderObject* _baseObj, std::map< int, GLuint>* _textureMap, bool _nonindexed = false);
251 
254  void drawLines();
255 
258  void addLineRenderObjects(IRenderer* _renderer, const RenderObject* _baseObj);
259 
260 
263  void drawVertices();
264 
267  void addPointRenderObjects(IRenderer* _renderer, const RenderObject* _baseObj);
268 
269 
270 
274  unsigned int getMemoryUsage(bool _printReport = false);
275 
276  // The updateX functions give a hint on what to update.
277  // may perform a full rebuild internally!
278 
281  void updateTopology() {rebuild_ |= REBUILD_TOPOLOGY;}
282 
285  void updateGeometry() {rebuild_ |= REBUILD_GEOMETRY;}
286 
289  void updateTextures() {rebuild_ |= REBUILD_TEXTURES;}
290 
294  void updateFull() {rebuild_ |= REBUILD_FULL;}
295 
300  unsigned int getNumTextures();
301 
310  void setTextureIndexPropertyName( std::string _indexPropertyName );
311 
316  const std::string& getTextureIndexPropertyName() const { return textureIndexPropertyName_; };
317 
326  void setPerFaceTextureCoordinatePropertyName( std::string _perFaceTextureCoordinatePropertyName );
327 
334  int perFaceTextureCoordinateAvailable();
335 
343  int perFaceTextureIndexAvailable();
344 
345 
346  enum PropertySource
347  {
348  PROPERTY_SOURCE_VERTEX = 0,
349  PROPERTY_SOURCE_HALFEDGE,
350  PROPERTY_SOURCE_FACE,
351  };
352 
358  void addVertexElement( const std::string& _propertyName, PropertySource _source = PROPERTY_SOURCE_VERTEX );
359 
370  bool scanVertexShaderForInput( const std::string& _vertexShaderFile );
371 
372 private:
373  // processing pipeline:
374 
378  void rebuild();
379 
380 
388  void readVertex(unsigned int _vertex,
389  const typename Mesh::VertexHandle _vh,
390  const typename Mesh::HalfedgeHandle _hh,
391  const typename Mesh::FaceHandle _fh);
392 
397  unsigned int getVertexColor(const typename Mesh::VertexHandle _vh);
398 
403  unsigned int getFaceColor(const typename Mesh::FaceHandle _fh);
404 
408  void updateGPUBuffers();
409 
413  void createVBO();
414 
418  void createIBO();
419 
423  void createVertexDeclaration();
424 
425 public:
426  // color picking
427 
435  void updatePickingVertices(ACG::GLState& _state , uint _offset = 0);
436 
446  if ( !pickVertColBuf_.empty() )
447  return &(pickVertColBuf_)[0];
448  else {
449  std::cerr << "Illegal request to pickVertexColorBuffer when buffer is empty!" << std::endl;
450  return 0;
451  }
452  };
453 
463  if ( !pickVertBuf_.empty() )
464  return &(pickVertBuf_)[0];
465  else {
466  std::cerr << "Illegal request to pickVertexBuffer when buffer is empty!" << std::endl;
467  return 0;
468  }
469  };
470 
471 
477  void drawPickingVertices_opt(const GLMatrixf& _mvp, int _pickOffset);
478 
479 
483  bool supportsPickingVertices_opt();
484 
489  void updatePickingVertices_opt(ACG::GLState& _state);
490 
491 #ifdef GL_ARB_texture_buffer_object
492 
493  TextureBuffer* pickVertexMap_opt(){
494  if ( pickVertexMapTBO_.is_valid() )
495  return &pickVertexMapTBO_;
496  else {
497  std::cerr << "Illegal request to pickVertexMap_opt when buffer is empty!" << std::endl;
498  return 0;
499  }
500  }
501 
502 #endif // GL_ARB_texture_buffer_object
503 
504 private:
505 
507  std::vector< ACG::Vec3f > pickVertBuf_;
509  std::vector< ACG::Vec4uc > pickVertColBuf_;
510 
511 
512 #ifdef GL_ARB_texture_buffer_object
513  // map from vbo vertex id to openmesh vertex id
514  TextureBuffer pickVertexMapTBO_;
515 #endif // GL_ARB_texture_buffer_object
516 
517  // vertex picking shader
518  GLSL::Program* pickVertexShader_;
519 
520 
521  // selected shader picking method:
522  // 0 -> use texturebuffer which maps from vbo id to openmesh vertex id
523  // 1 -> draw with indexbuffer mapping from openmesh vertex id to vbo vertex
524  int pickVertexMethod_;
525 
526 public:
527 
537  void updatePickingEdges(ACG::GLState& _state , uint _offset = 0 );
538 
548  if ( !pickEdgeBuf_.empty() )
549  return &(pickEdgeBuf_)[0];
550  else {
551  std::cerr << "Illegal request to pickEdgeColorBuffer when buffer is empty!" << std::endl;
552  return 0;
553  }
554  }
555 
556 
562  void drawPickingEdges_opt(const GLMatrixf& _mvp, int _pickOffset);
563 
564 
568  bool supportsPickingEdges_opt();
569 
574  void updatePickingEdges_opt(ACG::GLState& _state );
575 
576 private:
577 
578  std::vector< ACG::Vec4uc > pickEdgeBuf_;
579 
580  // edge picking shader
581  GLSL::Program* pickEdgeShader_;
582 
583 
584 public:
585 
590  void updatePickingFaces(ACG::GLState& _state );
591 
601  if ( !pickFaceColBuf_.empty() )
602  return &(pickFaceColBuf_)[0];
603  else {
604  std::cerr << "Illegal request to pickFaceColorBuffer when buffer is empty!" << std::endl;
605  return 0;
606  }
607  }
608 
618  if ( !pickFaceVertexBuf_.empty() )
619  return &(pickFaceVertexBuf_)[0];
620  else {
621  std::cerr << "Illegal request to pickFaceVertexBuffer when buffer is empty!" << std::endl;
622  return 0;
623  }
624  }
625 
631  void drawPickingFaces_opt(const GLMatrixf& _mvp, int _pickOffset);
632 
633 
637  bool supportsPickingFaces_opt();
638 
643  void updatePickingFaces_opt(ACG::GLState& _state );
644 
645 #ifdef GL_ARB_texture_buffer_object
646 
647  TextureBuffer* pickFaceTriangleMap_opt(){
648  if ( pickFaceTriToFaceMapTBO_.is_valid() )
649  return &pickFaceTriToFaceMapTBO_;
650  else {
651  std::cerr << "Illegal request to pickFaceTriangleMap_opt when buffer is empty!" << std::endl;
652  return 0;
653  }
654  }
655 #endif
656 
657 private:
658 
659  // unoptimized picking buffers
660  std::vector< ACG::Vec3f > pickFaceVertexBuf_;
661  std::vector< ACG::Vec4uc > pickFaceColBuf_;
662 
663 #ifdef GL_ARB_texture_buffer_object
664  // optimized picking with shaders: maps from triangle id in draw vbo to face id in openmesh
665  TextureBuffer pickFaceTriToFaceMapTBO_;
666 #endif // GL_ARB_texture_buffer_object
667 
670 
671 public:
679  void updatePickingAny(ACG::GLState& _state );
680 
690  if ( !pickAnyFaceColBuf_.empty() )
691  return &(pickAnyFaceColBuf_)[0];
692  else {
693  std::cerr << "Illegal request to pickAnyFaceColorBuffer when buffer is empty!" << std::endl;
694  return 0;
695  }
696  }
697 
707  if ( !pickAnyEdgeColBuf_.empty() )
708  return &(pickAnyEdgeColBuf_)[0];
709  else {
710  std::cerr << "Illegal request to pickAnyEdgeColorBuffer when buffer is empty!" << std::endl;
711  return 0;
712  }
713  }
714 
724  if ( !pickAnyVertexColBuf_.empty() )
725  return &(pickAnyVertexColBuf_)[0];
726  else {
727  std::cerr << "Illegal request to pickAnyVertexColorBuffer when buffer is empty!" << std::endl;
728  return 0;
729  }
730  }
731 
737  void drawPickingAny_opt(const GLMatrixf& _mvp, int _pickOffset);
738 
742  bool supportsPickingAny_opt();
743 
748  void updatePickingAny_opt(ACG::GLState& _state );
749 
750 private:
751 
752  std::vector< ACG::Vec4uc > pickAnyFaceColBuf_;
753  std::vector< ACG::Vec4uc > pickAnyEdgeColBuf_;
754  std::vector< ACG::Vec4uc > pickAnyVertexColBuf_;
755 
756 
757 private:
758 
759  // small helper functions
760 
771  unsigned int countTris(unsigned int* _pOutMaxPolyVerts = 0, unsigned int* _pOutNumIndices = 0);
772 
780  int getTextureIDofTri(unsigned int _tri);
781 
787  int getTextureIDofFace(unsigned int _face);
788 
797  const void* getMeshPropertyType(OpenMesh::BaseProperty* _prop, GLuint* _outType, unsigned int* _outSize) const;
798 
808  template<class T>
809  const void* testMeshPropertyTypeT(const OpenMesh::BaseProperty* _prop, unsigned int* _outSize) const;
810 
811 
812 public:
813 
818  void dumpObj(const char* _filename) const;
819 
820 private:
821 
824 
826  unsigned int* indices_;
827 
829  unsigned int rebuild_;
830 
834  size_t prevNumFaces_,prevNumVerts_;
835 
836 
839 
842 
845 
848 
851 
854 
857 
860 
861 
865  unsigned int* invVertexMap_;
866 
867 
868 
869  //========================================================================
870  // flexible vertex layout
871  //========================================================================
872 
873 
875  {
876  // get property from vertex, face or halfedge array
877  PropertySource source_;
878 
880  std::string name_;
881 
884 
887 
890 
892  const void* propDataPtr_;
893 
896  };
897 
899  const size_t offsetPos_,
900  offsetNormal_,
901  offsetTexc_,
902  offsetColor_;
903 
905  std::vector<VertexProperty> additionalElements_;
906 
907  //========================================================================
908  // texture handling
909  //========================================================================
910 
919 
926 
927 
928 private:
929  //========================================================================
930  // write functions for flexible vertex format
931 
932  void writeVertexElement(void* _dstBuf, unsigned int _vertex, unsigned int _stride, unsigned int _elementOffset, unsigned int _elementSize, const void* _elementData);
933 
934  void writePosition(unsigned int _vertex, const ACG::Vec3d& _p);
935 
936  void writeNormal(unsigned int _vertex, const ACG::Vec3d& _n);
937 
938  void writeTexcoord(unsigned int _vertex, const ACG::Vec2f& _uv);
939 
940  void writeColor(unsigned int _vertex, unsigned int _color);
941 
942  void writeVertexProperty(unsigned int _vertex, const VertexElement* _elementDesc, const ACG::Vec4f& _propf);
943 
944  void writeVertexProperty(unsigned int _vertex, const VertexElement* _elementDesc, const ACG::Vec4d& _propd);
945 
946 
952  void readVertexFromVBO(unsigned int _vertex, void* _dst);
953 
954 
955 public:
956 
957  //===========================================================================
958  // fully expanded vbo
959  //===========================================================================
960 
961 
966  void invalidateFullVBO();
967 
973  void updateFullVBO();
974 
975 
976 private:
977  // fully expanded mesh vbo (not indexed)
978  // this is only used for drawmodes with incompatible combinations of interpolation modes (ex. smooth gouraud lighting with flat face colors)
979  GeometryBuffer vboFull_;
980 
981  // full vbo has been invalidated
982  bool updateFullVBO_;
983 
984 
985 
986 
987 public:
988  //========================================================================
989  // per edge buffers
990 
996  void invalidatePerEdgeBuffers() {updatePerEdgeBuffers_ = 1;}
997 
1002  void updatePerEdgeBuffers();
1003 
1008  ACG::Vec3f* perEdgeVertexBuffer();
1009 
1014  ACG::Vec4f* perEdgeColorBuffer();
1015 
1021  void invalidatePerHalfedgeBuffers() {updatePerHalfedgeBuffers_ = 1;}
1022 
1027  template<typename Mesh::Normal (DrawMeshT::*NormalLookup)(typename Mesh::FaceHandle)>
1028  void updatePerHalfedgeBuffers();
1029 
1034  ACG::Vec3f* perHalfedgeVertexBuffer();
1035 
1040  ACG::Vec4f* perHalfedgeColorBuffer();
1041 
1042 
1045  void updateEdgeHalfedgeVertexDeclarations();
1046 
1047 
1050  const VertexDeclaration* getEdgeColoredVertexDeclaration() const {return vertexDeclEdgeCol_;}
1051 
1054  const VertexDeclaration* getHalfedgeVertexDeclaration() const {return vertexDeclHalfedgePos_;}
1055 
1058  const VertexDeclaration* getHalfedgeColoredVertexDeclaration() const {return vertexDeclHalfedgeCol_;}
1059 
1060 
1061 private:
1062  int updatePerEdgeBuffers_;
1063  std::vector<ACG::Vec3f> perEdgeVertexBuf_;
1064  std::vector<ACG::Vec4f> perEdgeColorBuf_;
1065 
1066  int updatePerHalfedgeBuffers_;
1067  std::vector<ACG::Vec3f> perHalfedgeVertexBuf_;
1068  std::vector<ACG::Vec4f> perHalfedgeColorBuf_;
1069 
1077  template<typename Mesh::Normal (DrawMeshT::*NormalLookup)(typename Mesh::FaceHandle)>
1078  typename Mesh::Point halfedge_point(const typename Mesh::HalfedgeHandle _heh);
1079 
1080  inline
1081  typename Mesh::Normal cachedNormalLookup(typename Mesh::FaceHandle fh) {
1082  return mesh_.normal(fh);
1083  }
1084 
1085  inline
1086  typename Mesh::Normal computedTriMeshNormal(typename Mesh::FaceHandle fh) {
1087  typename Mesh::FVIter fv_iter = mesh_.fv_begin(fh);
1088  const typename Mesh::Point p1 = mesh_.point(*fv_iter);
1089  const typename Mesh::Point p2 = mesh_.point(*(++fv_iter));
1090  const typename Mesh::Point p3 = mesh_.point(*(++fv_iter));
1091  return ( p1 + p2 + p3 ) / 3.0;
1092  }
1093 
1094  inline
1095  typename Mesh::Normal computedNormal(typename Mesh::FaceHandle fh) {
1096  unsigned int count = 0;
1097  typename Mesh::Normal normal(0, 0, 0);
1098  for (typename Mesh::FVIter fv_it = mesh_.fv_begin(fh), fv_end = mesh_.fv_end(fh); fv_it != fv_end; ++fv_it) {
1099  normal += mesh_.point(*fv_it);
1100  ++count;
1101  }
1102  normal /= count;
1103  return normal;
1104  }
1105 
1106  typename Mesh::HalfedgeHandle mapToHalfedgeHandle(int _vertexId);
1107 
1108 };
1109 
1110 
1111 //=============================================================================
1112 } // namespace ACG
1113 //=============================================================================
1114 #if defined(INCLUDE_TEMPLATES) && !defined(ACG_DRAW_MESH_TCC)
1115 #define ACG_DRAW_MESH_TEMPLATES
1116 #include "DrawMeshT.cc"
1117 #endif
1118 //=============================================================================
1119 #endif // ACG_DRAW_MESH_HH defined
1120 //=============================================================================
Mesh & mesh_
OpenMesh object to be rendered.
Definition: DrawMesh.hh:823
VertexElement destType_
property type as stored in vbo
Definition: DrawMesh.hh:889
std::string textureIndexPropertyName_
Property for the per face texture index.
Definition: DrawMesh.hh:918
ACG::Vec4uc * pickVertexColorBuffer()
get a pointer to the per vertex picking color buffer
Definition: DrawMesh.hh:445
std::vector< char > vertices_
Definition: DrawMesh.hh:142
int getNumSubsets() const
Get the number of subsets.
std::vector< ACG::Vec3f > pickVertBuf_
The vertex buffer used for vertex picking.
Definition: DrawMesh.hh:507
ACG::Vec4uc * pickAnyEdgeColorBuffer()
get a pointer to the any picking color buffer
Definition: DrawMesh.hh:706
int declElementID_
element id in vertex declaration
Definition: DrawMesh.hh:895
Description of one vertex element.
void invalidatePerHalfedgeBuffers()
Update of the buffers.
Definition: DrawMesh.hh:1021
ACG::Vec4uc * pickAnyVertexColorBuffer()
get a pointer to the any picking color buffer
Definition: DrawMesh.hh:723
std::string name_
property name in openmesh
Definition: DrawMesh.hh:880
int colorMode_
Color Mode: 0: none, 1: per vertex, else: per face.
Definition: DrawMesh.hh:838
const VertexDeclaration * getHalfedgeColoredVertexDeclaration() const
getter for vertex declarations
Definition: DrawMesh.hh:1058
Class to define the vertex input layout.
std::string vertexShaderInputName_
input name id in vertex shader
Definition: DrawMesh.hh:883
void updateGeometry()
request an update for the mesh vertices
Definition: DrawMesh.hh:285
GLuint lineIBO_
index buffer used in Wireframe / Hiddenline mode
Definition: DrawMesh.hh:134
VertexDeclaration * vertexDeclHalfedgePos_
vertex buffer layout declaration with halfedge positions only
Definition: DrawMesh.hh:154
GLSL::Program * pickFaceShader_
optimized face picking shader
Definition: DrawMesh.hh:669
void updateTextures()
request an update for the textures
Definition: DrawMesh.hh:289
void updateTopology()
request an update for the mesh topology
Definition: DrawMesh.hh:281
unsigned int rebuild_
hint on what to rebuild
Definition: DrawMesh.hh:829
ACG::Vec4uc * pickAnyFaceColorBuffer()
get a pointer to the any picking color buffer
Definition: DrawMesh.hh:689
VertexElement sourceType_
property type as stored in openmesh
Definition: DrawMesh.hh:886
std::string perFaceTextureCoordinatePropertyName_
Property for the per face texture coordinates.
Definition: DrawMesh.hh:925
Kernel::Normal Normal
Normal type.
Definition: PolyMeshT.hh:117
std::vector< ACG::Vec4uc > pickVertColBuf_
The color buffer used for vertex picking.
Definition: DrawMesh.hh:509
const size_t offsetPos_
fixed vertex elements:
Definition: DrawMesh.hh:899
const VertexDeclaration * getEdgeColoredVertexDeclaration() const
getter for vertex declarations
Definition: DrawMesh.hh:1050
const VertexDeclaration * getHalfedgeVertexDeclaration() const
getter for vertex declarations
Definition: DrawMesh.hh:1054
void updateFull()
request a full rebuild of the mesh
Definition: DrawMesh.hh:294
ACG::Vec3f * pickVertexBuffer()
get a pointer to the per vertex picking vertex buffer
Definition: DrawMesh.hh:462
GLenum getIndexType() const
get index type of index buffer
Definition: DrawMesh.hh:118
unsigned int * indices_
final index buffer used for rendering
Definition: DrawMesh.hh:826
GLuint pickVertexIBO_opt()
get an index buffer mapping from openmesh vertices to drawmesh vbo vertices
Definition: DrawMesh.hh:124
int textureMode_
per vertex / halfedge texture mode toggle: 0: per vertex, 1: per halfedge
Definition: DrawMesh.hh:850
Kernel::VertexHandle VertexHandle
Handle for referencing the corresponding item.
Definition: PolyMeshT.hh:139
MeshCompiler * getMeshCompiler()
get mesh compiler used to create the draw mesh
Definition: DrawMesh.hh:113
Namespace providing different geometric functions concerning angles.
Definition: DBSCANT.cc:51
int bVBOinFlatMode_
normals in VBO currently in flat / smooth mode
Definition: DrawMesh.hh:847
ACG::Vec3f * pickFaceVertexBuffer()
get a pointer to the per vertex picking color buffer
Definition: DrawMesh.hh:617
void invalidatePerEdgeBuffers()
Update of the buffers.
Definition: DrawMesh.hh:996
GLuint pickVertexIBO_
map from openmesh vertex to vbo vertex id
Definition: DrawMesh.hh:157
size_t prevNumFaces_
Definition: DrawMesh.hh:834
GLenum indexType_
support for 2 and 4 byte unsigned integers
Definition: DrawMesh.hh:137
int flatMode_
flat / smooth shade mode toggle
Definition: DrawMesh.hh:844
Mesh Drawing Class.
Definition: DrawMesh.hh:172
unsigned int * invVertexMap_
Definition: DrawMesh.hh:865
const std::string & getTextureIndexPropertyName() const
get the name of the texture index property
Definition: DrawMesh.hh:316
VertexDeclaration * vertexDecl_
vertex buffer layout declaration with per vertex colors
Definition: DrawMesh.hh:145
int bVBOinHalfedgeTexMode_
texcoords in VBO currently in per vertex / halfedge mode toggle
Definition: DrawMesh.hh:853
Kernel::Point Point
Coordinate type.
Definition: PolyMeshT.hh:115
VertexDeclaration * vertexDeclHalfedgeCol_
vertex buffer layout declaration with per halfedge colors
Definition: DrawMesh.hh:151
VertexDeclaration * vertexDeclEdgeCol_
vertex buffer layout declaration with per edge colors
Definition: DrawMesh.hh:148
Interface class between scenegraph and renderer.
const void * propDataPtr_
memory address of property data
Definition: DrawMesh.hh:892
int halfedgeNormalMode_
per vertex / halfedge normals mode toggle: 0: per vertex, 1: per halfedge
Definition: DrawMesh.hh:856
int curVBOColorMode_
Color Mode of vbo.
Definition: DrawMesh.hh:841
std::vector< VertexProperty > additionalElements_
additional optional elements
Definition: DrawMesh.hh:905
GLSL program class.
Definition: GLSLShader.hh:217
ACG::Vec4uc * pickEdgeColorBuffer()
get a pointer to the per edge picking color buffer
Definition: DrawMesh.hh:547
ACG::Vec4uc * pickFaceColorBuffer()
get a pointer to the per face picking color buffer
Definition: DrawMesh.hh:600
int bVBOinHalfedgeNormalMode_
normals in VBO currently in per vertex / halfedge mode toggle
Definition: DrawMesh.hh:859