Skip to content

Class QAccelPlot::Internal::RectVertexCache

ClassList > QAccelPlot > Internal > RectVertexCache

Vertices of a series that draws each rectangle as a quad positioned from a data texture. More...

  • #include <RectVertexCache.hpp>

Public Types

Type Name
typedef std::function< QColor(int index)> ColorFunction
Returns the color of rectangle index .

Public Static Attributes

Type Name
constexpr int kBytesPerRect = {72}
Size of the vertices of one rectangle in bytes.
constexpr int kVerticesPerRect = {6}
Number of vertices per rectangle.

Public Functions

Type Name
void copyTo (QSGGeometry & geometry) const
Reallocates geometry tovertexCount vertices and copies the vertices into it.
void invalidate () noexcept
Marks the vertices stale, keeping their allocation for the next rebuild.
void rebuild (int rectCount, const ColorFunction & colorAt)
Rebuilds the vertices of rectCount rectangles, keeping the allocation when it fits.
bool valid () noexcept const
Returns whether the vertices match the last rebuild.
int vertexCount () noexcept const
Returns the number of cached vertices.

Detailed Description

Each rectangle has 6 vertices (two triangles) in the DataTextureMaterial::attributeSet() layout: rectangle index, quad corner (0–5), and color. The vertices hold no coordinates, so only a rectangle count or color change requires a rebuild.

Public Types Documentation

typedef ColorFunction

Returns the color of rectangle index .

using QAccelPlot::Internal::RectVertexCache::ColorFunction =  std::function<QColor(int index)>;


Public Static Attributes Documentation

variable kBytesPerRect

Size of the vertices of one rectangle in bytes.

constexpr int QAccelPlot::Internal::RectVertexCache::kBytesPerRect;


variable kVerticesPerRect

Number of vertices per rectangle.

constexpr int QAccelPlot::Internal::RectVertexCache::kVerticesPerRect;


Public Functions Documentation

function copyTo

Reallocates geometry tovertexCount vertices and copies the vertices into it.

void QAccelPlot::Internal::RectVertexCache::copyTo (
    QSGGeometry & geometry
) const

geometry must use the DataTextureMaterial::attributeSet() layout.


function invalidate

Marks the vertices stale, keeping their allocation for the next rebuild.

void QAccelPlot::Internal::RectVertexCache::invalidate () noexcept


function rebuild

Rebuilds the vertices of rectCount rectangles, keeping the allocation when it fits.

void QAccelPlot::Internal::RectVertexCache::rebuild (
    int rectCount,
    const ColorFunction & colorAt
) 

Vertex colors come from colorAt, or are white when it is empty, e.g. when the shader uses a uniform color instead.


function valid

Returns whether the vertices match the last rebuild.

bool QAccelPlot::Internal::RectVertexCache::valid () noexcept const


function vertexCount

Returns the number of cached vertices.

int QAccelPlot::Internal::RectVertexCache::vertexCount () noexcept const



The documentation for this class was generated from the following file QAccelPlot/src/QAccelPlot/series/internal/RectVertexCache.hpp