0

I am trying to develop an application with Qt 5.5 and OpenGL. The basic work of the application will be to load simple objects, modify their positions in a scene and save them together with other attributes (material, name, parents/child relations etc...).

The only thing I am struggling about for a week now is that I really don't know how I should take on the problem of synchronizing data. Let's say I have some kind of SceneGraph class which takes care of all SceneObjects. Those SceneGraphs should be rendered in a SceneView-Widget which can be used to modify it's Objects via transformations. Now how would I tell every SceneView that an Object changed it's position?

I thought of the Model/View architecture for a moment but I am not really sure how this implementation should look like.

What would be the best way to handle Objects like that in different Windows/Widgets but still have one single piece of data?

  • SceneObject:

    • Holds the mesh-information (verticies, uvs, etc..)
    • Has a name (QString)
    • Has a material
    • Has a transform storing position, rotation and scaling information (Important: these datatypes should be synchronized in all views)
  • SceneGraph:

    • Contains different SceneObjects and is passed to SceneViews
  • SceneView:

    • The QWidget responsible for drawing the Scene correctly in any QWindow.
    • Has it's own camera to move around.
    • Handles UserInput and allows transformation of SceneObjects.
genpfault
  • 51,148
  • 11
  • 85
  • 139
maperz
  • 196
  • 3
  • 11

1 Answers1

-1

You could use the signal and slot to observe position updates of SceneObjects and process them in SceneView.

chung
  • 1
  • 2