Menu

#182 dtCore::Camera - revised camera-synch-callback, added camera-transform-callback

assigned
nobody
None
normal
feature
notapplicable
none
Enhancement
2010-08-17
2010-08-13
r0bs
No

Originally owned by: r.erik.johnson

I always needed a way to do the camera-transforms after the transforms of all other actors e.g. if the camera is looking at a moving target or moves itself or both. Right now I can't control any transformation-order so the camera often faces an object that is moving away right after that (in the same frame). With that inconstant framerates are a serious problem.

So this patch adds support for camera-transform-callbacks that are called on camera-synch but before the camera is transferred into screen-coords.
With that all the problems caused by framerate-hicups are solved (if you use the time-delta in your transformations).
You can use the transform-callbacks exactly like the synch-callback and I added support for single fired onces.

---- additional_information ----
Ideally this callback should be called in the osg-camera-prerender-state (e.g. if there are animations inside .osg/.ive-models) to really ensure that *everything* except the camera is transformed. Unfortunately osg only allows a single callback here and I don't know what about camera-coordinations at that point so I didn't continue that way.

Additinally I did some code clean up for the synchcallbacks and static containers.
(Of course there should be done some more refactoring but I didn't wanted to mess around with too many files)

regards
rob

Discussion

  • r0bs

    r0bs - 2010-08-13
     
  • r0bs

    r0bs - 2010-08-17

    Some more thoughts:
    It would be best to refactor all camera-callback-stuff so that there is only one container that holds all callbacks. Every callback has a type (e.g. PRE_FRAME, POST_FRAME, PRE_RENDER, SYNCH,...) and the camera calls them in OnMessage or through the different osgcamera-callbacks (that should all call a unified updatecallback(callbacktype& type)-method)...

    what do you think?

     

Log in to post a comment.