Changeset View
Changeset View
Standalone View
Standalone View
source/blender/freestyle/intern/stroke/StrokeRenderer.h
| Show All 10 Lines | |||||
| #include <map> | #include <map> | ||||
| #include <string.h> | #include <string.h> | ||||
| #include <utility> | #include <utility> | ||||
| #include <vector> | #include <vector> | ||||
| #include "Stroke.h" | #include "Stroke.h" | ||||
| #include "StrokeRep.h" | #include "StrokeRep.h" | ||||
| #include "../system/FreestyleConfig.h" | |||||
| #ifdef WITH_CXX_GUARDEDALLOC | #ifdef WITH_CXX_GUARDEDALLOC | ||||
| # include "MEM_guardedalloc.h" | # include "MEM_guardedalloc.h" | ||||
| #endif | #endif | ||||
| namespace Freestyle { | namespace Freestyle { | ||||
| /**********************************/ | /**********************************/ | ||||
| /* */ | /* */ | ||||
| Show All 22 Lines | inline bool hasLoaded() const | ||||
| return _hasLoadedTextures; | return _hasLoadedTextures; | ||||
| } | } | ||||
| inline unsigned int getDefaultTextureId() const | inline unsigned int getDefaultTextureId() const | ||||
| { | { | ||||
| return _defaultTextureId; | return _defaultTextureId; | ||||
| } | } | ||||
| struct Options { | |||||
| static void setPatternsPath(const string &path); | |||||
| static string getPatternsPath(); | |||||
| static void setBrushesPath(const string &path); | |||||
| static string getBrushesPath(); | |||||
| }; | |||||
| protected: | protected: | ||||
| virtual void loadStandardBrushes() = 0; | virtual void loadStandardBrushes() = 0; | ||||
| virtual unsigned loadBrush(string fileName, Stroke::MediumType = Stroke::OPAQUE_MEDIUM) = 0; | virtual unsigned loadBrush(string fileName, Stroke::MediumType = Stroke::OPAQUE_MEDIUM) = 0; | ||||
| typedef std::pair<string, Stroke::MediumType> BrushTexture; | typedef std::pair<string, Stroke::MediumType> BrushTexture; | ||||
| struct cmpBrushTexture { | struct cmpBrushTexture { | ||||
| bool operator()(const BrushTexture &bt1, const BrushTexture &bt2) const | bool operator()(const BrushTexture &bt1, const BrushTexture &bt2) const | ||||
| { | { | ||||
| int r = strcmp(bt1.first.c_str(), bt2.first.c_str()); | int r = strcmp(bt1.first.c_str(), bt2.first.c_str()); | ||||
| if (r != 0) { | if (r != 0) { | ||||
| return (r < 0); | return (r < 0); | ||||
| } | } | ||||
| else { | else { | ||||
| return (bt1.second < bt2.second); | return (bt1.second < bt2.second); | ||||
| } | } | ||||
| } | } | ||||
| }; | }; | ||||
| typedef std::map<BrushTexture, unsigned, cmpBrushTexture> brushesMap; | typedef std::map<BrushTexture, unsigned, cmpBrushTexture> brushesMap; | ||||
| static TextureManager *_pInstance; | static TextureManager *_pInstance; | ||||
| bool _hasLoadedTextures; | bool _hasLoadedTextures; | ||||
| brushesMap _brushesMap; | brushesMap _brushesMap; | ||||
| static string _patterns_path; | |||||
| static string _brushes_path; | |||||
| unsigned int _defaultTextureId; | unsigned int _defaultTextureId; | ||||
| #ifdef WITH_CXX_GUARDEDALLOC | #ifdef WITH_CXX_GUARDEDALLOC | ||||
| MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:TextureManager") | MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:TextureManager") | ||||
| #endif | #endif | ||||
| }; | }; | ||||
| /**********************************/ | /**********************************/ | ||||
| Show All 30 Lines | |||||