lilith3d::ResourcePool Class Reference

#include <resourcepool.h>

List of all members.


Detailed Description

The storage class for all the textures, models, and shaders. The ResourcePool is created and destroyed by the client application. However, there can be only one and it's pointer can be retrieved by the Instance() method.

Lilith pre-loads all its resources and expects them to not be deleted for the duration of the engine object. You may created resources "on demand", add them to the pool, and use them. But be *very* careful deleted a resource if you do this. Lilith does not lock or use "shaded pointers" to manage the resources.

The correct order of initialization and deletion:

  1. resourcePool = new ResourcePool();
  2. resourcePool->SetImportPath();
  3. resourcePool->LoadRequiredAssets();
  4. lilith = new Lilith3D();
  5. ...game code...
  6. delete lilith;
  7. delete resourcePool;


Public Member Functions

void SetImportPath (const std::string &path)
 Set a relative or absolute path the will be appended to *all* future load calls.
bool LoadRequiredAssets ()
 Load all the assets Lilith requires to run.
const TextureLoadTexture (const std::string &filename, const std::string &textureName, int textureId=0, int flags=0)
const TextureGetTexture (const std::string &textureName, U32 textureId)
StaticResourceLoadStaticRes (const std::string &filename, const std::string &name, U32 flags)
MD2ResourceLoadMD2Res (const std::string &name, const std::string &md2MeshFilename, const std::string &skinTextureFilename, const std::string &md2WeaponFilename, const std::string &weaponTextureFilename)
const StaticResourceGetStaticRes (const std::string &name)
 Get a pointer to a static mesh resource.
const MD2ResourceGetMD2Res (const std::string &name)
 Get a pointer to an MD2 animation resource.


Member Function Documentation

const Texture* lilith3d::ResourcePool::LoadTexture ( const std::string &  filename,
const std::string &  textureName,
int  textureId = 0,
int  flags = 0 
) [inline]

Loads a single 2D textures, with all the options.

Parameters:
filename Filename of the texture
textureName String part of the name.
textureId Integer part of the name. (Usually 0).
flags NO_MIPMAP, EMITS_LIGHT

const Texture* lilith3d::ResourcePool::GetTexture ( const std::string &  textureName,
U32  textureId 
) [inline]

Query for a texture.

Parameters:
textureName String part of the name.
textureId Integer part of the name.

StaticResource* lilith3d::ResourcePool::LoadStaticRes ( const std::string &  filename,
const std::string &  name,
U32  flags 
) [inline]

Load a static mesh resource.

Parameters:
filename filename
name name to give the resource
flags SMOOTH_SHADING if the model should be smooth shaded at all vertices, else 0 for hard shading

MD2Resource* lilith3d::ResourcePool::LoadMD2Res ( const std::string &  name,
const std::string &  md2MeshFilename,
const std::string &  skinTextureFilename,
const std::string &  md2WeaponFilename,
const std::string &  weaponTextureFilename 
) [inline]

Load an MD2 animation resource.

Parameters:
name Name of the MD2 resource
md2MeshFilename Filename of the .md2 mesh file for the main mesh.
skinTextureFilename Filename of the skin texture. (.bmp, .pcx, .tga, etc.)
md2WeaponFilename Filename of the .md2 file for the weapon
weaponTextureFilename Filename of the weapon texture. (.bmp, .pcx, .tga, etc.)


The documentation for this class was generated from the following file:
Generated on Fri Mar 23 19:36:28 2007 for Lilith3D by  doxygen 1.5.1-p1