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

Project OpenMesh, ©  Visual Computing Institute, RWTH Aachen. Documentation generated using doxygen .