(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();
bool SetAlphaMap(const NzString& name);
void SetAlphaMap(NzTexture* map);
bool SetAlphaMap(const NzString& textureName);
void SetAlphaMap(NzTextureRef alphaMap);
void SetAlphaThreshold(float alphaThreshold);
void SetAmbientColor(const NzColor& ambient);
void SetDepthFunc(nzRendererComparison depthFunc);
void SetDiffuseColor(const NzColor& diffuse);
bool SetDiffuseMap(const NzString& name);
void SetDiffuseMap(NzTexture* map);
bool SetDiffuseMap(const NzString& textureName);
void SetDiffuseMap(NzTextureRef diffuseMap);
void SetDiffuseSampler(const NzTextureSampler& sampler);
void SetDstBlend(nzBlendFunc func);
bool SetEmissiveMap(const NzString& name);
void SetEmissiveMap(NzTexture* map);
bool SetEmissiveMap(const NzString& textureName);
void SetEmissiveMap(NzTextureRef textureName);
void SetFaceCulling(nzFaceSide faceSide);
void SetFaceFilling(nzFaceFilling filling);
bool SetHeightMap(const NzString& name);
void SetHeightMap(NzTexture* map);
bool SetNormalMap(const NzString& name);
void SetNormalMap(NzTexture* map);
bool SetHeightMap(const NzString& textureName);
void SetHeightMap(NzTextureRef textureName);
bool SetNormalMap(const NzString& textureName);
void SetNormalMap(NzTextureRef textureName);
void SetRenderStates(const NzRenderStates& states);
void SetShader(const NzUberShader* uberShader);
void SetShader(NzUberShaderConstRef uberShader);
bool SetShader(const NzString& uberShaderName);
void SetShininess(float shininess);
void SetSpecularColor(const NzColor& specular);
bool SetSpecularMap(const NzString& name);
void SetSpecularMap(NzTexture* map);
bool SetSpecularMap(const NzString& textureName);
void SetSpecularMap(NzTextureRef specularMap);
void SetSpecularSampler(const NzTextureSampler& sampler);
void SetSrcBlend(nzBlendFunc func);

View File

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