Developer Documentation
DrawMesh.hh
1 #pragma once
2 /*===========================================================================*\
3  * *
4  * OpenFlipper *
5  * Copyright (c) 2001-2015, RWTH-Aachen University *
6  * Department of Computer Graphics and Multimedia *
7  * All rights reserved. *
8  * www.openflipper.org *
9  * *
10  *---------------------------------------------------------------------------*
11  * This file is part of OpenFlipper. *
12  *---------------------------------------------------------------------------*
13  * *
14  * Redistribution and use in source and binary forms, with or without *
15  * modification, are permitted provided that the following conditions *
16  * are met: *
17  * *
18  * 1. Redistributions of source code must retain the above copyright notice, *
19  * this list of conditions and the following disclaimer. *
20  * *
21  * 2. Redistributions in binary form must reproduce the above copyright *
22  * notice, this list of conditions and the following disclaimer in the *
23  * documentation and/or other materials provided with the distribution. *
24  * *
25  * 3. Neither the name of the copyright holder nor the names of its *
26  * contributors may be used to endorse or promote products derived from *
27  * this software without specific prior written permission. *
28  * *
29  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
30  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
31  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
32  * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
33  * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
34  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
35  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
36  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
37  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
38  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
39  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
40  * *
41 \*===========================================================================*/
42 
43 //=============================================================================
44 //
45 // CLASS DrawMeshT
46 //
47 //=============================================================================
48 
49 //== INCLUDES =================================================================
50 
51 #include <vector>
52 #include <list>
53 #include <OpenMesh/Core/Utils/Property.hh>
54 #include <OpenMesh/Core/Utils/color_cast.hh>
55 
56 #include <OpenMesh/Core/Mesh/DefaultTriMesh.hh>
57 #include <OpenMesh/Core/Mesh/DefaultPolyMesh.hh>
58 
59 #include <ACG/GL/globjects.hh>
60 #include <ACG/GL/GLState.hh>
61 #include <ACG/GL/IRenderer.hh>
62 #include <ACG/GL/MeshCompiler.hh>
63 #include <ACG/ShaderUtils/GLSLShader.hh>
64 
65 #include <ACG/Config/ACGDefines.hh>
66 
67 //== FORWARDDECLARATIONS ======================================================
68 
69 
70 //== NAMESPACES ===============================================================
71 
72 namespace ACG {
73 
74 //== CLASS DEFINITION =========================================================
75 
80 class ACGDLLEXPORT DrawMeshBase {
81  protected:
82  DrawMeshBase();
83  ~DrawMeshBase();
84 
85  void deleteIbo();
86  void bindVbo();
87  void bindIbo();
88  void bindLineIbo();
89  void bindHEVbo();
90  void unbindHEVbo();
91  void bindPickVertexIbo();
92 
93  void createIndexBuffer();
94  void fillLineBuffer(size_t n_edges, void *data);
95  void fillHEVBO(size_t numberOfElements_, size_t sizeOfElements_, void* data_);
96  void fillVertexBuffer();
97  void fillInvVertexMap(size_t n_vertices, void *data);
98 
99  public:
100  size_t getNumTris() const { return numTris_; }
101  size_t getNumVerts() const { return numVerts_; }
102 
105  MeshCompiler* getMeshCompiler() {return meshComp_;}
106  unsigned int getNumSubsets() const {return meshComp_->getNumSubsets();}
107 
110  GLenum getIndexType() const {return indexType_;}
111 
116  GLuint pickVertexIBO_opt() {return pickVertexIBO_;} // does not work
117 
118 
119 
120  protected:
121  GLuint vbo_, ibo_;
122  size_t numTris_, numVerts_;
123  MeshCompiler* meshComp_;
124 
126  GLuint lineIBO_;
128  GLuint heVBO_;
129  //previously bound buffer
130  GLint prevVBO_;
131 
133  GLenum indexType_;
134 
138  std::vector<char> vertices_;
139 
142 
145 
148 
151 
154 
157 
158 };
159 
160 
170 template <class Mesh>
171 class DrawMeshT : public DrawMeshBase
172 {
173 private:
174 
175  struct Subset
176  {
177  int materialID;
178  unsigned long startIndex;
179  unsigned long numTris;
180  };
181 
182  enum REBUILD_TYPE {REBUILD_NONE = 0, REBUILD_FULL = 1, REBUILD_GEOMETRY = 2, REBUILD_TOPOLOGY = 4, REBUILD_TEXTURES = 8};
183 
184 
185 public:
186 
187  explicit DrawMeshT(Mesh& _mesh);
188  virtual ~DrawMeshT();
189 
190  void disableColors() {colorMode_ = 0;}
191  void usePerVertexColors() {colorMode_ = 1;}
192  void usePerFaceColors() {colorMode_ = 2;}
193 
194  void setFlatShading() {flatMode_ = 1;}
195  void setSmoothShading() {flatMode_ = 0;}
196 
197  void usePerVertexTexcoords() {textureMode_ = 0;}
198  void usePerHalfedgeTexcoords() {textureMode_ = 1;}
199  void usePerVertexNormals() {halfedgeNormalMode_ = 0;}
200  void usePerHalfedgeNormals() {halfedgeNormalMode_ = 1;}
201 
204  void bindBuffers();
205 
208  GLuint getVBO();
209 
212  GLuint getIBO();
213 
218  GLuint getHEVBO(){return heVBO_;}
219 
222  VertexDeclaration* getVertexDeclaration();
223 
228  unsigned int mapVertexToVBOIndex(unsigned int _v);
229 
230 
233  void bindBuffersToRenderObject(RenderObject* _obj);
234 
237  void unbindBuffers();
238 
244  void draw(std::map< int, GLuint>* _textureMap, bool _nonindexed = false);
245 
254  void addTriRenderObjects(IRenderer* _renderer, const RenderObject* _baseObj, std::map< int, GLuint>* _textureMap, bool _nonindexed = false);
255 
258  void drawLines();
259 
262  void addLineRenderObjects(IRenderer* _renderer, const RenderObject* _baseObj);
263 
264 
267  void drawVertices();
268 
271  void addPointRenderObjects(IRenderer* _renderer, const RenderObject* _baseObj);
272 
273 
274 
278  unsigned int getMemoryUsage(bool _printReport = false);
279 
280  // The updateX functions give a hint on what to update.
281  // may perform a full rebuild internally!
282 
285  void updateTopology() {rebuild_ |= REBUILD_TOPOLOGY;}
286 
289  void updateGeometry() {rebuild_ |= REBUILD_GEOMETRY;}
290 
293  void updateTextures() {rebuild_ |= REBUILD_TEXTURES;}
294 
298  void updateFull() {rebuild_ |= REBUILD_FULL;}
299 
304  unsigned int getNumTextures();
305 
314  void setTextureIndexPropertyName( std::string _indexPropertyName );
315 
320  const std::string& getTextureIndexPropertyName() const { return textureIndexPropertyName_; };
321 
330  void setPerFaceTextureCoordinatePropertyName( std::string _perFaceTextureCoordinatePropertyName );
331 
338  int perFaceTextureCoordinateAvailable();
339 
347  int perFaceTextureIndexAvailable();
348 
349 
350  enum PropertySource
351  {
352  PROPERTY_SOURCE_VERTEX = 0,
353  PROPERTY_SOURCE_HALFEDGE,
354  PROPERTY_SOURCE_FACE,
355  };
356 
362  void addVertexElement( const std::string& _propertyName, PropertySource _source = PROPERTY_SOURCE_VERTEX );
363 
374  bool scanVertexShaderForInput( const std::string& _vertexShaderFile );
375 
376 private:
377  // processing pipeline:
378 
382  void rebuild();
383 
384 
392  void readVertex(size_t _vertex,
393  const typename Mesh::VertexHandle& _vh,
394  const typename Mesh::HalfedgeHandle& _hh,
395  const typename Mesh::FaceHandle& _fh);
396 
401  unsigned int getVertexColor(const typename Mesh::VertexHandle& _vh);
402 
407  unsigned int getFaceColor(const typename Mesh::FaceHandle& _fh);
408 
412  void updateGPUBuffers();
413 
417  void createVBO();
418 
422  void createIBO();
423 
427  void createVertexDeclaration();
428 
429 public:
430  // color picking
431 
439  void updatePickingVertices(ACG::GLState& _state , uint _offset = 0);
440 
450  if ( !pickVertColBuf_.empty() )
451  return &(pickVertColBuf_)[0];
452  else {
453  std::cerr << "Illegal request to pickVertexColorBuffer when buffer is empty!" << std::endl;
454  return 0;
455  }
456  };
457 
467  if ( !pickVertBuf_.empty() )
468  return &(pickVertBuf_)[0];
469  else {
470  std::cerr << "Illegal request to pickVertexBuffer when buffer is empty!" << std::endl;
471  return 0;
472  }
473  };
474 
475 
481  void drawPickingVertices_opt(const GLMatrixf& _mvp, size_t _pickOffset);
482 
483 
487  bool supportsPickingVertices_opt();
488 
493  void updatePickingVertices_opt(ACG::GLState& _state);
494 
495 
496  TextureBuffer* pickVertexMap_opt(){
497  if ( pickVertexMapTBO_.is_valid() )
498  return &pickVertexMapTBO_;
499  else {
500  std::cerr << "Illegal request to pickVertexMap_opt when buffer is empty!" << std::endl;
501  return 0;
502  }
503  }
504 
505 
506 private:
507 
509  std::vector< ACG::Vec3f > pickVertBuf_;
511  std::vector< ACG::Vec4uc > pickVertColBuf_;
512 
513 
514  // map from vbo vertex id to openmesh vertex id
515  TextureBuffer pickVertexMapTBO_;
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, size_t _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, size_t _pickOffset);
632 
633 
637  bool supportsPickingFaces_opt();
638 
643  void updatePickingFaces_opt(ACG::GLState& _state );
644 
645 
646  TextureBuffer* pickFaceTriangleMap_opt(){
647  if ( pickFaceTriToFaceMapTBO_.is_valid() )
648  return &pickFaceTriToFaceMapTBO_;
649  else {
650  std::cerr << "Illegal request to pickFaceTriangleMap_opt when buffer is empty!" << std::endl;
651  return 0;
652  }
653  }
654 
655 private:
656 
657  // unoptimized picking buffers
658  std::vector< ACG::Vec3f > pickFaceVertexBuf_;
659  std::vector< ACG::Vec4uc > pickFaceColBuf_;
660 
661  // optimized picking with shaders: maps from triangle id in draw vbo to face id in openmesh
662  TextureBuffer pickFaceTriToFaceMapTBO_;
663 
666 
667 public:
675  void updatePickingAny(ACG::GLState& _state );
676 
686  if ( !pickAnyFaceColBuf_.empty() )
687  return &(pickAnyFaceColBuf_)[0];
688  else {
689  std::cerr << "Illegal request to pickAnyFaceColorBuffer when buffer is empty!" << std::endl;
690  return 0;
691  }
692  }
693 
703  if ( !pickAnyEdgeColBuf_.empty() )
704  return &(pickAnyEdgeColBuf_)[0];
705  else {
706  std::cerr << "Illegal request to pickAnyEdgeColorBuffer when buffer is empty!" << std::endl;
707  return 0;
708  }
709  }
710 
720  if ( !pickAnyVertexColBuf_.empty() )
721  return &(pickAnyVertexColBuf_)[0];
722  else {
723  std::cerr << "Illegal request to pickAnyVertexColorBuffer when buffer is empty!" << std::endl;
724  return 0;
725  }
726  }
727 
733  void drawPickingAny_opt(const GLMatrixf& _mvp, size_t _pickOffset);
734 
738  bool supportsPickingAny_opt();
739 
744  void updatePickingAny_opt(ACG::GLState& _state );
745 
746 private:
747 
748  std::vector< ACG::Vec4uc > pickAnyFaceColBuf_;
749  std::vector< ACG::Vec4uc > pickAnyEdgeColBuf_;
750  std::vector< ACG::Vec4uc > pickAnyVertexColBuf_;
751 
752 
753 private:
754 
755  // small helper functions
756 
767  unsigned int countTris(unsigned int* _pOutMaxPolyVerts = 0, unsigned int* _pOutNumIndices = 0);
768 
776  int getTextureIDofTri(unsigned int _tri);
777 
783  int getTextureIDofFace(unsigned int _face);
784 
793  const void* getMeshPropertyType(OpenMesh::BaseProperty* _prop, GLuint* _outType, unsigned int* _outSize) const;
794 
804  template<class T>
805  const void* testMeshPropertyTypeT(const OpenMesh::BaseProperty* _prop, unsigned int* _outSize) const;
806 
807 
808 public:
809 
814  void dumpObj(const char* _filename) const;
815 
816 private:
817 
820 
822  unsigned int* indices_;
823 
825  unsigned int rebuild_;
826 
830  size_t prevNumFaces_,prevNumVerts_;
831 
832 
835 
838 
841 
844 
847 
850 
853 
856 
857 
861  unsigned int* invVertexMap_;
862 
863 
864 
865  //========================================================================
866  // flexible vertex layout
867  //========================================================================
868 
869 
871  {
872  // get property from vertex, face or halfedge array
873  PropertySource source_;
874 
876  std::string name_;
877 
880 
883 
886 
888  const void* propDataPtr_;
889 
892  };
893 
895  const size_t offsetPos_,
896  offsetNormal_,
897  offsetTexc_,
898  offsetColor_;
899 
901  std::vector<VertexProperty> additionalElements_;
902 
903  //========================================================================
904  // texture handling
905  //========================================================================
906 
915 
922 
923 
924 private:
925  //========================================================================
926  // write functions for flexible vertex format
927 
928  void writeVertexElement(void* _dstBuf, size_t _vertex, size_t _stride, size_t _elementOffset, size_t _elementSize, const void* _elementData);
929 
930  void writePosition(size_t _vertex, const ACG::Vec3d& _p);
931 
932  void writeNormal(size_t _vertex, const ACG::Vec3d& _n);
933 
934  void writeTexcoord(size_t _vertex, const ACG::Vec2f& _uv);
935 
936  void writeColor(size_t _vertex, unsigned int _color);
937 
938  void writeVertexProperty(size_t _vertex, const VertexElement* _elementDesc, const ACG::Vec4f& _propf);
939 
940  void writeVertexProperty(size_t _vertex, const VertexElement* _elementDesc, const ACG::Vec4d& _propd);
941 
942 
948  void readVertexFromVBO(unsigned int _vertex, void* _dst);
949 
950 
951 public:
952 
953  //===========================================================================
954  // fully expanded vbo
955  //===========================================================================
956 
957 
962  void invalidateFullVBO();
963 
969  void updateFullVBO();
970 
971 
972 private:
973  // fully expanded mesh vbo (not indexed)
974  // this is only used for drawmodes with incompatible combinations of interpolation modes (ex. smooth gouraud lighting with flat face colors)
975  GeometryBuffer vboFull_;
976 
977  // full vbo has been invalidated
978  bool updateFullVBO_;
979 
980  // (colored) edges
981  GeometryBuffer vboEdges_;
982 
983 public:
984  //========================================================================
985  // per edge buffers
986 
992  void invalidatePerEdgeBuffers() {updatePerEdgeBuffers_ = 1;}
993 
999  void updatePerEdgeBuffers();
1000 
1003  void updatePerEdgeBuffersNew();
1004 
1009  ACG::Vec3f* perEdgeVertexBuffer();
1010 
1015  ACG::Vec4f* perEdgeColorBuffer();
1016 
1022  void invalidatePerHalfedgeBuffers() {updatePerHalfedgeBuffers_ = 1;}
1023 
1028  template<typename Mesh::Normal (DrawMeshT::*NormalLookup)(typename Mesh::FaceHandle)>
1029  void updatePerHalfedgeBuffers();
1030 
1035  ACG::Vec3f* perHalfedgeVertexBuffer();
1036 
1041  ACG::Vec4f* perHalfedgeColorBuffer();
1042 
1043 
1046  void updateEdgeHalfedgeVertexDeclarations();
1047 
1048 
1051  const VertexDeclaration* getEdgeColoredVertexDeclaration() const {return vertexDeclEdgeCol_;}
1052 
1055  const VertexDeclaration* getHalfedgeVertexDeclaration() const {return vertexDeclHalfedgePos_;}
1056 
1059  const VertexDeclaration* getHalfedgeColoredVertexDeclaration() const {return vertexDeclHalfedgeCol_;}
1060 
1061 
1062 private:
1063  int updatePerEdgeBuffers_;
1064  std::vector<ACG::Vec3f> perEdgeVertexBuf_;
1065  std::vector<ACG::Vec4f> perEdgeColorBuf_;
1066 
1067  std::vector<float> perEdgeBuf_; // vertex vec3f + color vec4f
1068 
1069  int updatePerHalfedgeBuffers_;
1070  std::vector<ACG::Vec3f> perHalfedgeVertexBuf_;
1071  std::vector<ACG::Vec4f> perHalfedgeColorBuf_;
1072 
1080  template<typename Mesh::Normal (DrawMeshT::*NormalLookup)(typename Mesh::FaceHandle)>
1081  typename Mesh::Point halfedge_point(const typename Mesh::HalfedgeHandle _heh);
1082 
1083  inline
1084  typename Mesh::Normal cachedNormalLookup(typename Mesh::FaceHandle fh) {
1085  return mesh_.normal(fh);
1086  }
1087 
1088  inline
1089  typename Mesh::Normal computedTriMeshNormal(typename Mesh::FaceHandle fh) {
1090  typename Mesh::FVIter fv_iter = mesh_.fv_begin(fh);
1091  const typename Mesh::Point p1 = mesh_.point(*fv_iter);
1092  const typename Mesh::Point p2 = mesh_.point(*(++fv_iter));
1093  const typename Mesh::Point p3 = mesh_.point(*(++fv_iter));
1094  return ( p1 + p2 + p3 ) / 3.0;
1095  }
1096 
1097  inline
1098  typename Mesh::Normal computedNormal(typename Mesh::FaceHandle fh) {
1099  unsigned int count = 0;
1100  typename Mesh::Normal normal(0, 0, 0);
1101  for (typename Mesh::FVIter fv_it = mesh_.fv_begin(fh), fv_end = mesh_.fv_end(fh); fv_it != fv_end; ++fv_it) {
1102  normal += mesh_.point(*fv_it);
1103  ++count;
1104  }
1105  normal /= count;
1106  return normal;
1107  }
1108 
1109  typename Mesh::HalfedgeHandle mapToHalfedgeHandle(size_t _vertexId);
1110 
1111 };
1112 
1113 
1114 // defined in DrawMeshT_impl.cc:
1115 extern template class DrawMeshT<::OpenMesh::TriMesh>;
1116 extern template class DrawMeshT<::OpenMesh::PolyMesh>;
1117 
1118 } // namespace ACG
const VertexDeclaration * getHalfedgeColoredVertexDeclaration() const
getter for vertex declarations
Definition: DrawMesh.hh:1059
GLuint pickVertexIBO_opt()
get an index buffer mapping from openmesh vertices to drawmesh vbo vertices
Definition: DrawMesh.hh:116
unsigned int * invVertexMap_
Definition: DrawMesh.hh:861
Kernel::Normal Normal
Normal type.
Definition: PolyMeshT.hh:114
std::vector< ACG::Vec3f > pickVertBuf_
The vertex buffer used for vertex picking.
Definition: DrawMesh.hh:509
GLuint heVBO_
vbo for halfedge rendering, as they are offset
Definition: DrawMesh.hh:128
Namespace providing different geometric functions concerning angles.
void invalidatePerHalfedgeBuffers()
Update of the buffers.
Definition: DrawMesh.hh:1022
ACG::Vec4uc * pickFaceColorBuffer()
get a pointer to the per face picking color buffer
Definition: DrawMesh.hh:600
VertexElement sourceType_
property type as stored in openmesh
Definition: DrawMesh.hh:882
VertexDeclaration * vertexDecl_
vertex buffer layout declaration with per vertex colors
Definition: DrawMesh.hh:141
Kernel::Point Point
Coordinate type.
Definition: PolyMeshT.hh:112
VertexDeclaration * vertexDeclHalfedgeCol_
vertex buffer layout declaration with per halfedge colors
Definition: DrawMesh.hh:150
int colorMode_
Color Mode: 0: none, 1: per vertex, else: per face.
Definition: DrawMesh.hh:834
Class to define the vertex input layout.
std::string name_
property name in openmesh
Definition: DrawMesh.hh:876
GLuint getHEVBO()
getHEVBO get VBO which stores Halfedges with offset
Definition: DrawMesh.hh:218
VertexDeclaration * vertexDeclEdgeCol_
vertex buffer layout declaration with per edge colors, legacy path
Definition: DrawMesh.hh:144
int flatMode_
flat / smooth shade mode toggle
Definition: DrawMesh.hh:840
const std::string & getTextureIndexPropertyName() const
get the name of the texture index property
Definition: DrawMesh.hh:320
Mesh & mesh_
OpenMesh object to be rendered.
Definition: DrawMesh.hh:819
void updateTopology()
request an update for the mesh topology
Definition: DrawMesh.hh:285
int bVBOinFlatMode_
normals in VBO currently in flat / smooth mode
Definition: DrawMesh.hh:843
ACG::Vec4uc * pickAnyVertexColorBuffer()
get a pointer to the any picking color buffer
Definition: DrawMesh.hh:719
int curVBOColorMode_
Color Mode of vbo.
Definition: DrawMesh.hh:837
ACG::Vec3f * pickVertexBuffer()
get a pointer to the per vertex picking vertex buffer
Definition: DrawMesh.hh:466
int bVBOinHalfedgeTexMode_
texcoords in VBO currently in per vertex / halfedge mode toggle
Definition: DrawMesh.hh:849
size_t prevNumFaces_
Definition: DrawMesh.hh:830
const size_t offsetPos_
fixed vertex elements:
Definition: DrawMesh.hh:895
int halfedgeNormalMode_
per vertex / halfedge normals mode toggle: 0: per vertex, 1: per halfedge
Definition: DrawMesh.hh:852
MeshCompiler * getMeshCompiler()
get mesh compiler used to create the draw mesh
Definition: DrawMesh.hh:105
std::vector< VertexProperty > additionalElements_
additional optional elements
Definition: DrawMesh.hh:901
int declElementID_
element id in vertex declaration
Definition: DrawMesh.hh:891
std::vector< char > vertices_
Definition: DrawMesh.hh:138
ACG::Vec4uc * pickAnyFaceColorBuffer()
get a pointer to the any picking color buffer
Definition: DrawMesh.hh:685
void updateFull()
request a full rebuild of the mesh
Definition: DrawMesh.hh:298
std::string textureIndexPropertyName_
Property for the per face texture index.
Definition: DrawMesh.hh:914
VertexDeclaration vertexDeclEdgeNew_
vertex buffer layout declaration with per edge colors
Definition: DrawMesh.hh:147
Description of one vertex element.
GLSL program class.
Definition: GLSLShader.hh:211
VertexElement destType_
property type as stored in vbo
Definition: DrawMesh.hh:885
ACG::Vec3f * pickFaceVertexBuffer()
get a pointer to the per vertex picking color buffer
Definition: DrawMesh.hh:617
int textureMode_
per vertex / halfedge texture mode toggle: 0: per vertex, 1: per halfedge
Definition: DrawMesh.hh:846
GLenum getIndexType() const
get index type of index buffer
Definition: DrawMesh.hh:110
GLuint lineIBO_
index buffer used in Wireframe / Hiddenline mode
Definition: DrawMesh.hh:126
const void * propDataPtr_
memory address of property data
Definition: DrawMesh.hh:888
ACG::Vec4uc * pickAnyEdgeColorBuffer()
get a pointer to the any picking color buffer
Definition: DrawMesh.hh:702
std::vector< ACG::Vec4uc > pickVertColBuf_
The color buffer used for vertex picking.
Definition: DrawMesh.hh:511
unsigned int rebuild_
hint on what to rebuild
Definition: DrawMesh.hh:825
Mesh Drawing Class.
Definition: DrawMesh.hh:171
GLuint pickVertexIBO_
map from openmesh vertex to vbo vertex id
Definition: DrawMesh.hh:156
GLSL::Program * pickFaceShader_
optimized face picking shader
Definition: DrawMesh.hh:665
int getNumSubsets() const
Get the number of subsets.
std::string perFaceTextureCoordinatePropertyName_
Property for the per face texture coordinates.
Definition: DrawMesh.hh:921
const VertexDeclaration * getHalfedgeVertexDeclaration() const
getter for vertex declarations
Definition: DrawMesh.hh:1055
ACG::Vec4uc * pickEdgeColorBuffer()
get a pointer to the per edge picking color buffer
Definition: DrawMesh.hh:547
const VertexDeclaration * getEdgeColoredVertexDeclaration() const
getter for vertex declarations
Definition: DrawMesh.hh:1051
void updateTextures()
request an update for the textures
Definition: DrawMesh.hh:293
std::string vertexShaderInputName_
input name id in vertex shader
Definition: DrawMesh.hh:879
unsigned int * indices_
final index buffer used for rendering
Definition: DrawMesh.hh:822
Interface class between scenegraph and renderer.
Definition: RenderObject.hh:98
int bVBOinHalfedgeNormalMode_
normals in VBO currently in per vertex / halfedge mode toggle
Definition: DrawMesh.hh:855
GLenum indexType_
support for 2 and 4 byte unsigned integers
Definition: DrawMesh.hh:133
void invalidatePerEdgeBuffers()
Update of the buffers.
Definition: DrawMesh.hh:992
Kernel::VertexHandle VertexHandle
Handle for referencing the corresponding item.
Definition: PolyMeshT.hh:136
VertexDeclaration * vertexDeclHalfedgePos_
vertex buffer layout declaration with halfedge positions only
Definition: DrawMesh.hh:153
void updateGeometry()
request an update for the mesh vertices
Definition: DrawMesh.hh:289
ACG::Vec4uc * pickVertexColorBuffer()
get a pointer to the per vertex picking color buffer
Definition: DrawMesh.hh:449