Utility/MaterialData: Remove CustomDefined

Former-commit-id: 4c3c2012ae06bdc4679fed40ee6ad50027664a8f [formerly d0454f47bbecdbb2513d7afc629b00b53543f671] [formerly 07f50ad9e366215fc51280232c26cc8cdbf8236d [formerly 27fbbc6106dc22f72d3ddb382049672e82833cd8]]
Former-commit-id: e45fd2e87fcadbdf0a56c410d6c1ff36d9ea4b4a [formerly 0453e3ba57d326859fc78105b741cd7f1cb97bd6]
Former-commit-id: 9f7082ef9da8e8baefaef5c141e630ba99b32a83
This commit is contained in:
Lynix 2016-08-04 01:12:06 +02:00
parent cf8224b9e1
commit af01e7242c
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))
{ data = "<Custom>";
if (matData.HasParameter(Nz::MaterialData::CustomDefined))
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