⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 attribkernelt.hh

📁 penMesh is a generic and efficient data structure for representing and manipulating polygonal meshes
💻 HH
📖 第 1 页 / 共 2 页
字号:
  //---------------------------------------- edge status  const StatusInfo& status(HalfedgeHandle _eh) const {    return property(halfedge_status_, _eh);  }  StatusInfo& status(HalfedgeHandle _eh) {    return property(halfedge_status_, _eh);  }  //---------------------------------------- edge status  const StatusInfo& status(EdgeHandle _eh) const {    return property(edge_status_, _eh);  }  StatusInfo& status(EdgeHandle _eh) {    return property(edge_status_, _eh);  }  //---------------------------------------- face status  const StatusInfo& status(FaceHandle _fh) const {    return property(face_status_, _fh);  }  StatusInfo& status(FaceHandle _fh) {    return property(face_status_, _fh);  }  //---------------------------------------- face normals  const Normal& normal(FaceHandle _fh) const {    return property(face_normals_, _fh);  }  void set_normal(FaceHandle _fh, const Normal& _n) {    property(face_normals_, _fh) = _n;  }  //---------------------------------------- face colors  const Color& color(FaceHandle _fh) const {    return property(face_colors_, _fh);  }  void set_color(FaceHandle _fh, const Color& _c) {    property(face_colors_, _fh) = _c;  }  //------------------------------------------------ request / alloc properties  void request_vertex_normals() {    if (!refcount_vnormals_++)        vertex_normals_ = add_vnormals( Normal(), "v:normals" );  }  void request_vertex_colors() {    if (!refcount_vcolors_++)      vertex_colors_ = add_vcolors( Color(), "v:colors" );  }  void request_vertex_texcoords2D() {    if (!refcount_vtexcoords2D_++)      vertex_texcoords2D_ = add_vtexcoords( TexCoord2D(), "v:texcoords" );  }  void request_vertex_status() {    if (!refcount_vstatus_++)      add_property( vertex_status_, "v:status" );  }  void request_halfedge_status() {    if (!refcount_hstatus_++)      add_property( halfedge_status_, "h:status" );  }  void request_edge_status() {    if (!refcount_estatus_++)      add_property( edge_status_, "e:status" );  }  void request_face_normals() {    if (!refcount_fnormals_++)      add_property( face_normals_, "f:normals" );  }  void request_face_colors() {    if (!refcount_fcolors_++)      add_property( face_colors_, "f:colors" );  }  void request_face_status() {    if (!refcount_fstatus_++)      add_property( face_status_, "f:status" );  }  //------------------------------------------------- release / free properties  void release_vertex_normals() {    if ((refcount_vnormals_ > 0) && (! --refcount_vnormals_))      remove_property(vertex_normals_);  }  void release_vertex_colors() {    if ((refcount_vcolors_ > 0) && (! --refcount_vcolors_))      remove_property(vertex_colors_);  }  void release_vertex_texcoords2D() {    if ((refcount_vtexcoords2D_ > 0) && (! --refcount_vtexcoords2D_))      remove_property(vertex_texcoords2D_);  }  void release_vertex_status() {    if ((refcount_vstatus_ > 0) && (! --refcount_vstatus_))      remove_property(vertex_status_);  }  void release_halfedge_status() {    if ((refcount_hstatus_ > 0) && (! --refcount_hstatus_))      remove_property(halfedge_status_);  }  void release_edge_status() {    if ((refcount_estatus_ > 0) && (! --refcount_estatus_))      remove_property(edge_status_);  }  void release_face_normals() {    if ((refcount_fnormals_ > 0) && (! --refcount_fnormals_))      remove_property(face_normals_);  }  void release_face_colors() {    if ((refcount_fcolors_ > 0) && (! --refcount_fcolors_))      remove_property(face_colors_);  }  void release_face_status() {    if ((refcount_fstatus_ > 0) && (! --refcount_fstatus_))      remove_property(face_status_);  }  //----------------------------------------------- static check for properties  typedef   GenProg::Bool2Type<(bool)(VAttribs & Attributes::Normal)>   HasVertexNormals;  typedef   GenProg::Bool2Type<(bool)(VAttribs & Attributes::Color)>   HasVertexColors;  typedef  GenProg::Bool2Type<(bool)(VAttribs & Attributes::TexCoord2D)>   HasVertexTexCoords;  typedef  GenProg::Bool2Type<(bool)(VAttribs & Attributes::Status)>   HasVertexStatus;  typedef  GenProg::Bool2Type<(bool)(HAttribs & Attributes::PrevHalfedge)>   HasPrevHalfedge;  typedef  GenProg::Bool2Type<(bool)(HAttribs & Attributes::Status)>   HasHalfedgeStatus;  typedef  GenProg::Bool2Type<(bool)(EAttribs & Attributes::Status)>   HasEdgeStatus;  typedef   GenProg::Bool2Type<(bool)(FAttribs & Attributes::Normal)>   HasFaceNormals;  typedef   GenProg::Bool2Type<(bool)(FAttribs & Attributes::Color)>   HasFaceColors;  typedef  GenProg::Bool2Type<(bool)(FAttribs & Attributes::Status)>   HasFaceStatus;  //---------------------------------------------- dynamic check for properties  bool has_vertex_normals()   const { return vertex_normals_.is_valid();   }  bool has_vertex_colors()    const { return vertex_colors_.is_valid();    }  bool has_vertex_texcoords2D() const { return vertex_texcoords2D_.is_valid(); }  bool has_vertex_status()    const { return vertex_status_.is_valid();    }  bool has_edge_status()      const { return edge_status_.is_valid();      }  bool has_halfedge_status()  const { return halfedge_status_.is_valid();  }  bool has_face_normals()     const { return face_normals_.is_valid();     }  bool has_face_colors()      const { return face_colors_.is_valid();      }  bool has_face_status()      const { return face_status_.is_valid();      }  static bool has_prev_halfedge() {    return (HAttribs & Attributes::PrevHalfedge);   }public:  osg::GeometryPtr createGeometryPtr()  {    using namespace osg;    GeometryPtr geo=Geometry::create();    return bind(geo) ? geo : NullFC;      }  // create new geometry core from mesh  bool bind( osg::GeometryPtr& _geo )  {    using namespace osg;    int Mask =       Geometry::TypesFieldMask     |      Geometry::LengthsFieldMask   |      Geometry::IndicesFieldMask   |      Geometry::PositionsFieldMask;    if ( has_vertex_colors() )      Mask |= Geometry::ColorsFieldMask;    if ( has_vertex_normals() )      Mask |= Geometry::NormalsFieldMask;    if ( has_vertex_texcoords2D() )      Mask |= Geometry::TexCoordsFieldMask;//     std::clog << "#ptypes   : " << osg_ptypes()->getSize()     << std::endl;//     std::clog << "#plengths : " << osg_plengths()->getSize()   << std::endl;//     std::clog << "#indices  : " << osg_indices()->getSize()    << std::endl;//     std::clog << "#points   : " << osg_vpositions()->getSize() << std::endl;    beginEditCP( _geo, Mask );    {      addRefCP( osg_ptypes() );      _geo->setTypes    ( osg_ptypes() );      addRefCP( osg_plengths() );      _geo->setLengths  ( osg_plengths() );      addRefCP( osg_indices() );      _geo->setIndices  ( osg_indices() );      addRefCP( osg_vpositions() );      _geo->setPositions( osg_vpositions() );      if ( has_vertex_colors() )      {	addRefCP( osg_vcolors() );	_geo->setColors   ( osg_vcolors() );      }      if ( has_vertex_normals() )      {	addRefCP( osg_vnormals() );	_geo->setNormals  ( osg_vnormals() );      }      if ( has_vertex_texcoords2D() )      {	addRefCP( osg_vtexcoords() );	_geo->setTexCoords( osg_vtexcoords() );      }    }    endEditCP  (_geo, Mask);    return true;        }private:    VPropHandleT<Point>         points_;  VPropHandleT<Normal>        vertex_normals_;  VPropHandleT<Color>         vertex_colors_;  VPropHandleT<TexCoord2D>    vertex_texcoords2D_;  VPropHandleT<StatusInfo>    vertex_status_;  FPTypesHandle               face_types_;  FPLengthsHandle             face_lengths_;  FIndicesHandle              face_indices_;  EPropHandleT<StatusInfo>    edge_status_;  HPropHandleT<StatusInfo>    halfedge_status_;  FPropHandleT<Normal>        face_normals_;  FPropHandleT<Color>         face_colors_;  FPropHandleT<StatusInfo>    face_status_;  unsigned int  refcount_vnormals_;  unsigned int  refcount_vcolors_;  unsigned int  refcount_vtexcoords2D_;  unsigned int  refcount_vstatus_;  unsigned int  refcount_estatus_;  unsigned int  refcount_hstatus_;  unsigned int  refcount_fnormals_;  unsigned int  refcount_fcolors_;  unsigned int  refcount_fstatus_;};//=============================================================================} // namespace Kernel_OSG} // namespace OpenMesh//=============================================================================#endif // OPENMESH_KERNEL_OSG_ATTRIBKERNEL_HH defined//=============================================================================

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -