Skip to content

Class QAccelPlot::DataTextureMaterial

ClassList > QAccelPlot > DataTextureMaterial

Base QSGMaterial that samples series data from a DataTexture and exposes shared shader uniforms.More...

  • #include <DataTextureMaterial.hpp>

Inherits the following classes: QSGMaterial

Inherited by the following classes: QAccelPlot::BandMaterial, QAccelPlot::ErrorBarMaterial, QAccelPlot::LineMaterial, QAccelPlot::PointCloudMaterial, QAccelPlot::PointMaterial, QAccelPlot::RectMaterial

Inheritance diagram

flowchart TB
  classQAccelPlot_1_1DataTextureMaterial["QAccelPlot::DataTextureMaterial"]

  external_base_classQAccelPlot_1_1DataTextureMaterial_1["QSGMaterial"]
  external_base_classQAccelPlot_1_1DataTextureMaterial_1 --> classQAccelPlot_1_1DataTextureMaterial

  classQAccelPlot_1_1BandMaterial["QAccelPlot::BandMaterial"]
  classQAccelPlot_1_1DataTextureMaterial --> classQAccelPlot_1_1BandMaterial
  click classQAccelPlot_1_1BandMaterial "../classQAccelPlot_1_1BandMaterial/" "Open QAccelPlot::BandMaterial"

  classQAccelPlot_1_1ErrorBarMaterial["QAccelPlot::ErrorBarMaterial"]
  classQAccelPlot_1_1DataTextureMaterial --> classQAccelPlot_1_1ErrorBarMaterial
  click classQAccelPlot_1_1ErrorBarMaterial "../classQAccelPlot_1_1ErrorBarMaterial/" "Open QAccelPlot::ErrorBarMaterial"

  classQAccelPlot_1_1LineMaterial["QAccelPlot::LineMaterial"]
  classQAccelPlot_1_1DataTextureMaterial --> classQAccelPlot_1_1LineMaterial
  click classQAccelPlot_1_1LineMaterial "../classQAccelPlot_1_1LineMaterial/" "Open QAccelPlot::LineMaterial"

  classQAccelPlot_1_1BandEdgeMaterial["QAccelPlot::BandEdgeMaterial"]
  classQAccelPlot_1_1LineMaterial --> classQAccelPlot_1_1BandEdgeMaterial
  click classQAccelPlot_1_1BandEdgeMaterial "../classQAccelPlot_1_1BandEdgeMaterial/" "Open QAccelPlot::BandEdgeMaterial"

  classQAccelPlot_1_1GradientLineMaterial["QAccelPlot::GradientLineMaterial"]
  classQAccelPlot_1_1LineMaterial --> classQAccelPlot_1_1GradientLineMaterial
  click classQAccelPlot_1_1GradientLineMaterial "../classQAccelPlot_1_1GradientLineMaterial/" "Open QAccelPlot::GradientLineMaterial"

  classQAccelPlot_1_1PointCloudMaterial["QAccelPlot::PointCloudMaterial"]
  classQAccelPlot_1_1DataTextureMaterial --> classQAccelPlot_1_1PointCloudMaterial
  click classQAccelPlot_1_1PointCloudMaterial "../classQAccelPlot_1_1PointCloudMaterial/" "Open QAccelPlot::PointCloudMaterial"

  classQAccelPlot_1_1PointMaterial["QAccelPlot::PointMaterial"]
  classQAccelPlot_1_1DataTextureMaterial --> classQAccelPlot_1_1PointMaterial
  click classQAccelPlot_1_1PointMaterial "../classQAccelPlot_1_1PointMaterial/" "Open QAccelPlot::PointMaterial"

  classQAccelPlot_1_1RectMaterial["QAccelPlot::RectMaterial"]
  classQAccelPlot_1_1DataTextureMaterial --> classQAccelPlot_1_1RectMaterial
  click classQAccelPlot_1_1RectMaterial "../classQAccelPlot_1_1RectMaterial/" "Open QAccelPlot::RectMaterial"

  classQAccelPlot_1_1BarMaterial["QAccelPlot::BarMaterial"]
  classQAccelPlot_1_1RectMaterial --> classQAccelPlot_1_1BarMaterial
  click classQAccelPlot_1_1BarMaterial "../classQAccelPlot_1_1BarMaterial/" "Open QAccelPlot::BarMaterial"

Public Attributes

Type Name
QColor color = {Qt::blue}
Line/fill color uniform.
std::shared_ptr< DataTexture > dataTexture
Data texture sampled by the shader. Materials drawing the same samples may share one.
QVector2D domainMax = {1.0f, 1.0f}
Maximum data-space coordinate.
QVector2D domainMin = {0.0f, 0.0f}
Minimum data-space coordinate.
float logScaleX = {0.0f}
1.0 when the X axis uses log scale (float for std140 UBO compatibility).
float logScaleY = {0.0f}
1.0 when the Y axis uses log scale (float for std140 UBO compatibility).
float useVertexColor = {0.0f}
1.0 when per-vertex color overrides color (float for std140 UBO compatibility).
QVector2D viewportSize = {800.0f, 600.0f}
Viewport size in pixels.

Public Functions

Type Name
DataTextureMaterial ()
Constructs an empty DataTextureMaterial .
int compare (const QSGMaterial * other) override const
Compares shared uniform fields; delegates type-specific fields to compareExtra() .
QSGTexture * sampledTexture () const
Returns the texture the shader samples, or nullptr beforedataTexture holds an upload.
void uploadTexture (QQuickWindow * window, const float * data, int floatCount)
Uploads floatCount raw floats from__data intodataTexture , creating it when it isnullptr .
~DataTextureMaterial () override

Public Static Functions

Type Name
const QSGGeometry::AttributeSet & attributeSet ()
Returns the shared vertex attribute set: {float id, float param, uchar4 color} (12 bytes).
void commitTexture (QSGMaterialShader::RenderState & state, int binding, QSGTexture ** texture, const DataTexture * data)
Commits the texture of data to sampler__binding (call fromupdateSampledImage ). Does nothing before an upload.
const QSGGeometry::AttributeSet & vertexIndexAttributeSet ()
Returns the attribute set of marker quads: one ignored uchar4 placeholder (4 bytes).
bool writeCommonUniforms (char * buf, int bufSize, const QMatrix4x4 & matrix, const DataTextureMaterial * mat)
Writes the shared UBO prefix (transform + color + domain + flags) into buf .

Protected Functions

Type Name
virtual int compareExtra (const QSGMaterial * other) const
Subclass hook for compare() — called after the shared fields compare equal.

Detailed Description

Subclasses (LineMaterial, RectMaterial) extend the UBO (Uniform Buffer Object) with type-specific fields. The shared uniform block occupies the first 116 bytes of the std140 UBO:

** **

  • 0–63 mat4 transform matrix
  • 64–79 vec4 color
  • 80–87 vec2 domainMin
  • 88–95 vec2 domainMax
  • 96–103 vec2 viewportSize
  • 104–107 float logScaleX
  • 108–111 float logScaleY
  • 112–115 float useVertexColor

Public Attributes Documentation

variable color

Line/fill color uniform.

QColor QAccelPlot::DataTextureMaterial::color;


variable dataTexture

Data texture sampled by the shader. Materials drawing the same samples may share one.

std::shared_ptr<DataTexture> QAccelPlot::DataTextureMaterial::dataTexture;


variable domainMax

Maximum data-space coordinate.

QVector2D QAccelPlot::DataTextureMaterial::domainMax;


variable domainMin

Minimum data-space coordinate.

QVector2D QAccelPlot::DataTextureMaterial::domainMin;


variable logScaleX

1.0 when the X axis uses log scale (float for std140 UBO compatibility).

float QAccelPlot::DataTextureMaterial::logScaleX;


variable logScaleY

1.0 when the Y axis uses log scale (float for std140 UBO compatibility).

float QAccelPlot::DataTextureMaterial::logScaleY;


variable useVertexColor

1.0 when per-vertex color overrides color (float for std140 UBO compatibility).

float QAccelPlot::DataTextureMaterial::useVertexColor;


variable viewportSize

Viewport size in pixels.

QVector2D QAccelPlot::DataTextureMaterial::viewportSize;


Public Functions Documentation

function DataTextureMaterial

Constructs an empty DataTextureMaterial .

QAccelPlot::DataTextureMaterial::DataTextureMaterial () 


function compare

Compares shared uniform fields; delegates type-specific fields to compareExtra() .

int QAccelPlot::DataTextureMaterial::compare (
    const QSGMaterial * other
) override const


function sampledTexture

Returns the texture the shader samples, or nullptr beforedataTexture holds an upload.

QSGTexture * QAccelPlot::DataTextureMaterial::sampledTexture () const


function uploadTexture

Uploads floatCount raw floats from__data intodataTexture , creating it when it isnullptr .

void QAccelPlot::DataTextureMaterial::uploadTexture (
    QQuickWindow * window,
    const float * data,
    int floatCount
) 


function ~DataTextureMaterial

QAccelPlot::DataTextureMaterial::~DataTextureMaterial () override

Public Static Functions Documentation

function attributeSet

Returns the shared vertex attribute set: {float id, float param, uchar4 color} (12 bytes).

static const QSGGeometry::AttributeSet & QAccelPlot::DataTextureMaterial::attributeSet () 


function commitTexture

Commits the texture of data to sampler__binding (call fromupdateSampledImage ). Does nothing before an upload.

static void QAccelPlot::DataTextureMaterial::commitTexture (
    QSGMaterialShader::RenderState & state,
    int binding,
    QSGTexture ** texture,
    const DataTexture * data
) 


function vertexIndexAttributeSet

Returns the attribute set of marker quads: one ignored uchar4 placeholder (4 bytes).

static const QSGGeometry::AttributeSet & QAccelPlot::DataTextureMaterial::vertexIndexAttributeSet () 

The marker shaders derive the point index and quad corner from gl_VertexIndex.


function writeCommonUniforms

Writes the shared UBO prefix (transform + color + domain + flags) into buf .

static bool QAccelPlot::DataTextureMaterial::writeCommonUniforms (
    char * buf,
    int bufSize,
    const QMatrix4x4 & matrix,
    const DataTextureMaterial * mat
) 

Returns false only if bufSize is too small; always writes all fields otherwise.


Protected Functions Documentation

function compareExtra

Subclass hook for compare() — called after the shared fields compare equal.

virtual int QAccelPlot::DataTextureMaterial::compareExtra (
    const QSGMaterial * other
) const



The documentation for this class was generated from the following file QAccelPlot/src/QAccelPlot/materials/DataTextureMaterial.hpp