[Plib-devel] Implement ssgAnimTransform?
Brought to you by:
sjbaker
From: Wolfram K. <w_...@rz...> - 2004-10-25 23:00:24
|
As you know, I am working on PPE. I now need the option to display animations of models to be converted in PPE. The viewer sample loads animation from *.ase files and displays it. I have have tweaked the ASE loader to handle a new kind of animation I need and also I have moved the code "doing" the animation into PLIB and called it from PPE. It "works" so far, see below. I have not committed it yet. I am absolutely prepared to share all code I have, but right now it is not fit to be comitted and it might just be that I have to kludge things in this insane hurry enough so that it is of no general interest. This is however just what I want to avoid. The animation data consists of different transform matrices for different times/frames. =46unctionalitywise, the bad thing about the current implementation is that the viewer code puts the animation data into the user data field. Since PPE uses this field when selecting, the animation works till the first time you select something. Also, the code is very different to the animation code we did later, for example, it does not use the animation modes etc. Does it make sense to implement and commit the following?: There would be a ssgAnimTransform which is derived from ssgTransform. It contains a array of "frame" matrices. There will be a global ssg function "ssgSetAnimTime" with the "time" as parameter that walks the tree and for each ssgAnimTransform it sets the main transform from either one of the "frame" matrices (discreet animation) or a interpolation between two (smooth animation). The app could call this function before ssgCullAndDraw(). It would be similar to the existing animation, for example with a float time like in ssgTween instead of a discreet one as in the viewer example. Also, there is the exposer demo showing off bones, but I doubt much code can be shared. All current apps would not be affected. Only if they load an ase file with animation will the ssgAnimTransform be created and these would only be active iff the app calls the ssgSetAnimTime function. Also, I could implement a global variable saying "Something animated has been loaded" so that the ssgSetAnimTime function is only called if needed.=20 This feature would be used in the viewer sample, in PPE and I can well imagine games authors using it as simple way to get animated objects into their game. Bye bye, Wolfram. |