Graphics/Shader: Make texture units statics

Provides better performances and prevents the sampler type bug to happen
This commit is contained in:
Lynix
2016-12-18 01:13:46 +01:00
parent 1a8805aad1
commit 682dab32b3
10 changed files with 203 additions and 183 deletions

View File

@@ -64,7 +64,7 @@ namespace Nz
inline Material(const Material& material);
inline ~Material();
void Apply(const MaterialPipeline::Instance& instance, UInt8 textureUnit = 0, UInt8* lastUsedUnit = nullptr) const;
void Apply(const MaterialPipeline::Instance& instance) const;
void BuildFromParameters(const ParameterList& matData, const MaterialParams& matParams = MaterialParams());
@@ -174,6 +174,7 @@ namespace Nz
inline Material& operator=(const Material& material);
inline static MaterialRef GetDefault();
inline static int GetTextureUnit(TextureMap textureMap);
template<typename... Args> static MaterialRef New(Args&&... args);
// Signals:
@@ -207,6 +208,7 @@ namespace Nz
float m_alphaThreshold;
float m_shininess;
static std::array<int, TextureMap_Max + 1> s_textureUnits;
static MaterialLibrary::LibraryMap s_library;
static MaterialLoader::LoaderList s_loaders;
static MaterialManager::ManagerMap s_managerMap;