Unsolved Q3D: creating custom geometry class C++
-
Hello!
I' m currently in the process of developing my own geometry class of some complex 3D shape in Q3D. I think that the right path is to do something like QCylinderMesh in Q3D extras (correct me if I'm wrong).
First of all, it would be nice to learn the general pipeline of creating geometries in C++. The documentation is quite sparse on this topic.
Now I'm trying to analise the Extras and I'm stuck with ruling out the use of the basic classes:
- QGeometry
- QGeometryView (can't find it in the available for developer headers)
- QGeometryRenderer
Tit would be nice to learn how this classes are related. The roles of this classes is also poorly documented, not enough to make custom Mesh class at least. May be some diagrams or at least textual description would also be very helpfull.
Also the particular pain is the Private classes that are not accessible in the distribution of Qt Q3D and can't be inherited. So even inheritance from QGeometry tails the necesity to have QGeometryPrivate class which is hidden from the developer (as intended to).
Any help or advise are appreciated.
P.S.: I do NOT consider using Quick or QML for the time beeing since I've not found how to build some complex 3D shapes with it.
-
@VictorT said in Q3D: creating custom geometry class C++:
correct me if I'm wrong.
No, you're quite right.
Now I'm trying to analise the Extras and I'm stuck with ruling out the use of the basic classes:
- QGeometry
This is what you want to implement. Fill your vertex attribute (and other data) there.
- QGeometryView (can't find it in the available for developer headers)
This appears to be new to Qt6, I haven't seen it before, but looks like some kind of a proxy to
QGeometry
. I'd ignore it for now.- QGeometryRenderer
This is the way the geometry is rendered, most notably
QMesh
derives from this. You don't really need to touch any of it at this point.
To show something, create your geometry implementation, create a defaultQGeometryRenderer
set your geometry to it and add it to anQEntity
somewhere in the scene. That's it, more or less.Also the particular pain is the Private classes that are not accessible in the distribution of Qt Q3D and can't be inherited. So even inheritance from QGeometry tails the necesity to have QGeometryPrivate class which is hidden from the developer (as intended to).
Well, yes, in principle. But you could decide not to use the d-ptr idioum in your code at all.
P.S.: I do NOT consider using Quick or QML for the time beeing since I've not found how to build some complex 3D shapes with it.
I don't think you can define a geometry from QML to begin with.
-
Thanks a lot!
I've made what I planedNow I just need to fix some minor bugs