Developer Documentation
AttribKernelT.hh
1 /* ========================================================================= *
2  * *
3  * OpenMesh *
4  * Copyright (c) 2001-2015, RWTH-Aachen University *
5  * Department of Computer Graphics and Multimedia *
6  * All rights reserved. *
7  * www.openmesh.org *
8  * *
9  *---------------------------------------------------------------------------*
10  * This file is part of OpenMesh. *
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 #ifndef OPENMESH_ATTRIBKERNEL_HH
45 #define OPENMESH_ATTRIBKERNEL_HH
46 
47 
48 //== INCLUDES =================================================================
49 
51 #include <OpenMesh/Core/Utils/GenProg.hh>
52 #include <OpenMesh/Core/Utils/vector_traits.hh>
53 #include <vector>
54 #include <algorithm>
55 
56 //== NAMESPACES ===============================================================
57 
58 namespace OpenMesh {
59 
60 
61 //== CLASS DEFINITION =========================================================
62 
71 template <class MeshItems, class Connectivity>
72 class AttribKernelT : public Connectivity
73 {
74 public:
75 
76  //---------------------------------------------------------------- item types
77 
78  typedef MeshItems MeshItemsT;
79  typedef Connectivity ConnectivityT;
80  typedef typename Connectivity::Vertex Vertex;
81  typedef typename Connectivity::Halfedge Halfedge;
82  typedef typename Connectivity::Edge Edge;
83  typedef typename Connectivity::Face Face;
84 
85  typedef typename MeshItems::Point Point;
86  typedef typename MeshItems::Normal Normal;
87  typedef typename MeshItems::Color Color;
88  typedef typename MeshItems::TexCoord1D TexCoord1D;
89  typedef typename MeshItems::TexCoord2D TexCoord2D;
90  typedef typename MeshItems::TexCoord3D TexCoord3D;
91  typedef typename MeshItems::Scalar Scalar;
92  typedef typename MeshItems::TextureIndex TextureIndex;
93 
94  typedef typename MeshItems::VertexData VertexData;
95  typedef typename MeshItems::HalfedgeData HalfedgeData;
96  typedef typename MeshItems::EdgeData EdgeData;
97  typedef typename MeshItems::FaceData FaceData;
98 
100 
101  enum Attribs {
102  VAttribs = MeshItems::VAttribs,
103  HAttribs = MeshItems::HAttribs,
104  EAttribs = MeshItems::EAttribs,
105  FAttribs = MeshItems::FAttribs
106  };
107 
112 
113 public:
114 
115  //-------------------------------------------------- constructor / destructor
116 
117  AttribKernelT()
118  : refcount_vnormals_(0),
119  refcount_vcolors_(0),
120  refcount_vtexcoords1D_(0),
121  refcount_vtexcoords2D_(0),
122  refcount_vtexcoords3D_(0),
123  refcount_htexcoords1D_(0),
124  refcount_htexcoords2D_(0),
125  refcount_htexcoords3D_(0),
126  refcount_henormals_(0),
127  refcount_hecolors_(0),
128  refcount_ecolors_(0),
129  refcount_fnormals_(0),
130  refcount_fcolors_(0),
131  refcount_ftextureIndex_(0)
132  {
133  this->add_property( points_, "v:points" );
134 
135  if (VAttribs & Attributes::Normal)
136  request_vertex_normals();
137 
138  if (VAttribs & Attributes::Color)
139  request_vertex_colors();
140 
141  if (VAttribs & Attributes::TexCoord1D)
142  request_vertex_texcoords1D();
143 
144  if (VAttribs & Attributes::TexCoord2D)
145  request_vertex_texcoords2D();
146 
147  if (VAttribs & Attributes::TexCoord3D)
148  request_vertex_texcoords3D();
149 
150  if (HAttribs & Attributes::TexCoord1D)
151  request_halfedge_texcoords1D();
152 
153  if (HAttribs & Attributes::TexCoord2D)
154  request_halfedge_texcoords2D();
155 
156  if (HAttribs & Attributes::TexCoord3D)
157  request_halfedge_texcoords3D();
158 
159  if (HAttribs & Attributes::Color)
160  request_halfedge_colors();
161 
162  if (VAttribs & Attributes::Status)
163  Connectivity::request_vertex_status();
164 
165  if (HAttribs & Attributes::Status)
166  Connectivity::request_halfedge_status();
167 
168  if (HAttribs & Attributes::Normal)
169  request_halfedge_normals();
170 
171  if (EAttribs & Attributes::Status)
172  Connectivity::request_edge_status();
173 
174  if (EAttribs & Attributes::Color)
175  request_edge_colors();
176 
177  if (FAttribs & Attributes::Normal)
178  request_face_normals();
179 
180  if (FAttribs & Attributes::Color)
181  request_face_colors();
182 
183  if (FAttribs & Attributes::Status)
184  Connectivity::request_face_status();
185 
186  if (FAttribs & Attributes::TextureIndex)
187  request_face_texture_index();
188 
189  //FIXME: data properties might actually cost storage even
190  //if there are no data traits??
191  this->add_property(data_vpph_);
192  this->add_property(data_fpph_);
193  this->add_property(data_hpph_);
194  this->add_property(data_epph_);
195  }
196 
197  virtual ~AttribKernelT()
198  {
199  // should remove properties, but this will be done in
200  // BaseKernel's destructor anyway...
201  }
202 
210  template <class _AttribKernel>
211  void assign(const _AttribKernel& _other, bool copyStandardProperties = false)
212  {
213  //copy standard properties if necessary
214  if(copyStandardProperties)
215  this->copy_all_kernel_properties(_other);
216 
217  this->assign_connectivity(_other);
218  for (typename Connectivity::VertexIter v_it = Connectivity::vertices_begin();
219  v_it != Connectivity::vertices_end(); ++v_it)
220  {//assumes Point constructor supports cast from _AttribKernel::Point
221  set_point(*v_it, (Point)_other.point(*v_it));
222  }
223 
224  //initialize standard properties if necessary
225  if(copyStandardProperties)
227  }
228 
229  //-------------------------------------------------------------------- points
230 
231  const Point* points() const
232  { return this->property(points_).data(); }
233 
234  const Point& point(VertexHandle _vh) const
235  { return this->property(points_, _vh); }
236 
237  Point& point(VertexHandle _vh)
238  { return this->property(points_, _vh); }
239 
240  void set_point(VertexHandle _vh, const Point& _p)
241  { this->property(points_, _vh) = _p; }
242 
243 
244  //------------------------------------------------------------ vertex normals
245 
246  const Normal* vertex_normals() const
247  { return this->property(vertex_normals_).data(); }
248 
249  const Normal& normal(VertexHandle _vh) const
250  { return this->property(vertex_normals_, _vh); }
251 
252  void set_normal(VertexHandle _vh, const Normal& _n)
253  { this->property(vertex_normals_, _vh) = _n; }
254 
255 
256  //------------------------------------------------------------- vertex colors
257 
258  const Color* vertex_colors() const
259  { return this->property(vertex_colors_).data(); }
260 
261  const Color& color(VertexHandle _vh) const
262  { return this->property(vertex_colors_, _vh); }
263 
264  void set_color(VertexHandle _vh, const Color& _c)
265  { this->property(vertex_colors_, _vh) = _c; }
266 
267 
268  //------------------------------------------------------- vertex 1D texcoords
269 
270  const TexCoord1D* texcoords1D() const {
271  return this->property(vertex_texcoords1D_).data();
272  }
273 
274  const TexCoord1D& texcoord1D(VertexHandle _vh) const {
275  return this->property(vertex_texcoords1D_, _vh);
276  }
277 
278  void set_texcoord1D(VertexHandle _vh, const TexCoord1D& _t) {
279  this->property(vertex_texcoords1D_, _vh) = _t;
280  }
281 
282 
283  //------------------------------------------------------- vertex 2D texcoords
284 
285  const TexCoord2D* texcoords2D() const {
286  return this->property(vertex_texcoords2D_).data();
287  }
288 
289  const TexCoord2D& texcoord2D(VertexHandle _vh) const {
290  return this->property(vertex_texcoords2D_, _vh);
291  }
292 
293  void set_texcoord2D(VertexHandle _vh, const TexCoord2D& _t) {
294  this->property(vertex_texcoords2D_, _vh) = _t;
295  }
296 
297 
298  //------------------------------------------------------- vertex 3D texcoords
299 
300  const TexCoord3D* texcoords3D() const {
301  return this->property(vertex_texcoords3D_).data();
302  }
303 
304  const TexCoord3D& texcoord3D(VertexHandle _vh) const {
305  return this->property(vertex_texcoords3D_, _vh);
306  }
307 
308  void set_texcoord3D(VertexHandle _vh, const TexCoord3D& _t) {
309  this->property(vertex_texcoords3D_, _vh) = _t;
310  }
311 
312  //.------------------------------------------------------ halfedge 1D texcoords
313 
314  const TexCoord1D* htexcoords1D() const {
315  return this->property(halfedge_texcoords1D_).data();
316  }
317 
318  const TexCoord1D& texcoord1D(HalfedgeHandle _heh) const {
319  return this->property(halfedge_texcoords1D_, _heh);
320  }
321 
322  void set_texcoord1D(HalfedgeHandle _heh, const TexCoord1D& _t) {
323  this->property(halfedge_texcoords1D_, _heh) = _t;
324  }
325 
326 
327  //------------------------------------------------------- halfedge 2D texcoords
328 
329  const TexCoord2D* htexcoords2D() const {
330  return this->property(halfedge_texcoords2D_).data();
331  }
332 
333  const TexCoord2D& texcoord2D(HalfedgeHandle _heh) const {
334  return this->property(halfedge_texcoords2D_, _heh);
335  }
336 
337  void set_texcoord2D(HalfedgeHandle _heh, const TexCoord2D& _t) {
338  this->property(halfedge_texcoords2D_, _heh) = _t;
339  }
340 
341 
342  //------------------------------------------------------- halfedge 3D texcoords
343 
344  const TexCoord3D* htexcoords3D() const {
345  return this->property(halfedge_texcoords3D_).data();
346  }
347 
348  const TexCoord3D& texcoord3D(HalfedgeHandle _heh) const {
349  return this->property(halfedge_texcoords3D_, _heh);
350  }
351 
352  void set_texcoord3D(HalfedgeHandle _heh, const TexCoord3D& _t) {
353  this->property(halfedge_texcoords3D_, _heh) = _t;
354  }
355 
356  //------------------------------------------------------------- edge colors
357 
358  const Color* edge_colors() const
359  { return this->property(edge_colors_).data(); }
360 
361  const Color& color(EdgeHandle _eh) const
362  { return this->property(edge_colors_, _eh); }
363 
364  void set_color(EdgeHandle _eh, const Color& _c)
365  { this->property(edge_colors_, _eh) = _c; }
366 
367 
368  //------------------------------------------------------------- halfedge normals
369 
370  const Normal& normal(HalfedgeHandle _heh) const
371  { return this->property(halfedge_normals_, _heh); }
372 
373  void set_normal(HalfedgeHandle _heh, const Normal& _n)
374  { this->property(halfedge_normals_, _heh) = _n; }
375 
376 
377  //------------------------------------------------------------- halfedge colors
378 
379  const Color* halfedge_colors() const
380  { return this->property(halfedge_colors_).data(); }
381 
382  const Color& color(HalfedgeHandle _heh) const
383  { return this->property(halfedge_colors_, _heh); }
384 
385  void set_color(HalfedgeHandle _heh, const Color& _c)
386  { this->property(halfedge_colors_, _heh) = _c; }
387 
388  //-------------------------------------------------------------- face normals
389 
390  const Normal& normal(FaceHandle _fh) const
391  { return this->property(face_normals_, _fh); }
392 
393  void set_normal(FaceHandle _fh, const Normal& _n)
394  { this->property(face_normals_, _fh) = _n; }
395 
396  //-------------------------------------------------------------- per Face Texture index
397 
398  const TextureIndex& texture_index(FaceHandle _fh) const
399  { return this->property(face_texture_index_, _fh); }
400 
401  void set_texture_index(FaceHandle _fh, const TextureIndex& _t)
402  { this->property(face_texture_index_, _fh) = _t; }
403 
404  //--------------------------------------------------------------- face colors
405 
406  const Color& color(FaceHandle _fh) const
407  { return this->property(face_colors_, _fh); }
408 
409  void set_color(FaceHandle _fh, const Color& _c)
410  { this->property(face_colors_, _fh) = _c; }
411 
412  //------------------------------------------------ request / alloc properties
413 
414  void request_vertex_normals()
415  {
416  if (!refcount_vnormals_++)
417  this->add_property( vertex_normals_, "v:normals" );
418  }
419 
420  void request_vertex_colors()
421  {
422  if (!refcount_vcolors_++)
423  this->add_property( vertex_colors_, "v:colors" );
424  }
425 
426  void request_vertex_texcoords1D()
427  {
428  if (!refcount_vtexcoords1D_++)
429  this->add_property( vertex_texcoords1D_, "v:texcoords1D" );
430  }
431 
432  void request_vertex_texcoords2D()
433  {
434  if (!refcount_vtexcoords2D_++)
435  this->add_property( vertex_texcoords2D_, "v:texcoords2D" );
436  }
437 
438  void request_vertex_texcoords3D()
439  {
440  if (!refcount_vtexcoords3D_++)
441  this->add_property( vertex_texcoords3D_, "v:texcoords3D" );
442  }
443 
444  void request_halfedge_texcoords1D()
445  {
446  if (!refcount_htexcoords1D_++)
447  this->add_property( halfedge_texcoords1D_, "h:texcoords1D" );
448  }
449 
450  void request_halfedge_texcoords2D()
451  {
452  if (!refcount_htexcoords2D_++)
453  this->add_property( halfedge_texcoords2D_, "h:texcoords2D" );
454  }
455 
456  void request_halfedge_texcoords3D()
457  {
458  if (!refcount_htexcoords3D_++)
459  this->add_property( halfedge_texcoords3D_, "h:texcoords3D" );
460  }
461 
462  void request_edge_colors()
463  {
464  if (!refcount_ecolors_++)
465  this->add_property( edge_colors_, "e:colors" );
466  }
467 
468  void request_halfedge_normals()
469  {
470  if (!refcount_henormals_++)
471  this->add_property( halfedge_normals_, "h:normals" );
472  }
473 
474  void request_halfedge_colors()
475  {
476  if (!refcount_hecolors_++)
477  this->add_property( halfedge_colors_, "h:colors" );
478  }
479 
480  void request_face_normals()
481  {
482  if (!refcount_fnormals_++)
483  this->add_property( face_normals_, "f:normals" );
484  }
485 
486  void request_face_colors()
487  {
488  if (!refcount_fcolors_++)
489  this->add_property( face_colors_, "f:colors" );
490  }
491 
492  void request_face_texture_index()
493  {
494  if (!refcount_ftextureIndex_++)
495  this->add_property( face_texture_index_, "f:textureindex" );
496  }
497 
498  //------------------------------------------------- release / free properties
499 
500  void release_vertex_normals()
501  {
502  if ((refcount_vnormals_ > 0) && (! --refcount_vnormals_))
503  this->remove_property(vertex_normals_);
504  }
505 
506  void release_vertex_colors()
507  {
508  if ((refcount_vcolors_ > 0) && (! --refcount_vcolors_))
509  this->remove_property(vertex_colors_);
510  }
511 
512  void release_vertex_texcoords1D() {
513  if ((refcount_vtexcoords1D_ > 0) && (! --refcount_vtexcoords1D_))
514  this->remove_property(vertex_texcoords1D_);
515  }
516 
517  void release_vertex_texcoords2D() {
518  if ((refcount_vtexcoords2D_ > 0) && (! --refcount_vtexcoords2D_))
519  this->remove_property(vertex_texcoords2D_);
520  }
521 
522  void release_vertex_texcoords3D() {
523  if ((refcount_vtexcoords3D_ > 0) && (! --refcount_vtexcoords3D_))
524  this->remove_property(vertex_texcoords3D_);
525  }
526 
527  void release_halfedge_texcoords1D() {
528  if ((refcount_htexcoords1D_ > 0) && (! --refcount_htexcoords1D_))
529  this->remove_property(halfedge_texcoords1D_);
530  }
531 
532  void release_halfedge_texcoords2D() {
533  if ((refcount_htexcoords2D_ > 0) && (! --refcount_htexcoords2D_))
534  this->remove_property(halfedge_texcoords2D_);
535  }
536 
537  void release_halfedge_texcoords3D() {
538  if ((refcount_htexcoords3D_ > 0) && (! --refcount_htexcoords3D_))
539  this->remove_property(halfedge_texcoords3D_);
540  }
541 
542  void release_edge_colors()
543  {
544  if ((refcount_ecolors_ > 0) && (! --refcount_ecolors_))
545  this->remove_property(edge_colors_);
546  }
547 
548  void release_halfedge_normals()
549  {
550  if ((refcount_henormals_ > 0) && (! --refcount_henormals_))
551  this->remove_property(halfedge_normals_);
552  }
553 
554  void release_halfedge_colors()
555  {
556  if ((refcount_hecolors_ > 0) && (! --refcount_hecolors_))
557  this->remove_property(halfedge_colors_);
558  }
559 
560  void release_face_normals()
561  {
562  if ((refcount_fnormals_ > 0) && (! --refcount_fnormals_))
563  this->remove_property(face_normals_);
564  }
565 
566  void release_face_colors()
567  {
568  if ((refcount_fcolors_ > 0) && (! --refcount_fcolors_))
569  this->remove_property(face_colors_);
570  }
571 
572  void release_face_texture_index()
573  {
574  if ((refcount_ftextureIndex_ > 0) && (! --refcount_ftextureIndex_))
575  this->remove_property(face_texture_index_);
576  }
577 
578  //---------------------------------------------- dynamic check for properties
579 
580  bool has_vertex_normals() const { return vertex_normals_.is_valid(); }
581  bool has_vertex_colors() const { return vertex_colors_.is_valid(); }
582  bool has_vertex_texcoords1D() const { return vertex_texcoords1D_.is_valid(); }
583  bool has_vertex_texcoords2D() const { return vertex_texcoords2D_.is_valid(); }
584  bool has_vertex_texcoords3D() const { return vertex_texcoords3D_.is_valid(); }
585  bool has_halfedge_texcoords1D() const { return halfedge_texcoords1D_.is_valid();}
586  bool has_halfedge_texcoords2D() const { return halfedge_texcoords2D_.is_valid();}
587  bool has_halfedge_texcoords3D() const { return halfedge_texcoords3D_.is_valid();}
588  bool has_edge_colors() const { return edge_colors_.is_valid(); }
589  bool has_halfedge_normals() const { return halfedge_normals_.is_valid(); }
590  bool has_halfedge_colors() const { return halfedge_colors_.is_valid(); }
591  bool has_face_normals() const { return face_normals_.is_valid(); }
592  bool has_face_colors() const { return face_colors_.is_valid(); }
593  bool has_face_texture_index() const { return face_texture_index_.is_valid(); }
594 
595 public:
596 
612 
613 public:
614  //standard vertex properties
615  PointsPropertyHandle points_pph() const
616  { return points_; }
617 
618  VertexNormalsPropertyHandle vertex_normals_pph() const
619  { return vertex_normals_; }
620 
621  VertexColorsPropertyHandle vertex_colors_pph() const
622  { return vertex_colors_; }
623 
624  VertexTexCoords1DPropertyHandle vertex_texcoords1D_pph() const
625  { return vertex_texcoords1D_; }
626 
627  VertexTexCoords2DPropertyHandle vertex_texcoords2D_pph() const
628  { return vertex_texcoords2D_; }
629 
630  VertexTexCoords3DPropertyHandle vertex_texcoords3D_pph() const
631  { return vertex_texcoords3D_; }
632 
633  //standard halfedge properties
634  HalfedgeTexCoords1DPropertyHandle halfedge_texcoords1D_pph() const
635  { return halfedge_texcoords1D_; }
636 
637  HalfedgeTexCoords2DPropertyHandle halfedge_texcoords2D_pph() const
638  { return halfedge_texcoords2D_; }
639 
640  HalfedgeTexCoords3DPropertyHandle halfedge_texcoords3D_pph() const
641  { return halfedge_texcoords3D_; }
642 
643  // standard edge properties
644  HalfedgeNormalsPropertyHandle halfedge_normals_pph() const
645  { return halfedge_normals_; }
646 
647 
648  // standard edge properties
649  HalfedgeColorsPropertyHandle halfedge_colors_pph() const
650  { return halfedge_colors_; }
651 
652  // standard edge properties
653  EdgeColorsPropertyHandle edge_colors_pph() const
654  { return edge_colors_; }
655 
656  //standard face properties
657  FaceNormalsPropertyHandle face_normals_pph() const
658  { return face_normals_; }
659 
660  FaceColorsPropertyHandle face_colors_pph() const
661  { return face_colors_; }
662 
663  FaceTextureIndexPropertyHandle face_texture_index_pph() const
664  { return face_texture_index_; }
665 
666  VertexData& data(VertexHandle _vh)
667  { return this->property(data_vpph_, _vh); }
668 
669  const VertexData& data(VertexHandle _vh) const
670  { return this->property(data_vpph_, _vh); }
671 
672  FaceData& data(FaceHandle _fh)
673  { return this->property(data_fpph_, _fh); }
674 
675  const FaceData& data(FaceHandle _fh) const
676  { return this->property(data_fpph_, _fh); }
677 
678  EdgeData& data(EdgeHandle _eh)
679  { return this->property(data_epph_, _eh); }
680 
681  const EdgeData& data(EdgeHandle _eh) const
682  { return this->property(data_epph_, _eh); }
683 
684  HalfedgeData& data(HalfedgeHandle _heh)
685  { return this->property(data_hpph_, _heh); }
686 
687  const HalfedgeData& data(HalfedgeHandle _heh) const
688  { return this->property(data_hpph_, _heh); }
689 
690 private:
691  //standard vertex properties
692  PointsPropertyHandle points_;
693  VertexNormalsPropertyHandle vertex_normals_;
694  VertexColorsPropertyHandle vertex_colors_;
695  VertexTexCoords1DPropertyHandle vertex_texcoords1D_;
696  VertexTexCoords2DPropertyHandle vertex_texcoords2D_;
697  VertexTexCoords3DPropertyHandle vertex_texcoords3D_;
698  //standard halfedge properties
699  HalfedgeTexCoords1DPropertyHandle halfedge_texcoords1D_;
700  HalfedgeTexCoords2DPropertyHandle halfedge_texcoords2D_;
701  HalfedgeTexCoords3DPropertyHandle halfedge_texcoords3D_;
702  HalfedgeNormalsPropertyHandle halfedge_normals_;
703  HalfedgeColorsPropertyHandle halfedge_colors_;
704  // standard edge properties
705  EdgeColorsPropertyHandle edge_colors_;
706  //standard face properties
707  FaceNormalsPropertyHandle face_normals_;
708  FaceColorsPropertyHandle face_colors_;
709  FaceTextureIndexPropertyHandle face_texture_index_;
710  //data properties handles
711  DataVPropHandle data_vpph_;
712  DataHPropHandle data_hpph_;
713  DataEPropHandle data_epph_;
714  DataFPropHandle data_fpph_;
715 
716  unsigned int refcount_vnormals_;
717  unsigned int refcount_vcolors_;
718  unsigned int refcount_vtexcoords1D_;
719  unsigned int refcount_vtexcoords2D_;
720  unsigned int refcount_vtexcoords3D_;
721  unsigned int refcount_htexcoords1D_;
722  unsigned int refcount_htexcoords2D_;
723  unsigned int refcount_htexcoords3D_;
724  unsigned int refcount_henormals_;
725  unsigned int refcount_hecolors_;
726  unsigned int refcount_ecolors_;
727  unsigned int refcount_fnormals_;
728  unsigned int refcount_fcolors_;
729  unsigned int refcount_ftextureIndex_;
730 
736  {
737  if(!this->get_property_handle(points_,
738  "v:points"))
739  {
740  //mesh has no points?
741  }
742  refcount_vnormals_ = this->get_property_handle(vertex_normals_,
743  "v:normals") ? 1 : 0 ;
744  refcount_vcolors_ = this->get_property_handle(vertex_colors_,
745  "v:colors") ? 1 : 0 ;
746  refcount_vtexcoords1D_ = this->get_property_handle(vertex_texcoords1D_,
747  "v:texcoords1D") ? 1 : 0 ;
748  refcount_vtexcoords2D_ = this->get_property_handle(vertex_texcoords2D_,
749  "v:texcoords2D") ? 1 : 0 ;
750  refcount_vtexcoords3D_ = this->get_property_handle(vertex_texcoords3D_,
751  "v:texcoords3D") ? 1 : 0 ;
752  refcount_htexcoords1D_ = this->get_property_handle(halfedge_texcoords1D_,
753  "h:texcoords1D") ? 1 : 0 ;
754  refcount_htexcoords2D_ = this->get_property_handle(halfedge_texcoords2D_,
755  "h:texcoords2D") ? 1 : 0 ;
756  refcount_htexcoords3D_ = this->get_property_handle(halfedge_texcoords3D_,
757  "h:texcoords3D") ? 1 : 0 ;
758  refcount_henormals_ = this->get_property_handle(halfedge_normals_,
759  "h:normals") ? 1 : 0 ;
760  refcount_hecolors_ = this->get_property_handle(halfedge_colors_,
761  "h:colors") ? 1 : 0 ;
762  refcount_ecolors_ = this->get_property_handle(edge_colors_,
763  "e:colors") ? 1 : 0 ;
764  refcount_fnormals_ = this->get_property_handle(face_normals_,
765  "f:normals") ? 1 : 0 ;
766  refcount_fcolors_ = this->get_property_handle(face_colors_,
767  "f:colors") ? 1 : 0 ;
768  refcount_ftextureIndex_ = this->get_property_handle(face_texture_index_,
769  "f:textureindex") ? 1 : 0 ;
770  }
771 };
772 
773 //=============================================================================
774 } // namespace OpenMesh
775 //=============================================================================
776 #endif // OPENMESH_ATTRIBKERNEL_HH defined
777 //=============================================================================
Add 1D texture coordinates (vertices, halfedges)
Definition: Attributes.hh:86
Handle for a vertex entity.
Definition: Handles.hh:120
void initializeStandardProperties()
initializeStandardProperties Initializes the standard properties and sets refcount to 1 if found...
Handle for a halfedge entity.
Definition: Handles.hh:127
Add colors to mesh item (vertices/faces/edges)
Definition: Attributes.hh:83
Add 3D texture coordinates (vertices, halfedges)
Definition: Attributes.hh:88
Add texture index (faces)
Definition: Attributes.hh:89
Handle for a face entity.
Definition: Handles.hh:141
void assign(const _AttribKernel &_other, bool copyStandardProperties=false)
Add 2D texture coordinates (vertices, halfedges)
Definition: Attributes.hh:87
Handle for a edge entity.
Definition: Handles.hh:134
Add status to mesh item (all items)
Definition: Attributes.hh:85
bool is_valid() const
The handle is valid iff the index is not negative.
Definition: Handles.hh:72
Add normals to mesh item (vertices/faces)
Definition: Attributes.hh:82