IAnimatedMesh* CPingPangMeshLoader::createMesh( IReadFile* file ) { IAnimatedMesh* msh = 0; if( strstr( file->getFileName(), ".md2" ) ) { msh = new CPingPangMD2XMesh(); if( ((CPingPangMD2XMesh*)msh)->loadFile( file ) ) return msh; msh->drop(); } else if( strstr( file->getFileName(), ".sam" ) ) { msh = new CPingPangSAMMesh(); if( ((CPingPangSAMMesh*)msh)->loadFile( file ) ) return msh; msh->drop(); } // Modified by Huang Liang else if ( strstr( file->getFileName(), ".ms3d" ) ) { msh = new irr::scene::sklani::CSkeletonAni(m_driver); // if ( ((irr::scene::sklani::CSkeletonAni*)msh)->LoadOldMs3Mesh(file) ) if ( ((irr::scene::sklani::CSkeletonAni*)msh)->Import(file) ) return msh; } // Modified end return 0; }
/*----------------------------------------------------------------------------*/ void OcclusionCulling::loadLeaf(s16 n) { //printf(" >> loading leaf %d %d mdls\n", n, world[n].mdl.size()); // load and models of this leaf for (u16 i=0; i < world[n].mdl.size(); i++) { u16 id = world[n].mdl[i]->id; //printf(" >> load mdl %d [%s]\n", id, listMDL[id]); IAnimatedMesh* mesh = smgr->getMesh(listMDL[id]); world[n].mdl[i]->node = smgr->addAnimatedMeshSceneNode(mesh); if (world[n].mdl[i]->node) { world[n].mdl[i]->node->setPosition(world[n].mdl[i]->pos); world[n].mdl[i]->node->setRotation(vector3df(0,world[n].mdl[i]->angle,world[n].mdl[i]->upvector)); } mesh->drop(); } // create light // apply shaders // set collision }
//! creates/loads an animated mesh from the file. //! \return Pointer to the created mesh. Returns 0 if loading failed. //! If you no longer need the mesh, you should call IAnimatedMesh::drop(). //! See IReferenceCounted::drop() for more information. IAnimatedMesh* CMD2MeshFileLoader::createMesh(io::IReadFile* file) { IAnimatedMesh* msh = new CAnimatedMeshMD2(); if (msh) { if (loadFile(file, (CAnimatedMeshMD2*)msh) ) return msh; msh->drop(); } return 0; }
/*----------------------------------------------------------------------------*/ Smodel* OcclusionCulling::loadModel(u16 id, vector3df pos, u16 angle, u16 upvector) { Smodel* x = createSmodel(id, pos, angle, upvector); IAnimatedMesh* mesh = smgr->getMesh(listMDL[id]); //mesh->setHardwareMappingHint(EHM_STATIC); //printf("loading model [%s]\n", listMDL[id]); getchar(); x->node = smgr->addAnimatedMeshSceneNode(mesh); if (x->node) { x->node->setPosition(pos); x->node->setRotation(vector3df(0,angle,upvector)); } mesh->drop(); return x; }