Merge branch 'main/rendor-staging' into fixes
[ryzomcore.git] / nel / src / 3d / shape_bank_user.cpp
blob5ded42d0dc50ec3bfed43303ae9ab632d6ee27fd
1 // NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
2 // Copyright (C) 2010 Winch Gate Property Limited
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
17 #include "std3d.h"
19 #include "nel/3d/shape_bank_user.h"
20 #include "nel/3d/driver_user.h"
21 #include "nel/misc/file.h"
22 #include "nel/misc/path.h"
23 #include "nel/misc/big_file.h"
25 using namespace NLMISC;
26 using namespace std;
28 #ifdef DEBUG_NEW
29 #define new DEBUG_NEW
30 #endif
32 namespace NL3D
35 // ***************************************************************************
37 void CShapeBankUser::addShapeCache(const std::string &shapeCacheName)
39 _ShapeBank.addShapeCache( shapeCacheName );
42 // ***************************************************************************
44 void CShapeBankUser::removeShapeCache(const std::string &shapeCacheName)
46 _ShapeBank.removeShapeCache( shapeCacheName );
49 // ***************************************************************************
51 void CShapeBankUser::reset()
53 _ShapeBank.reset();
56 // ***************************************************************************
58 void CShapeBankUser::setShapeCacheSize(const std::string &shapeCacheName, sint32 maxSize)
60 _ShapeBank.setShapeCacheSize( shapeCacheName, maxSize );
63 // ***************************************************************************
65 void CShapeBankUser::linkShapeToShapeCache(const std::string &shapeName, const std::string &shapeCacheName)
67 _ShapeBank.linkShapeToShapeCache( shapeName, shapeCacheName );
70 // ***************************************************************************
71 void CShapeBankUser::preLoadShapesFromDirectory(const std::string &shapeCacheName,
72 const std::string &path, const std::string &wildCardNotLwr, bool recurs, NLMISC::IProgressCallback *progress, bool flushTextures /*= false*/)
74 // List all files From the path
75 vector<string> listFile;
76 CPath::getPathContent(path, recurs, false, true, listFile);
78 // preLoad
79 if(!listFile.empty())
80 _ShapeBank.preLoadShapes(shapeCacheName, listFile, wildCardNotLwr, progress, flushTextures, _DriverUser->getDriver());
83 // ***************************************************************************
84 void CShapeBankUser::preLoadShapesFromBNP(const std::string &shapeCacheName,
85 const std::string &bnpName, const std::string &wildCardNotLwr, NLMISC::IProgressCallback *progress, bool flushTextures /*= false*/)
87 // List all files From the bnp
88 vector<string> listFile;
89 CBigFile::getInstance().list(bnpName, listFile);
91 // preLoad
92 if(!listFile.empty())
93 _ShapeBank.preLoadShapes(shapeCacheName, listFile, wildCardNotLwr, progress, flushTextures, _DriverUser->getDriver());
96 // ***************************************************************************
97 UShape CShapeBankUser::getShape(const std::string &shapeName)
99 // get the IShape from the bank
100 UShape ret;
101 ret.attach(_ShapeBank.getShape(shapeName));
103 return ret;
106 // ***************************************************************************
107 void CShapeBankUser::buildSystemGeometryForshape(const std::string &shapeName)
109 _ShapeBank.buildSystemGeometryForshape(shapeName);
113 } // NL3D