gnu3dkit-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnu3dkit-dev] Re: G3DCamera


From: Philippe C.D. Robert
Subject: [Gnu3dkit-dev] Re: G3DCamera
Date: Thu, 4 Jul 2002 08:02:17 +0200

Hi Brent,

On Wednesday, July 3, 2002, at 11:39 PM, Brent Gulanowski wrote:
Just one question currently: why does the camera retain the world? Seems a bit weird, if harmless. Does it prevent errors if a world somehow gets shut down before a camera is freed? I can't see how that would happen. I imagine a world definitely being much more permanent than a camera.

This is true. This was done like that because of a special purpose and does indeed not belong into a generic library like the 3DKit.

Here's a snippet of how I see the retain graph for a virtual world:

Model                  Controllers                 View
-----                  -----------                 ----

             ________ Application_______________
            /              |                    \
               V               V                     V
       Producer  -----> WindowController? -----> Window
(World Controller)          |                     |
     |       |              |                     |
     V       V              |                     |
  World     A.I.            |                     |
  |   |       |             |                     |
  |   V       V             V                     |
  | Things-->Behaviors    ViewController------    |
(Entities) .-------------/                    \   |
  V       /                                    \  V
  Observers------------------------------------>Views
  |       |
  V       V
Cameras Contexts

(This will look even worse if you don't have that "diagram" visible in a proportional font). Objects retain the objects beneath them (the downward arrows), while some entities maintain references to other objects with whom they work.

An observer is like a demon possession (have you played Dungeon Keeper?), and it carries its context and camera with it wherever it goes, flitting from one entity to another. An entity is my idea of any inhabitant of the world, from a stone to gravity to light to characters. I'm still having trouble with whether I'll be able to integrate that concept with 3DKit or at least overlay it nicely.

So there are observers integrated into the world, in this model, retained by an entity. An entity can be a pretty complex thing, like a group in 3DKit. So the entity owns the observer, who owns a camera, and is linked to a view when the camera is active.

It looks like 3DKit maintains the camera at the top of the heirarchy, which is fine if you've only got one. What if you want more than one? Or does one camera do the duty of many? What about multiple views on the screen at the same time? In a driving game you can have the main view and a rear view mirror.

Do you have any opinions about this?

It is on the top of my TODO list since months...:-) I currently work on a new design for the camera and context as well as the CULL and DRAW traversals. This will allow the user to instantiate many cameras and render the same scene multiple times from different views, either using the same context or different ones. I also deprecate the designted root node. The new camera will not be a subclass of NSView but will use a view. So the camera can be used together with different backends by using different 'drawables', ie. SDL or GLX or whatever.

-Phil
--
Philippe C.D. Robert
http://www.nice.ch/~phip




reply via email to

[Prev in Thread] Current Thread [Next in Thread]