Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
assetsmanager [2019/03/08 12:32] – [Finding an asset] adminassetsmanager [Unknown date] (current) – removed - external edit (Unknown date) 127.0.0.1
Line 1: Line 1:
-====== Using AssetsManager ====== 
- 
- 
-The AssetsManager is the core component in effective media management inside your Gorilla3D application.  
- 
-Models, textures, audio and so on will be cached for faster access and reusage. You can build packages within the AssetsManager for modular media management.  
- 
-For example: you could build a package for the main character and reference to it in every scene package. Scene packages are extremly useful for compact and fast loading of all data of a specific scene. 
- 
-===== Package ===== 
-An assets package is the management unit to handle groups and their attached assets. 
-It is allowed to store a package as zip-archive or to use as in-memory package. 
- 
-===== Groups ===== 
-Each package provides a number of fixed group entries to organize media content. 
-  * GORILLA_ASSETS_MODEL 
-  * GORILLA_ASSETS_TEXTURE 
-  * GORILLA_ASSETS_AUDIO 
-  * GORILLA_ASSETS_VIDEO 
-  * GORILLA_ASSETS_MISC 
-  * GORILLA_ASSETS_DIALOGUE 
-  * GORILLA_ASSETS_INVENTORY 
- 
-===== Assets ===== 
-A media file is represented as extended TGorillaAsset instance inside in a specific group in an assets package. 
-Depending on the media type the asset holds the data. 
- 
-==== TGorillaModelAsset ==== 
-Holds model and animation data by the internal definition format TModelDef and writes data as *.g3d file to the zip-archive. 
- 
-==== TGorillaTextureAsset ==== 
-Holds the texture as TBitmap in memory and writes those in original file format to zip-archive. 
- 
-==== TGorillaAudioAsset ==== 
-Holds audio files in a TMemoryStream and writes those in original file format to zip-archive. 
- 
-==== TGorillaVideoAsset ==== 
-Holds video files in a TMemoryStream and writes those in original file format to zip-archive. 
- 
-==== TGorillaMiscAsset ==== 
-Used for unspecified file formats. Currently supported *.txt, *.json and *.xml. 
-Holds data in a TMemoryStream and writes those in original file format to zip-archive. 
- 
-==== TGorillaDialogueAsset ==== 
-Holds dialogue data in a TMemoryStream and writes those as *.dia file to zip-archive. 
- 
-==== TGorillaInventoryAsset ==== 
-Holds inventory configuration data in a TMemoryStream and writes those as *.iff file to zip-archive. 
- 
-===== DesignTime ===== 
-You can find the TGorillaAssetsManager component in the toolbar. Simply drag and drop onto your form. 
- 
-In the next step we need to create a new package in "Packages" property by the Delphi collection editor. 
- 
-===== Example ===== 
- 
-==== Creating package at runtime ==== 
- 
-Alternatively you can create the assets manager and packages at runtime. 
- 
-<file pascal Form1.pas> 
-  FAssetsManager := TGorillaAssetsManager.Create(Self); 
-  FAssetsManager.AddEmptyPackage(GORILLA_PACKAGE_DEFAULT); 
-</file> 
- 
-==== Finding an asset ==== 
- 
-1) Each assets has an unique id (GUID) when added to the package by which we can find it exactly. 
- 
-<file pascal Form1.pas> 
-  // finding an asset in a specific group by its unique id 
-  LAssetId := '{18E01973-D452-4596-A1A1-C51F09763954}'; 
-  FAssetsManager.GetAssetFromId(GORILLA_ASSETS_TEXTURE, LAssetId); 
-</file> 
- 
-2)  
- 
-<file pascal Form1.pas> 
-  // finding an asset in a specific group by its unique id 
-  LAssetId := '{18E01973-D452-4596-A1A1-C51F09763954}'; 
-  FAssetsManager.GetAssetFromId(GORILLA_ASSETS_TEXTURE, LAssetId); 
-</file>