Handle missing 3d models in example 08

Ugly replacement if dwarf is missing.
Doing this because Debian currently discussing to remove the dwarf due to a conflict of it's license with Debian policy.


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6436 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
cutealien 2022-10-07 18:28:04 +00:00
parent b3fff12423
commit 3c5a2387cf

View File

@ -70,6 +70,11 @@ int main()
*/ */
scene::IAnimatedMesh* mesh = smgr->getMesh(mediaPath + "room.3ds"); scene::IAnimatedMesh* mesh = smgr->getMesh(mediaPath + "room.3ds");
if ( !mesh )
{
printf("Can't find model room.3ds in media path");
return 1;
}
smgr->getMeshManipulator()->makePlanarTextureMapping(mesh->getMesh(0), 0.004f); smgr->getMeshManipulator()->makePlanarTextureMapping(mesh->getMesh(0), 0.004f);
@ -252,6 +257,11 @@ int main()
// add animated character // add animated character
mesh = smgr->getMesh(mediaPath + "dwarf.x"); mesh = smgr->getMesh(mediaPath + "dwarf.x");
if (!mesh) // some Linux distributions might not have dwarf due to license
{
mesh = smgr->addArrowMesh("no_dwarf", video::SColor(0xFFFFFFFF), video::SColor(0xFFFFFFFF), 4, 8, 80.f, 50.f, 5.f, 15.f);
}
scene::IAnimatedMeshSceneNode* anode = 0; scene::IAnimatedMeshSceneNode* anode = 0;
anode = smgr->addAnimatedMeshSceneNode(mesh); anode = smgr->addAnimatedMeshSceneNode(mesh);