Merge branch 'development' into cmake/SPEC-2513_w4267

This commit is contained in:
Esteban Papp
2021-08-02 18:03:04 -07:00
493 changed files with 7775 additions and 12867 deletions
@@ -112,17 +112,8 @@ namespace WhiteBox
AddLodBuffers(modelLodCreator);
modelLodCreator.BeginMesh();
modelLodCreator.SetMeshAabb(meshData.GetAabb());
// set the default material
if (auto materialAsset = AZ::RPI::AssetUtils::LoadAssetByProductPath<AZ::RPI::MaterialAsset>(TexturedMaterialPath.data()))
{
modelLodCreator.SetMeshMaterialAsset(materialAsset);
}
else
{
AZ_Error("CreateLodAsset", false, "Could not load material.");
return false;
}
modelLodCreator.SetMeshMaterialSlot(OneMaterialSlotId);
AddMeshBuffers(modelLodCreator);
modelLodCreator.EndMesh();
@@ -154,6 +145,20 @@ namespace WhiteBox
modelCreator.Begin(AZ::Data::AssetId(AZ::Uuid::CreateRandom()));
modelCreator.SetName(ModelName);
modelCreator.AddLodAsset(AZStd::move(m_lodAsset));
if (auto materialAsset = AZ::RPI::AssetUtils::LoadAssetByProductPath<AZ::RPI::MaterialAsset>(TexturedMaterialPath.data()))
{
AZ::RPI::ModelMaterialSlot materialSlot;
materialSlot.m_stableId = OneMaterialSlotId;
materialSlot.m_defaultMaterialAsset = materialAsset;
modelCreator.AddMaterialSlot(materialSlot);
}
else
{
AZ_Error("CreateLodAsset", false, "Could not load material.");
return;
}
modelCreator.End(m_modelAsset);
}
@@ -91,6 +91,7 @@ namespace WhiteBox
// TODO: LYN-784
static constexpr AZStd::string_view TexturedMaterialPath = "materials/defaultpbr.azmaterial";
static constexpr AZStd::string_view SolidMaterialPath = "materials/defaultpbr.azmaterial";
static constexpr AZ::RPI::ModelMaterialSlot::StableId OneMaterialSlotId = 0;
//! White box model name.
static constexpr AZStd::string_view ModelName = "WhiteBoxMesh";