38 Q_PROPERTY(QQuick3DNode *scene READ scene WRITE setScene NOTIFY sceneChanged)
39 Q_PROPERTY(QVector3D sceneCenter READ sceneCenter WRITE setSceneCenter NOTIFY sceneCenterChanged)
40 Q_PROPERTY(QVector3D sceneExtents READ sceneExtents WRITE setSceneExtents NOTIFY sceneExtentsChanged)
41 Q_PROPERTY(
float shapeResolution READ shapeResolution WRITE setShapeResolution NOTIFY shapeResolutionChanged)
42 Q_PROPERTY(QList<QQuick3DNode *> excludedNodes READ excludedNodes WRITE setExcludedNodes NOTIFY excludedNodesChanged)
43 Q_PROPERTY(QQuick3DGeometry *geometry READ geometry NOTIFY geometryChanged)
44 QML_NAMED_ELEMENT(ParticleSceneShape3D)
45 QML_ADDED_IN_VERSION(6, 11)
48 explicit QQuick3DParticleSceneShape(QObject *parent =
nullptr);
49 ~QQuick3DParticleSceneShape() override;
51 QQuick3DNode *scene()
const;
52 QVector3D sceneCenter()
const;
53 QVector3D sceneExtents()
const;
54 float shapeResolution()
const;
55 QQuick3DGeometry *geometry()
const;
56 QList<QQuick3DNode *> excludedNodes()
const;
59 void setScene(QQuick3DNode *scene);
60 void setSceneCenter(
const QVector3D &extents);
61 void setSceneExtents(
const QVector3D &extents);
62 void setShapeResolution(
float resolution);
63 void setExcludedNodes(
const QList<QQuick3DNode *> &nodes);
66 QVector3D getPosition(
int particleIndex) override;
67 QVector3D getSurfaceNormal(
int particleIndex) override;
71 void sceneCenterChanged();
72 void sceneExtentsChanged();
73 void shapeResolutionChanged();
74 void geometryChanged();
75 void excludedNodesChanged();
78 QVector3D randomPositionModel(
int particleIndex);
79 void createShapeData();
80 void clearModelVertexPositions();
81 void calculateModelVertexPositions();
82 QList<QVector3D> excludeTriangles(
const QList<QVector3D> &list);
83 void updateGeometry();
84 bool isVisibleRecursive(QQuick3DNode *node);
85 bool isExcluded(QQuick3DModel *model);
86 void markDirty(
bool dirty =
true,
bool excludeDirty =
false);
88 QList<QQuick3DNode *> m_excludeList;
89 QQuick3DGeometry *m_geometry =
nullptr;
90 QQuick3DNode *m_root =
nullptr;
91 QQuick3DNode *m_scene =
nullptr;
94 QVector<QVector3D> vertexPositions;
95 float modelTriangleAreasSum = 0;
96 QVector<
float> modelTriangleAreas;
97 QVector3D modelTriangleCenter;
99 bool hasVertices =
false;
100 bool visible =
false;
101 bool excluded =
false;
102 bool excludedDirty =
true;
103 QMetaObject::Connection sceneTransformConnection;
104 QMetaObject::Connection visibilityConnection;
107 vertexPositions.clear();
108 modelTriangleAreasSum = 0;
109 modelTriangleAreas.clear();
110 modelTriangleCenter = {};
113 struct SceneNapkinMesh;
114 std::vector<ShapeData> m_data;
115 ShapeData m_sceneData;
116 SceneNapkinMesh *m_sceneMesh =
nullptr;
117 QVector3D m_cachedNormal;
118 QVector3D m_sceneCenter;
119 QVector3D m_sceneExtents;
120 float m_shapeResolution = 10.0f;
121 int m_cachedIndex = -1;
void init(float x, float z, float w, float d, int ccx, int ccz, float y)
void initCells(Cell *cells, float x, float z, float w, float d, int ccx, int ccz, float y)
void update(const QVector3D &v1, const QVector3D &v2, const QVector3D &v3, bool append=true)
static constexpr float c_maximumYDiff
QList< QVector3D > positions(float miny, float icp100)