[Interest] Qt3D - Bounds of visible entities

Mike Krus mike.krus at kdab.com
Sun Mar 26 11:12:05 CEST 2017


Hi Andy

> On 26 Mar 2017, at 00:51, Andy <asmaloney at gmail.com> wrote:
> Are there plans to add an interface to get the bounds of visible entities (ones with geometry that is rendered)?
> 
> Seems like something a lot of developers would need for moving the camera around - centering scenes, handling standard camera views (top, left, right, etc.), zooming in to a specific object, etc..
support for some of these basic operations is in the works for 5.10. Due to frontend/backend split and heavy multithreading in Qt3D, it’s not trivial to expose such data structures directly as they are maintained by the backend. See https://codereview.qt-project.org/#/c/183705/ and previous few patches.

Access to bounding volume data structures will come in some form but how exactly is unclear yet.

Also bounding volumes in the backend are computed as spheres which may or may not fit for your purpose (for example, they are not very useful as a basis for displaying a box around selected objects).

> If we do have to do it outside the framework, what would be the general approach? I haven't quite figured out how to do it with the current public API.
> 
> I have a QEntity-derived class, and I wanted to look for QGeometryRenderer/QTransform components being added to it, hook in to their signals, and calculate & store the info on the entity. But as far as I can tell there's no way for an entity to receive notification that components are added/removed. The addComponent() and removeComponent() methods aren't virtual so I can't override them either.
frontend and backend nodes don’t rely on signals and slots to communicate change notifications, but use change messages. There is a QComponentAddedChange message, but I don’t think a frontend node can listen to it’s own change messages.

> Is there an easier approach that I'm missing?
I think currently you would have to maintain all the necessary information in your application, making sure it’s updated when the scene graph changes, etc.

Hope this helps,

Mike

--
Mike Krus | mike.krus at kdab.com | Senior Software Engineer
KDAB (UK) Ltd., a KDAB Group company
Tel: UK Office +44 1625 809908   Mobile +44 7833 491941
KDAB - The Qt Experts




More information about the Interest mailing list