User Tools

Site Tools


class:ui:xrender



XRender

Inherited from QOpenGLWidget,XView,

Inherited by NULL

Friend class NULL

Description

XRender类从XView继承,是用于三维视图的渲染和用户交互的视图基类,它支持多种渲染模式和显示状态,交互上它支持多种不同的对象选择和拾取方法,以及视图的操作(如旋转、平移、缩放),还支持云图渲染以及变形渲染,以及基于GLSL着色器语言的高级渲染技术。除此以外它还提供了用于指定裁剪平面和局部视图的方法接口以及定制功能专用数据的预览显示接口,可以根据需要显示多种标记。

为了提高渲染速度,XRender首先在帧缓冲区对象中渲染,然后通过纹理渲染到正常渲染上下文中。

XRender为三维场景提供了较完备的渲染以及交互方法,开发者可以从它继承很方便的定制更多专用三维场景的显示与交互。

Members

Public interface

Protected interface


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:
    1. [i]MainFrame * pParApp: 框架对象
    2. [i] XDocument * doc: 文档对象
  • return value: 无

virtual ~XRender()

  • function: 析构函数
  • parameters: NULL
  • return value: 无

virtual void onViewDataUpdated()

  • function: 视图数据更新时更新视图的相关缓冲区
  • parameters: NULL
  • return value: 无

void onAnimationFrameUpdated()

  • function: 动画帧更新时更新动画相关的缓冲区
  • parameters: NULL
  • return value: 无

virtual void createContextMenu()

  • function: 创建右键菜单
  • parameters: NULL
  • return value: 无

virtual void setOpFlag(OpType op)

  • function: 设置指定操作的标志
  • parameters:
    1. [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:
    1. [i]const real * range: 视图框包围盒
  • return value: 无

void setModelViewMatrix(double *matrix)

  • function: 设置模型视图变换矩阵
  • parameters:
    1. [i]double *matrix: 模型视图变换矩阵
  • return value: 无

void saveVisualAngle(XVisualAngle * va)

  • function: 设置视角
  • parameters:
    1. [i]XVisualAngle * va: 视角数据
  • return value: 无

void loadVisualAngle(const XVisualAngle * va)

  • function: 载入视角
  • parameters:
    1. [i]const XVisualAngle * va: 视角数据
  • return value: 无

void setVisualAngle(const double * viewRange, const double * dir)

  • function: 设置视角
  • parameters:
    1. [i]const double * viewRange: 视图区域
    2. [i] const double * dir: 视图方向
  • return value: 无

void synchronize(XView * refView)

  • function: 同步视图
  • parameters:
    1. [i]XView * refView: 参考视图
  • return value: 无

void saveImage(const char * path, bool bOffScreen = true)

  • function: 将视图以图像保存到文件中
  • parameters:
    1. [i]const char * path: 图像文件路径
    2. [i] bool bOffScreen = true: 是否离屏渲染
  • return value: 无

void updateOverlay()

  • function: 更新覆盖层
  • parameters: NULL
  • return value: 无

void updateColorEncode(bool forced = false)

  • function: 更新对象编码
  • parameters:
    1. [i]bool forced = false: 强制更新
  • return value: 无

int countColoredPixel(const XRenderData * rd)

  • function: 渲染之后计算被编码的像素数目
  • parameters:
    1. [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()

  • function: 是否多边形选择模式
  • parameters: NULL
  • return value: 多边形选择模式返回true,否则返回false

float getDepthOnPoint(int x, int y)

  • function: 获取屏幕给定点的深度值
  • parameters:
    1. [i]int x: 点X坐标
    2. [i] int y: 点Y坐标
  • return value: 屏幕给定点的深度值

GLuint loadTexture(const char* file_name)

  • function: 载入纹理数据
  • parameters:
    1. [i]const char* file_name: 纹理图片路径
  • return value: 纹理对象ID

void fitLocal(const real * localBox, bool bResetCenter = false)

  • function: 调整视图的包围盒与指定包围盒适配,并根据需要重置中心
  • parameters:
    1. [i]const real * localBox: 指定视图包围盒
    2. [i] bool bResetCenter = false: 是否重置视图中心
  • return value: 无

void drawLabel(int x, int y, int w, int h, const char * str)

  • function: 绘制标签
  • parameters:
    1. [i]int x: 起始点x坐标
    2. [i] int y: 起始点Y坐标
    3. [i] int w: 标签长度
    4. [i] int h: 标签高度
    5. [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:
    1. [i]ValueLabel * vl: 值标签数据
    2. [i] bool bDrawLine = true: 是否绘制指示线
    3. [i] int width = 120: 标签宽度
    4. [i] int height = 28: 标签高度
  • return value: 无

void setValueLabel(const char * str, ValueLabel * vl, RGBAColor c = RGBAColor(108, 0, 108, 64))

  • function: 设置值标签
  • parameters:
    1. [i]const char * str: 标签字符串
    2. [i] ValueLabel * vl: 值标签对象
    3. [i] RGBAColor c: 颜色值
  • return value: 无

virtual void updateValueLabel()

  • function: 更新值标签
  • parameters: NULL
  • return value: 无

void clearValueLabel(vector<ItemPtr> * keepObjs = NULL)

  • function: 清空值标签
  • parameters:
    1. [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:
    1. [i]int width: 窗口宽度
    2. [i] int height: 窗口高度
  • return value: 无

void paintGL()

  • function: 绘制openGL窗口
  • parameters: NULL
  • return value: 无

void keyPressEvent(QKeyEvent *event)

  • function: 响应键盘单击事件
  • parameters:
    1. [i]QKeyEvent *event: 键盘单击事件
  • return value: 无

void keyReleaseEvent(QKeyEvent *event)

  • function: 响应键盘释放事件
  • parameters:
    1. [i]QKeyEvent *event: 键盘释放事件
  • return value: 无

void wheelEvent(QWheelEvent * e)

  • function: 响应鼠标滚轮事件
  • parameters:
    1. [i]QWheelEvent * e: 鼠标滚轮事件
  • return value: 无

void mousePressEvent(QMouseEvent *event)

  • function: 响应鼠标单击事件
  • parameters:
    1. [i]QMouseEvent *event: 鼠标单击事件
  • return value: 无

void mouseMoveEvent(QMouseEvent *event)

  • function: 响应鼠标移动事件
  • parameters:
    1. [i]QMouseEvent *event: 鼠标移动事件
  • return value: 无

void mouseReleaseEvent(QMouseEvent *event)

  • function: 响应鼠标释放事件
  • parameters:
    1. [i]QMouseEvent *event: 鼠标释放事件
  • return value: 无

void contextMenuEvent(QContextMenuEvent * event)

  • function: 响应右键菜单事件
  • parameters:
    1. [i]QContextMenuEvent * event: 右键菜单事件
  • return value: 无

void getPlaneBy2Point(int x0, int y0, int x1, int y1, XPlane * plane)

  • function: 通过过的指定2点的垂直于屏幕的平面
  • parameters:
    1. [i]int x0: 第一点坐标X
    2. [i] int y0: 第一点坐标Y
    3. [i] int x1: 第二点坐标X
    4. [i] int y1: 第二点坐标Y
    5. [i] XPlane * plane: 平面对象
  • return value: 无

bool createShaderProgram(const char * src_code, const char * fragment, ShaderProgram * sp)

  • function: 创建着色器
  • parameters:
    1. [i]const char * src_code: 顶点着色器源码
    2. [i] const char * fragment: 片元着色器源码
    3. [i] ShaderProgram * sp: 着色器对象
  • return value: 成功创建返回true,否则返回false

void deleteShaderProgram(ShaderProgram * sp)

  • function: 销毁着色器对象
  • parameters:
    1. [i]ShaderProgram * sp: 着色器对象
  • return value: 无

void useShaderProgram(ulong spid)

  • function: 使用着色器
  • parameters:
    1. [i]ulong spid: 着色器ID
  • return value: 无

void updateShaderAttribLocation(ulong spID, ShaderVarLocation * varLoc = 0)

  • function: 更新着色器变量位置
  • parameters:
    1. [i]ulong spID: 着色器ID
    2. [i] ShaderVarLocation * varLoc = 0: 着色器变量结构体
  • return value: 无

void updateClipPlane(bool bUseShader = true)

  • function: 更新裁剪平面
  • parameters:
    1. [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:
    1. [i]const XElement * el: 单元对象
  • return value: 无

void drawPickedElements(const XRenderData * rd, bool bUseIndex = false)

  • function: 绘制指定单元对象
  • parameters:
    1. [i]const XRenderData * rd: 单元对象的渲染数据结构体
    2. [i] bool bUseIndex = false: 是否使用ELEMENT INDEX
  • return value: 无

bool isOperationType(int op)

  • function: 是否为指定类型操作(如旋转)
  • parameters:
    1. [i]int op: 操作类型
  • return value: 是指定操作返回true,否则返回false

virtual void setViewAngle(GLViewAngle va, const real *rot_angle = 0)

  • function: 设置视图视角
  • parameters:
    1. [i]GLViewAngle va: 视角类型
    2. [i] const real *rot_angle = 0: 视图旋转角
  • return value: 无

virtual void setCenter(const real * center)

  • function: 设置视图中心
  • parameters:
    1. [i]const real * center: 视图中心坐标
  • return value: 无

void drawSolid(const XGeometry * g, bool bEncode, bool bSecond = false)

  • function: 绘制实体对象
  • parameters:
    1. [i]const XGeometry * g: 实体几何对象
    2. [i] bool bEncode: 是否编码
    3. [i] bool bSecond = false: 是否第二显示模型
  • return value: 无

void drawPart(const XPart * p, bool bEncode, bool bSecond = false)

  • function: 绘制部件
  • parameters:
    1. [i]const XPart * p: 部件对象
    2. [i] bool bEncode: 是否编码(用于拾取)
    3. [i] bool bSecond = false: 是否第二显示模型
  • return value: 无

void drawTransform(ulong spID, ShaderVarLocation * contourVarLoc = 0)

  • function: 绘制变形体
  • parameters:
    1. [i]ulong spID: 着色器ID
    2. [i] ShaderVarLocation * contourVarLoc = 0: 着色器变量位置数据
  • return value: 无

void initShaderContext(XShaderContext * sc)

  • function: 初始化着色器上下文
  • parameters:
    1. [i]XShaderContext * sc: 着色器上下文对象
  • return value: 无

void useShaderContext(XShaderContext * sc)

  • function: 使用着色器上下文
  • parameters:
    1. [i]XShaderContext * sc: 着色器上下文对象
  • return value: 无

void unuseShaderContext(XShaderContext * sc, bool bRelease = false)

  • function: 取消使用着色器上下文
  • parameters:
    1. [i]XShaderContext * sc: 着色器上下文对象
    2. [i] bool bRelease = false: 是否释放着色器上下文
  • return value: 无

virtual void setShaderContext(ulong spID)

  • function: 设置当前着色器上下文
  • parameters:
    1. [i]ulong spID: 着色器ID
  • return value: 无

void checkGLExtension()

  • function: 检查openGL扩展
  • parameters: NULL
  • return value: 无

void onPick()

  • function: 当交互操作为拾取对象时响应对象拾取操作
  • parameters: NULL
  • return value: 无

bool calcPickCoord(real * coord)

  • function: 计算拾取坐标
  • parameters:
    1. [i]real * coord: 存放拾取坐标
  • return value: 返回true

ErrorCode error()

  • function: 检查openGL的错误字符串
  • parameters: NULL
  • return value: 返回错误码

void drawString(const char *str, const double * loc)

  • function: 绘制字符串
  • parameters:
    1. [i]const char *str: 字符串
    2. [i] const double * loc: 绘制的起始坐标
  • return value: 无

void drawString(const char *str, float x, float y, float z)

  • function: 绘制字符串
  • parameters:
    1. [i]const char *str: 字符串
    2. [i] float x: 绘制的起始X坐标
    3. [i] float y: 绘制的起始Y坐标
    4. [i] float z: 绘制的起始Z坐标
  • return value: 无

void drawString(const char * str, int x, int y, bool bNewMatrix = true)

  • function: 绘制字符串
  • parameters:
    1. [i]const char * str: 字符串
    2. [i] int x: 绘制的起始屏幕坐标X
    3. [i] int y: 绘制的起始屏幕坐标Y
    4. [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:
    1. [i]const XCoordSystem * cs: 坐标系对象
  • return value: 无

void drawDatumAxis(const XDatumAxis * cs)

  • function: 绘制基准轴
  • parameters:
    1. [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:
    1. [i]DrawingBaseEntity * pEnt: 基本实体对象
    2. [i] void * quadratic = 0: 二次曲线参数对象
  • return value: 无

void drawOverlay()

  • function: 绘制Overlay层
  • parameters: NULL
  • return value: 无

void drawColorIndex(const char * label)

  • function: 绘制色带标签
  • parameters:
    1. [i]const char * label: 标签字符串
  • return value: 无

void drawColorIndex(const char * label, float min, float max, int div)

  • function: 绘制色带标签
  • parameters:
    1. [i]const char * label: 标签字符串
    2. [i] float min: 最小值
    3. [i] float max: 最大值
    4. [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:
    1. [i]ShaderProgram * sp: 着色器对象
    2. [i] float vecScale: 矢量比例系数
    3. [i] float coordScale: 坐标比例系数
    4. [i] const XRenderData * rd: 渲染数据结构体
  • return value: 无

void drawElemEncode(XModel * mdl)

  • function: 绘制单元编码
  • parameters:
    1. [i]XModel * mdl: 模型对象
  • return value: 无

void drawNodeEncode(XModel * mdl)

  • function: 绘制节点编码
  • parameters:
    1. [i]XModel * mdl: 模型对象
  • return value: 无

void drawFaceEncode(XModel * mdl, bool bSecond = false)

  • function: 绘制面编码
  • parameters:
    1. [i]XModel * mdl: 模型对象
    2. [i] bool bSecond = false: 是否第二显示模式
  • return value: 无

void drawEdgeEncode(XModel * mdl, bool bSecond = false)

  • function: 绘制边编码
  • parameters:
    1. [i]XModel * mdl: 模型对象
    2. [i] bool bSecond = false: 是否第二显示模式
  • return value: 无

void drawVertexEncode(XModel * mdl, bool bSecond = false)

  • function: 绘制顶点编码
  • parameters:
    1. [i]XModel * mdl: 模型对象
    2. [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:
    1. [i]int mode: 绘制模式
    2. [i] int count: 个数
    3. [i] int type = GL_UNSIGNED_INT: 数据类型
    4. [i] const void *indices = NULL: 索引数组
    5. [i] int rangeStart = -1: 起始索引
    6. [i] int rangeEnd = -1: 结束索引
  • return value: 无

void drawModelGeometry(XModel * mdl, TypeID geomType, TypeID drawType)

  • function: 绘制模型几何对象
  • parameters:
    1. [i]XModel * mdl: 模型对象
    2. [i] TypeID geomType: 几何类型
    3. [i] TypeID drawType: 绘制模式
  • return value: 无

void drawFPS(double fps)

  • function: 绘制帧率
  • parameters:
    1. [i]double fps: 帧率值
  • return value: 无

void drawScale(double scale)

  • function: 绘制比例系数
  • parameters:
    1. [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:
    1. [i]int px: 起始X坐标
    2. [i] int py: 起始Y坐标
  • return value: 无

void endPixelDraw()

  • function: 结束像素绘制
  • parameters: NULL
  • return value: 无

void renderFromFBO(FBObject &fbo)

  • function: 从帧缓冲对象中渲染
  • parameters:
    1. [i]FBObject &fbo: 帧缓冲对象
  • return value: 无

void bindFBO(FBObject &fbo)

  • function: 绑定帧缓冲对象
  • parameters:
    1. [i]FBObject &fbo: 帧缓冲对象
  • return value: 无

void releaseFBO()

  • function: 释放帧缓冲对象
  • parameters: NULL
  • return value: 无

void resizeFBO()

  • function: 重新设置帧缓冲对象的大小(当窗口发生变化时)
  • parameters: NULL
  • return value: 无

void updateModelViewMatrix()

  • function: 更新模型视图变换矩阵
  • parameters: NULL
  • return value: 无

void calcSigntLine(int x, int y, double depth, double * l_pt, double * l_dir)

  • function: 计算经过给定屏幕点的直线
  • parameters:
    1. [i]int x: 屏幕点坐标X
    2. [i] int y: 屏幕点坐标Y
    3. [i] double depth: 点的深度值
    4. [i] double * l_pt: 直线上一点
    5. [i] double * l_dir: 直线的方向矢量
  • return value: 无

bool isGuidePlaneActived()

  • function: 辅助向导平面是否激活
  • parameters: NULL
  • return value: 若激活向导平面返回true,否则返回false

void panGuidePlane(int wx, int wy)

  • function: 平移辅助向导平面
  • parameters:
    1. [i]int wx: 平移X分量
    2. [i] int wy: 平移Y分量
  • return value: 无

bool isSceneTimeOut()

  • function: 场景绘制时间是否超限
  • parameters: NULL
  • return value: 超限返回true,否则返回false

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)

  • function: 获取拾取点空间坐标
  • parameters:
    1. [i]real * pos: 拾取点空间坐标
  • return value: 成功获取返回true,否则返回false

bool getPickCuboid(int left, int right, int bot, int top, XObBox * box)

  • function: 获取拾取立方体
  • parameters:
    1. [i]int left: 拾取域左边X位置
    2. [i] int right: 拾取域右边X位置
    3. [i] int bot: 拾取域上边Y位置
    4. [i] int top: 拾取域下边Y位置
    5. [i] XObBox * box: 有向包围盒
  • return value: 成功获取返回true,否则返回false

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:
    1. [i]const char * str: 字符串
    2. [i] const double * startPos: 起始位置
    3. [i] const char * endPos: 结束位置
    4. [i] TypeID extendAxis: 扩展轴
    5. [i] double extendH: 扩展高度
  • return value: 无

void drawTris(XModel * mdl)

  • function: 绘制模型的面片视图数据
  • parameters:
    1. [i]XModel * mdl: 模型对象
  • return value: 无

void drawLines(XModel * mdl)

  • function: 绘制模型的线段视图数据
  • parameters:
    1. [i]XModel * mdl: 模型对象
  • return value: 无

void drawAxis(const double * dir, GLUquadricObj * pQuadric, const char * label = 0, double axisLen = 5)

  • function: 绘制坐标轴
  • parameters:
    1. [i]const double * dir: 方向矢量
    2. [i] GLUquadricObj * pQuadric: 二次曲面对象
    3. [i] const char * label = 0: 标签
    4. [i] double axisLen = 5: 轴长度系数
  • return value: 无

void drawCross(const double * center, double scale, bool bOblicque = false, RGBAColor c = RGBAColor(0,255,0))

  • function: 绘制十字标记
  • parameters:
    1. [i]const double * center: 绘制中心
    2. [i] double scale: 比例系数
    3. [i] bool bOblicque = false: 是否透明
    4. [i] RGBAColor c: 颜色
  • return value: 无

void drawArrow(const double * dir, GLUquadricObj * pQuadric)

  • function: 绘制箭头
  • parameters:
    1. [i]const double * dir: 箭头方向
    2. [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)

  • function: 搜索指定位置的对象颜色编码
  • parameters:
    1. [i]int x: 指定屏幕X坐标
    2. [i] int y: 指定屏幕Y坐标
    3. [i] int range = 10: 搜索范围
  • return value: 指定位置(指定范围内)的对象颜色编码

int getColoredEnitityId(int xb, int yb, int xt, int yt, IDHash * eid_hash)

  • function: 获取指定范围的所有对象编码ID
  • parameters:
    1. [i]int xb: 指定范围左下X坐标
    2. [i] int yb: 指定范围左下Y坐标
    3. [i] int xt: 指定范围右上X坐标
    4. [i] int yt: 指定范围右上Y坐标
    5. [i] IDHash * eid_hash: 存放编码ID的哈希
  • return value: 有效编码的个数

int getColoredEnitityId(IDHash * eid_hash)

  • function: 获取选择范围内所有对象编码ID
  • parameters:
    1. [i]IDHash * eid_hash: 存放编码ID的哈希
  • return value: 有效编码的个数

void setGLState(KGL_STATE st)

  • function: 设置opengl的状态
  • parameters:
    1. [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:
    1. [i]XArrayPool<ulong> * pArray: 索引数组
    2. [i] int offset: 偏移值
    3. [i] int count: 个数
    4. [i] int bufId: VBO ID
  • return value: 无

void bindColorDataFromArray(XArrayPool<ulong> * pArray, int offset, int count, int bufId)

  • function: 绑定颜色数据到VBO对象中
  • parameters:
    1. [i]XArrayPool<ulong> * pArray: 颜色数组
    2. [i] int offset: 偏移量
    3. [i] int count: 个数
    4. [i] int bufId: VBO ID
  • return value: 无

void checkClipPlane()

  • function: 检查裁剪平面并正确设置状态
  • parameters: NULL
  • return value: 无

virtual void updateAnimationFrame(VertexFrameFile * vff)

  • function: 更新动画帧
  • parameters:
    1. [i]VertexFrameFile * vff: 顶点帧文件对象
  • return value: 无

void drawModelVFF(const VertexFrameFile * vff, int activeMode = Active_Normal)

  • function: 绘制模型上的顶点帧
  • parameters:
    1. [i]const VertexFrameFile * vff: 顶点帧文件对象
    2. [i] int activeMode = Active_Normal: 绘制模式
  • return value: 无

void drawVFF(const VertexFrameFile * vff, int target, int mode = Active_Normal)

  • function: 绘制顶点帧
  • parameters:
    1. [i]const VertexFrameFile * vff: 顶点帧文件对象
    2. [i] int target: 对象类型
    3. [i] int mode = Active_Normal: 绘制模式
  • return value: 无

void drawScene()

  • function: 绘制场景
  • parameters: NULL
  • return value: 无

virtual void updateSceneVBO(TypeID updateFlag)

  • function: 更新场景VBO对象
  • parameters:
    1. [i]TypeID updateFlag: 更新标志
  • return value: 无

void resetVBOCount(TypeID updateFlag)

  • function: 重置VBO对象大小
  • parameters:
    1. [i]TypeID updateFlag: 更新标志
  • return value: 无

void resetSecondVBOCount(TypeID updateFlag)

  • function: 重置第二显示模型的VBO对象大小
  • parameters:
    1. [i]TypeID updateFlag: 更新标志
  • return value: 无

void updateVBOSize(TypeID updateFlag = (Update_Face | Update_Edge))

  • function: 更新VBO大小
  • parameters:
    1. [i]TypeID updateFlag: 更新标志
  • return value: 无

void updateSecondVBOSize(TypeID updateFlag = (Update_Face | Update_Edge))

  • function: 更新第二显示模型的VBO对象大小
  • parameters:
    1. [i]TypeID updateFlag: 更新标志
  • return value: 无

void bindVBOVertexArrayAttribute(TypeID vbType, ulong vaID)

  • function: 绑定VBO数据到顶点属性数组中
  • parameters:
    1. [i]TypeID vbType:VBO类型
    2. [i] ulong vaID: 顶点属性数组ID
  • return value: 无

void updateRenderDataToVBO(const XRenderData * rd, int mode, ulong color, int contourVAID, const int * deformVAID)

  • function: 更新渲染数据到VBO中
  • parameters:
    1. [i]const XRenderData * rd: 渲染数据对象
    2. [i] int mode: 绘制模式
    3. [i] ulong color: 颜色值
    4. [i] int contourVAID: 值顶点属性对象ID
    5. [i] const int * deformVAID: 矢量顶点属性对象ID数组
  • return value: 无

void updateSecondRenderDataToVBO(const XRenderData * rd, int mode, ulong color)

  • function: 更新渲染数据到第二显示模型VBO中
  • parameters:
    1. [i]const XRenderData * rd: 渲染数据对象
    2. [i] int mode: 绘制模式
    3. [i] ulong color: 颜色值
  • return value: 无

int updateRenderDataToLineIndex(const XRenderData * rd, vector<int> * lineIndex, int offset = 0)

  • function: 更加边标志更新渲染视图数据到线段索引中(用于显示线段)
  • parameters:
    1. [i]const XRenderData * rd: 渲染数据对象
    2. [i] vector<int> * lineIndex: 线段顶点索引数组
    3. [i] int offset = 0: 偏移量
  • return value: 无

void updateLocalContourDataToVBO(const XRenderData * rd, const XArray<ulong> * pcolor)

  • function: 更新局部云图数据到VBO中
  • parameters:
    1. [i]const XRenderData * rd: 渲染数据对象
    2. [i] const XArray<ulong> * pcolor: 颜色值
  • return value: 无

void drawModelVBO(int activeMode = Active_Normal, int edgeIndexCnt = 0)

  • function: 绘制模型VBO
  • parameters:
    1. [i]int activeMode = Active_Normal: 绘制模式
    2. [i] int edgeIndexCnt = 0: 边标志个数
  • return value: 无

void drawSecondModelVBO(int activeMode = Active_Normal)

  • function: 绘制第二模型VBO
  • parameters:
    1. [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:
    1. [i]const XRenderData * rd: 渲染数据对象
    2. [i] int mode = Active_Normal: 绘制模式
    3. [i] int contourVAID = 0: 值顶点数组对象ID
    4. [i] const int * deformVAID = NULL: 矢量顶点数组对象ID
  • return value: 无

void drawVBO(int target, int mode = Active_Normal)

  • function: 绘制VBO
  • parameters:
    1. [i]int target: 目标类型
    2. [i] int mode = Active_Normal: 绘制模式
  • return value: 无

void drawTriEdgeVBO(int mode, int triEdgeIndexCnt = 0)

  • function: 绘制带边标志的面片
  • parameters:
    1. [i]int mode: 绘制模式
    2. [i] int triEdgeIndexCnt = 0: 边标志个数
  • return value: 无

void drawSecondVBO(int target, int mode = Active_Normal)

  • function: 绘制第二显示模型的VBO
  • parameters:
    1. [i]int target: VBO类型
    2. [i] int mode = Active_Normal: 绘制模式
  • return value: 无

void createVBO(XVertexBuffer & bs, int count, int unitSize = sizeof(float), int dim = 1)

  • function: 创建VBO
  • parameters:
    1. [i]XVertexBuffer & bs: 顶点数组对象
    2. [i] int count: 顶点个数
    3. [i] int unitSize = sizeof(float): 数据类型大小
    4. [i] int dim: 数据维数
  • return value: 无

void drawInstancedVector(ShaderProgram * sp, const XRenderData * rd)

  • function: 绘制实例化矢量
  • parameters:
    1. [i]ShaderProgram * sp: 着色器
    2. [i] const XRenderData * rd: 渲染数据对象
  • return value: 无
class/ui/xrender.txt · Last modified: 2023/08/04 08:40 (external edit)