====== XFace ====== **//Inherited from//** [[class::domain::xgeometry|XGeometry]], **//Inherited by//** NULL **//Friend class//** GeometryManager, **//Description//** XFace封装了几何面的数据及其方法,其类型标识名为“CGEOFACE”(以CGEO为前缀)。几何面是由若干边构成的封闭曲面,是划分面网格的对象基础。XFace从XGeometry继承并重新实现了适用于面的方法。 **//Members//** * XBoundBox [[xface#m_dboundbox|m_dBoundBox]] * RGBAColor [[xface#m_bakcolor|m_BakColor]] * XRenderData [[xface#m_renderdata|m_RenderData]] * XItemPtrArray|2>]] * XItemPtrArray [[xface#m_psolidelems|m_pSolidElems]] * vector [[xface#m_psolidfacetid|m_pSolidFacetId]] **//Public interface//** * static void [[xface#enablefinefacetnormal|enableFineFacetNormal]](bool b) * [[xface#xface1|XFace]](ulong id,XMemPool * pHashPool = 0) * [[xface#~xface|~XFace]]() * void [[xface#updateboundbox|updateBoundbox]]() * real [[xface#getarea|getArea]]() const * int [[xface#counttess|countTess]]() const * void [[xface#buildrenderdata_withindex|buildRenderData_WithIndex]](const float * rvalue = NULL, bool bUseSolidElemCode = false) * void [[xface#buildrenderdata_polygon|buildRenderData_Polygon]](bool bUseSolidElemCode = false) * void [[xface#buildrenderdatafvm|buildRenderDataFVM]](bool bUseSolidElemCode = false) * void [[xface#buildrenderdata|buildRenderData]](bool bUseSolidElemCode = false) * void [[xface#updateelemencode|updateElemEncode]](bool bAsSolid = false) * const XRenderData * [[xface#getrenderdata|getRenderData]]() const * void [[xface#updaterenderdata|updateRenderData]](const float * colorValue, int colorLoc, const float * deformX, const float * deformY, const float * deformZ, const int * elemNodeIndex = NULL) * void [[xface#updaterenderdatafvm|updateRenderDataFVM]](const RenderContext * rc) * void [[xface#updatetexdata|updateTexData]](TexElementManager * texMgr) * const XBoundBox & [[xface#getboundbox|getBoundBox]]() const * void [[xface#normalizeboundbox|normalizeBoundBox]](const real * origin, real scale) * void [[xface#restoreboundbox|restoreBoundBox]](const real * origin, real scale) * void [[xface#copyboundbox|copyBoundBox]](const XFace * f) * void [[xface#clear|clear]](ClearFlag f = Clear_All) * const XGeometry * [[xface#getupperentity|getUpperEntity]](int index) const * const XSolid * [[xface#getfirstparentbody|getFirstParentBody]]() const * bool [[xface#isupperentity|isUpperEntity]](const XGeometry * pBody) const * int [[xface#getuppercount|getUpperCount]]() const * void [[xface#addupperentity|addUpperEntity]](const XGeometry * pBody) * void [[xface#removeupperentity|removeUpperEntity]](const XGeometry *pBody) * void [[xface#write|write]](XBinaryIO * io)const * ErrorCode [[xface#read|read]](GeometryManager * esmgr, XBinaryIO * io) * void [[xface#updateafterrenumber|updateAfterRenumber]](TypeID tid) ---- {{anchor:m_dboundbox}} **XBoundBox m_dBoundBox** 几何面的包围盒 {{anchor:m_bakcolor}} **RGBAColor m_BakColor** 几何面的颜色备份,用于修改颜色时保存旧的颜色以方便恢复之前的颜色。 {{anchor:m_renderdata}} **XRenderData m_RenderData** 几何面的视图数据 {{anchor:m_upperlist}} **XItemPtrArray m_UpperList** 几何面的父拓扑对象数组 {{anchor:m_psolidelems}} **vector m_pSolidElems** 面单元所对应的体单元数组 {{anchor:m_psolidfacetid}} **vector m_pSolidFacetId** 面单元在所对应的体单元的面号数组 ---- {{anchor:enablefinefacetnormal}} **static void enableFineFacetNormal(bool b)** *function: 是否以精细模式计算面法向(精细模式下会耗用更多的计算资源) *parameters: - [i]bool b: 是否精细模式 *return value: 无 {{anchor:xface1}} **XFace(ulong id,XMemPool * pHashPool = 0)** *function: 构造函数 *parameters: - [i]ulong id: 对象ID - [i]XMemPool * pHashPool = 0: 内存池 *return value: 无 {{anchor:~xface}} **~XFace()** *function: 析构函数 *parameters: NULL *return value: 无 {{anchor:updateboundbox}} **void updateBoundbox()** *function: 更新几何面的包围盒 *parameters: NULL *return value: 无 {{anchor:getarea}} **double getArea() const** *function: 计算几何面的面积 *parameters: NULL *return value: 几何面的面积 {{anchor:counttess}} **int countTess() const** *function: 获取几何面的三角片个数 *parameters: NULL *return value: 几何面的三角片个数 {{anchor:buildrenderdatafvm}} **void buildRenderDataFVM(bool bUseSolidElemCode = false)** *function: 构建有限体积法下的几何面渲染视图数据 *parameters: - [i]bool bUseSolidElemCode = false: 是否使用体单元编码渲染,在旋转体单元模式下设置为true *return value: 无 {{anchor:buildrenderdata}} **void buildRenderData(bool bUseSolidElemCode = false)** *function: 构建几何面的渲染视图数据 *parameters: - [i]bool bUseSolidElemCode = false: 是否使用体单元编码渲染,在旋转体单元模式下设置为true *return value: 无 {{anchor:updateelemencode}} **void updateElemEncode(bool bAsSolid = false)** *function: 更新视图数据中的单元颜色编码 *parameters: - [i]bool bAsSolid = false: 是否使用体单元编码渲染,在旋转体单元模式下设置为true *return value: 无 {{anchor:getrenderdata}} **const XRenderData * getRenderData() const** *function: 获取几何面的渲染视图数据 *parameters: NULL *return value: 无 {{anchor:updaterenderdata}} **void updateRenderData(const float * colorValue, int colorLoc, const float * deformX, const float * deformY, const float * deformZ, const int * elemNodeIndex = NULL)** *function: 更新几何面的渲染视图数据 *parameters: - [i]const float * colorValue: 渲染数值地址 - [i] int colorLoc: 渲染数值的位置(积分点、单元节点或节点) - [i] const float * deformX: X变形分量数组地址 - [i] const float * deformY: Y变形分量数组地址 - [i] const float * deformZ: Z变形分量数组地址 - [i] const int * elemNodeIndex = NULL: 单元节点数组索引 *return value: 无 {{anchor:updaterenderdatafvm}} **void updateRenderDataFVM(const RenderContext * rc)** *function: 更新几何面的渲染视图数据 *parameters: - [i]const RenderContext * rc: 渲染数据上下文 *return value: 无 {{anchor:updatetexdata}} **void updateTexData(TexElementManager * texMgr)** *function: 更新几何面的渲染纹理数据 *parameters: - [i]TexElementManager * texMgr: 纹理对象管理器 *return value: 无 {{anchor:getboundbox}} **const XBoundBox & getBoundBox() const** *function: 获取几何面的包围盒 *parameters: NULL *return value: 几何面的包围盒 {{anchor:normalizeboundbox}} **void normalizeBoundBox(const real * origin, real scale)** *function: 归一化几何面的包围盒 *parameters: - [i]const real * origin: 归一化基准点 - [i] real scale: 归一化系数 *return value: 无 {{anchor:restoreboundbox}} **void restoreBoundBox(const real * origin, real scale)** *function: 归一化之后恢复几何面的原始包围盒 *parameters: - [i]const real * origin: 归一化基准点 - [i] real scale: 归一化系数 *return value: 无 {{anchor:copyboundbox}} **void copyBoundBox(const XFace * f)** *function: 拷贝几何面对象的包围盒 *parameters: - [i]const XFace * f: 参考几何面对象 *return value: 无 {{anchor:clear}} **void clear(ClearFlag f = Clear_All)** *function: 清空几何面的数据 *parameters: - [i]ClearFlag f = Clear_All: 清空标记 *return value: 无 {{anchor:getupperentity}} **const XGeometry * getUpperEntity(int index) const** *function: 重新实现XGeometry的getUpperEntity方法,获取第index个父拓扑对象 *parameters: - [i]int index: 父拓扑对象序号 *return value: 父拓扑对象 {{anchor:getfirstparentbody}} **const XSolid * getFirstParentBody() const** *function: 获取第一个父拓扑对象 *parameters: NULL *return value: 第一个父拓扑对象 {{anchor:isupperentity}} **bool isUpperEntity(const XGeometry * pBody) const** *function: 判断pBody是否为几何面对象的父拓扑对象 *parameters: - [i]const XGeometry * pBody: 几何拓扑对象 *return value: pBody为几何面对象的父拓扑对象返回true,否则返回false {{anchor:getuppercount}} **int getUpperCount() const** *function: 获取父拓扑对象的个数 *parameters: NULL *return value: 父拓扑对象的个数 {{anchor:addupperentity}} **void addUpperEntity(const XGeometry * pBody)** *function: 添加父拓扑对象 *parameters: - [i]const XGeometry * pBody: 父拓扑对象 *return value: 无 {{anchor:removeupperentity}} **void removeUpperEntity(const XGeometry *pBody)** *function: 删除父拓扑对象 *parameters: - [i]const XGeometry *pBody: 父拓扑对象 *return value: 无 {{anchor:write}} **void write(XBinaryIO * io)const** *function: 将几何面对象写入到二进制文件中 *parameters: - [i]XBinaryIO * io: 二进制文件句柄 *return value: 无 {{anchor:read}} **ErrorCode read(GeometryManager * esmgr, XBinaryIO * io)** *function: 从二进制文件中读取几何对象数据 *parameters: - [i]GeometryManager * esmgr: 几何对象管理器 - [i] XBinaryIO * io: 二进制文件句柄 *return value: 成功读取返回Error_None,否则返回相应错误码 {{anchor:updateafterrenumber}} **void updateAfterRenumber(TypeID tid)** *function: 在对模型对象重编号之后调用,用以更新对重编号对象的引用 *parameters: - [i]TypeID tid: 重编号的对象类型 *return value: 无