Hi Jeremy,

I'm no OSG guru, and I (still) didn't use osgWidget, but here is an idea:
Why does the WindowManager have to know anything about cameras? From my point 
of view, a "WindowManager" should only do what its name says: manage windows.
I think the "picking" ability shoud be separated into another class (say 
"WindowPicker"?). Maybe this "WindowPicker" have to know a camera and have to 
be passed to the WindowManager. I guess this is the user role to set a camera 
and then give it to the "WindowPicker". Moreover, some users will certainly 
want to display windows (and other things) without needing the picking ability. 
And perhaps some would like to display windows/widgets in the 3D world (such as 
on a wall) using multiple cameras, but only one for picking (a camera that 
could change over time - I mean the user/player may switch between cameras).

The createParentOrthoCamera() would then be a free (convinience) function that 
have to know about a Camera and maybe a WindowManager to get bounds of the 
windows.

What do you think about it?

Sukender
PVLE - Lightweight cross-platform game engine - http://pvle.sourceforge.net/


Le Mon, 24 Nov 2008 21:54:43 +0100, Jeremy Moles <[EMAIL PROTECTED]> a écrit:

> Hello all! Allow me to talk briefly about osgWidget's current design and
> perhaps how I can change it for the better.
>
> A number of people over the last few months have asked me why the
> WindowManager object requires an osgViewer::View* to be created. This is
> an interesting question, and it segues into something possibly more
> complicated, and which potentially demonstrates my lack of understanding
> of some things related to OSG. :)
>
> To summarize, a WindowManager object in osgWidget is derived from
> osg::Switch, and its purpose is to position and layer various Window
> objects which are added to it. It does this in a kind of "virtual
> space"--that is to say, it has no awareness of how it will be viewed,
> and I leave that aspect up to the user. Windows in osgWidget are derived
> from osg::MatrixTransform, so it is quite simple to position and size
> these objects in a virtual space.
>
> However, as I mentioned earlier, when created a WindowManager must have
> access to an osgViewer::View* so that it can call the
> computeInteresections() method on this pointer and perform proper
> picking. This raises an interesting design question: what exactly is (or
> should be) the relationship between a WindowManager and an osg::Camera?
> There certainly is SOME relationship, but whether or not I am properly
> utilizing it in osgWidget remains to be seen.
>
> If any of you have used osgWidget you may be familiar with the following
> convenience method:
>
>       osgWidget::WindowManager::createParentOrthoCamera()
>
> What this member/method does is creates an orthographic 2D camera, adds
> the "this" pointer as it's first child, and returns the newly created
> Camera. This is a quick way to put the WindowManager object in a state
> where it can be seen and behaves as expected, but I fear I may have this
> all only "accidentally" working.
>
> My question, then, is to the OSG Gurus: if you were designing osgWidget,
> how would you model this relationship between the topmost osgWidget
> "manager" object and the Camera to which it should be attached? Would
> you use an osgViewer::View* like I do to perform picking, or would you
> interface directly with the Camera and perform picking that way? If so,
> the question of WindowManager->Camera relationship becomes even more
> important. Furthermore, how would you handle 3D GUI objects, which can
> certainly be added to a WindowManager's "virtual" space, but will appear
> wildly differently depending on whether the object is viewed through an
> orthographic or perspective camera?
>
> (Please forgive me if I'm using some wrong terminology here, I hope I
> get the idea across!)
>
> _______________________________________________
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to