Inherited from QOpenGLWidget,XView,
Inherited by NULL
Friend class NULL
Description
XRender类从XView继承,是用于三维视图的渲染和用户交互的视图基类,它支持多种渲染模式和显示状态,交互上它支持多种不同的对象选择和拾取方法,以及视图的操作(如旋转、平移、缩放),还支持云图渲染以及变形渲染,以及基于GLSL着色器语言的高级渲染技术。除此以外它还提供了用于指定裁剪平面和局部视图的方法接口以及定制功能专用数据的预览显示接口,可以根据需要显示多种标记。
为了提高渲染速度,XRender首先在帧缓冲区对象中渲染,然后通过纹理渲染到正常渲染上下文中。
XRender为三维场景提供了较完备的渲染以及交互方法,开发者可以从它继承很方便的定制更多专用三维场景的显示与交互。
Members
Public interface
XRender(MainFrame * pParApp, XDocument * doc)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
void
saveImage(const char * path, bool bOffScreen = true)
-
-
-
-
-
-
-
-
-
void
fitLocal(const real * localBox, bool bResetCenter = false)
void
drawLabel(int x, int y, int w, int h, const char * str)
-
void
drawValueLabel(ValueLabel * vl, bool bDrawLine = true, int width = 120, int height = 28)
void
setValueLabel(const char * str, ValueLabel * vl, RGBAColor c = RGBAColor(108, 0, 108, 64))
-
-
-
-
Protected interface
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
virtual void
setViewAngle(GLViewAngle va, const real *rot_angle = 0)
-
void
drawSolid(const XGeometry * g, bool bEncode, bool bSecond = false)
void
drawPart(const XPart * p, bool bEncode, bool bSecond = false)
void
drawTransform(ulong spID, ShaderVarLocation * contourVarLoc = 0)
-
-
-
-
-
-
-
-
void
drawString(const char *str, const double * loc)
void
drawString(const char *str, float x, float y, float z)
void
drawString(const char * str, int x, int y, bool bNewMatrix = true)
-
-
-
-
-
-
-
-
-
-
void
drawEntity(DrawingBaseEntity * pEnt, void * quadratic = 0)
-
-
void
drawColorIndex(const char * label, float min, float max, int div)
-
-
-
-
-
-
-
void
drawPrimitive(int mode, int count, int type = GL_UNSIGNED_INT, const void *indices = NULL, int rangeStart = -1, int rangeEnd = -1)
-
-
-
-
-
-
-
-
-
-
-
-
void
calcSigntLine(int x, int y, double depth, double * l_pt, double * l_dir)
-
-
-
-
-
-
-
bool
getPickCuboid(int left, int right, int bot, int top, XObBox * box)
-
-
-
-
-
-
-
-
void
drawMarkerText(const char * str, const double * startPos, const char * endPos, TypeID extendAxis, double extendH)
-
-
void
drawAxis(const double * dir, GLUquadricObj * pQuadric, const char * label = 0, double axisLen = 5)
void
drawCross(const double * center, double scale, bool bOblicque = false, RGBAColor c = RGBAColor(0,255,0))
void
drawArrow(const double * dir, GLUquadricObj * pQuadric)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
void
drawModelVFF(const VertexFrameFile * vff, int activeMode = Active_Normal)
void
drawVFF(const VertexFrameFile * vff, int target, int mode = Active_Normal)
-
-
-
-
void
updateVBOSize(TypeID updateFlag = (Update_Face | Update_Edge))
-
-
void
updateRenderDataToVBO(const XRenderData * rd, int mode, ulong color, int contourVAID, const int * deformVAID)
-
-
-
void
drawModelVBO(int activeMode = Active_Normal, int edgeIndexCnt = 0)
-
void
drawRenderData(const XRenderData * rd, int mode = Active_Normal, int contourVAID = 0, const int * deformVAID = NULL)
void
drawVBO(int target, int mode = Active_Normal)
-
-
void
createVBO(XVertexBuffer & bs, int count, int unitSize = sizeof(float), int dim = 1)
-
MainFrame * m_pParApp
框架对象
QPoint m_qLastPos
鼠标操作的最后位置坐标
Vector2i m_PrevPt
鼠标操作的前一个位置坐标
Vector2i m_CurPt
鼠标操作的当前位置坐标
QPoint m_qRubberBandPos
鼠标操作的橡皮筋显示(虚线显示选择框)
real m_fRotAngle[3]
视图旋转角度
real m_dCenter[3]
视图中心
Matrix4d m_dModelViewMatrix
模型视图变换矩阵
Matrix4d m_dProjectMatrix
模型视图投影矩阵
GLdouble m_dViewBox[6]
视图包围盒
GLint m_iWndWidth
视图宽度
GLint m_iWndHeight
视图高度
GLuint m_uiFboId
帧缓冲区对象ID
ulong m_ulCurrentShader
当前着色器ID
ShaderVarLocation m_SVLoc
着色器变量位置结构体
ulong m_ulGLExt
OpenGL扩展标志
ulong m_ulEnable
帧缓冲区对象的激活标志
bool m_bTexReady
纹理是否准备好
bool m_bEncodeReady
对象编码数据是否准备好
bool m_bContextMenuReady
右键菜单是否准备好
ulong m_ulImageTextureID
纹理图片ID号
ulong m_ulOpFlag
交互操作状态标志
ulong m_ulPickEntityId
拾取对象ID
QElapsedTimer * m_pTimer
渲染计时器
ulong m_ulPrevTime
上一个渲染时间点
double m_dScale
渲染空间大小与像素的比例系数
QPolygonF * m_PolygonPickPts
多边形拾取模式下的点坐标数组
unordered_map<ItemPtr, ValueLabel> * m_pTextLabels
文本标签数组
uint8 m_BGTopColor[3]
背景上部颜色
uint8 m_BGBotColor[3]
背景下部颜色
RGBAColor m_TextColor
文本显示颜色
FBObject m_ColorEncodeFbo
对象编码帧缓冲区对象
QOpenGLFramebufferObject * m_pOverlayFbo
Overlay缓冲区对象
XVertexBuffer m_VBO[VBO_MaxType]
顶点缓冲区对象数组
XArray<ulong> g_ulColorEncode
对象编码值(从编码帧缓冲区中读取)
XArray<float> g_fDepth
渲染深度值数组
QTimer * m_pAnimationTimer
动画计时器
ulong m_SceneBeginTime
场景渲染起始时间
static float g_fOffsetFarest
最远深度偏移值
static float g_fOffsetFar
较远深度偏移值
static float g_fOffsetNear
较近深度偏移值
static float g_fOffsetNearest
最近深度偏移值
static ulong g_ulOp[Op_Type_Count]
交互操作标志
OpenGLAPI * m_API
OpenGL函数接口句柄
GifGenerator m_pGif
GIF动画生成器
XRender(MainFrame * pParApp, XDocument * doc)
function: 构造函数
parameters:
[i]MainFrame * pParApp: 框架对象
[i] XDocument * doc: 文档对象
return value: 无
virtual ~XRender()
function: 析构函数
parameters: NULL
return value: 无
virtual void onViewDataUpdated()
void onAnimationFrameUpdated()
virtual void createContextMenu()
function: 创建右键菜单
parameters: NULL
return value: 无
virtual void setOpFlag(OpType op)
function: 设置指定操作的标志
parameters:
[i]OpType op: 操作类型
return value: 操作标志
virtual void refresh()
function: 重新渲染视图
parameters: NULL
return value: 无
virtual void updateShader()
function: 更新着色器
parameters: NULL
return value: 无
virtual void clearShader()
function: 清空着色器
parameters: NULL
return value: 无
MainFrame * getFrame()
function: 获取框架对象
parameters: NULL
return value: 框架对象
virtual void updateViewBox(const real * range)
function: 更新视图框
parameters:
[i]const real * range: 视图框包围盒
return value: 无
void setModelViewMatrix(double *matrix)
function: 设置模型视图变换矩阵
parameters:
[i]double *matrix: 模型视图变换矩阵
return value: 无
void saveVisualAngle(XVisualAngle * va)
function: 设置视角
parameters:
[i]XVisualAngle * va: 视角数据
return value: 无
void loadVisualAngle(const XVisualAngle * va)
function: 载入视角
parameters:
[i]const XVisualAngle * va: 视角数据
return value: 无
void setVisualAngle(const double * viewRange, const double * dir)
function: 设置视角
parameters:
[i]const double * viewRange: 视图区域
[i] const double * dir: 视图方向
return value: 无
void synchronize(XView * refView)
function: 同步视图
parameters:
[i]XView * refView: 参考视图
return value: 无
void saveImage(const char * path, bool bOffScreen = true)
function: 将视图以图像保存到文件中
parameters:
[i]const char * path: 图像文件路径
[i] bool bOffScreen = true: 是否离屏渲染
return value: 无
void updateOverlay()
function: 更新覆盖层
parameters: NULL
return value: 无
void updateColorEncode(bool forced = false)
function: 更新对象编码
parameters:
[i]bool forced = false: 强制更新
return value: 无
int countColoredPixel(const XRenderData * rd)
function: 渲染之后计算被编码的像素数目
parameters:
[i]const XRenderData * rd: 渲染数据对象
return value: 被编码的像素个数
void updateColorSetting()
function: 更新颜色设定
parameters: NULL
return value: 无
virtual void createShader()
function: 虚接口,创建着色器
parameters: NULL
return value: 无
void clearPickPolygon()
function: 清空多边形选择点
parameters: NULL
return value: 无
bool isPolygonAvailable()
float getDepthOnPoint(int x, int y)
function: 获取屏幕给定点的深度值
parameters:
[i]int x: 点X坐标
[i] int y: 点Y坐标
return value: 屏幕给定点的深度值
GLuint loadTexture(const char* file_name)
function: 载入纹理数据
parameters:
[i]const char* file_name: 纹理图片路径
return value: 纹理对象ID
void fitLocal(const real * localBox, bool bResetCenter = false)
void drawLabel(int x, int y, int w, int h, const char * str)
function: 绘制标签
parameters:
[i]int x: 起始点x坐标
[i] int y: 起始点Y坐标
[i] int w: 标签长度
[i] int h: 标签高度
[i] const char * str: 标签字符串
return value: 无
void drawPointLabel()
function: 绘制点标签
parameters: NULL
return value: 无
void drawValueLabel(ValueLabel * vl, bool bDrawLine = true, int width = 120, int height = 28)
function: 绘制值标签
parameters:
[i]ValueLabel * vl: 值标签数据
[i] bool bDrawLine = true: 是否绘制指示线
[i] int width = 120: 标签宽度
[i] int height = 28: 标签高度
return value: 无
void setValueLabel(const char * str, ValueLabel * vl, RGBAColor c = RGBAColor(108, 0, 108, 64))
function: 设置值标签
parameters:
[i]const char * str: 标签字符串
[i] ValueLabel * vl: 值标签对象
[i] RGBAColor c: 颜色值
return value: 无
virtual void updateValueLabel()
function: 更新值标签
parameters: NULL
return value: 无
void clearValueLabel(vector<ItemPtr> * keepObjs = NULL)
function: 清空值标签
parameters:
[i]vector<ItemPtr> * keepObjs = NULL: 需要保留的对象数组
return value: 无
void addGifFrame()
function: 添加Gif动画帧
parameters: NULL
return value: 无
void endGifRecord()
function: 结束GIF动画录制
parameters: NULL
return value: 无
void initializeGL()
function: 初始化openGL窗口
parameters: NULL
return value: 无
void resizeGL(int width, int height)
function: 调整openGL窗口大小
parameters:
[i]int width: 窗口宽度
[i] int height: 窗口高度
return value: 无
void paintGL()
function: 绘制openGL窗口
parameters: NULL
return value: 无
void keyPressEvent(QKeyEvent *event)
function: 响应键盘单击事件
parameters:
[i]QKeyEvent *event: 键盘单击事件
return value: 无
void keyReleaseEvent(QKeyEvent *event)
function: 响应键盘释放事件
parameters:
[i]QKeyEvent *event: 键盘释放事件
return value: 无
void wheelEvent(QWheelEvent * e)
function: 响应鼠标滚轮事件
parameters:
[i]QWheelEvent * e: 鼠标滚轮事件
return value: 无
void mousePressEvent(QMouseEvent *event)
function: 响应鼠标单击事件
parameters:
[i]QMouseEvent *event: 鼠标单击事件
return value: 无
void mouseMoveEvent(QMouseEvent *event)
function: 响应鼠标移动事件
parameters:
[i]QMouseEvent *event: 鼠标移动事件
return value: 无
void mouseReleaseEvent(QMouseEvent *event)
function: 响应鼠标释放事件
parameters:
[i]QMouseEvent *event: 鼠标释放事件
return value: 无
void contextMenuEvent(QContextMenuEvent * event)
function: 响应右键菜单事件
parameters:
[i]QContextMenuEvent * event: 右键菜单事件
return value: 无
void getPlaneBy2Point(int x0, int y0, int x1, int y1, XPlane * plane)
bool createShaderProgram(const char * src_code, const char * fragment, ShaderProgram * sp)
void deleteShaderProgram(ShaderProgram * sp)
function: 销毁着色器对象
parameters:
[i]ShaderProgram * sp: 着色器对象
return value: 无
void useShaderProgram(ulong spid)
function: 使用着色器
parameters:
[i]ulong spid: 着色器ID
return value: 无
void updateShaderAttribLocation(ulong spID, ShaderVarLocation * varLoc = 0)
function: 更新着色器变量位置
parameters:
[i]ulong spID: 着色器ID
[i] ShaderVarLocation * varLoc = 0: 着色器变量结构体
return value: 无
void updateClipPlane(bool bUseShader = true)
function: 更新裁剪平面
parameters:
[i]bool bUseShader = true: 是否使用着色器
return value: 无
void disableClipPlane()
function: 抑制裁剪平面
parameters: NULL
return value: 无
void enableClipPlane()
function: 激活裁剪平面
parameters: NULL
return value: 无
void highlightElement(const XElement * el)
function: 高亮单元
parameters:
[i]const XElement * el: 单元对象
return value: 无
void drawPickedElements(const XRenderData * rd, bool bUseIndex = false)
function: 绘制指定单元对象
parameters:
[i]const XRenderData * rd: 单元对象的渲染数据结构体
[i] bool bUseIndex = false: 是否使用ELEMENT INDEX
return value: 无
bool isOperationType(int op)
virtual void setViewAngle(GLViewAngle va, const real *rot_angle = 0)
function: 设置视图视角
parameters:
[i]GLViewAngle va: 视角类型
[i] const real *rot_angle = 0: 视图旋转角
return value: 无
virtual void setCenter(const real * center)
function: 设置视图中心
parameters:
[i]const real * center: 视图中心坐标
return value: 无
void drawSolid(const XGeometry * g, bool bEncode, bool bSecond = false)
function: 绘制实体对象
parameters:
[i]const XGeometry * g: 实体几何对象
[i] bool bEncode: 是否编码
[i] bool bSecond = false: 是否第二显示模型
return value: 无
void drawPart(const XPart * p, bool bEncode, bool bSecond = false)
function: 绘制部件
parameters:
[i]const XPart * p: 部件对象
[i] bool bEncode: 是否编码(用于拾取)
[i] bool bSecond = false: 是否第二显示模型
return value: 无
void drawTransform(ulong spID, ShaderVarLocation * contourVarLoc = 0)
function: 绘制变形体
parameters:
[i]ulong spID: 着色器ID
[i] ShaderVarLocation * contourVarLoc = 0: 着色器变量位置数据
return value: 无
void initShaderContext(XShaderContext * sc)
function: 初始化着色器上下文
parameters:
[i]XShaderContext * sc: 着色器上下文对象
return value: 无
void useShaderContext(XShaderContext * sc)
function: 使用着色器上下文
parameters:
[i]XShaderContext * sc: 着色器上下文对象
return value: 无
void unuseShaderContext(XShaderContext * sc, bool bRelease = false)
function: 取消使用着色器上下文
parameters:
[i]XShaderContext * sc: 着色器上下文对象
[i] bool bRelease = false: 是否释放着色器上下文
return value: 无
virtual void setShaderContext(ulong spID)
function: 设置当前着色器上下文
parameters:
[i]ulong spID: 着色器ID
return value: 无
void checkGLExtension()
function: 检查openGL扩展
parameters: NULL
return value: 无
void onPick()
bool calcPickCoord(real * coord)
function: 计算拾取坐标
parameters:
[i]real * coord: 存放拾取坐标
return value: 返回true
ErrorCode error()
function: 检查openGL的错误字符串
parameters: NULL
return value: 返回错误码
void drawString(const char *str, const double * loc)
function: 绘制字符串
parameters:
[i]const char *str: 字符串
[i] const double * loc: 绘制的起始坐标
return value: 无
void drawString(const char *str, float x, float y, float z)
function: 绘制字符串
parameters:
[i]const char *str: 字符串
[i] float x: 绘制的起始X坐标
[i] float y: 绘制的起始Y坐标
[i] float z: 绘制的起始Z坐标
return value: 无
void drawString(const char * str, int x, int y, bool bNewMatrix = true)
function: 绘制字符串
parameters:
[i]const char * str: 字符串
[i] int x: 绘制的起始屏幕坐标X
[i] int y: 绘制的起始屏幕坐标Y
[i] bool bNewMatrix = true: 是否使用新的变换矩阵
return value: 无
void chooseGLFormat()
function: 选择GL上下文格式
parameters: NULL
return value: 无
void saveGLState()
function: 保存openGL渲染状态
parameters: NULL
return value: 无
void restoreGLState()
function: 恢复openGL渲染状态
parameters: NULL
return value: 无
void drawBackground()
function: 绘制背景
parameters: NULL
return value: 无
virtual void drawForeground()
function: 绘制前景
parameters: NULL
return value: 无
void drawAxis()
function: 绘制所有坐标系
parameters: NULL
return value: 无
void drawCoordSys(const XCoordSystem * cs)
function: 绘制指定坐标系
parameters:
[i]const XCoordSystem * cs: 坐标系对象
return value: 无
void drawDatumAxis(const XDatumAxis * cs)
function: 绘制基准轴
parameters:
[i]const XDatumAxis * cs: 基准轴对象
return value: 无
void drawGuidePlane()
function: 绘制辅助向导平面
parameters: NULL
return value: 无
void drawRubberband()
function: 绘制橡皮筋框
parameters: NULL
return value: 无
void drawEntity(DrawingBaseEntity * pEnt, void * quadratic = 0)
function: 绘制基本实体
parameters:
[i]DrawingBaseEntity * pEnt: 基本实体对象
[i] void * quadratic = 0: 二次曲线参数对象
return value: 无
void drawOverlay()
function: 绘制Overlay层
parameters: NULL
return value: 无
void drawColorIndex(const char * label)
function: 绘制色带标签
parameters:
[i]const char * label: 标签字符串
return value: 无
void drawColorIndex(const char * label, float min, float max, int div)
function: 绘制色带标签
parameters:
[i]const char * label: 标签字符串
[i] float min: 最小值
[i] float max: 最大值
[i] int div: 色带个数
return value: 无
void drawLocalContour()
function: 绘制局部云图
parameters: NULL
return value: 无
void drawInstancedVectorVBO(ShaderProgram * sp, float vecScale, float coordScale, const XRenderData * rd)
function: 绘制实例化矢量
parameters:
[i]ShaderProgram * sp: 着色器对象
[i] float vecScale: 矢量比例系数
[i] float coordScale: 坐标比例系数
[i] const XRenderData * rd: 渲染数据结构体
return value: 无
void drawElemEncode(XModel * mdl)
function: 绘制单元编码
parameters:
[i]XModel * mdl: 模型对象
return value: 无
void drawNodeEncode(XModel * mdl)
function: 绘制节点编码
parameters:
[i]XModel * mdl: 模型对象
return value: 无
void drawFaceEncode(XModel * mdl, bool bSecond = false)
function: 绘制面编码
parameters:
[i]XModel * mdl: 模型对象
[i] bool bSecond = false: 是否第二显示模式
return value: 无
void drawEdgeEncode(XModel * mdl, bool bSecond = false)
function: 绘制边编码
parameters:
[i]XModel * mdl: 模型对象
[i] bool bSecond = false: 是否第二显示模式
return value: 无
void drawVertexEncode(XModel * mdl, bool bSecond = false)
function: 绘制顶点编码
parameters:
[i]XModel * mdl: 模型对象
[i] bool bSecond = false: 是否第二显示模式
return value: 无
void drawPrimitive(int mode, int count, int type = GL_UNSIGNED_INT, const void *indices = NULL, int rangeStart = -1, int rangeEnd = -1)
function: 绘制几何元素
parameters:
[i]int mode: 绘制模式
[i] int count: 个数
[i] int type = GL_UNSIGNED_INT: 数据类型
[i] const void *indices = NULL: 索引数组
[i] int rangeStart = -1: 起始索引
[i] int rangeEnd = -1: 结束索引
return value: 无
void drawModelGeometry(XModel * mdl, TypeID geomType, TypeID drawType)
function: 绘制模型几何对象
parameters:
[i]XModel * mdl: 模型对象
[i] TypeID geomType: 几何类型
[i] TypeID drawType: 绘制模式
return value: 无
void drawFPS(double fps)
function: 绘制帧率
parameters:
[i]double fps: 帧率值
return value: 无
void drawScale(double scale)
function: 绘制比例系数
parameters:
[i]double scale: 比例系数
return value: 无
void zoomStepIn()
function: 单步放大
parameters: NULL
return value: 无
void zoomStepOut()
function: 单步缩小
parameters: NULL
return value: 无
void beginPixelDraw(int px, int py)
function: 开始像素绘制
parameters:
[i]int px: 起始X坐标
[i] int py: 起始Y坐标
return value: 无
void endPixelDraw()
function: 结束像素绘制
parameters: NULL
return value: 无
void renderFromFBO(FBObject &fbo)
function: 从帧缓冲对象中渲染
parameters:
[i]FBObject &fbo: 帧缓冲对象
return value: 无
void bindFBO(FBObject &fbo)
function: 绑定帧缓冲对象
parameters:
[i]FBObject &fbo: 帧缓冲对象
return value: 无
void releaseFBO()
function: 释放帧缓冲对象
parameters: NULL
return value: 无
void resizeFBO()
void updateModelViewMatrix()
function: 更新模型视图变换矩阵
parameters: NULL
return value: 无
void calcSigntLine(int x, int y, double depth, double * l_pt, double * l_dir)
function: 计算经过给定屏幕点的直线
parameters:
[i]int x: 屏幕点坐标X
[i] int y: 屏幕点坐标Y
[i] double depth: 点的深度值
[i] double * l_pt: 直线上一点
[i] double * l_dir: 直线的方向矢量
return value: 无
bool isGuidePlaneActived()
void panGuidePlane(int wx, int wy)
function: 平移辅助向导平面
parameters:
[i]int wx: 平移X分量
[i] int wy: 平移Y分量
return value: 无
bool isSceneTimeOut()
virtual void drawEncodeColor()
function: 虚接口,绘制对象颜色编码
parameters: NULL
return value: 无
virtual void drawHighlight()
function: 虚接口,绘制高亮对象
parameters: NULL
return value: 无
virtual void drawAnimation()
function: 虚接口,绘制动画
parameters: NULL
return value: 无
bool getPickPosition(real * pos)
bool getPickCuboid(int left, int right, int bot, int top, XObBox * box)
virtual void drawModel()
function: 虚接口,绘制模型
parameters: NULL
return value:
virtual void drawSolid()
function: 虚接口,绘制实体
parameters: NULL
return value: 无
virtual void drawClip()
function: 虚接口,绘制剪切体
parameters: NULL
return value: 无
virtual void drawPreview()
function: 虚接口,绘制预览对象
parameters: NULL
return value: 无
virtual void drawIsoline()
function: 虚接口,绘制等值线
parameters: NULL
return value: 无
virtual void drawStreamline()
function: 虚接口,绘制流线
parameters: NULL
return value: 无
virtual void drawPicked()
function: 虚接口,绘制选择对象
parameters: NULL
return value: 无
virtual void drawMarker()
function: 虚接口,绘制标记
parameters: NULL
return value: 无
void drawMarkerText(const char * str, const double * startPos, const char * endPos, TypeID extendAxis, double extendH)
function: 绘制标记字符串
parameters:
[i]const char * str: 字符串
[i] const double * startPos: 起始位置
[i] const char * endPos: 结束位置
[i] TypeID extendAxis: 扩展轴
[i] double extendH: 扩展高度
return value: 无
void drawTris(XModel * mdl)
function: 绘制模型的面片视图数据
parameters:
[i]XModel * mdl: 模型对象
return value: 无
void drawLines(XModel * mdl)
function: 绘制模型的线段视图数据
parameters:
[i]XModel * mdl: 模型对象
return value: 无
void drawAxis(const double * dir, GLUquadricObj * pQuadric, const char * label = 0, double axisLen = 5)
function: 绘制坐标轴
parameters:
[i]const double * dir: 方向矢量
[i] GLUquadricObj * pQuadric: 二次曲面对象
[i] const char * label = 0: 标签
[i] double axisLen = 5: 轴长度系数
return value: 无
void drawCross(const double * center, double scale, bool bOblicque = false, RGBAColor c = RGBAColor(0,255,0))
function: 绘制十字标记
parameters:
[i]const double * center: 绘制中心
[i] double scale: 比例系数
[i] bool bOblicque = false: 是否透明
[i] RGBAColor c: 颜色
return value: 无
void drawArrow(const double * dir, GLUquadricObj * pQuadric)
function: 绘制箭头
parameters:
[i]const double * dir: 箭头方向
[i] GLUquadricObj * pQuadric: 二次曲面对象
return value: 无
void zoomLocal()
function: 缩放视图以适配指定局部区域
parameters: NULL
return value: 无
double getScaleFactor()
function: 获取场景缩放系数
parameters: NULL
return value: 场景缩放系数
void initOpFlag()
function: 初始化操作标志
parameters: NULL
return value: 无
void initFBO()
function: 初始化帧缓冲对象
parameters: NULL
return value: 无
void initLight()
function: 初始化光照设置
parameters: NULL
return value: 无
ulong getColoredEnitityId(int x, int y, int range = 10)
int getColoredEnitityId(int xb, int yb, int xt, int yt, IDHash * eid_hash)
int getColoredEnitityId(IDHash * eid_hash)
void setGLState(KGL_STATE st)
function: 设置opengl的状态
parameters:
[i]KGL_STATE st: 状态类型
return value: 无
void saveGLformat()
function: 保存opengl的上下文格式
parameters: NULL
return value: 无
void bindIndexDataFromArray(XArrayPool<ulong> * pArray, int offset, int count, int bufId)
function: 绑定索引数据到VBO对象中
parameters:
[i]XArrayPool<ulong> * pArray: 索引数组
[i] int offset: 偏移值
[i] int count: 个数
[i] int bufId: VBO ID
return value: 无
void bindColorDataFromArray(XArrayPool<ulong> * pArray, int offset, int count, int bufId)
function: 绑定颜色数据到VBO对象中
parameters:
[i]XArrayPool<ulong> * pArray: 颜色数组
[i] int offset: 偏移量
[i] int count: 个数
[i] int bufId: VBO ID
return value: 无
void checkClipPlane()
function: 检查裁剪平面并正确设置状态
parameters: NULL
return value: 无
virtual void updateAnimationFrame(VertexFrameFile * vff)
function: 更新动画帧
parameters:
[i]VertexFrameFile * vff: 顶点帧文件对象
return value: 无
void drawModelVFF(const VertexFrameFile * vff, int activeMode = Active_Normal)
function: 绘制模型上的顶点帧
parameters:
[i]const VertexFrameFile * vff: 顶点帧文件对象
[i] int activeMode = Active_Normal: 绘制模式
return value: 无
void drawVFF(const VertexFrameFile * vff, int target, int mode = Active_Normal)
function: 绘制顶点帧
parameters:
[i]const VertexFrameFile * vff: 顶点帧文件对象
[i] int target: 对象类型
[i] int mode = Active_Normal: 绘制模式
return value: 无
void drawScene()
function: 绘制场景
parameters: NULL
return value: 无
virtual void updateSceneVBO(TypeID updateFlag)
function: 更新场景VBO对象
parameters:
[i]TypeID updateFlag: 更新标志
return value: 无
void resetVBOCount(TypeID updateFlag)
function: 重置VBO对象大小
parameters:
[i]TypeID updateFlag: 更新标志
return value: 无
void resetSecondVBOCount(TypeID updateFlag)
void updateVBOSize(TypeID updateFlag = (Update_Face | Update_Edge))
function: 更新VBO大小
parameters:
[i]TypeID updateFlag: 更新标志
return value: 无
void updateSecondVBOSize(TypeID updateFlag = (Update_Face | Update_Edge))
void bindVBOVertexArrayAttribute(TypeID vbType, ulong vaID)
void updateRenderDataToVBO(const XRenderData * rd, int mode, ulong color, int contourVAID, const int * deformVAID)
function: 更新渲染数据到VBO中
parameters:
[i]const XRenderData * rd: 渲染数据对象
[i] int mode: 绘制模式
[i] ulong color: 颜色值
[i] int contourVAID: 值顶点属性对象ID
[i] const int * deformVAID: 矢量顶点属性对象ID数组
return value: 无
void updateSecondRenderDataToVBO(const XRenderData * rd, int mode, ulong color)
int updateRenderDataToLineIndex(const XRenderData * rd, vector<int> * lineIndex, int offset = 0)
void updateLocalContourDataToVBO(const XRenderData * rd, const XArray<ulong> * pcolor)
function: 更新局部云图数据到VBO中
parameters:
[i]const XRenderData * rd: 渲染数据对象
[i] const XArray<ulong> * pcolor: 颜色值
return value: 无
void drawModelVBO(int activeMode = Active_Normal, int edgeIndexCnt = 0)
function: 绘制模型VBO
parameters:
[i]int activeMode = Active_Normal: 绘制模式
[i] int edgeIndexCnt = 0: 边标志个数
return value: 无
void drawSecondModelVBO(int activeMode = Active_Normal)
function: 绘制第二模型VBO
parameters:
[i]int activeMode = Active_Normal: 绘制模式
return value: 无
void drawRenderData(const XRenderData * rd, int mode = Active_Normal, int contourVAID = 0, const int * deformVAID = NULL)
function: 直接渲染数据
parameters:
[i]const XRenderData * rd: 渲染数据对象
[i] int mode = Active_Normal: 绘制模式
[i] int contourVAID = 0: 值顶点数组对象ID
[i] const int * deformVAID = NULL: 矢量顶点数组对象ID
return value: 无
void drawVBO(int target, int mode = Active_Normal)
function: 绘制VBO
parameters:
[i]int target: 目标类型
[i] int mode = Active_Normal: 绘制模式
return value: 无
void drawTriEdgeVBO(int mode, int triEdgeIndexCnt = 0)
function: 绘制带边标志的面片
parameters:
[i]int mode: 绘制模式
[i] int triEdgeIndexCnt = 0: 边标志个数
return value: 无
void drawSecondVBO(int target, int mode = Active_Normal)
function: 绘制第二显示模型的VBO
parameters:
[i]int target: VBO类型
[i] int mode = Active_Normal: 绘制模式
return value: 无
void createVBO(XVertexBuffer & bs, int count, int unitSize = sizeof(float), int dim = 1)
function: 创建VBO
parameters:
[i]XVertexBuffer & bs: 顶点数组对象
[i] int count: 顶点个数
[i] int unitSize = sizeof(float): 数据类型大小
[i] int dim: 数据维数
return value: 无
void drawInstancedVector(ShaderProgram * sp, const XRenderData * rd)
function: 绘制实例化矢量
parameters:
[i]ShaderProgram * sp: 着色器
[i] const XRenderData * rd: 渲染数据对象
return value: 无