Gorilla.DefTypes.Cache
Unit Gorilla.DefTypes.Cache.pasClasses
- TAnimationFrameCompression = class ( TObject )
- TAnimationCaching = class ( TComponent )
Enumerations
- enum TAnimationCachingState = ( Started, Finished ) ;
Constants
TAnimationCachingState
Defining states of caching.
Started - The caching mechanism was started. But this do not mean, that already some data was cached.
Finished - The caching process is finished and all necessary frames were cached.
TAnimationFrameCompression
Helper class for copying parts of a vertexbuffer into a memory stream. It also provides methods for stream compression.
Remarks
On MSWindows x86 we use LZ4 compression, because its much faster than default ZLib. On all other platforms ZLib compression is used, to pack data.Ancestors
Members
Methods
- public function GetSourceStream
(
const
AFormat :
TVertexFormat; const
ABuffer :
TVertexBuffer
)
: TMemoryStream
;
class overload;
Extracts a part of the supplied vertex buffer to a memory stream.
- public function GetSourceStream
(
const
AData :
Pointer; const
ASize :
Int64
)
: TMemoryStream
;
class overload;
Creates a new memory stream and copies the data from the supplied buffer pointer into the stream.
- public procedure SetSourceStream
(
const
AFormat :
TVertexFormat; const
ABuffer :
TVertexBuffer; const
AStream :
TMemoryStream
)
;
class overload;
Copies a part of the vertex buffer depending on the supplied vertex-format into an existing memory stream.
- public procedure SetSourceStream
(
const
AData :
Pointer; const
ASize :
Int64; const
AStream :
TMemoryStream
)
;
class overload;
Copies the data from the supplied buffer pointer into an existing memory stream.
- public function Compress
(
const
AFormat :
TVertexFormat; const
ABuffer :
TVertexBuffer
)
: TMemoryStream
;
class overload;
Returns a new memory stream with the compressed data, requested by GetSourceStream() depending on the supplied vertex buffer and format.
- public function Compress
(
const
AData :
Pointer; const
ASize :
Int64
)
: TMemoryStream
;
class overload;
Returns a new memory stream with the compressed data, supplied by a buffer pointer and size.
- public function Decompress
(
const
AStream :
TMemoryStream
)
: TMemoryStream
;
class;
Decompresses the supplied memory stream and returns a new memory stream.
TAnimationCaching
Animation Caching Helper Class This class will manage cache generation for model animations
Ancestors
Members
Fields
- protected FModelDef :
TModelDef
- protected FAnimDef :
TAnimationDef
- protected FFlags :
TAnimationCachingFlags
- protected FModel :
TComponent
- protected FIsModelTemp :
Boolean
- protected FAnimation :
TComponent
- protected FLastTime :
Double
- protected FTotalTime :
Double
- protected FFrameTime :
Double
- protected FMeshBuffers :
TDictionary<Gorilla.DefTypes.TMeshDef,FMX.Types3D.TVertexBuffer>
- protected FOnBeginAnimation :
TOnAnimationNotify
- protected FOnEndAnimation :
TOnAnimationNotify
- protected FOnBeginFrame :
TOnAnimationFrameNotifiy
- protected FOnEndFrame :
TOnAnimationFrameNotifiy
- protected FOnCached :
TOnAnimationCachedNotify
Methods
- public constructor Create ( const ADef : TModelDef; const AFlags : TAnimationCachingFlags = [] ; const AModel : TComponent = nil ) ;
- public destructor Destroy ( ) ;
- protected procedure DoOnMeshBufferNotify ( ASender : TObject; const AItem : TVertexBuffer; AAction : TCollectionNotification ) ;
- protected procedure DoPrepare
(
const
AAnim :
TObject
)
;
This method checks if only a part of the vertex buffer is cached. If so, it creates a new vertex-buffer which easily can be copied, instead of extracting each element.
- protected procedure DoCleanup
(
const
AAnim :
TObject
)
;
Destroys eventually created helper structures from DoPrepare().
- protected procedure Setup
(
)
;
If FModel is not assigned yet, the routine will create a temporary TGorillaModel and apply the model definition to it for caching process.
- public procedure BeginFrame
(
const
ACurrent :
Integer; const
ATotal :
Integer
)
;
Executed at the beginning of each frame-caching and for each mesh of the model.
- public procedure EndFrame
(
const
ACurrent :
Integer; const
ATotal :
Integer
)
;
Executed at the end of each frame-caching and for each meah of the model.
- public procedure Execute
(
const
AAnimDef :
TAnimationDef
)
;
Starts caching process for a specific model. The routine will generate bufferobject for each frame of the animation and for all meshes inside of this model.