| Description | Hierarchy | Fields | Methods | Properties |
type TVRMLGLAnimation = class(TVRMLAnimation)
This is an animation of VRML model done by interpolating between any number of model states.
After constructing an object of this class, you must actually load it's animation by calling Load or LoadFromFile.
When loading you must provide one or more VRML models that have exactly the same structure, but possibly different values for various fields. Each scene has an associated position in Time (Time is just a float number). Scenes must be specified in increasing Time order. For example, first object may be a small sphere with blue color, the other object may be a larger sphere with white color, and the simplest times are 0.0 for the 1st scene and 1.0 for the 2nd scene.
This creates a list of Scenes such that
the first scene on the list is exactly the 1st object
the last scene on the list is exactly the last object
intermediate scenes are accordingly interpolated between the two surrounding "predefined" by you scenes
In effect, the Scenes is a list of scenes that, when rendered, will display an animation of the 1st object smoothly changing (morphing) into the 2nd object, then to the 3rd and so on, until the last object. In our example, the blue sphere will grow larger and larger and will fade into the white color. Of course, any kind of models is allowed — e.g. it can be a walking man at various stages, so in effect you get an animation of walking man.
A special case when you pass only one scene to this class is allowed (it may be handy in some situations). This will obviously produce just a still result, i.e. resulting TVRMLGLAnimation will be just a wrapper around single TVRMLFlatSceneGL instance.
All given objects must be "structurally equal" — the same nodes hierarchy, the same names of nodes, the same values of all fields (with the exception of fields that are interpolated: SFColor, SFFloat, SFMatrix, SFRotation, SFVec2f, SFVec3f and equivalent MFXxx fields). For multi-fields (MFXxx) that can be interpolated: note that values of items may differ, but still the counts of items must be equal.
Note that this is not the perfect way to design animations — a much better way would be to write the animation details in VRML file, use a modeller that allows you to design animations and store them in such way in VRML file, and read animations from this VRML file. But this means that many things must be done that currently are not ready — VRML 2.0 (and X3D) support must be done (they allow to write data about how model should be animated), and Blender exporter to VRML must store Blender animation data in VRML.
Until the things mentioned above are done, this class allows you to create animations by simply making two or more VRML scenes with various state of the same model. In many cases this should be acceptable solution.
![]() |
constructor Create(ACache: TVRMLOpenGLRendererContextCache = nil); |
![]() |
destructor Destroy; override; |
![]() |
procedure Load( RootNodes: TVRMLNodesList; AOwnsFirstRootNode: boolean; ATimes: TDynSingleArray; ScenesPerTime: Cardinal; AOptimization: TGLRendererOptimization; const EqualityEpsilon: Single); |
![]() |
procedure LoadStatic( RootNode: TVRMLNode; AOwnsRootNode: boolean; AOptimization: TGLRendererOptimization); |
![]() |
procedure LoadFromFile(const FileName: string; ChangeLoadParameters: TAnimationChangeLoadParametersFunc = nil); |
![]() |
procedure Close; |
![]() |
function ScenesCount: Integer; |
![]() |
function FirstScene: TVRMLFlatSceneGL; |
![]() |
function LastScene: TVRMLFlatSceneGL; |
![]() |
procedure PrepareRender( TransparentGroups: TTransparentGroups; Options: TPrepareRenderOptions; ProgressStep: boolean); |
![]() |
procedure FreeResources(Resources: TVRMLSceneFreeResources); |
![]() |
procedure CloseGL; |
![]() |
function TimeDuration: Single; |
![]() |
function TimeDurationWithBack: Single; |
![]() |
function SceneFromTime(const Time: Single): TVRMLFlatSceneGL; |
![]() |
function Attributes: TVRMLSceneRenderingAttributes; |
![]() |
function ManifoldEdges: TDynManifoldEdgeArray; |
![]() |
function BorderEdges: TDynBorderEdgeArray; |
![]() |
procedure ShareManifoldAndBorderEdges( ManifoldShared: TDynManifoldEdgeArray; BorderShared: TDynBorderEdgeArray); |
![]() |
function BoundingBoxSum: TBox3d; |
![]() |
procedure ChangedAll; |
![]() |
function Info(InfoTriVertCounts: boolean): string; |
![]() |
procedure WritelnInfoNodes; |
![]() |
property Loaded: boolean read FLoaded; |
![]() |
property OwnsFirstRootNode: boolean
read FOwnsFirstRootNode; |
![]() |
property Scenes[I: Integer]: TVRMLFlatSceneGL read GetScenes; |
![]() |
property TimeBegin: Single read FTimeBegin; |
![]() |
property TimeEnd: Single read FTimeEnd; |
![]() |
property TimeLoop: boolean read FTimeLoop write FTimeLoop default true; |
![]() |
property TimeBackwards: boolean
read FTimeBackwards write FTimeBackwards default false; |
![]() |
property BackgroundSkySphereRadius: Single
read GetBackgroundSkySphereRadius
write SetBackgroundSkySphereRadius; |
![]() |
constructor Create(ACache: TVRMLOpenGLRendererContextCache = nil); |
|
Constructor. | |
![]() |
destructor Destroy; override; |
![]() |
procedure Load( RootNodes: TVRMLNodesList; AOwnsFirstRootNode: boolean; ATimes: TDynSingleArray; ScenesPerTime: Cardinal; AOptimization: TGLRendererOptimization; const EqualityEpsilon: Single); |
|
This actually loads the animation scenes. You must call this (or some other loading routine like LoadFromFile) before you do almost anything with this object. Loaded changes to
Parameters
Exceptions raised
| |
![]() |
procedure LoadStatic( RootNode: TVRMLNode; AOwnsRootNode: boolean; AOptimization: TGLRendererOptimization); |
|
Load a dumb animation that consists of only one frame (so actually there's no animation, everything is static). This just calls Load with parameters such that
This is usefull when you know that you have a static scene, but still you want to treat it as TVRMLGLAnimation. | |
![]() |
procedure LoadFromFile(const FileName: string; ChangeLoadParameters: TAnimationChangeLoadParametersFunc = nil); |
|
This loads TVRMLGLAnimation by loading it's parameters (models to use, times to use etc.) from given file. File format is described on [http://vrmlengine.sourceforge.net/kanim_format.php]. You can change some of the loaded parameters by providing ChangeLoadParameters callback (you can provide If you need more control than simple ChangeLoadParameters callback, you should use something more flexible (and less comfortable to use) like LoadFromFileToVars class procedure. Note that you can always change TimeLoop and TimeBackwards — since these properties are writeable at any time. Loaded property changes to | |
![]() |
procedure Close; |
|
This releases all resources allocared by Load (or LoadFromFile). Loaded property changes to It's safe to call this even if Loaded is already | |
![]() |
function ScenesCount: Integer; |
![]() |
function FirstScene: TVRMLFlatSceneGL; |
|
Just a shortcut for Scenes[0]. | |
![]() |
function LastScene: TVRMLFlatSceneGL; |
|
Just a shortcut for Scenes[ScenesCount - 1]. | |
![]() |
procedure PrepareRender( TransparentGroups: TTransparentGroups; Options: TPrepareRenderOptions; ProgressStep: boolean); |
|
Prepare all scenes for rendering. This just calls If ProgressStep then it will additionally call Progress.Step after preparing each scene (it will call it ScenesCount times). If prManifoldAndBorderEdges is included, then actually a special memory (and prepare time) optimization will be used: only the first scene will have actually prepared prManifoldAndBorderEdges. The other scenes will just share the same ManifoldEdges and BorderEdges instances, by TVRMLFlatScene.ShareManifoldAndBorderEdges method. | |
![]() |
procedure FreeResources(Resources: TVRMLSceneFreeResources); |
|
This calls See TVRMLSceneFreeResource documentation for a description of what are possible resources to free. Note in case you pass frRootNode: the first scene has OwnsRootNode set to what you passed as OwnsFirstRootNode. Which means that if you passed OwnsFirstRootNode = | |
![]() |
procedure CloseGL; |
|
Close anything associated with current OpenGL context in this class. This calls | |
![]() |
function TimeDuration: Single; |
![]() |
function TimeDurationWithBack: Single; |
|
This is TimeDuration * 2 if TimeBackwards, otherwise it's just TimeDuration. In other words, this is the time of the one "full" (forward + backward) animation. | |
![]() |
function SceneFromTime(const Time: Single): TVRMLFlatSceneGL; |
|
This will return appropriate scene from Scenes based on given Time. If Time is between given TimeBegin and TimeEnd, then this will be appropriate scene in the middle. For Time outside the range TimeBegin .. TimeEnd behavior depends on TimeLoop and TimeBackwards properties:
| |
![]() |
function Attributes: TVRMLSceneRenderingAttributes; |
|
Attributes controlling rendering. See TVRMLSceneRenderingAttributes and TVRMLRenderingAttributes for documentation of properties. You can change properties of this object at any time, but beware that some changes may force time-consuming regeneration of some things (like OpenGL display lists) in the nearest Render of the scenes. So explicitly calling PrepareRender may be useful after changing these Attributes. Note that Attributes may be accessed and even changed when the scene is not loaded (e.g. before calling Load / LoadFromFile). Also, Attributes are preserved between various animations loaded. | |
![]() |
function ManifoldEdges: TDynManifoldEdgeArray; |
|
This simply returns FirstScene.ManifoldEdges. Since all scenes in the animation must have exactly the same structure, we know that this | |
![]() |
function BorderEdges: TDynBorderEdgeArray; |
|
This simply returns FirstScene.BorderEdges. Like ManifoldEdges: all scenes in the animation must have exactly the same structure, we know that this | |
![]() |
procedure ShareManifoldAndBorderEdges( ManifoldShared: TDynManifoldEdgeArray; BorderShared: TDynBorderEdgeArray); |
|
Calls ShareManifoldAndBoderEdges on all scenes within this animation. This is useful if you already have ManifoldEdges and BorderEdges, and you somehow know that it's good also for this scene. | |
![]() |
function BoundingBoxSum: TBox3d; |
|
The sum of bounding boxes of all animation frames. Result of this function is cached, which means that it usually returns very fast. But you have to call ChangedAll when you changed something inside Scenes[] using some direct Scenes[].RootNode operations, to force recalculation of this box. | |
![]() |
procedure ChangedAll; |
|
Call this when you changed something inside Scenes[] using some direct Scenes[].RootNode operations. This calls TVRMLFlatSceneGL.ChangedAll on all Scenes[] and invalidates some cached things inside this class. | |
![]() |
function Info(InfoTriVertCounts: boolean): string; |
|
Returns some textual | |
![]() |
procedure WritelnInfoNodes; |
|
Write contents of all VRML "Info" nodes. Also write how many Info nodes there are in the scene. Actually, this just calls | |
![]() |
property Loaded: boolean read FLoaded; |
![]() |
property OwnsFirstRootNode: boolean
read FOwnsFirstRootNode; |
![]() |
property Scenes[I: Integer]: TVRMLFlatSceneGL read GetScenes; |
|
You can read anything from Scenes below. But you cannot set some things: don't set their scenes Attributes properties. Use only our Attributes. | |
![]() |
property TimeBegin: Single read FTimeBegin; |
|
First and last time that you passed to Load (or that were read from file by LoadFromFile). In other words, Times[0] and Times[High(Times)]. | |
![]() |
property TimeEnd: Single read FTimeEnd; |
![]() |
property TimeLoop: boolean read FTimeLoop write FTimeLoop default true; |
|
See SceneFromTime for description what this property does. | |
![]() |
property TimeBackwards: boolean
read FTimeBackwards write FTimeBackwards default false; |
|
See SceneFromTime for description what this property does. | |
![]() |
property BackgroundSkySphereRadius: Single
read GetBackgroundSkySphereRadius
write SetBackgroundSkySphereRadius; |
|
Common This reads simply FirstScene.BackgroundSkySphereRadius and sets Note that there is doesn't really exist a requirement that all animation frames have the same | |