34 Q_PROPERTY(QQuick3DNode *scene READ scene WRITE setScene NOTIFY sceneChanged)
35 Q_PROPERTY(QVector3D sceneCenter READ sceneCenter WRITE setSceneCenter NOTIFY sceneCenterChanged)
36 Q_PROPERTY(QVector3D sceneExtents READ sceneExtents WRITE setSceneExtents NOTIFY sceneExtentsChanged)
37 Q_PROPERTY(
float shapeResolution READ shapeResolution WRITE setShapeResolution NOTIFY shapeResolutionChanged)
38 Q_PROPERTY(QList<QQuick3DNode *> excludedNodes READ excludedNodes WRITE setExcludedNodes NOTIFY excludedNodesChanged)
39 Q_PROPERTY(QQuick3DGeometry *geometry READ geometry NOTIFY geometryChanged)
40 QML_NAMED_ELEMENT(ParticleSceneShape3D)
41 QML_ADDED_IN_VERSION(6, 11)
44 explicit QQuick3DParticleSceneShape(QObject *parent =
nullptr);
45 ~QQuick3DParticleSceneShape() override;
47 QQuick3DNode *scene()
const;
48 QVector3D sceneCenter()
const;
49 QVector3D sceneExtents()
const;
50 float shapeResolution()
const;
51 QQuick3DGeometry *geometry()
const;
52 QList<QQuick3DNode *> excludedNodes()
const;
55 void setScene(QQuick3DNode *scene);
56 void setSceneCenter(
const QVector3D &extents);
57 void setSceneExtents(
const QVector3D &extents);
58 void setShapeResolution(
float resolution);
59 void setExcludedNodes(
const QList<QQuick3DNode *> &nodes);
62 QVector3D getPosition(
int particleIndex) override;
63 QVector3D getSurfaceNormal(
int particleIndex) override;
67 void sceneCenterChanged();
68 void sceneExtentsChanged();
69 void shapeResolutionChanged();
70 void geometryChanged();
71 void excludedNodesChanged();
74 QVector3D randomPositionModel(
int particleIndex);
75 void createShapeData();
76 void clearModelVertexPositions();
77 void calculateModelVertexPositions();
78 QList<QVector3D> excludeTriangles(
const QList<QVector3D> &list);
79 void updateGeometry();
80 bool isVisibleRecursive(QQuick3DNode *node);
81 bool isExcluded(QQuick3DModel *model);
82 void markDirty(
bool dirty =
true,
bool excludeDirty =
false);
84 QList<QQuick3DNode *> m_excludeList;
85 QQuick3DGeometry *m_geometry =
nullptr;
86 QQuick3DNode *m_root =
nullptr;
87 QQuick3DNode *m_scene =
nullptr;
90 QVector<QVector3D> vertexPositions;
91 float modelTriangleAreasSum = 0;
92 QVector<
float> modelTriangleAreas;
93 QVector3D modelTriangleCenter;
95 bool hasVertices =
false;
97 bool excluded =
false;
98 bool excludedDirty =
true;
99 QMetaObject::Connection sceneTransformConnection;
100 QMetaObject::Connection visibilityConnection;
103 vertexPositions.clear();
104 modelTriangleAreasSum = 0;
105 modelTriangleAreas.clear();
106 modelTriangleCenter = {};
109 struct SceneNapkinMesh;
110 QList<ShapeData> m_data;
111 ShapeData m_sceneData;
112 SceneNapkinMesh *m_sceneMesh =
nullptr;
113 QVector3D m_cachedNormal;
114 QVector3D m_sceneCenter;
115 QVector3D m_sceneExtents;
116 float m_shapeResolution = 10.0f;
117 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)