45 setShaderFileName(VertexStage, baseName +
QStringLiteral(
".vert.qsb"));
46 setShaderFileName(FragmentStage, baseName +
QStringLiteral(
".frag.qsb"));
72 float matrixScale = 0.0f;
73 if (
state.isMatrixDirty()) {
76 memcpy(
buf->data() +
offset,
m.constData(), 64);
80 memcpy(
buf->data() +
offset, &matrixScale, 4);
86 if (
state.isOpacityDirty()) {
87 const float opacity =
state.opacity();
88 memcpy(
buf->data() +
offset, &opacity, 4);
99 if (newNode ==
nullptr)
108 QVector4D oldStrokeColor = oldNode !=
nullptr
115 if (oldNode ==
nullptr || oldStrokeColor != newStrokeColor) {
116 memcpy(
buf->data() +
offset, &newStrokeColor, 16);
121 if (oldNode ==
nullptr
145 if (oldNode ==
nullptr || oldColor != newColor) {
146 memcpy(
buf->data() +
offset, &newColor, 16);
155 QVector2D oldGradientStart = oldNode !=
nullptr
159 if (newGradientStart != oldGradientStart || oldEffect ==
nullptr) {
160 memcpy(
buf->data() +
offset, &newGradientStart, 8);
166 QVector2D oldGradientEnd = oldNode!=
nullptr
170 if (newGradientEnd != oldGradientEnd || oldEffect ==
nullptr) {
171 memcpy(
buf->data() +
offset, &newGradientEnd, 8);
180 QVector2D oldFocalPoint = oldNode !=
nullptr
183 if (oldNode ==
nullptr || newFocalPoint != oldFocalPoint) {
184 memcpy(
buf->data() +
offset, &newFocalPoint, 8);
190 QVector2D oldCenterPoint = oldNode !=
nullptr
194 QVector2D newCenterToFocal = newCenterPoint - newFocalPoint;
195 QVector2D oldCenterToFocal = oldCenterPoint - oldFocalPoint;
196 if (oldNode ==
nullptr || newCenterToFocal != oldCenterToFocal) {
197 memcpy(
buf->data() +
offset, &newCenterToFocal, 8);
203 float oldCenterRadius = oldNode !=
nullptr
206 if (oldNode ==
nullptr || !
qFuzzyCompare(newCenterRadius, oldCenterRadius)) {
207 memcpy(
buf->data() +
offset, &newCenterRadius, 4);
213 float oldFocalRadius = oldNode !=
nullptr
216 if (oldNode ==
nullptr || !
qFuzzyCompare(newFocalRadius, oldFocalRadius)) {
217 memcpy(
buf->data() +
offset, &newFocalRadius, 4);
226 QVector2D oldFocalPoint = oldNode !=
nullptr
229 if (oldNode ==
nullptr || newFocalPoint != oldFocalPoint) {
230 memcpy(
buf->data() +
offset, &newFocalPoint, 8);
236 float oldAngle = oldNode !=
nullptr
239 if (oldNode ==
nullptr || !
qFuzzyCompare(newAngle, oldAngle)) {
241 memcpy(
buf->data() +
offset, &newAngle, 4);
271 if (
int d =
a->strokeColor().rgba() -
b->strokeColor().rgba())
275 if (
int d =
a->color().red() -
b->color().red())
277 if (
int d =
a->color().green() -
b->color().green())
279 if (
int d =
a->color().blue() -
b->color().blue())
281 if (
int d =
a->color().alpha() -
b->color().alpha())
287 if (
int d = ga.
a.
x() - gb.
a.
x())
289 if (
int d = ga.
a.
y() - gb.
a.
y())
291 if (
int d = ga.
b.
x() - gb.
b.
x())
293 if (
int d = ga.
b.
y() - gb.
b.
y())
296 if (
int d = ga.
v0 - gb.
v0)
298 if (
int d = ga.
v1 - gb.
v1)
310 if (
int d = ga.
stops[
i].second.rgba() - gb.
stops[
i].second.rgba())
324 if (
node()->hasStroke())
332 return new QQuickShapeCurveMaterialShader(
node()->gradientType(),
float greenF() const noexcept
Returns the green color component of this color.
float redF() const noexcept
Returns the red color component of this color.
float alphaF() const noexcept
Returns the alpha color component of this color.
float blueF() const noexcept
Returns the blue color component of this color.
qsizetype size() const noexcept
The QMatrix4x4 class represents a 4x4 transformation matrix in 3D space.
constexpr qreal x() const noexcept
Returns the x coordinate of this point.
constexpr qreal y() const noexcept
Returns the y coordinate of this point.
int compare(const QSGMaterial *other) const override
Compares this material to other and returns 0 if they are equal; -1 if this material should sort befo...
QQuickShapeCurveNode * node() const
QSGMaterialShader * createShader(QSGRendererInterface::RenderMode renderMode) const override
This function returns a new instance of a the QSGMaterialShader implementation used to render geometr...
QQuickShapeCurveMaterial(QQuickShapeCurveNode *node)
QSGMaterialType * type() const override
This function is called by the scene graph to query an identifier that is unique to the QSGMaterialSh...
QQuickAbstractPathRenderer::FillGradientType gradientType() const
QQuickAbstractPathRenderer::GradientDesc fillGradient() const
float strokeWidth() const
QColor strokeColor() const
QSGTexture * get(const QQuickShapeGradientCacheKey &grad)
static QQuickShapeGradientCache * cacheForRhi(QRhi *rhi)
Encapsulates the current rendering state during a call to QSGMaterialShader::updateUniformData() and ...
The QSGMaterialShader class represents a graphics API independent shader program.
The QSGMaterial class encapsulates rendering state for a shader program.
void setFlag(Flags flags, bool on=true)
Sets the flags flags on this material if on is true; otherwise clears the attribute.
RenderMode
\value RenderMode2D Normal 2D rendering \value RenderMode2DNoDepthBuffer Normal 2D rendering with dep...
virtual void commitTextureOperations(QRhi *rhi, QRhiResourceUpdateBatch *resourceUpdates)
Call this function to enqueue image upload operations to resourceUpdates, in case there are any pendi...
\macro QT_RESTRICTED_CAST_FROM_ASCII
The QVector2D class represents a vector or vertex in 2D space.
The QVector4D class represents a vector or vertex in 4D space.
Combined button and popup list for selecting options.
bool qFuzzyCompare(qfloat16 p1, qfloat16 p2) noexcept
qfloat16 qSqrt(qfloat16 f)
constexpr float qDegreesToRadians(float degrees)
constexpr T qAbs(const T &t)
GLboolean GLboolean GLboolean b
GLfloat GLfloat GLfloat w
[0]
GLboolean GLboolean GLboolean GLboolean a
[7]
GLenum GLuint GLenum GLsizei const GLchar * buf
GLenum GLuint GLintptr offset
#define QStringLiteral(str)
QQuickShapeGradient::SpreadMode spread
The QSGMaterialType class is used as a unique type token in combination with QSGMaterial.