# 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  

driver_user2.cpp

Go to the documentation of this file.
00001 
00007 /* Copyright, 2001 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 #include "std3d.h"
00027 
00028 // ***************************************************************************
00029 // THIS FILE IS DIVIDED IN TWO PARTS BECAUSE IT MAKES VISUAL CRASH.
00030 // fatal error C1076: compiler limit : internal heap limit reached; use /Zm to specify a higher limit
00031 // ***************************************************************************
00032 
00033 #include "3d/driver_user.h"
00034 #include "3d/scene_user.h"
00035 #include "3d/text_context_user.h"
00036 #include "nel/3d/u_driver.h"
00037 #include "3d/dru.h"
00038 #include "3d/scene.h"
00039 #include "3d/texture_user.h"
00040 #include "3d/material_user.h"
00041 #include "nel/3d/u_camera.h"
00042 #include "nel/misc/file.h"
00043 #include "nel/misc/path.h"
00044 
00045 
00046 using namespace std;
00047 using namespace NLMISC;
00048 
00049 
00050 namespace NL3D 
00051 {
00052 
00053 
00054 // ***************************************************************************
00055 // ***************************************************************************
00056 // Component Management.
00057 // ***************************************************************************
00058 // ***************************************************************************
00059 
00060 
00061 
00062 // ***************************************************************************
00063 UScene                  *CDriverUser::createScene() 
00064 {
00065         NL3D_MEM_DRIVER
00066 
00067         CSceneUser *pSU = new CSceneUser(this);
00068         // set the shape bank
00069         pSU->getScene().setShapeBank( &_ShapeBank._ShapeBank );
00070         // set the MeshSkinManager
00071         pSU->getScene().getRenderTrav()->setMeshSkinManager(&_MeshSkinManager);
00072         // set the AsyncTextureManager
00073         pSU->getScene().setAsyncTextureManager(&_AsyncTextureManager);
00074         // set the lodManager
00075         pSU->getScene().setLodCharacterManager(&_LodCharacterManager);
00076         return _Scenes.insert(pSU);
00077 }
00078 // ***************************************************************************
00079 void                    CDriverUser::deleteScene(UScene *scene) 
00080 {
00081         NL3D_MEM_DRIVER
00082 
00083         _Scenes.erase((CSceneUser*)scene, "deleteScene(): Bad scene ptr");
00084 }
00085 
00086 
00087 
00088 
00089 
00090 
00091 // ***************************************************************************
00092 UTextContext    *CDriverUser::createTextContext(const std::string fontFileName, const std::string fontExFileName) 
00093 {
00094         NL3D_MEM_DRIVER
00095 
00096         return _TextContexts.insert(new CTextContextUser(fontFileName, fontExFileName, this, &_FontManager));
00097 }
00098 // ***************************************************************************
00099 void                    CDriverUser::deleteTextContext(UTextContext     *textContext) 
00100 {
00101         NL3D_MEM_DRIVER
00102 
00103         _TextContexts.erase((CTextContextUser*)textContext, "deleteTextContext: Bad TextContext");
00104 }
00105 // ***************************************************************************
00106 void                    CDriverUser::setFontManagerMaxMemory(uint maxMem) 
00107 {
00108         NL3D_MEM_DRIVER
00109 
00110         _FontManager.setMaxMemory(maxMem);
00111 }
00112 // ***************************************************************************
00113 std::string             CDriverUser::getFontManagerCacheInformation() const
00114 {
00115         NL3D_MEM_DRIVER
00116 
00117         return _FontManager.getCacheInformation();
00118 }
00119 
00120 
00121 
00122 // ***************************************************************************
00123 UTextureFile    *CDriverUser::createTextureFile(const std::string &file) 
00124 {
00125         NL3D_MEM_DRIVER
00126 
00127         CTextureFileUser        *text= new CTextureFileUser(file);
00128         _Textures.insert(text);
00129         return text;
00130 }
00131 // ***************************************************************************
00132 void                    CDriverUser::deleteTextureFile(UTextureFile *textfile) 
00133 {
00134         NL3D_MEM_DRIVER
00135 
00136         _Textures.erase(dynamic_cast<CTextureFileUser*>(textfile), "deleteTextureFile: Bad textfile");
00137 }
00138 // ***************************************************************************
00139 UTextureRaw             *CDriverUser::createTextureRaw() 
00140 {
00141         NL3D_MEM_DRIVER
00142         nlstop; // Not implemented!!
00143 
00144         return NULL;
00145 }
00146 // ***************************************************************************
00147 void                    CDriverUser::deleteTextureRaw(UTextureRaw *textraw) 
00148 {
00149         NL3D_MEM_DRIVER
00150         nlstop; // Not implemented!!
00151 
00152         delete textraw;
00153 }
00154 // ***************************************************************************
00155 UMaterial               *CDriverUser::createMaterial() 
00156 {
00157         NL3D_MEM_DRIVER
00158 
00159         return _Materials.insert(new CMaterialUser);
00160 }
00161 // ***************************************************************************
00162 void                    CDriverUser::deleteMaterial(UMaterial *umat) 
00163 {
00164         NL3D_MEM_DRIVER
00165 
00166         _Materials.erase( (CMaterialUser*)umat, "deleteMaterial: Bad material");
00167 }
00168 
00169 
00170 
00171 // ***************************************************************************
00172 // ***************************************************************************
00173 // Profile.
00174 // ***************************************************************************
00175 // ***************************************************************************
00176 
00177 
00178 // ***************************************************************************
00179 void                    CDriverUser::profileRenderedPrimitives(CPrimitiveProfile &pIn, CPrimitiveProfile &pOut)
00180 {
00181         NL3D_MEM_DRIVER
00182 
00183         _Driver->profileRenderedPrimitives(pIn, pOut);
00184 }
00185 
00186 
00187 // ***************************************************************************
00188 uint32                  CDriverUser::profileAllocatedTextureMemory()
00189 {
00190         NL3D_MEM_DRIVER
00191 
00192         return _Driver->profileAllocatedTextureMemory();
00193 }
00194 
00195 
00196 // ***************************************************************************
00197 uint32                  CDriverUser::profileSetupedMaterials() const
00198 {
00199         NL3D_MEM_DRIVER
00200 
00201         return _Driver->profileSetupedMaterials();
00202 }
00203 
00204 
00205 // ***************************************************************************
00206 uint32                  CDriverUser::profileSetupedModelMatrix() const
00207 {
00208         NL3D_MEM_DRIVER
00209         return _Driver->profileSetupedModelMatrix();
00210 }
00211 
00212 
00213 // ***************************************************************************
00214 void                    CDriverUser::enableUsedTextureMemorySum (bool enable)
00215 {
00216         NL3D_MEM_DRIVER
00217         _Driver->enableUsedTextureMemorySum (enable);
00218 }
00219 
00220 
00221 // ***************************************************************************
00222 uint32                  CDriverUser::getUsedTextureMemory () const
00223 {
00224         NL3D_MEM_DRIVER
00225         return _Driver->getUsedTextureMemory ();
00226 }
00227 
00228 
00229 } // NL3D