| OpenMesh

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

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