42 #ifndef OPENMESH_KERNEL_OSG_PROPERTYKERNEL_HH
43 #define OPENMESH_KENREL_OSG_PROPERTYKERNEL_HH
48 #include <OpenMesh/Core/Utils/Property.hh>
49 #include <OpenMesh/Core/Mesh/BaseKernel.hh>
51 #include <OpenMesh/Tools/Kernel_OSG/PropertyT.hh>
56 namespace Kernel_OSG {
65 template <
typename IsTriMesh >
90 template <
typename T >
92 {
return VPropHandleT<T>(_add_vprop(
new typename _t2vp<T>::prop(_n))); }
94 template <
typename T >
96 {
return VPropHandleT<T>(_add_vprop(
new typename _t2vn<T>::prop(_n) )); }
98 template <
typename T >
100 {
return VPropHandleT<T>(_add_vprop(
new typename _t2vc<T>::prop(_n) )); }
102 template <
typename T >
104 {
return VPropHandleT<T>(_add_vprop(
new typename _t2vtc<T>::prop(_n) )); }
109 FPTypesHandle add_fptypes( )
110 {
return FPTypesHandle(_add_fprop(
new GeoPTypes)); }
112 FPLengthsHandle add_fplengths( )
113 {
return FPLengthsHandle(_add_fprop(
new GeoPLengths)); }
115 FIndicesHandle add_findices( FPTypesHandle _pht, FPLengthsHandle _phl )
117 GeoIndices *bp =
new GeoIndices( fptypes(_pht), fplengths(_phl ) );
118 return FIndicesHandle(_add_fprop( bp ) );
123 template <
typename T >
125 {
return static_cast<typename _t2vp<T>::prop&
>( _vprop( _ph ) ); }
127 template <
typename T >
129 {
return static_cast<const typename _t2vp<T>::prop&
>( _vprop( _ph ) ); }
132 template <
typename T >
134 {
return static_cast<typename _t2vn<T>::prop&
>( _vprop( _ph ) ); }
136 template <
typename T >
138 {
return static_cast<const typename _t2vn<T>::prop&
>( _vprop( _ph ) ); }
141 template <
typename T >
143 {
return static_cast<typename _t2vc<T>::prop&
>( _vprop( _ph ) ); }
145 template <
typename T >
147 {
return static_cast<const typename _t2vc<T>::prop&
>( _vprop( _ph ) ); }
150 template <
typename T >
152 {
return static_cast<typename _t2vtc<T>::prop&
>( _vprop( _ph ) ); }
154 template <
typename T >
155 const typename _t2vtc<T>::prop& vtexcoords(
VPropHandleT<T> _ph )
const
156 {
return static_cast<const typename _t2vtc<T>::prop&
>( _vprop( _ph ) ); }
160 GeoPTypes& fptypes( FPTypesHandle _ph )
161 {
return static_cast<GeoPTypes&
>( _fprop(_ph) ); }
163 const GeoPTypes& fptypes( FPTypesHandle _ph )
const
164 {
return static_cast<const GeoPTypes&
>( _fprop(_ph) ); }
167 GeoPLengths& fplengths( FPLengthsHandle _ph )
168 {
return static_cast<GeoPLengths&
>( _fprop(_ph) ); }
170 const GeoPLengths& fplengths( FPLengthsHandle _ph )
const
171 {
return static_cast<const GeoPLengths&
>( _fprop(_ph) ); }
174 GeoIndices& findices( FIndicesHandle _ph )
175 {
return static_cast<GeoIndices&
>( _fprop(_ph) ); }
177 const GeoIndices& findices( FIndicesHandle _ph )
const
178 {
return static_cast<const GeoIndices&
>( _fprop(_ph) ); }
183 template <
typename T>
185 {
return vpositions(_ph)[_vh.
idx()]; }
189 {
return vpositions(_ph)[_vh.
idx()]; }
192 template <
typename T>
194 {
return vnormals(_ph)[_vh.
idx()]; }
198 {
return vnormals(_ph)[_vh.
idx()]; }
201 template <
typename T>
203 {
return vcolors(_ph)[_vh.
idx()]; }
207 {
return vcolors(_ph)[_vh.
idx()]; }
210 template <
typename T>
212 {
return vtexcoords(_ph)[_vh.
idx()]; }
216 {
return vtexcoords(_ph)[_vh.
idx()]; }
221 FPTypesHandle::value_type&
223 {
return fptypes( _ph )[ _fh.
idx()]; }
225 const FPTypesHandle::value_type&
226 fptypes( FPTypesHandle _ph,
FaceHandle _fh )
const
227 {
return fptypes( _ph )[ _fh.
idx()]; }
230 FPLengthsHandle::value_type&
231 fplengths( FPLengthsHandle _ph,
FaceHandle _fh )
232 {
return fplengths( _ph )[ _fh.
idx()]; }
234 const FPLengthsHandle::value_type&
235 fplengths( FPLengthsHandle _ph,
FaceHandle _fh )
const
236 {
return fplengths( _ph )[ _fh.
idx()]; }
239 FIndicesHandle::value_type&
240 findices( FIndicesHandle _ph,
FaceHandle _fh )
241 {
return findices( _ph )[ _fh.
idx()]; }
243 const FIndicesHandle::value_type&
244 findices( FIndicesHandle _ph,
FaceHandle _fh )
const
245 {
return findices( _ph )[ _fh.
idx()]; }
251 std::cout <<
"#V : " << n_vertices() << std::endl;
252 std::cout <<
"#E : " << n_edges() << std::endl;
253 std::cout <<
"#F : " << n_faces() << std::endl;
263 #endif // OPENMESH_KERNEL_OSG_PROPERTYKERNEL_HH defined
int idx() const
Get the underlying index of this handle.
Definition: Handles.hh:67
Adaptor for osg::GeoIndicesUI32.
Definition: PropertyT.hh:286
Property adaptor for OpenSG GeoProperties.
Definition: PropertyT.hh:85
Contains all the mesh ingredients like the polygonal mesh, the triangle mesh, different mesh kernels ...
Definition: MeshItems.hh:56
Helper class, extending functionaliy of OpenMesh::BaseKernel to OpenSG specific property adaptors...
Definition: PropertyKernel.hh:66
Handle representing a face property.
Definition: Property.hh:518
Handle for a face entity.
Definition: Handles.hh:135
Handle representing a vertex property.
Definition: Property.hh:476
This class provides the basic property management like adding/removing properties and access to prope...
Definition: BaseKernel.hh:91
Handle for a vertex entity.
Definition: Handles.hh:114