Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changes between Version 4 and Version 5 of code/doc/ModulesDescription


Ignore:
Timestamp:
Mar 29, 2005, 11:43:29 PM (20 years ago)
Author:
bensch
Comment:

added resourceManager

Legend:

Unmodified
Added
Removed
Modified
  • code/doc/ModulesDescription

    v4 v5  
    44Currently we have following modules descriptions here:
    55 * list (list.h)
    6 
     6 * ResourceManager (resource_manager.h)
    77
    88== list ==
     
    8080
    8181}}}
     82
     83== Resource Manager ==
     84There is a filehandler, that loades stores and unloades resources, like .obj-models, wav's, ogg's, textures and so on
     85
     86== usage in a WorldEntity like the Player ==
     87{{{
     88#include "resource_manager.h"     /* includes the headers of the ResourceManager */
     89
     90Player::Player()         /* in the initialisation we load the module */
     91{
     92  .
     93  .
     94  .
     95  /* the following loads an OBJ-file named models/reaplow.obj
     96   * The type is OBJ (if no type is specified the model will try to determine it for itself)
     97   * RP_CAMPAIGN tells the ResourceManager when, and if it will be allowed to delete the Model
     98  */
     99  this->model = (Model*)ResourceManager::load("models/reaplow.obj", OBJ, RP_CAMPAIGN);
     100}
     101
     102Player::~Player()
     103{
     104   /* here we would unload the Resource, that we allocated, but because WorldEntity
     105    * is doing it anyway, we do not have to concern ourselves with this.
     106    * But one could do something like: ResourceManager::unload(this->model); to do it
     107   */
     108}
     109
     110/* and thats it */
     111}}}
     112
     113== settings ==
     114As we see in the Player::Player() example, there are some options to be considered when
     115allocating a resource:
     116
     117__RESOURCE TYPES__: different types known to the resourceManager
     118{{{
     119/**
     120   OBJ: a .obj-file
     121   PRIM: a Model primitive (CUBE, CYLINDER, SPHERE and so on...)
     122   WAV: a wave-file
     123   OGG: i think you get it
     124*/
     125enum ResourceType {OBJ, PRIM, WAV, MP3, OGG, IMAGE};
     126}}}
     127
     128__RESOURCE PRIORITIES__: different unload-stages
     129{{{
     130/**
     131   RP_NO: will be unloaded on request
     132   RP_LEVEL: will be unloaded at the end of a Level
     133   RP_CAMPAIGN: will be unloaded at the end of a Campaign
     134   RP_GAME: will be unloaded at the end of the whole Game (when exiting orxonox)
     135*/
     136enum ResourcePriority {RP_NO = 0, RP_LEVEL = 1, RP_CAMPAIGN = 2, RP_GAME = 3};
     137}}}
     138