# Home    # nevrax.com   
Nevrax
Nevrax.org
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
Docs
 
Documentation  
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  

async_file_manager_3d.h

Go to the documentation of this file.
00001 
00007 /* Copyright, 2000 Nevrax Ltd.
00008  *
00009  * This file is part of NEVRAX NEL.
00010  * NEVRAX NEL is free software; you can redistribute it and/or modify
00011  * it under the terms of the GNU General Public License as published by
00012  * the Free Software Foundation; either version 2, or (at your option)
00013  * any later version.
00014 
00015  * NEVRAX NEL is distributed in the hope that it will be useful, but
00016  * WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00018  * General Public License for more details.
00019 
00020  * You should have received a copy of the GNU General Public License
00021  * along with NEVRAX NEL; see the file COPYING. If not, write to the
00022  * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
00023  * MA 02111-1307, USA.
00024  */
00025 
00026 #ifndef NL_ASYNC_FILE_MANAGER_3D_H
00027 #define NL_ASYNC_FILE_MANAGER_3D_H
00028 
00029 #include "nel/misc/types_nl.h"
00030 #include "nel/misc/thread.h"
00031 #include "nel/misc/async_file_manager.h"
00032 
00033 
00034 namespace NL3D
00035 {
00036 
00037 class IShape;
00038 class IDriver;
00039 class CInstanceGroup;
00040 class UInstanceGroup;
00041 class CTextureFile;
00042 
00049 class CAsyncFileManager3D
00050 {
00051 
00052 public:
00053 
00054         static CAsyncFileManager3D &getInstance (); // Must be called instead of constructing the object
00055         static void terminate (); // release singleton
00056 
00057         void loadMesh (const std::string &sMeshName, IShape **ppShp, IDriver *pDriver);
00058         bool cancelLoadMesh (const std::string& sMeshName);
00059 
00060         void loadIG (const std::string &igName, CInstanceGroup **ppIG);
00061         void loadIGUser (const std::string &igName, UInstanceGroup **ppIG);
00062 
00063         void loadTexture (CTextureFile *textureFile, bool *pSgn);
00064         bool cancelLoadTexture (CTextureFile *textFile);
00065 
00066 
00067         // Do not use these methods with the bigfile manager
00068         void loadFile (const std::string &fileName, uint8 **pPtr);
00069         void loadFiles (const std::vector<std::string> &vFileNames, const std::vector<uint8**> &vPtrs);
00070 
00071         
00072         void signal (bool *pSgn); // Signal a end of loading for a group of "mesh or file" added
00073         void cancelSignal (bool *pSgn);
00074         
00075 private:
00076 
00077 
00078         CAsyncFileManager3D (); // Singleton mode -> access it with the getInstance function
00079 
00080         static CAsyncFileManager3D *_Singleton;
00081 
00082 
00083         friend class CLoadMeshCancel;
00084         friend class CLoadTextureCancel;
00085         
00086         // All the tasks
00087         // -------------
00088         
00089         // Load a .shape
00090         class CMeshLoad : public NLMISC::IRunnable
00091         {
00092                 IShape **_ppShp;
00093                 IDriver *_pDriver;
00094         public:
00095                 std::string MeshName;
00096         public:
00097                 CMeshLoad (const std::string &meshName, IShape **ppShp, IDriver *pDriver);
00098                 void run (void);
00099         };
00100 
00101         // Load a .ig
00102         class CIGLoad : public NLMISC::IRunnable
00103         {
00104                 std::string _IGName;
00105                 CInstanceGroup **_ppIG;
00106         public:
00107                 CIGLoad (const std::string& meshName, CInstanceGroup **ppIG);
00108                 void run (void);
00109         };
00110 
00111         // Load a .ig User Interface
00112         class CIGLoadUser : public NLMISC::IRunnable
00113         {
00114                 std::string _IGName;
00115                 UInstanceGroup **_ppIG;
00116         public:
00117                 CIGLoadUser (const std::string& meshName, UInstanceGroup **ppIG);
00118                 void run (void);
00119         };
00120 
00121         // Load a texture
00122         class CTextureLoad : public NLMISC::IRunnable
00123         {
00124         public:
00125                 CTextureFile    *TextureFile;
00126                 bool                    *Signal;
00127         public:
00128                 CTextureLoad(CTextureFile *textureFile, bool *psgn)
00129                         : TextureFile(textureFile), Signal(psgn)
00130                 {}
00131 
00132                 virtual void    run();
00133         };
00134 
00135 };
00136 
00137 
00138 } // NL3D
00139 
00140 
00141 #endif // NL_ASYNC_FILE_MANAGER_3D_H
00142 
00143 /* End of async_file_manager.h */