Skip to content

Commit

Permalink
replace deprecated common::SubMesh::MaterialIndex() with GetMaterialI…
Browse files Browse the repository at this point in the history
…ndex() (#606)

Signed-off-by: Ashton Larkin <[email protected]>
  • Loading branch information
adlarkin authored Apr 11, 2022
1 parent baf046b commit 35d87f3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
5 changes: 4 additions & 1 deletion ogre/src/OgreMeshFactory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,10 @@ bool OgreMeshFactory::LoadImpl(const MeshDescriptor &_desc)
*indices++ = subMesh.Index(j);

common::MaterialPtr material;
material = _desc.mesh->MaterialByIndex(subMesh.MaterialIndex());
if (const auto subMeshIdx = subMesh.GetMaterialIndex())
{
material = _desc.mesh->MaterialByIndex(subMeshIdx.value());
}

MaterialPtr mat = this->scene->CreateMaterial();
if (material)
Expand Down
5 changes: 4 additions & 1 deletion ogre2/src/Ogre2MeshFactory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,10 @@ bool Ogre2MeshFactory::LoadImpl(const MeshDescriptor &_desc)
iBuf->unlock();

common::MaterialPtr material;
material = _desc.mesh->MaterialByIndex(subMesh.MaterialIndex());
if (const auto subMeshIdx = subMesh.GetMaterialIndex())
{
material = _desc.mesh->MaterialByIndex(subMeshIdx.value());
}

MaterialPtr mat = this->scene->CreateMaterial();
if (material)
Expand Down
5 changes: 4 additions & 1 deletion optix/src/OptixMeshFactory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,10 @@ OptixSubMeshStorePtr OptixSubMeshStoreFactory::Create(
sm->optixGeomInstance->setGeometry(optixGeometry);

common::MaterialPtr material;
material = _desc.mesh->MaterialByIndex(subMesh->MaterialIndex());
if (const auto subMeshIdx = SubMesh.GetMaterialIndex())
{
material = _desc.mesh->MaterialByIndex(subMeshIdx.value());
}
MaterialPtr mat = this->scene->CreateMaterial();
if (material)
{
Expand Down

0 comments on commit 35d87f3

Please sign in to comment.