- Main Page
- Packages
- Classes
- Files

- File List
- File Members

# D:/guillaume/guillara/3D/DXGfx/Backup/DXGfxLib/RessourceManager.cs

Go to the documentation of this file.

    00001 using System;
    00002 using System.Collections.Generic;
    00003 using System.Text;
    00004 using System.Collections;
    00005
    00006 namespace DXGfxLib
    00007 {
    00014     public class RessourceManager
    00015     {
    00021         protected static RessourceManager globalInstance = null;
    00022
    00026         Hashtable loadedMeshRessources = null;
    00027
    00032         public RessourceManager()
    00033         {
    00034             if (globalInstance != null)
    00035             {
    00036                 throw new Exception("This is wrong only one instance of the RessourceManager can be created per process and there is already one!");
    00037             }
    00038             loadedMeshRessources = new Hashtable();
    00039             globalInstance = this;
    00040         }
    00041
    00047         public RessourceManager GetGlobalInstance()
    00048         {
    00049             if (globalInstance == null)
    00050             {
    00051                 throw new NullReferenceException("There is no instance of RessourceManager class in this AppDomain. It is wrong to call this method now!");
    00052             }
    00053             return globalInstance;
    00054         }
    00055
    00066         public MeshRessource GetMeshRessource(string filename)
    00067         {
    00068             MeshRessource preloaded = loadedMeshRessources[filename] as MeshRessource;
    00069
    00070             if (preloaded == null)
    00071             {
    00072                 preloaded = new MeshRessource(filename);
    00073             }
    00074
    00075             return preloaded;
    00076         }
    00077     }
    00078 }