1 // NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
2 // Copyright (C) 2010 Winch Gate Property Limited
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.
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/>.
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
;
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()
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
);
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
);
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
101 ret
.attach(_ShapeBank
.getShape(shapeName
));
106 // ***************************************************************************
107 void CShapeBankUser::buildSystemGeometryForshape(const std::string
&shapeName
)
109 _ShapeBank
.buildSystemGeometryForshape(shapeName
);