49 #ifndef OPENMESH_KERNEL_OSG_PROPERTYKERNEL_HH 50 #define OPENMESH_KENREL_OSG_PROPERTYKERNEL_HH 55 #include <OpenMesh/Core/Utils/Property.hh> 56 #include <OpenMesh/Core/Mesh/BaseKernel.hh> 58 #include <OpenMesh/Tools/Kernel_OSG/PropertyT.hh> 63 namespace Kernel_OSG {
72 template <
typename IsTriMesh >
97 template <
typename T >
99 {
return VPropHandleT<T>(_add_vprop(
new typename _t2vp<T>::prop(_n))); }
101 template <
typename T >
103 {
return VPropHandleT<T>(_add_vprop(
new typename _t2vn<T>::prop(_n) )); }
105 template <
typename T >
107 {
return VPropHandleT<T>(_add_vprop(
new typename _t2vc<T>::prop(_n) )); }
109 template <
typename T >
111 {
return VPropHandleT<T>(_add_vprop(
new typename _t2vtc<T>::prop(_n) )); }
116 FPTypesHandle add_fptypes( )
117 {
return FPTypesHandle(_add_fprop(
new GeoPTypes)); }
119 FPLengthsHandle add_fplengths( )
120 {
return FPLengthsHandle(_add_fprop(
new GeoPLengths)); }
122 FIndicesHandle add_findices( FPTypesHandle _pht, FPLengthsHandle _phl )
124 GeoIndices *bp =
new GeoIndices( fptypes(_pht), fplengths(_phl ) );
125 return FIndicesHandle(_add_fprop( bp ) );
130 template <
typename T >
132 {
return static_cast<typename _t2vp<T>::prop&
>( _vprop( _ph ) ); }
134 template <
typename T >
136 {
return static_cast<const typename _t2vp<T>::prop&
>( _vprop( _ph ) ); }
139 template <
typename T >
141 {
return static_cast<typename _t2vn<T>::prop&
>( _vprop( _ph ) ); }
143 template <
typename T >
145 {
return static_cast<const typename _t2vn<T>::prop&
>( _vprop( _ph ) ); }
148 template <
typename T >
150 {
return static_cast<typename _t2vc<T>::prop&
>( _vprop( _ph ) ); }
152 template <
typename T >
154 {
return static_cast<const typename _t2vc<T>::prop&
>( _vprop( _ph ) ); }
157 template <
typename T >
159 {
return static_cast<typename _t2vtc<T>::prop&
>( _vprop( _ph ) ); }
161 template <
typename T >
162 const typename _t2vtc<T>::prop& vtexcoords(
VPropHandleT<T> _ph )
const 163 {
return static_cast<const typename _t2vtc<T>::prop&
>( _vprop( _ph ) ); }
167 GeoPTypes& fptypes( FPTypesHandle _ph )
168 {
return static_cast<GeoPTypes&
>( _fprop(_ph) ); }
170 const GeoPTypes& fptypes( FPTypesHandle _ph )
const 171 {
return static_cast<const GeoPTypes&
>( _fprop(_ph) ); }
174 GeoPLengths& fplengths( FPLengthsHandle _ph )
175 {
return static_cast<GeoPLengths&
>( _fprop(_ph) ); }
177 const GeoPLengths& fplengths( FPLengthsHandle _ph )
const 178 {
return static_cast<const GeoPLengths&
>( _fprop(_ph) ); }
181 GeoIndices& findices( FIndicesHandle _ph )
182 {
return static_cast<GeoIndices&
>( _fprop(_ph) ); }
184 const GeoIndices& findices( FIndicesHandle _ph )
const 185 {
return static_cast<const GeoIndices&
>( _fprop(_ph) ); }
190 template <
typename T>
192 {
return vpositions(_ph)[_vh.
idx()]; }
196 {
return vpositions(_ph)[_vh.
idx()]; }
199 template <
typename T>
201 {
return vnormals(_ph)[_vh.
idx()]; }
205 {
return vnormals(_ph)[_vh.
idx()]; }
208 template <
typename T>
210 {
return vcolors(_ph)[_vh.
idx()]; }
214 {
return vcolors(_ph)[_vh.
idx()]; }
217 template <
typename T>
219 {
return vtexcoords(_ph)[_vh.
idx()]; }
223 {
return vtexcoords(_ph)[_vh.
idx()]; }
228 FPTypesHandle::value_type&
230 {
return fptypes( _ph )[ _fh.
idx()]; }
232 const FPTypesHandle::value_type&
233 fptypes( FPTypesHandle _ph,
FaceHandle _fh )
const 234 {
return fptypes( _ph )[ _fh.
idx()]; }
237 FPLengthsHandle::value_type&
238 fplengths( FPLengthsHandle _ph,
FaceHandle _fh )
239 {
return fplengths( _ph )[ _fh.
idx()]; }
241 const FPLengthsHandle::value_type&
242 fplengths( FPLengthsHandle _ph,
FaceHandle _fh )
const 243 {
return fplengths( _ph )[ _fh.
idx()]; }
246 FIndicesHandle::value_type&
247 findices( FIndicesHandle _ph,
FaceHandle _fh )
248 {
return findices( _ph )[ _fh.
idx()]; }
250 const FIndicesHandle::value_type&
251 findices( FIndicesHandle _ph,
FaceHandle _fh )
const 252 {
return findices( _ph )[ _fh.
idx()]; }
258 std::cout <<
"#V : " << n_vertices() << std::endl;
259 std::cout <<
"#E : " << n_edges() << std::endl;
260 std::cout <<
"#F : " << n_faces() << std::endl;
270 #endif // OPENMESH_KERNEL_OSG_PROPERTYKERNEL_HH defined This class provides low-level property management like adding/removing properties and access to prope...
Definition: BaseKernel.hh:102
Property adaptor for OpenSG GeoProperties.
Definition: PropertyT.hh:92
Handle for a face entity.
Definition: Handles.hh:146
Contains all the mesh ingredients like the polygonal mesh, the triangle mesh, different mesh kernels ...
Definition: MeshItems.hh:64
Handle representing a face property.
Definition: Property.hh:529
int idx() const
Get the underlying index of this handle.
Definition: Handles.hh:74
Handle representing a vertex property.
Definition: Property.hh:487
Handle for a vertex entity.
Definition: Handles.hh:125
Helper class, extending functionaliy of OpenMesh::BaseKernel to OpenSG specific property adaptors...
Definition: PropertyKernel.hh:73
Adaptor for osg::GeoIndicesUI32.
Definition: PropertyT.hh:293