NL3D::CShapeBankUser Class Reference

#include <shape_bank_user.h>

Inheritance diagram for NL3D::CShapeBankUser:

NL3D::UShapeBank

Detailed Description

Implementation of the user interface managing shape bank

Author:
Matthieu Besson

Nevrax France

Date:
2001

Definition at line 46 of file shape_bank_user.h.

Public Member Functions

virtual void addShapeCache (const std::string &shapeCacheName)
virtual UShape getShape (const std::string &shapeName)
virtual void linkShapeToShapeCache (const std::string &shapeName, const std::string &shapeCacheName)
virtual void preLoadShapesFromBNP (const std::string &shapeCacheName, const std::string &bnpName, const std::string &wildCard, NLMISC::IProgressCallback *progress=NULL, bool flushTextures=false)
virtual void preLoadShapesFromDirectory (const std::string &shapeCacheName, const std::string &path, const std::string &wildCard, bool recurs, NLMISC::IProgressCallback *progress=NULL, bool flushTextures=false)
virtual void removeShapeCache (const std::string &shapeCacheName)
virtual void reset ()
virtual void setShapeCacheSize (const std::string &shapeCacheName, sint32 maxSize)
virtual ~CShapeBankUser ()

Data Fields

CDriverUser_DriverUser
CShapeBank _ShapeBank


Constructor & Destructor Documentation

virtual NL3D::CShapeBankUser::~CShapeBankUser  )  [inline, virtual]
 

Definition at line 49 of file shape_bank_user.h.

References NL3D_MEM_SHAPE_BANK.

00050         {
00051                 NL3D_MEM_SHAPE_BANK
00052         }


Member Function Documentation

void NL3D::CShapeBankUser::addShapeCache const std::string &  shapeCacheName  )  [virtual]
 

Add a new ShapeCache. If already exist do nothing.

Implements NL3D::UShapeBank.

Definition at line 42 of file shape_bank_user.cpp.

References NL3D::CShapeBank::addShapeCache(), and NL3D_MEM_SHAPE_BANK.

00043 {
00044         NL3D_MEM_SHAPE_BANK
00045         _ShapeBank.addShapeCache( shapeCacheName );
00046 }

UShape NL3D::CShapeBankUser::getShape const std::string &  shapeName  )  [virtual]
 

Return a UShape proxy from this name. NB: if not found the mesh is not loaded, and the proxy returned will be empty

Implements NL3D::UShapeBank.

Definition at line 107 of file shape_bank_user.cpp.

References NL3D::UShape::attach(), and NL3D::CShapeBank::getShape().

00108 {
00109         // get the IShape from the bank
00110         UShape  ret;
00111         ret.attach(_ShapeBank.getShape(shapeName));
00112 
00113         return ret;
00114 }

void NL3D::CShapeBankUser::linkShapeToShapeCache const std::string &  shapeName,
const std::string &  shapeCacheName
[virtual]
 

Link a shape to a ShapeCache. The ShapeCache must exist and must not contains the shape.

Implements NL3D::UShapeBank.

Definition at line 74 of file shape_bank_user.cpp.

References NL3D::CShapeBank::linkShapeToShapeCache(), and NL3D_MEM_SHAPE_BANK.

00075 {
00076         NL3D_MEM_SHAPE_BANK
00077         _ShapeBank.linkShapeToShapeCache( shapeName, shapeCacheName );
00078 }

void NL3D::CShapeBankUser::preLoadShapesFromBNP const std::string &  shapeCacheName,
const std::string &  bnpName,
const std::string &  wildCard,
NLMISC::IProgressCallback progress = NULL,
bool  flushTextures = false
[virtual]
 

PreLoad all shapes (.shape, .ps, .skel...) files from a directory into a shapeCache. same as preLoadShapesFromDirectory() but take a BNP name which must have been added with CBigFile::add() or through CPath::addSearchBigFile()

Parameters:
bnpName eg: "characters.bnp" (NB: set the bigFileNAme without any path).
flushTex : true to flush the texture of each shape when it is loaded

Implements NL3D::UShapeBank.

Definition at line 94 of file shape_bank_user.cpp.

References NL3D::CDriverUser::getDriver(), and NL3D::CShapeBank::preLoadShapes().

00096 {
00097         // List all files From the bnp
00098         vector<string>  listFile;
00099         CBigFile::getInstance().list(bnpName, listFile);
00100  
00101         // preLoad
00102         if(!listFile.empty())
00103                 _ShapeBank.preLoadShapes(shapeCacheName, listFile, wildCardNotLwr, progress, flushTextures, _DriverUser->getDriver());
00104 }

void NL3D::CShapeBankUser::preLoadShapesFromDirectory const std::string &  shapeCacheName,
const std::string &  path,
const std::string &  wildCard,
bool  recurs,
NLMISC::IProgressCallback progress = NULL,
bool  flushTextures = false
[virtual]
 

PreLoad all shapes (.shape, .ps, .skel...) files from a directory into a shapeCache. Shapes are Loaded if not present, assigned to the given cache, and fit in the cache Size as max possible. NB: crash if you try to load a non shape file (eg: a .dds etc...)

Parameters:
shapeCacheName name of a shapeCache created with addShapeCache()/setShapeCacheSize(). no-op if don't exist
path a valid path (local or not) where to find shapes. NB: CPath is used to load the shapes.
wildcard a filter string like: "*.shape", "??_HOM*.shape". NB: strlwr-ed internally
recurs true if want to recurs in sub directory

Implements NL3D::UShapeBank.

Definition at line 81 of file shape_bank_user.cpp.

References NL3D::CDriverUser::getDriver(), and NL3D::CShapeBank::preLoadShapes().

00083 {
00084         // List all files From the path
00085         vector<string>  listFile;
00086         CPath::getPathContent(path, recurs, false, true, listFile);
00087 
00088         // preLoad
00089         if(!listFile.empty())
00090                 _ShapeBank.preLoadShapes(shapeCacheName, listFile, wildCardNotLwr, progress, flushTextures, _DriverUser->getDriver());
00091 }

void NL3D::CShapeBankUser::removeShapeCache const std::string &  shapeCacheName  )  [virtual]
 

Remove a ShapeCache. All shapes in the shape cache are deleted. All links are redirected to the default ShapeCache.

Implements NL3D::UShapeBank.

Definition at line 50 of file shape_bank_user.cpp.

References NL3D_MEM_SHAPE_BANK, and NL3D::CShapeBank::removeShapeCache().

00051 {
00052         NL3D_MEM_SHAPE_BANK
00053         _ShapeBank.removeShapeCache( shapeCacheName );
00054 }

void NL3D::CShapeBankUser::reset  )  [virtual]
 

Remove all ShapeCache and suppress all links (even the link to the default cache are removed)

Implements NL3D::UShapeBank.

Definition at line 58 of file shape_bank_user.cpp.

References NL3D_MEM_SHAPE_BANK, and NL3D::CShapeBank::reset().

00059 {
00060         NL3D_MEM_SHAPE_BANK
00061         _ShapeBank.reset();
00062 }

void NL3D::CShapeBankUser::setShapeCacheSize const std::string &  shapeCacheName,
sint32  maxSize
[virtual]
 

Set the shapeCache shapeCacheName the new size.(delete shapes if maxsize<shapeCacheSize).

Implements NL3D::UShapeBank.

Definition at line 66 of file shape_bank_user.cpp.

References NL3D_MEM_SHAPE_BANK, NL3D::CShapeBank::setShapeCacheSize(), and sint32.

00067 {
00068         NL3D_MEM_SHAPE_BANK
00069         _ShapeBank.setShapeCacheSize( shapeCacheName, maxSize );
00070 }


Field Documentation

CDriverUser* NL3D::CShapeBankUser::_DriverUser
 

Definition at line 67 of file shape_bank_user.h.

Referenced by NL3D::CDriverUser::CDriverUser().

CShapeBank NL3D::CShapeBankUser::_ShapeBank
 

Definition at line 66 of file shape_bank_user.h.

Referenced by NL3D::CDriverUser::createScene().


The documentation for this class was generated from the following files:
Generated on Tue Mar 16 07:44:13 2004 for NeL by doxygen 1.3.6