= Resource Manager = Resources are Objects, that can be loaded from a harddrive, and then used from memory. Because the loading process is quite Resource-dependable, the loading of each resource (e.g Texture, 3d-model etc.) should be made as little as possible. For this Orxonox provides a Shared Resource System for these time-consuming processes. 1. Resources that are loaded (like a Texture) always have a Data-type (like !TextureData) where the data is stored. 2. The Resources have a counted pointer to these Data, so if you copy one Texture to another one, only the pointer will be copied, and the reference-count of the pointer will be automatically increased 3. To Finaly load a Resource from disc, and keep a constant version of the Data in check, the Resource functionality is finally used: for the Resource Texture the coresponding Resourcerer is [wiki:archive/ResourceTexture ResourceTexture]. Resources do: * locate Files on the disc in a Directoy of your joice * store a copy of a !ResourceData with a Key-Name. In the following document [wiki:archive/ResourceTexture ResourceTexture] is only assumed as an Example. This also works with ResourceMD2, ResourceOBJ, !ResourceSoundBuffer and so on. == Usage Example == * Share a Resource (assumes texutre has some data assigned to it): {{{ #!cpp #include "texture.h" ... Texture copy = texture; }}} Here you can see, that copy has _NO_ pointer type, so we can copy one Texture to another one, and both textures share the same data. * Load a Texture from the disc with [wiki:archive/ResourceTexture ResourceTexture] {{{ #!cpp #include "texture.h" #include "resource_texture.h" ... Texture storeTex = ResourceTexture("orxonox.png", GL_TEXTURE_2D); }}} As you can see Texture is loaded over [wiki:archive/ResourceTexture ResourceTexture], the data loaded in Resource Texture is assigned as easy from Texture to storeTex as from any other Texture (since [wiki:archive/ResourceTexture ResourceTexture] isA Texture :) ). == Behind the scenes == [wiki:archive/ResourceTexture ResourceTexture] is a Handler that is derived from Texture and Resource. * The Texture part sais, how to load a Texture from a disc. * The Resource part sais, where the Resource can be found, and to check if the Resource was already loaded