QWT API (中文) 7.3.0
Qt绘图库 - 中文API文档
载入中...
搜索中...
未找到
Public 成员函数 | Public 属性 | 所有成员列表
Qwt3DRenderContext结构体 参考

Bundles all widget resources that drawables need during rendering 更多...

#include <qwt3d_render_context.h>

Public 成员函数

QPointF worldToScreen (const Triple &world) const
 Projects a world-space point to screen pixel coordinates
 
Triple screenToWorld (const QPointF &screen) const
 Unprojects screen pixel coordinates to a world-space point
 
Triple relativePosition (Triple rel) const
 Converts a relative viewport position to world coordinates
 

Public 属性

QMatrix4x4 modelView
 
QMatrix4x4 projection
 
QSize viewport
 
QOpenGLShaderProgram * lineShader = nullptr
 
QOpenGLShaderProgram * polygonShader = nullptr
 
QOpenGLShaderProgram * textShader = nullptr
 

详细描述

Bundles all widget resources that drawables need during rendering

A value struct constructed per-call-site in Qwt3DPlot::paintGL() with the matrices, viewport, and shared shader programs current at that moment. Passed by const reference down the drawable draw chain, replacing the former Qwt3DPlot* back-pointer baked into Qwt3DDrawable (deferred smell #1, resolved).

The coordinate-conversion methods (worldToScreen, screenToWorld, relativePosition) are pure CPU math over the stored matrices and viewport — no OpenGL calls — so the context is self-contained and copyable.

// Constructed in paintGL() per draw phase:
ctx.modelView = d->m_modelView;
ctx.projection = d->m_projection;
ctx.viewport = viewportSize();
ctx.lineShader = d->m_lineShader;
ctx.polygonShader = d->m_polygonShader;
ctx.textShader = d->m_textShader;
d->m_coordinates.draw(ctx);
Bundles all widget resources that drawables need during rendering
Definition qwt3d_render_context.h:38

成员函数说明

◆ relativePosition()

Triple Qwt3DRenderContext::relativePosition ( Triple  rel) const

Converts a relative viewport position to world coordinates

参数
relRelative position in viewport coordinates [0..1]
返回
Corresponding world coordinates

Scales the relative position by the viewport dimensions to obtain screen pixel coordinates, then unprojects to world space.

◆ screenToWorld()

Triple Qwt3DRenderContext::screenToWorld ( const QPointF &  screen) const

Unprojects screen pixel coordinates to a world-space point

参数
screenScreen-space point (pixel coordinates)
返回
World-space Triple

Uses the inverse of the CPU-side modelView and projection matrices to unproject screen coordinates. The z-component is determined by the near plane (z=0 in NDC).

◆ worldToScreen()

QPointF Qwt3DRenderContext::worldToScreen ( const Triple world) const

Projects a world-space point to screen pixel coordinates

参数
worldWorld-space Triple
返回
Screen-space QPointF (pixel coordinates)

Uses the CPU-side modelView and projection matrices to transform world coordinates to normalized device coordinates, then maps to viewport pixels.


该结构体的文档由以下文件生成: