6#include <QtQuick/private/qsgcontext_p.h>
7#include <private/qsgadaptationlayer_p.h>
8#include <private/qquickitem_p.h>
9#include <QtQuick/qsgnode.h>
10#include <QtQuick/qsgtexture.h>
12#include <QRandomGenerator>
15#include <private/qquicksprite_p.h>
16#include <private/qquickspriteengine_p.h>
17#include <QSGRendererInterface>
18#include <QtQuick/private/qsgplaintexture_p.h>
19#include <private/qqmlglobal_p.h>
20#include <QtQml/qqmlinfo.h>
21#include <QtCore/QtMath>
29#define UNIFORM_ARRAY_SIZE 64
67 const int shaderMatrixCount = newMaterial->viewCount();
68 const int matrixCount =
qMin(renderState.projectionMatrixCount(), shaderMatrixCount);
70 for (
int viewIndex = 0; viewIndex < matrixCount; ++viewIndex) {
71 if (renderState.isMatrixDirty()) {
72 const QMatrix4x4 m = renderState.combinedMatrix(viewIndex);
73 memcpy(
buf->data() + 64 * viewIndex,
m.constData(), 64);
77 if (renderState.isOpacityDirty()) {
78 const float opacity = renderState.opacity();
79 memcpy(
buf->data() + 64 * shaderMatrixCount, &opacity, 4);
85 memcpy(
buf->data() + 64 * shaderMatrixCount + 4, &
entry, 4);
87 float timestamp = float(
state->timestamp);
88 memcpy(
buf->data() + 64 * shaderMatrixCount + 8, ×tamp, 4);
90 float *
p =
reinterpret_cast<float *
>(
buf->data() + 64 * shaderMatrixCount + 16);
109 state->colorTable->commitTextureOperations(renderState.rhi(), renderState.resourceUpdateBatch());
111 }
else if (binding == 1) {
112 state->texture->commitTextureOperations(renderState.rhi(), renderState.resourceUpdateBatch());
149 const int shaderMatrixCount = newMaterial->viewCount();
150 const int matrixCount =
qMin(renderState.projectionMatrixCount(), shaderMatrixCount);
152 for (
int viewIndex = 0; viewIndex < matrixCount; ++viewIndex) {
153 if (renderState.isMatrixDirty()) {
154 const QMatrix4x4 m = renderState.combinedMatrix(viewIndex);
155 memcpy(
buf->data() + 64 * viewIndex,
m.constData(), 64);
159 if (renderState.isOpacityDirty()) {
160 const float opacity = renderState.opacity();
161 memcpy(
buf->data() + 64 * shaderMatrixCount, &opacity, 4);
167 memcpy(
buf->data() + 64 * shaderMatrixCount + 4, &
entry, 4);
169 float timestamp = float(
state->timestamp);
170 memcpy(
buf->data() + 64 * shaderMatrixCount + 8, ×tamp, 4);
180 state->texture->commitTextureOperations(renderState.rhi(), renderState.resourceUpdateBatch());
217 const int shaderMatrixCount = newMaterial->viewCount();
218 const int matrixCount =
qMin(renderState.projectionMatrixCount(), shaderMatrixCount);
220 for (
int viewIndex = 0; viewIndex < matrixCount; ++viewIndex) {
221 if (renderState.isMatrixDirty()) {
222 const QMatrix4x4 m = renderState.combinedMatrix(viewIndex);
223 memcpy(
buf->data() + 64 * viewIndex,
m.constData(), 64);
227 if (renderState.isOpacityDirty()) {
228 const float opacity = renderState.opacity();
229 memcpy(
buf->data() + 64 * shaderMatrixCount, &opacity, 4);
235 memcpy(
buf->data() + 64 * shaderMatrixCount + 4, &
entry, 4);
237 float timestamp = float(
state->timestamp);
238 memcpy(
buf->data() + 64 * shaderMatrixCount + 8, ×tamp, 4);
240 float *
p =
reinterpret_cast<float *
>(
buf->data() + 64 * shaderMatrixCount + 16);
259 state->colorTable->commitTextureOperations(renderState.rhi(), renderState.resourceUpdateBatch());
261 }
else if (binding == 1) {
262 state->texture->commitTextureOperations(renderState.rhi(), renderState.resourceUpdateBatch());
299 const int shaderMatrixCount = newMaterial->viewCount();
300 const int matrixCount =
qMin(renderState.projectionMatrixCount(), shaderMatrixCount);
302 for (
int viewIndex = 0; viewIndex < matrixCount; ++viewIndex) {
303 if (renderState.isMatrixDirty()) {
304 const QMatrix4x4 m = renderState.combinedMatrix(viewIndex);
305 memcpy(
buf->data() + 64 * viewIndex,
m.constData(), 64);
309 if (renderState.isOpacityDirty()) {
310 const float opacity = renderState.opacity();
311 memcpy(
buf->data() + 64 * shaderMatrixCount, &opacity, 4);
317 memcpy(
buf->data() + 64 * shaderMatrixCount + 4, &
entry, 4);
319 float timestamp = float(
state->timestamp);
320 memcpy(
buf->data() + 64 * shaderMatrixCount + 8, ×tamp, 4);
323 memcpy(
buf->data() + 64 * shaderMatrixCount + 12, &
dpr, 4);
333 state->texture->commitTextureOperations(renderState.rhi(), renderState.resourceUpdateBatch());
399 const int shaderMatrixCount = newMaterial->viewCount();
400 const int matrixCount =
qMin(renderState.projectionMatrixCount(), shaderMatrixCount);
402 for (
int viewIndex = 0; viewIndex < matrixCount; ++viewIndex) {
403 if (renderState.isMatrixDirty()) {
404 const QMatrix4x4 m = renderState.combinedMatrix(viewIndex);
405 memcpy(
buf->data() + 64 * viewIndex,
m.constData(), 64);
409 if (renderState.isOpacityDirty()) {
410 const float opacity = renderState.opacity();
411 memcpy(
buf->data() + 64 * shaderMatrixCount, &opacity, 4);
417 memcpy(
buf->data() + 64 * shaderMatrixCount + 4, &
entry, 4);
419 float timestamp = float(
state->timestamp);
420 memcpy(
buf->data() + 64 * shaderMatrixCount + 8, ×tamp, 4);
423 memcpy(
buf->data() + 64 * shaderMatrixCount + 12, &
dpr, 4);
433 state->texture->commitTextureOperations(renderState.rhi(), renderState.resourceUpdateBatch());
702 , m_color_variation(0.0)
705 , m_alphaVariation(0.0)
707 , m_redVariation(0.0)
708 , m_greenVariation(0.0)
709 , m_blueVariation(0.0)
711 , m_rotationVariation(0)
712 , m_rotationVelocity(0)
713 , m_rotationVelocityVariation(0)
714 , m_autoRotation(
false)
718 , m_spritesInterpolate(true)
719 , m_explicitColor(
false)
720 , m_explicitRotation(
false)
721 , m_explicitDeformation(
false)
722 , m_explicitAnimation(
false)
723 , m_bypassOptimizations(
false)
727 , m_entryEffect(Fade)
728 , m_startedImageLoading(0)
730 , m_apiChecked(
false)
732 , m_previousActive(
false)
744 return QQmlListProperty<QQuickSprite>(
this, &m_sprites,
752 m_material =
nullptr;
753 delete m_outgoingNode;
754 m_outgoingNode =
nullptr;
755 m_apiChecked =
false;
760 if (
image.isEmpty()){
769 m_image.
reset(
new ImageData);
770 if (
image == m_image->source)
772 m_image->source =
image;
780 if (
table.isEmpty()){
782 m_colorTable.
reset();
789 m_colorTable.
reset(
new ImageData);
790 if (
table == m_colorTable->source)
792 m_colorTable->source =
table;
799 if (
table.isEmpty()){
808 m_sizeTable.
reset(
new ImageData);
809 if (
table == m_sizeTable->source)
811 m_sizeTable->source =
table;
818 if (
table.isEmpty()){
819 if (m_opacityTable) {
820 m_opacityTable.
reset();
827 m_opacityTable.
reset(
new ImageData);
828 if (
table == m_opacityTable->source)
830 m_opacityTable->source =
table;
837 if (
color == m_color)
841 m_explicitColor =
true;
847 if (
var == m_color_variation)
849 m_color_variation =
var;
851 m_explicitColor =
true;
857 if (m_alphaVariation !=
arg) {
858 m_alphaVariation =
arg;
861 m_explicitColor =
true;
867 if (m_alpha !=
arg) {
871 m_explicitColor =
true;
877 if (m_redVariation !=
arg) {
878 m_redVariation =
arg;
881 m_explicitColor =
true;
887 if (m_greenVariation !=
arg) {
888 m_greenVariation =
arg;
891 m_explicitColor =
true;
897 if (m_blueVariation !=
arg) {
898 m_blueVariation =
arg;
901 m_explicitColor =
true;
907 if (m_rotation !=
arg) {
911 m_explicitRotation =
true;
917 if (m_rotationVariation !=
arg) {
918 m_rotationVariation =
arg;
921 m_explicitRotation =
true;
927 if (m_rotationVelocity !=
arg) {
928 m_rotationVelocity =
arg;
931 m_explicitRotation =
true;
937 if (m_rotationVelocityVariation !=
arg) {
938 m_rotationVelocityVariation =
arg;
941 m_explicitRotation =
true;
947 if (m_autoRotation !=
arg) {
948 m_autoRotation =
arg;
951 m_explicitRotation =
true;
957 if (m_xVector !=
arg) {
961 m_explicitDeformation =
true;
967 if (m_yVector !=
arg) {
971 m_explicitDeformation =
true;
977 if (m_spritesInterpolate !=
arg) {
978 m_spritesInterpolate =
arg;
985 if (m_bypassOptimizations !=
arg) {
986 m_bypassOptimizations =
arg;
995 if (m_entryEffect !=
arg) {
998 getState(m_material)->
entry = (
qreal) m_entryEffect;
1005 m_explicitColor =
false;
1008 if (
d->colorOwner ==
this) {
1009 d->colorOwner =
nullptr;
1014 m_color_variation = 0.0f;
1015 m_redVariation = 0.0f;
1016 m_blueVariation = 0.0f;
1017 m_greenVariation = 0.0f;
1019 m_alphaVariation = 0.0f;
1024 m_explicitRotation =
false;
1027 if (
d->rotationOwner ==
this) {
1028 d->rotationOwner =
nullptr;
1033 m_rotationVariation = 0;
1034 m_rotationVelocity = 0;
1035 m_rotationVelocityVariation = 0;
1036 m_autoRotation =
false;
1041 m_explicitDeformation =
false;
1044 if (
d->deformationOwner ==
this) {
1045 d->deformationOwner =
nullptr;
1053 m_xVector =
nullptr;
1054 m_yVector =
nullptr;
1065void QQuickImageParticle::invalidateSceneGraph()
1070void QQuickImageParticle::createEngine()
1073 delete m_spriteEngine;
1074 if (m_sprites.
size()) {
1078 m_explicitAnimation =
true;
1080 m_spriteEngine =
nullptr;
1081 m_explicitAnimation =
false;
1095 ( 2 + 4 + 4 ) *
sizeof(
float),
1109 ( 2 + 4 + 4 ) *
sizeof(
float) + 4 *
sizeof(
uchar),
1124 ( 2 + 4 + 4 ) *
sizeof(
float) + (4 + 4) *
sizeof(
uchar),
1140 (4 + 4 + 4 + 4) *
sizeof(
float) + (4 + 4) *
sizeof(
uchar),
1158 (4 + 4 + 4 + 4 + 3 + 3) *
sizeof(
float) + (4 + 4) *
sizeof(
uchar),
1162void QQuickImageParticle::clearShadows()
1164 foreach (
const QVector<QQuickParticleData*>
data, m_shadowData)
1166 m_shadowData.clear();
1175 if (!m_shadowData.contains(datum->
groupId)) {
1177 QVector<QQuickParticleData*>
data;
1178 const int gdSize = gd->
size();
1179 data.reserve(gdSize);
1180 for (
int i = 0;
i < gdSize;
i++) {
1182 *datum = *(gd->data[
i]);
1192void QQuickImageParticle::checkPerfLevel(PerformanceLevel
level)
1194 if (m_targetPerfLevel <
level) {
1195 m_targetPerfLevel =
level;
1200bool QQuickImageParticle::loadingSomething()
1202 return (m_image && m_image->pix.
isLoading())
1203 || (m_colorTable && m_colorTable->pix.
isLoading())
1204 || (m_sizeTable && m_sizeTable->pix.
isLoading())
1205 || (m_opacityTable && m_opacityTable->pix.
isLoading())
1206 || (m_spriteEngine && m_spriteEngine->
isLoading());
1209void QQuickImageParticle::mainThreadFetchImageData()
1213 const auto loadPix = [&](ImageData *
image) {
1223 m_image->pix.
clear(
this);
1224 loadPix(m_image.
get());
1231 loadPix(m_colorTable.
get());
1234 loadPix(m_sizeTable.
get());
1237 loadPix(m_opacityTable.
get());
1239 m_startedImageLoading = 2;
1246 if (*passThrough || loadingSomething())
1249 if (m_startedImageLoading == 0) {
1250 m_startedImageLoading = 1;
1252 QQuickImageParticle::staticMetaObject.invokeMethod(
this,
"mainThreadFetchImageData",
Qt::QueuedConnection);
1253 }
else if (m_startedImageLoading == 2) {
1254 finishBuildParticleNodes(passThrough);
1260void QQuickImageParticle::finishBuildParticleNodes(
QSGNode** node)
1267 qmlInfo(
this) <<
"ImageParticle: Too many particles - maximum 16383 per ImageParticle";
1276 if (m_sprites.
size() || m_bypassOptimizations) {
1278 }
else if (m_colorTable || m_sizeTable || m_opacityTable) {
1280 }
else if (m_autoRotation || m_rotation || m_rotationVariation
1281 || m_rotationVelocity || m_rotationVelocityVariation
1282 || m_xVector || m_yVector) {
1284 }
else if (m_alphaVariation || m_alpha != 1.0 || m_color.
isValid() || m_color_variation
1285 || m_redVariation || m_blueVariation || m_greenVariation) {
1296 if (
other->perfLevel > perfLevel) {
1301 perfLevel =
other->perfLevel;
1303 }
else if (
other->perfLevel < perfLevel) {
1319 m_targetPerfLevel = perfLevel;
1323 m_material =
nullptr;
1330 bool imageLoaded =
false;
1331 switch (perfLevel) {
1334 if (!m_spriteEngine) {
1335 qWarning() <<
"ImageParticle: No sprite engine...";
1359 if (m_colorTable->pix.
isReady())
1362 qmlWarning(
this) <<
"Error loading color table: " << m_colorTable->pix.
error();
1366 if (m_sizeTable->pix.
isReady())
1369 qmlWarning(
this) <<
"Error loading size table: " << m_sizeTable->pix.
error();
1372 if (m_opacityTable) {
1373 if (m_opacityTable->pix.
isReady())
1376 qmlWarning(
this) <<
"Error loading opacity table: " << m_opacityTable->pix.
error();
1413 if (!m_image || !m_image->pix.
isReady()) {
1438 m_nodes.
insert(groupId, node);
1439 m_idxStarts.
insert(groupId, m_lastIdxStart);
1441 m_lastIdxStart +=
count;
1444 int vCount =
count * 4;
1445 int iCount =
count * 6;
1450 else if (perfLevel ==
Tabled)
1454 else if (perfLevel ==
Colored)
1466 qDebug(
"Using point sprites");
1475 initTexCoords<SpriteVertex>((
SpriteVertex*)
g->vertexData(), vCount);
1476 else if (perfLevel ==
Tabled)
1480 else if (perfLevel ==
Colored)
1481 initTexCoords<ColoredVertex>((
ColoredVertex*)
g->vertexData(), vCount);
1502 if (node == *(m_nodes.
begin()))
1505 (*(m_nodes.
begin()))->appendChildNode(node);
1508 *node = *(m_nodes.
begin());
1515 m_apiChecked =
true;
1526 if (!node && !isRhi)
1534 if (isRhi && !m_rhi) {
1535 qWarning(
"Failed to query QRhi, particles disabled");
1546 delete m_outgoingNode;
1547 m_outgoingNode = node;
1552 m_idxStarts.
clear();
1553 m_startsIdx.
clear();
1556 m_material =
nullptr;
1559 m_startedImageLoading = 0;
1560 }
else if (!m_material) {
1573 }
else if (m_startedImageLoading < 2) {
1579 node = m_outgoingNode;
1580 m_outgoingNode =
nullptr;
1588 if (*node ==
nullptr){
1591 qDebug() <<
"QQuickImageParticle Feature level: " << perfLevel;
1592 qDebug() <<
"QQuickImageParticle Nodes: ";
1601 if (*node ==
nullptr)
1613 spritesUpdate(
time);
1625 bool active =
false;
1633 const bool dirty = active || m_previousActive;
1639 m_previousActive = active;
1643void QQuickImageParticle::spritesUpdate(
qreal time)
1654 QQuickParticleData* datum = (mainDatum->animationOwner ==
this ? mainDatum : getShadowDatum(mainDatum));
1656 for (
int i = 0;
i<m_startsIdx.
size();
i++) {
1657 if (m_startsIdx[
i].second == groupId){
1669 if (m_spritesInterpolate)
1670 progress = std::modf(
frame,&frameAt);
1672 std::modf(
frame,&frameAt);
1677 m_spriteEngine->
advance(spriteIdx);
1694 spriteVertices += datum->
index*4;
1695 for (
int i=0;
i<4;
i++) {
1696 spriteVertices[
i].animX1 =
x1;
1697 spriteVertices[
i].animY1 =
y;
1698 spriteVertices[
i].animX2 =
x2;
1699 spriteVertices[
i].animW =
w;
1700 spriteVertices[
i].animH =
h;
1701 spriteVertices[
i].animProgress = progress;
1707void QQuickImageParticle::spriteAdvance(
int spriteIdx)
1709 if (!m_startsIdx.
size())
1714 for (
i = 0;
i<m_startsIdx.
size();
i++) {
1715 if (spriteIdx < m_startsIdx[
i].
first) {
1716 gIdx = m_startsIdx[
i-1].second;
1721 gIdx = m_startsIdx[
i-1].second;
1722 int pIdx = spriteIdx - m_startsIdx[
i-1].
first;
1725 QQuickParticleData* datum = (mainDatum->animationOwner ==
this ? mainDatum : getShadowDatum(mainDatum));
1745 if (m_spriteEngine) {
1746 spriteIdx = m_idxStarts[gIdx] + datum->
index;
1747 if (spriteIdx >= m_spriteEngine->
count())
1748 m_spriteEngine->
setCount(spriteIdx+1);
1757 if (m_explicitAnimation && m_spriteEngine){
1761 writeTo->
animT = writeTo->
t;
1763 if (m_spriteEngine){
1764 m_spriteEngine->
start(spriteIdx);
1777 writeTo->
animT = datum->
t;
1791 if (m_explicitDeformation){
1797 datum->
xx =
ret.x();
1798 datum->
xy =
ret.y();
1801 shadow->
xx =
ret.x();
1802 shadow->
xy =
ret.y();
1808 datum->
yx =
ret.x();
1809 datum->
yy =
ret.y();
1812 shadow->
yx =
ret.x();
1813 shadow->
yy =
ret.y();
1818 if (m_explicitRotation){
1822 m_rotation + (m_rotationVariation
1826 + (m_rotationVelocityVariation
1828 autoRotate = m_autoRotation ? 1 : 0;
1846 if (m_explicitColor) {
1849 const auto rgbColor = m_color.
toRgb();
1880 spriteVertices += pIdx*4;
1881 for (
int i=0;
i<4;
i++){
1884 spriteVertices[
i].t = datum->
t;
1885 spriteVertices[
i].lifeSpan = datum->
lifeSpan;
1886 spriteVertices[
i].size = datum->
size;
1887 spriteVertices[
i].endSize = datum->
endSize;
1888 spriteVertices[
i].vx = datum->
vx;
1889 spriteVertices[
i].vy = datum->
vy;
1890 spriteVertices[
i].ax = datum->
ax;
1891 spriteVertices[
i].ay = datum->
ay;
1894 spriteVertices[
i].xx = shadow->
xx;
1895 spriteVertices[
i].xy = shadow->
xy;
1896 spriteVertices[
i].yx = shadow->
yx;
1897 spriteVertices[
i].yy = shadow->
yy;
1899 spriteVertices[
i].xx = datum->
xx;
1900 spriteVertices[
i].xy = datum->
xy;
1901 spriteVertices[
i].yx = datum->
yx;
1902 spriteVertices[
i].yy = datum->
yy;
1906 spriteVertices[
i].rotation = shadow->
rotation;
1908 spriteVertices[
i].autoRotate = shadow->
autoRotate;
1910 spriteVertices[
i].rotation = datum->
rotation;
1915 if (m_explicitColor && datum->
colorOwner !=
this) {
1917 spriteVertices[
i].color = shadow->
color;
1919 spriteVertices[
i].color = datum->
color;
1925 deformableVertices += pIdx*4;
1926 for (
int i=0;
i<4;
i++){
1929 deformableVertices[
i].t = datum->
t;
1930 deformableVertices[
i].lifeSpan = datum->
lifeSpan;
1931 deformableVertices[
i].size = datum->
size;
1932 deformableVertices[
i].endSize = datum->
endSize;
1933 deformableVertices[
i].vx = datum->
vx;
1934 deformableVertices[
i].vy = datum->
vy;
1935 deformableVertices[
i].ax = datum->
ax;
1936 deformableVertices[
i].ay = datum->
ay;
1939 deformableVertices[
i].xx = shadow->
xx;
1940 deformableVertices[
i].xy = shadow->
xy;
1941 deformableVertices[
i].yx = shadow->
yx;
1942 deformableVertices[
i].yy = shadow->
yy;
1944 deformableVertices[
i].xx = datum->
xx;
1945 deformableVertices[
i].xy = datum->
xy;
1946 deformableVertices[
i].yx = datum->
yx;
1947 deformableVertices[
i].yy = datum->
yy;
1951 deformableVertices[
i].rotation = shadow->
rotation;
1953 deformableVertices[
i].autoRotate = shadow->
autoRotate;
1955 deformableVertices[
i].rotation = datum->
rotation;
1957 deformableVertices[
i].autoRotate = datum->
autoRotate;
1959 if (m_explicitColor && datum->
colorOwner !=
this) {
1961 deformableVertices[
i].color = shadow->
color;
1963 deformableVertices[
i].color = datum->
color;
1968 coloredVertices += pIdx*4;
1969 for (
int i=0;
i<4;
i++){
1972 coloredVertices[
i].t = datum->
t;
1973 coloredVertices[
i].lifeSpan = datum->
lifeSpan;
1974 coloredVertices[
i].size = datum->
size;
1975 coloredVertices[
i].endSize = datum->
endSize;
1976 coloredVertices[
i].vx = datum->
vx;
1977 coloredVertices[
i].vy = datum->
vy;
1978 coloredVertices[
i].ax = datum->
ax;
1979 coloredVertices[
i].ay = datum->
ay;
1980 if (m_explicitColor && datum->
colorOwner !=
this) {
1982 coloredVertices[
i].color = shadow->
color;
1984 coloredVertices[
i].color = datum->
color;
1989 coloredPointVertices += pIdx*1;
1990 for (
int i=0;
i<1;
i++){
1993 coloredPointVertices[
i].t = datum->
t;
1994 coloredPointVertices[
i].lifeSpan = datum->
lifeSpan;
1995 coloredPointVertices[
i].size = datum->
size;
1996 coloredPointVertices[
i].endSize = datum->
endSize;
1997 coloredPointVertices[
i].vx = datum->
vx;
1998 coloredPointVertices[
i].vy = datum->
vy;
1999 coloredPointVertices[
i].ax = datum->
ax;
2000 coloredPointVertices[
i].ay = datum->
ay;
2001 if (m_explicitColor && datum->
colorOwner !=
this) {
2003 coloredPointVertices[
i].color = shadow->
color;
2005 coloredPointVertices[
i].color = datum->
color;
2010 simplePointVertices += pIdx*1;
2011 for (
int i=0;
i<1;
i++){
2014 simplePointVertices[
i].t = datum->
t;
2015 simplePointVertices[
i].lifeSpan = datum->
lifeSpan;
2016 simplePointVertices[
i].size = datum->
size;
2017 simplePointVertices[
i].endSize = datum->
endSize;
2018 simplePointVertices[
i].vx = datum->
vx;
2019 simplePointVertices[
i].vy = datum->
vy;
2020 simplePointVertices[
i].ax = datum->
ax;
2021 simplePointVertices[
i].ay = datum->
ay;
2033#include "moc_qquickimageparticle_p.cpp"
ColoredMaterialRhiShader(int viewCount)
QSGMaterialShader * createShader(QSGRendererInterface::RenderMode renderMode) const override
This function returns a new instance of a the QSGMaterialShader implementation used to render geometr...
ImageMaterialData * state() override
QSGMaterialType * type() const override
This function is called by the scene graph to query an identifier that is unique to the QSGMaterialSh...
ColoredPointMaterialRhiShader(int viewCount)
void updateSampledImage(RenderState &renderState, int binding, QSGTexture **texture, QSGMaterial *newMaterial, QSGMaterial *) override
This function is called by the scene graph to prepare use of sampled images in the shader,...
bool updateUniformData(RenderState &renderState, QSGMaterial *newMaterial, QSGMaterial *) override
This function is called by the scene graph to get the contents of the shader program's uniform buffer...
QSGMaterialShader * createShader(QSGRendererInterface::RenderMode renderMode) const override
This function returns a new instance of a the QSGMaterialShader implementation used to render geometr...
ImageMaterialData * state() override
QSGMaterialType * type() const override
This function is called by the scene graph to query an identifier that is unique to the QSGMaterialSh...
float opacityTable[UNIFORM_ARRAY_SIZE]
float sizeTable[UNIFORM_ARRAY_SIZE]
bool updateUniformData(RenderState &renderState, QSGMaterial *newMaterial, QSGMaterial *) override
This function is called by the scene graph to get the contents of the shader program's uniform buffer...
void updateSampledImage(RenderState &renderState, int binding, QSGTexture **texture, QSGMaterial *newMaterial, QSGMaterial *) override
This function is called by the scene graph to prepare use of sampled images in the shader,...
ParticleSpriteMaterialRhiShader(int viewCount)
The QColor class provides colors based on RGB, HSV or CMYK values.
QColor toRgb() const noexcept
Create and returns an RGB QColor based on this color.
int red() const noexcept
Returns the red color component of this color.
bool isValid() const noexcept
Returns true if the color is valid; otherwise returns false.
key_iterator keyEnd() const noexcept
iterator begin()
Returns an \l{STL-style iterators}{STL-style iterator} pointing to the first item in the hash.
key_iterator keyBegin() const noexcept
void clear() noexcept(std::is_nothrow_destructible< Node >::value)
Removes all items from the hash and frees up all memory used by it.
iterator insert(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
QImage scaled(int w, int h, Qt::AspectRatioMode aspectMode=Qt::IgnoreAspectRatio, Qt::TransformationMode mode=Qt::FastTransformation) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
QRgb pixel(int x, int y) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
@ Format_ARGB32_Premultiplied
qsizetype size() const noexcept
void append(parameter_type t)
The QMatrix4x4 class represents a 4x4 transformation matrix in 3D space.
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
\inmodule QtCore\reentrant
constexpr qreal x() const noexcept
Returns the x coordinate of this point.
constexpr qreal y() const noexcept
Returns the y coordinate of this point.
The QQmlContext class defines a context within a QML engine.
The QQmlEngine class provides an environment for instantiating QML components.
virtual QPointF sample(const QPointF &from)
void sceneGraphInvalidated() override
QQmlListProperty< QQuickSprite > sprites
void setYVector(QQuickDirection *arg)
void setColortable(const QUrl &table)
void rotationVelocityChanged(qreal arg)
void setSizetable(const QUrl &table)
QSGNode * updatePaintNode(QSGNode *, UpdatePaintNodeData *) override
Called on the render thread when it is time to sync the state of the item with the scene graph.
void blueVariationChanged(qreal arg)
QQuickImageParticle(QQuickItem *parent=nullptr)
\qmltype ImageParticle \instantiates QQuickImageParticle \inqmlmodule QtQuick.Particles \inherits Par...
void xVectorChanged(QQuickDirection *arg)
void greenVariationChanged(qreal arg)
void setSpritesInterpolate(bool arg)
void buildParticleNodes(QSGNode **)
void setXVector(QQuickDirection *arg)
void setColorVariation(qreal var)
virtual ~QQuickImageParticle()
void setRotation(qreal arg)
void bypassOptimizationsChanged(bool arg)
void setRotationVelocityVariation(qreal arg)
void setAutoRotation(bool arg)
void rotationVariationChanged(qreal arg)
void initialize(int gIdx, int pIdx) override
void spritesInterpolateChanged(bool arg)
void setColor(const QColor &color)
bool prepareNextFrame(QSGNode **)
void setRedVariation(qreal arg)
void alphaVariationChanged(qreal arg)
void setBypassOptimizations(bool arg)
void entryEffectChanged(EntryEffect arg)
void setRotationVelocity(qreal arg)
void redVariationChanged(qreal arg)
void alphaChanged(qreal arg)
void setRotationVariation(qreal arg)
void yVectorChanged(QQuickDirection *arg)
QUrl opacitytable() const
void setOpacitytable(const QUrl &table)
void commit(int gIdx, int pIdx) override
void setBlueVariation(qreal arg)
void setGreenVariation(qreal arg)
void opacitytableChanged()
void autoRotationChanged(bool arg)
void setImage(const QUrl &image)
void setEntryEffect(EntryEffect arg)
void setAlphaVariation(qreal arg)
void colorVariationChanged()
void rotationVelocityVariationChanged(qreal arg)
static QQuickItemPrivate * get(QQuickItem *item)
The QQuickItem class provides the most basic of all visual items in \l {Qt Quick}.
void setFlag(Flag flag, bool enabled=true)
Enables the specified flag for this item if enabled is true; if enabled is false, the flag is disable...
QString state() const
\qmlproperty string QtQuick::Item::state
qreal y
Defines the item's y position relative to its parent.
void update()
Schedules a call to updatePaintNode() for this item.
QQuickImageParticle * deformationOwner
QQuickImageParticle * colorOwner
QQuickParticleGroupData::ID groupId
QQuickImageParticle * animationOwner
QQuickImageParticle * rotationOwner
const GroupIDs & groupIds() const
QQuickParticleSystem * m_system
QVarLengthArray< QQuickParticleGroupData *, 32 > groupData
int systemSync(QQuickParticlePainter *p)
int spriteDuration(int sprite=0) const
QQuickSprite * sprite(int sprite=0) const
int spriteFrames(int sprite=0) const
int spriteStart(int sprite=0) const
int spriteX(int sprite=0) const
void advance(int index=0) override
void startAssemblingImage()
int spriteState(int sprite=0) const
int spriteHeight(int sprite=0) const
int spriteWidth(int sprite=0) const
int spriteY(int sprite=0) const
QImage assembledImage(int maxSize=2048)
void stateChanged(int idx)
void start(int index=0, int state=0)
uint updateSprites(uint time)
static Q_DECL_CONST_FUNCTION QRandomGenerator * global()
\threadsafe
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
const QSGGeometry * geometry() const
Returns this node's geometry.
void setGeometry(QSGGeometry *geometry)
Sets the geometry of this node to geometry.
virtual QSGRendererInterface * rendererInterface(QSGRenderContext *renderContext)
Returns a pointer to the (presumably) global renderer interface.
The QSGGeometryNode class is used for all rendered content in the scene graph.
void setMaterial(QSGMaterial *material)
Sets the material of this geometry node to material.
The QSGGeometry class provides low-level storage for graphics primitives in the \l{Qt Quick Scene Gra...
void * vertexData()
Returns a pointer to the raw vertex data of this geometry object.
Encapsulates the current rendering state during a call to QSGMaterialShader::updateUniformData() and ...
The QSGMaterialShader class represents a graphics API independent shader program.
void setShaderFileName(Stage stage, const QString &filename)
Sets the filename for the shader for the specified stage.
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.
\group qtquick-scenegraph-nodes \title Qt Quick Scene Graph Node classes
void markDirty(DirtyState bits)
Notifies all connected renderers that the node has dirty bits.
void setFlag(Flag, bool=true)
Sets the flag f on this node if enabled is true; otherwise clears the flag.
static QSGPlainTexture * fromImage(const QImage &image)
QSGContext * sceneGraphContext() const
An interface providing access to some of the graphics API specific internals of the scenegraph.
RenderMode
\value RenderMode2D Normal 2D rendering \value RenderMode2DNoDepthBuffer Normal 2D rendering with dep...
static bool isApiRhiBased(GraphicsApi api)
GraphicsApi
\value Unknown An unknown graphics API is in use \value Software The Qt Quick 2D Renderer is in use \...
void reset(T *other=nullptr) noexcept(noexcept(Cleanup::cleanup(std::declval< T * >())))
Deletes the existing object it is pointing to (if any), and sets its pointer to other.
constexpr size_type size() const noexcept
bool updateUniformData(RenderState &renderState, QSGMaterial *newMaterial, QSGMaterial *) override
This function is called by the scene graph to get the contents of the shader program's uniform buffer...
SimplePointMaterialRhiShader(int viewCount)
void updateSampledImage(RenderState &renderState, int binding, QSGTexture **texture, QSGMaterial *newMaterial, QSGMaterial *) override
This function is called by the scene graph to prepare use of sampled images in the shader,...
QSGMaterialShader * createShader(QSGRendererInterface::RenderMode renderMode) const override
This function returns a new instance of a the QSGMaterialShader implementation used to render geometr...
QSGMaterialType * type() const override
This function is called by the scene graph to query an identifier that is unique to the QSGMaterialSh...
ImageMaterialData * state() override
QSGMaterialType * type() const override
This function is called by the scene graph to query an identifier that is unique to the QSGMaterialSh...
QSGMaterialShader * createShader(QSGRendererInterface::RenderMode renderMode) const override
This function returns a new instance of a the QSGMaterialShader implementation used to render geometr...
ImageMaterialData * state() override
bool updateUniformData(RenderState &renderState, QSGMaterial *newMaterial, QSGMaterial *) override
This function is called by the scene graph to get the contents of the shader program's uniform buffer...
void updateSampledImage(RenderState &renderState, int binding, QSGTexture **texture, QSGMaterial *newMaterial, QSGMaterial *) override
This function is called by the scene graph to prepare use of sampled images in the shader,...
TabledMaterialRhiShader(int viewCount)
QSGMaterialShader * createShader(QSGRendererInterface::RenderMode renderMode) const override
This function returns a new instance of a the QSGMaterialShader implementation used to render geometr...
ImageMaterialData * state() override
QSGMaterialType * type() const override
This function is called by the scene graph to query an identifier that is unique to the QSGMaterialSh...
qDeleteAll(list.begin(), list.end())
QSet< QString >::iterator it
Combined button and popup list for selecting options.
constexpr float qDegreesToRadians(float degrees)
constexpr const T & qMin(const T &a, const T &b)
constexpr const T & qBound(const T &min, const T &val, const T &max)
GLenum GLuint GLint level
GLfloat GLfloat GLfloat w
[0]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLuint GLfloat GLfloat GLfloat x1
GLenum GLenum GLsizei count
GLint GLint GLint GLint GLsizei GLsizei GLsizei GLboolean commit
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLenum GLuint GLenum GLsizei const GLchar * buf
GLsizei GLenum const void * indices
GLfloat GLfloat GLfloat GLfloat h
GLenum GLenum GLsizei void * table
QT_BEGIN_NAMESPACE constexpr decltype(auto) qMakePair(T1 &&value1, T2 &&value2) noexcept(noexcept(std::make_pair(std::forward< T1 >(value1), std::forward< T2 >(value2))))
QQmlContext * qmlContext(const QObject *obj)
Q_QML_EXPORT QQmlInfo qmlInfo(const QObject *me)
Q_QML_EXPORT QQmlInfo qmlWarning(const QObject *me)
static QT_BEGIN_NAMESPACE qreal dpr(const QWindow *w)
static QSGGeometry::Attribute DeformableParticle_Attributes[]
static QSGGeometry::AttributeSet SpriteParticle_AttributeSet
void fillUniformArrayFromImage(float *array, const QImage &img, int size)
static QSGGeometry::Attribute SpriteParticle_Attributes[]
#define UNIFORM_ARRAY_SIZE
static QSGGeometry::AttributeSet SimplePointParticle_AttributeSet
static QSGGeometry::Attribute ColoredParticle_Attributes[]
static QSGGeometry::AttributeSet DeformableParticle_AttributeSet
static QSGGeometry::AttributeSet ColoredParticle_AttributeSet
static QSGGeometry::Attribute ColoredPointParticle_Attributes[]
static QSGGeometry::AttributeSet ColoredPointParticle_AttributeSet
static QSGGeometry::Attribute SimplePointParticle_Attributes[]
void spriteReplace(QQmlListProperty< QQuickSprite > *p, qsizetype idx, QQuickSprite *s)
void spriteAppend(QQmlListProperty< QQuickSprite > *p, QQuickSprite *s)
void spriteRemoveLast(QQmlListProperty< QQuickSprite > *p)
qsizetype spriteCount(QQmlListProperty< QQuickSprite > *p)
QQuickSprite * spriteAt(QQmlListProperty< QQuickSprite > *p, qsizetype idx)
void spriteClear(QQmlListProperty< QQuickSprite > *p)
constexpr int qAlpha(QRgb rgb)
#define QStringLiteral(str)
QImage scaled(const QImage &image)
[0]
QNetworkRequestFactory api
[0]
The QSGGeometry::AttributeSet describes how the vertices in a QSGGeometry are built up.
The QSGGeometry::Attribute describes a single vertex attribute in a QSGGeometry.
static Attribute create(int pos, int tupleSize, int primitiveType, bool isPosition=false)
Creates a new QSGGeometry::Attribute for attribute register pos with tupleSize.
The QSGMaterialType class is used as a unique type token in combination with QSGMaterial.