Utility/MaterialData: Remove CustomDefined
Former-commit-id: 3dc61fac4aa014daa8ccb2732bd3010c9b7a3013 [formerly 911c0c99570971d97e69d4a7d544ec1666432c26] [formerly cd5daaf8eb34d687da378f2531714d794b193a42 [formerly 5f58954832a234a14396585247dd18e1101f2918]] Former-commit-id: 22a69eb53fb4e400203bcbf0222a7b338de70ab1 [formerly 3f66b581a5b1c55c288a9226a7791981877ea68e] Former-commit-id: 921e4fe70ce1240e92c0c057ffe4a7678fc58a0b
This commit is contained in:
parent
e4211b13a0
commit
0c533d378f
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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";
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
|
|
|
||||||
|
|
@ -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);
|
||||||
|
|
|
||||||
|
|
@ -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));
|
||||||
|
|
|
||||||
|
|
@ -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);
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue