Utility/MaterialData: Remove CustomDefined

Former-commit-id: a3051df8a12d596901043b142ee1fa55a2481644 [formerly 97b1364fc5ba7f22bb28479f0edb351db8e7cfff] [formerly 49730b561eda3f1350e87b2c99c48c04f45c849a [formerly e20bc09b46ea5a6555ef887b1db3a6f7f2b7cb3a]]
Former-commit-id: 78f2eff516042ec38f0f61ab9b4263d968c0488a [formerly c6e7d6d63628402d8a58cf8e95dbb0509d07ff03]
Former-commit-id: b269a6e53c5205aa27ef921f348367f1affde02e
This commit is contained in:
Lynix 2016-08-04 01:12:06 +02:00
parent 66bc8a5dde
commit 00fb383f70
7 changed files with 5 additions and 17 deletions

View File

@ -173,12 +173,7 @@ int main()
Nz::String data; Nz::String data;
if (!matData.GetStringParameter(Nz::MaterialData::FilePath, &data)) if (!matData.GetStringParameter(Nz::MaterialData::FilePath, &data))
{
if (matData.HasParameter(Nz::MaterialData::CustomDefined))
data = "<Custom>"; data = "<Custom>";
else
data = "<No data>";
}
std::cout << "\t" << (i+1) << ": " << data << std::endl; std::cout << "\t" << (i+1) << ": " << data << std::endl;
} }

View File

@ -23,7 +23,6 @@ namespace Nz
static constexpr const char* BackFaceStencilZFail = "MatBackFaceStencilZFail"; static constexpr const char* BackFaceStencilZFail = "MatBackFaceStencilZFail";
static constexpr const char* Blending = "MatBlending"; static constexpr const char* Blending = "MatBlending";
static constexpr const char* CullingSide = "MatCullingSide"; static constexpr const char* CullingSide = "MatCullingSide";
static constexpr const char* CustomDefined = "MatCustomDefined";
static constexpr const char* ColorWrite = "MatColorWrite"; static constexpr const char* ColorWrite = "MatColorWrite";
static constexpr const char* DepthBuffer = "MatDepthBuffer"; static constexpr const char* DepthBuffer = "MatDepthBuffer";
static constexpr const char* DepthFunc = "MatDepthfunc"; static constexpr const char* DepthFunc = "MatDepthfunc";

View File

@ -237,8 +237,6 @@ bool Load(Mesh* mesh, Stream& stream, const MeshParams& parameters)
aiColor4D color; aiColor4D color;
if (aiGetMaterialColor(aiMat, aiKey, aiType, aiIndex, &color) == aiReturn_SUCCESS) if (aiGetMaterialColor(aiMat, aiKey, aiType, aiIndex, &color) == aiReturn_SUCCESS)
{ {
matData.SetParameter(MaterialData::CustomDefined);
matData.SetParameter(colorKey, Color(static_cast<UInt8>(color.r * 255), static_cast<UInt8>(color.g * 255), static_cast<UInt8>(color.b * 255), static_cast<UInt8>(color.a * 255))); matData.SetParameter(colorKey, Color(static_cast<UInt8>(color.r * 255), static_cast<UInt8>(color.g * 255), static_cast<UInt8>(color.b * 255), static_cast<UInt8>(color.a * 255)));
} }
}; };
@ -249,7 +247,6 @@ bool Load(Mesh* mesh, Stream& stream, const MeshParams& parameters)
aiTextureMapMode mapMode[3]; aiTextureMapMode mapMode[3];
if (aiGetMaterialTexture(aiMat, aiType, 0, &path, nullptr, nullptr, nullptr, nullptr, &mapMode[0], nullptr) == aiReturn_SUCCESS) if (aiGetMaterialTexture(aiMat, aiType, 0, &path, nullptr, nullptr, nullptr, nullptr, &mapMode[0], nullptr) == aiReturn_SUCCESS)
{ {
matData.SetParameter(MaterialData::CustomDefined);
matData.SetParameter(textureKey, stream.GetDirectory() + String(path.data, path.length)); matData.SetParameter(textureKey, stream.GetDirectory() + String(path.data, path.length));
if (wrapKey) if (wrapKey)

View File

@ -39,7 +39,7 @@ namespace Nz
else else
NazaraWarning("Failed to load material from file " + String::Number(i)); NazaraWarning("Failed to load material from file " + String::Number(i));
} }
else if (matData.HasParameter(MaterialData::CustomDefined)) else
{ {
MaterialRef material = Material::New(); MaterialRef material = Material::New();
material->BuildFromParameters(matData, parameters.material); material->BuildFromParameters(matData, parameters.material);

View File

@ -102,7 +102,6 @@ namespace Nz
stream.Read(skin, 68*sizeof(char)); stream.Read(skin, 68*sizeof(char));
ParameterList matData; ParameterList matData;
matData.SetParameter(MaterialData::CustomDefined);
matData.SetParameter(MaterialData::DiffuseTexturePath, baseDir + skin); matData.SetParameter(MaterialData::DiffuseTexturePath, baseDir + skin);
mesh->SetMaterialData(i, std::move(matData)); mesh->SetMaterialData(i, std::move(matData));

View File

@ -73,8 +73,6 @@ namespace Nz
{ {
ParameterList data; ParameterList data;
data.SetParameter(MaterialData::CustomDefined);
UInt8 alphaValue = static_cast<UInt8>(mtlMat->alpha*255.f); UInt8 alphaValue = static_cast<UInt8>(mtlMat->alpha*255.f);
Color ambientColor(mtlMat->ambient); Color ambientColor(mtlMat->ambient);

View File

@ -121,7 +121,9 @@ namespace Nz
MTLParser::Material* material = mtlFormat.AddMaterial(name); MTLParser::Material* material = mtlFormat.AddMaterial(name);
String strVal; String strVal;
if (matData.HasParameter(MaterialData::CustomDefined)) if (matData.GetStringParameter(MaterialData::FilePath, &strVal))
material->diffuseMap = strVal;
else
{ {
Color colorVal; Color colorVal;
float fValue; float fValue;
@ -147,8 +149,6 @@ namespace Nz
if (matData.GetStringParameter(MaterialData::SpecularTexturePath, &strVal)) if (matData.GetStringParameter(MaterialData::SpecularTexturePath, &strVal))
material->specularMap = strVal; material->specularMap = strVal;
} }
else if (matData.GetStringParameter(MaterialData::FilePath, &strVal))
material->diffuseMap = strVal;
} }
// Meshes // Meshes