44 #ifndef OPENMESH_KERNEL_OSG_PROPERTYKERNEL_HH 45 #define OPENMESH_KENREL_OSG_PROPERTYKERNEL_HH 50 #include <OpenMesh/Core/Utils/Property.hh> 51 #include <OpenMesh/Core/Mesh/BaseKernel.hh> 53 #include <OpenMesh/Tools/Kernel_OSG/PropertyT.hh> 58 namespace Kernel_OSG {
67 template <
typename IsTriMesh >
92 template <
typename T >
94 {
return VPropHandleT<T>(_add_vprop(
new typename _t2vp<T>::prop(_n))); }
96 template <
typename T >
98 {
return VPropHandleT<T>(_add_vprop(
new typename _t2vn<T>::prop(_n) )); }
100 template <
typename T >
102 {
return VPropHandleT<T>(_add_vprop(
new typename _t2vc<T>::prop(_n) )); }
104 template <
typename T >
106 {
return VPropHandleT<T>(_add_vprop(
new typename _t2vtc<T>::prop(_n) )); }
111 FPTypesHandle add_fptypes( )
112 {
return FPTypesHandle(_add_fprop(
new GeoPTypes)); }
114 FPLengthsHandle add_fplengths( )
115 {
return FPLengthsHandle(_add_fprop(
new GeoPLengths)); }
117 FIndicesHandle add_findices( FPTypesHandle _pht, FPLengthsHandle _phl )
119 GeoIndices *bp =
new GeoIndices( fptypes(_pht), fplengths(_phl ) );
120 return FIndicesHandle(_add_fprop( bp ) );
125 template <
typename T >
127 {
return static_cast<typename _t2vp<T>::prop&
>( _vprop( _ph ) ); }
129 template <
typename T >
131 {
return static_cast<const typename _t2vp<T>::prop&
>( _vprop( _ph ) ); }
134 template <
typename T >
136 {
return static_cast<typename _t2vn<T>::prop&
>( _vprop( _ph ) ); }
138 template <
typename T >
140 {
return static_cast<const typename _t2vn<T>::prop&
>( _vprop( _ph ) ); }
143 template <
typename T >
145 {
return static_cast<typename _t2vc<T>::prop&
>( _vprop( _ph ) ); }
147 template <
typename T >
149 {
return static_cast<const typename _t2vc<T>::prop&
>( _vprop( _ph ) ); }
152 template <
typename T >
154 {
return static_cast<typename _t2vtc<T>::prop&
>( _vprop( _ph ) ); }
156 template <
typename T >
157 const typename _t2vtc<T>::prop& vtexcoords(
VPropHandleT<T> _ph )
const 158 {
return static_cast<const typename _t2vtc<T>::prop&
>( _vprop( _ph ) ); }
162 GeoPTypes& fptypes( FPTypesHandle _ph )
163 {
return static_cast<GeoPTypes&
>( _fprop(_ph) ); }
165 const GeoPTypes& fptypes( FPTypesHandle _ph )
const 166 {
return static_cast<const GeoPTypes&
>( _fprop(_ph) ); }
169 GeoPLengths& fplengths( FPLengthsHandle _ph )
170 {
return static_cast<GeoPLengths&
>( _fprop(_ph) ); }
172 const GeoPLengths& fplengths( FPLengthsHandle _ph )
const 173 {
return static_cast<const GeoPLengths&
>( _fprop(_ph) ); }
176 GeoIndices& findices( FIndicesHandle _ph )
177 {
return static_cast<GeoIndices&
>( _fprop(_ph) ); }
179 const GeoIndices& findices( FIndicesHandle _ph )
const 180 {
return static_cast<const GeoIndices&
>( _fprop(_ph) ); }
185 template <
typename T>
187 {
return vpositions(_ph)[_vh.
idx()]; }
191 {
return vpositions(_ph)[_vh.
idx()]; }
194 template <
typename T>
196 {
return vnormals(_ph)[_vh.
idx()]; }
200 {
return vnormals(_ph)[_vh.
idx()]; }
203 template <
typename T>
205 {
return vcolors(_ph)[_vh.
idx()]; }
209 {
return vcolors(_ph)[_vh.
idx()]; }
212 template <
typename T>
214 {
return vtexcoords(_ph)[_vh.
idx()]; }
218 {
return vtexcoords(_ph)[_vh.
idx()]; }
223 FPTypesHandle::value_type&
225 {
return fptypes( _ph )[ _fh.
idx()]; }
227 const FPTypesHandle::value_type&
228 fptypes( FPTypesHandle _ph,
FaceHandle _fh )
const 229 {
return fptypes( _ph )[ _fh.
idx()]; }
232 FPLengthsHandle::value_type&
233 fplengths( FPLengthsHandle _ph,
FaceHandle _fh )
234 {
return fplengths( _ph )[ _fh.
idx()]; }
236 const FPLengthsHandle::value_type&
237 fplengths( FPLengthsHandle _ph,
FaceHandle _fh )
const 238 {
return fplengths( _ph )[ _fh.
idx()]; }
241 FIndicesHandle::value_type&
242 findices( FIndicesHandle _ph,
FaceHandle _fh )
243 {
return findices( _ph )[ _fh.
idx()]; }
245 const FIndicesHandle::value_type&
246 findices( FIndicesHandle _ph,
FaceHandle _fh )
const 247 {
return findices( _ph )[ _fh.
idx()]; }
253 std::cout <<
"#V : " << n_vertices() << std::endl;
254 std::cout <<
"#E : " << n_edges() << std::endl;
255 std::cout <<
"#F : " << n_faces() << std::endl;
265 #endif // OPENMESH_KERNEL_OSG_PROPERTYKERNEL_HH defined Handle for a face entity.
int idx() const
Get the underlying index of this handle.
Handle for a vertex entity.
Adaptor for osg::GeoIndicesUI32.