#include <hls_texture_manager.h>
Nevrax France
Definition at line 45 of file hls_texture_manager.h.
Public Member Functions | |
| void | addBank (CHLSTextureBank *bank) |
| Add a compiled bank. Ptr is owned and deleted by the manager. | |
| bool | buildTexture (sint textId, NLMISC::CBitmap &out) const |
| CHLSTextureManager () | |
| Constructor. | |
| sint | findTexture (const std::string &name) const |
| uint | getNumTextures () const |
| Texture name access. | |
| const char * | getTextureName (uint i) const |
| void | reset () |
| ~CHLSTextureManager () | |
Private Attributes | |
| std::vector< CHLSTextureBank * > | _Banks |
| std::vector< CHLSTextureBank::CTextureInstanceHandle > | _Instances |
|
|
Constructor.
Definition at line 38 of file hls_texture_manager.cpp.
00039 {
00040 }
|
|
|
Definition at line 43 of file hls_texture_manager.cpp. References reset().
00044 {
00045 reset();
00046 }
|
|
|
Add a compiled bank. Ptr is owned and deleted by the manager.
Definition at line 63 of file hls_texture_manager.cpp. References _Banks, _Instances, and NL3D::CHLSTextureBank::fillHandleArray(). Referenced by NL3D::CDriverUser::loadHLSBank().
00064 {
00065 // add the bank to the list
00066 _Banks.push_back(bank);
00067
00068 // Add the bank instance list to the main.
00069 bank->fillHandleArray(_Instances);
00070
00071 // then re-sort this array.
00072 sort(_Instances.begin(), _Instances.end());
00073 }
|
|
||||||||||||
|
build the colored version bitmap of a texture
Definition at line 101 of file hls_texture_manager.cpp. References _Instances, NL3D::CHLSTextureBank::CTextureInstance::buildColorVersion(), and sint. Referenced by NL3D::CAsyncTextureManager::getNextTextureToUpLoad().
00102 {
00103 if(textId<0 || textId>=(sint)_Instances.size())
00104 return false;
00105 else
00106 {
00107 // Ok. build the bitmap
00108 CHLSTextureBank::CTextureInstance &textInst= *_Instances[textId].Texture;
00109 textInst.buildColorVersion(out);
00110 return true;
00111 }
00112 }
|
|
|
search a texture name in the banks (case insensitive), and return its id.
Definition at line 77 of file hls_texture_manager.cpp. References _Instances, NL3D::CHLSTextureBank::CTextureInstance::buildAsKey(), NL3D::CHLSTextureBank::CTextureInstance::sameName(), NLMISC::searchLowerBound(), sint, NLMISC::strlwr(), NL3D::CHLSTextureBank::CTextureInstanceHandle::Texture, and uint. Referenced by NL3D::CAsyncTextureManager::addTextureRef().
00078 {
00079 // empty?
00080 if(_Instances.empty())
00081 return -1;
00082
00083 // Build a valid key.
00084 string nameLwr= strlwr(name);
00085 CHLSTextureBank::CTextureInstance textKey;
00086 CHLSTextureBank::CTextureInstanceHandle textKeyHandle;
00087 textKey.buildAsKey(nameLwr.c_str());
00088 textKeyHandle.Texture= &textKey;
00089
00090 // logN search it in the array
00091 uint id= searchLowerBound(_Instances, textKeyHandle);
00092 // verify if really same name (index must exist since 0 if error, and not empty here)
00093 CHLSTextureBank::CTextureInstance &textInst= *_Instances[id].Texture;
00094 if( textInst.sameName(nameLwr.c_str()) )
00095 return id;
00096 else
00097 return -1;
00098 }
|
|
|
Texture name access.
Definition at line 71 of file hls_texture_manager.h. References _Instances, and uint.
00071 {return _Instances.size();}
|
|
|
Definition at line 116 of file hls_texture_manager.cpp. References _Instances, nlassert, and uint.
00117 {
00118 nlassert(i<_Instances.size());
00119 return _Instances[i].Texture->getName();
00120 }
|
|
|
Definition at line 49 of file hls_texture_manager.cpp. References _Banks, _Instances, and uint. Referenced by ~CHLSTextureManager().
|
|
|
Definition at line 77 of file hls_texture_manager.h. |
|
|
Definition at line 80 of file hls_texture_manager.h. Referenced by addBank(), buildTexture(), findTexture(), getNumTextures(), getTextureName(), and reset(). |
1.3.6