Fission FSN
Loading...
Searching...
No Matches
fsCBrushManager.h
Go to the documentation of this file.
1/********************************************************************
2*
3* Created: 27/2/2014 15:42
4*
5* File: fsCBrushManager.h
6*
7* Author: Mick Waites
8*
9* Purpose: Loading textures and texture pages and presenting
10* them as brush references.
11*
12*********************************************************************/
13
14#ifndef fsCBrushManagerhdr
15#define fsCBrushManagerhdr
16
17#include <map>
18#include <memory>
19#include <vector>
20
21#include <fsCore/fsStr.h>
23#include "../fsITexture.h"
24
25class fsCBrush;
26
27
28class fsCBrushManager : public fsTSingleton<fsCBrushManager>
29{
30 friend class fsTSingleton<fsCBrushManager>;
31
32public:
33
34 fsStr brushNameGet(fsCBrush* const pBrush);
35 void rawBrushesFinalise();
36 fsBool textureExistsGet(const fsCResourceName& pFileName);
37 // True only if the brush is already loaded (e.g. from a texture page); no disk lookup.
38 fsBool brushCachedGet(const fsCResourceName& pFileName);
39 void maskTexturePageLoad(fsITexture::fsSOptions const& pOptions);
40 void texturePageLoad(fsITexture::fsSOptions const& pOptions);
41 void permanantBrushLoad(fsITexture::fsSOptions const& pOptions);
42
43 std::shared_ptr<fsCBrush> uncachedGet(const fsCResourceName& pFileName);
44 std::shared_ptr<fsCBrush> get(const fsCResourceName& pFileName, fsBool pHitMap,
45 fsBool pDeferedUpload = false, fsBool pUVAnimation = false);
46 static std::shared_ptr<fsCBrush> getNoCache(std::shared_ptr<fsCBrush> pBrush, fsS32 pU, fsS32 pV, fsS32 pW,
47 fsS32 pH);
48 static std::shared_ptr<fsCBrush> getNoCache(fsS32 pWidth, fsS32 pHeight);
49
50 static std::shared_ptr<fsCBrush> getAlpha8BrushFromHitmap(std::shared_ptr<fsCBrush> pBrushWithHitMap);
51
52 void flush();
53
54protected:
55
56 static std::map<fsStr, std::shared_ptr<fsCBrush>>::iterator existingBrushLocate(
57 const fsStr& pFileName, std::map<fsStr, std::shared_ptr<fsCBrush>>& pMap);
58 std::shared_ptr<fsCBrush> newBrushLoadAndAddToMap(std::map<fsStr, std::shared_ptr<fsCBrush>>& pMap,
59 fsITexture::fsSOptions const& pOptions);
60
62 virtual ~fsCBrushManager();
63
64private:
65
66 void masksApplyToExistingBrushes(std::map<fsStr, std::shared_ptr<fsCBrush>> pMasks);
67 void texturePageParse(std::map<fsStr, std::shared_ptr<fsCBrush>>& pBrushes, fsITexture::fsSOptions const& pOptions);
68
69 std::map<fsStr, std::shared_ptr<fsCBrush>> mPermanantBrushes;
70 std::map<fsStr, std::shared_ptr<fsCBrush>> mBrushes;
71
72 std::vector<fsCBrush*> mRawBrushes;
73};
74
75#endif
Definition fsCBrush.h:26
static std::shared_ptr< fsCBrush > getNoCache(std::shared_ptr< fsCBrush > pBrush, fsS32 pU, fsS32 pV, fsS32 pW, fsS32 pH)
Definition fsCBrushManager.cpp:163
std::shared_ptr< fsCBrush > uncachedGet(const fsCResourceName &pFileName)
Definition fsCBrushManager.cpp:209
fsBool brushCachedGet(const fsCResourceName &pFileName)
Definition fsCBrushManager.cpp:44
fsBool textureExistsGet(const fsCResourceName &pFileName)
Definition fsCBrushManager.cpp:27
void flush()
Definition fsCBrushManager.cpp:220
void maskTexturePageLoad(fsITexture::fsSOptions const &pOptions)
Definition fsCBrushManager.cpp:74
fsCBrushManager()
Definition fsCBrushManager.cpp:225
static std::map< fsStr, std::shared_ptr< fsCBrush > >::iterator existingBrushLocate(const fsStr &pFileName, std::map< fsStr, std::shared_ptr< fsCBrush > > &pMap)
Definition fsCBrushManager.cpp:192
std::shared_ptr< fsCBrush > get(const fsCResourceName &pFileName, fsBool pHitMap, fsBool pDeferedUpload=false, fsBool pUVAnimation=false)
Definition fsCBrushManager.cpp:144
void texturePageLoad(fsITexture::fsSOptions const &pOptions)
Definition fsCBrushManager.cpp:81
void permanantBrushLoad(fsITexture::fsSOptions const &pOptions)
Definition fsCBrushManager.cpp:136
fsStr brushNameGet(fsCBrush *const pBrush)
Definition fsCBrushManager.cpp:13
static std::shared_ptr< fsCBrush > getAlpha8BrushFromHitmap(std::shared_ptr< fsCBrush > pBrushWithHitMap)
Definition fsCBrushManager.cpp:180
std::shared_ptr< fsCBrush > newBrushLoadAndAddToMap(std::map< fsStr, std::shared_ptr< fsCBrush > > &pMap, fsITexture::fsSOptions const &pOptions)
Definition fsCBrushManager.cpp:198
virtual ~fsCBrushManager()
Definition fsCBrushManager.cpp:229
void rawBrushesFinalise()
Definition fsCBrushManager.cpp:127
Definition fsCResourceName.h:32
Definition fsStr.h:23
bool fsBool
Definition fsBaseTypes.h:26
int fsS32
Definition fsBaseTypes.h:20
Definition fsITexture.h:56