(Material) Set*Map methods now take an object reference...

...instead of a naked pointer.
Also renamed some parameters to make them more explicit.


Former-commit-id: 3b962ba178ffc94d630fb11e005e9992cf93005d
This commit is contained in:
Lynix 2015-02-18 21:03:17 +01:00
parent af94573f5f
commit 2b6dcb4e2b
2 changed files with 53 additions and 53 deletions

View File

@ -109,31 +109,31 @@ class NAZARA_API NzMaterial : public NzRefCounted, public NzResource
void Reset(); void Reset();
bool SetAlphaMap(const NzString& name); bool SetAlphaMap(const NzString& textureName);
void SetAlphaMap(NzTexture* map); void SetAlphaMap(NzTextureRef alphaMap);
void SetAlphaThreshold(float alphaThreshold); void SetAlphaThreshold(float alphaThreshold);
void SetAmbientColor(const NzColor& ambient); void SetAmbientColor(const NzColor& ambient);
void SetDepthFunc(nzRendererComparison depthFunc); void SetDepthFunc(nzRendererComparison depthFunc);
void SetDiffuseColor(const NzColor& diffuse); void SetDiffuseColor(const NzColor& diffuse);
bool SetDiffuseMap(const NzString& name); bool SetDiffuseMap(const NzString& textureName);
void SetDiffuseMap(NzTexture* map); void SetDiffuseMap(NzTextureRef diffuseMap);
void SetDiffuseSampler(const NzTextureSampler& sampler); void SetDiffuseSampler(const NzTextureSampler& sampler);
void SetDstBlend(nzBlendFunc func); void SetDstBlend(nzBlendFunc func);
bool SetEmissiveMap(const NzString& name); bool SetEmissiveMap(const NzString& textureName);
void SetEmissiveMap(NzTexture* map); void SetEmissiveMap(NzTextureRef textureName);
void SetFaceCulling(nzFaceSide faceSide); void SetFaceCulling(nzFaceSide faceSide);
void SetFaceFilling(nzFaceFilling filling); void SetFaceFilling(nzFaceFilling filling);
bool SetHeightMap(const NzString& name); bool SetHeightMap(const NzString& textureName);
void SetHeightMap(NzTexture* map); void SetHeightMap(NzTextureRef textureName);
bool SetNormalMap(const NzString& name); bool SetNormalMap(const NzString& textureName);
void SetNormalMap(NzTexture* map); void SetNormalMap(NzTextureRef textureName);
void SetRenderStates(const NzRenderStates& states); void SetRenderStates(const NzRenderStates& states);
void SetShader(const NzUberShader* uberShader); void SetShader(NzUberShaderConstRef uberShader);
bool SetShader(const NzString& uberShaderName); bool SetShader(const NzString& uberShaderName);
void SetShininess(float shininess); void SetShininess(float shininess);
void SetSpecularColor(const NzColor& specular); void SetSpecularColor(const NzColor& specular);
bool SetSpecularMap(const NzString& name); bool SetSpecularMap(const NzString& textureName);
void SetSpecularMap(NzTexture* map); void SetSpecularMap(NzTextureRef specularMap);
void SetSpecularSampler(const NzTextureSampler& sampler); void SetSpecularSampler(const NzTextureSampler& sampler);
void SetSrcBlend(nzBlendFunc func); void SetSrcBlend(nzBlendFunc func);

View File

@ -406,23 +406,23 @@ void NzMaterial::Reset()
SetShader("Basic"); SetShader("Basic");
} }
bool NzMaterial::SetAlphaMap(const NzString& name) bool NzMaterial::SetAlphaMap(const NzString& textureName)
{ {
NzTextureRef texture = NzTextureLibrary::Query(name); NzTextureRef texture = NzTextureLibrary::Query(textureName);
if (!texture) if (!texture)
{ {
texture = NzTextureManager::Get(name); texture = NzTextureManager::Get(textureName);
if (!texture) if (!texture)
return false; return false;
} }
SetAlphaMap(texture); SetAlphaMap(std::move(texture));
return true; return true;
} }
void NzMaterial::SetAlphaMap(NzTexture* map) void NzMaterial::SetAlphaMap(NzTextureRef alphaMap)
{ {
m_alphaMap = map; m_alphaMap = std::move(alphaMap);
InvalidateShaders(); InvalidateShaders();
} }
@ -447,23 +447,23 @@ void NzMaterial::SetDiffuseColor(const NzColor& diffuse)
m_diffuseColor = diffuse; m_diffuseColor = diffuse;
} }
bool NzMaterial::SetDiffuseMap(const NzString& name) bool NzMaterial::SetDiffuseMap(const NzString& textureName)
{ {
NzTextureRef texture = NzTextureLibrary::Query(name); NzTextureRef texture = NzTextureLibrary::Query(textureName);
if (!texture) if (!texture)
{ {
texture = NzTextureManager::Get(name); texture = NzTextureManager::Get(textureName);
if (!texture) if (!texture)
return false; return false;
} }
SetDiffuseMap(texture); SetDiffuseMap(std::move(texture));
return true; return true;
} }
void NzMaterial::SetDiffuseMap(NzTexture* map) void NzMaterial::SetDiffuseMap(NzTextureRef diffuseMap)
{ {
m_diffuseMap = map; m_diffuseMap = std::move(diffuseMap);
InvalidateShaders(); InvalidateShaders();
} }
@ -478,23 +478,23 @@ void NzMaterial::SetDstBlend(nzBlendFunc func)
m_states.dstBlend = func; m_states.dstBlend = func;
} }
bool NzMaterial::SetEmissiveMap(const NzString& name) bool NzMaterial::SetEmissiveMap(const NzString& textureName)
{ {
NzTextureRef texture = NzTextureLibrary::Query(name); NzTextureRef texture = NzTextureLibrary::Query(textureName);
if (!texture) if (!texture)
{ {
texture = NzTextureManager::Get(name); texture = NzTextureManager::Get(textureName);
if (!texture) if (!texture)
return false; return false;
} }
SetEmissiveMap(texture); SetEmissiveMap(std::move(texture));
return true; return true;
} }
void NzMaterial::SetEmissiveMap(NzTexture* map) void NzMaterial::SetEmissiveMap(NzTextureRef emissiveMap)
{ {
m_emissiveMap = map; m_emissiveMap = std::move(emissiveMap);
InvalidateShaders(); InvalidateShaders();
} }
@ -509,44 +509,44 @@ void NzMaterial::SetFaceFilling(nzFaceFilling filling)
m_states.faceFilling = filling; m_states.faceFilling = filling;
} }
bool NzMaterial::SetHeightMap(const NzString& name) bool NzMaterial::SetHeightMap(const NzString& textureName)
{ {
NzTextureRef texture = NzTextureLibrary::Query(name); NzTextureRef texture = NzTextureLibrary::Query(textureName);
if (!texture) if (!texture)
{ {
texture = NzTextureManager::Get(name); texture = NzTextureManager::Get(textureName);
if (!texture) if (!texture)
return false; return false;
} }
SetHeightMap(texture); SetHeightMap(std::move(texture));
return true; return true;
} }
void NzMaterial::SetHeightMap(NzTexture* map) void NzMaterial::SetHeightMap(NzTextureRef heightMap)
{ {
m_heightMap = map; m_heightMap = std::move(heightMap);
InvalidateShaders(); InvalidateShaders();
} }
bool NzMaterial::SetNormalMap(const NzString& name) bool NzMaterial::SetNormalMap(const NzString& textureName)
{ {
NzTextureRef texture = NzTextureLibrary::Query(name); NzTextureRef texture = NzTextureLibrary::Query(textureName);
if (!texture) if (!texture)
{ {
texture = NzTextureManager::Get(name); texture = NzTextureManager::Get(textureName);
if (!texture) if (!texture)
return false; return false;
} }
SetNormalMap(texture); SetNormalMap(std::move(texture));
return true; return true;
} }
void NzMaterial::SetNormalMap(NzTexture* map) void NzMaterial::SetNormalMap(NzTextureRef normalMap)
{ {
m_normalMap = map; m_normalMap = std::move(normalMap);
InvalidateShaders(); InvalidateShaders();
} }
@ -556,20 +556,20 @@ void NzMaterial::SetRenderStates(const NzRenderStates& states)
m_states = states; m_states = states;
} }
void NzMaterial::SetShader(const NzUberShader* uberShader) void NzMaterial::SetShader(NzUberShaderConstRef uberShader)
{ {
m_uberShader = uberShader; m_uberShader = std::move(uberShader);
InvalidateShaders(); InvalidateShaders();
} }
bool NzMaterial::SetShader(const NzString& uberShaderName) bool NzMaterial::SetShader(const NzString& uberShaderName)
{ {
NzUberShader* uberShader = NzUberShaderLibrary::Get(uberShaderName); NzUberShaderConstRef uberShader = NzUberShaderLibrary::Get(uberShaderName);
if (!uberShader) if (!uberShader)
return false; return false;
SetShader(uberShader); SetShader(std::move(uberShader));
return true; return true;
} }
@ -583,23 +583,23 @@ void NzMaterial::SetSpecularColor(const NzColor& specular)
m_specularColor = specular; m_specularColor = specular;
} }
bool NzMaterial::SetSpecularMap(const NzString& name) bool NzMaterial::SetSpecularMap(const NzString& textureName)
{ {
NzTextureRef texture = NzTextureLibrary::Query(name); NzTextureRef texture = NzTextureLibrary::Query(textureName);
if (!texture) if (!texture)
{ {
texture = NzTextureManager::Get(name); texture = NzTextureManager::Get(textureName);
if (!texture) if (!texture)
return false; return false;
} }
SetSpecularMap(texture); SetSpecularMap(std::move(texture));
return true; return true;
} }
void NzMaterial::SetSpecularMap(NzTexture* map) void NzMaterial::SetSpecularMap(NzTextureRef specularMap)
{ {
m_specularMap = map; m_specularMap = std::move(specularMap);
InvalidateShaders(); InvalidateShaders();
} }