本文整理汇总了C++中IAnimatedMesh类的典型用法代码示例。如果您正苦于以下问题:C++ IAnimatedMesh类的具体用法?C++ IAnimatedMesh怎么用?C++ IAnimatedMesh使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IAnimatedMesh类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadMesh
void Entity::loadMesh(char *filename, bool planar, bool hwSkin, int skinSpeed)
{
if(type == MESH_TYPE || type == MAP_TYPE)
{
IAnimatedMesh *mesh;
mesh = Scene->getMesh(filename);
if(planar == true)
{
Scene->getMeshManipulator()->makePlanarTextureMapping(mesh->getMesh(0), 0.003f);
}
tmesh = Scene->getMeshManipulator()->createMeshWithTangents(mesh->getMesh(0));
sceneNode = Scene->addMeshSceneNode(tmesh);
sceneNode->setMaterialFlag(EMF_LIGHTING, lit);
}
else if(type == ANIM_TYPE)
{
mesh = Scene->getMesh(filename);
if(planar == true)
{
Scene->getMeshManipulator()->makePlanarTextureMapping(mesh->getMesh(0), 0.003f);
}
Scene->getMeshManipulator()->createMeshWithTangents(mesh->getMesh(0));
animNode = Scene->addAnimatedMeshSceneNode(mesh);
animNode->setMaterialFlag(EMF_LIGHTING, lit);
if(hwSkin)
//hwSkinInstance.getInstance->setupNode(irrlicht, animNode);
HWSkinCB::getInstance()->setupNode(irrlicht, animNode, 60);
}
}
示例2: loadLeaf
/*----------------------------------------------------------------------------*/
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
}
示例3: createMesh
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;
}
示例4: deserializeAttributes
//! Reads attributes of the scene node.
void COctTreeSceneNode::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options)
{
const s32 oldMinimal = MinimalPolysPerNode;
MinimalPolysPerNode = in->getAttributeAsInt("MinimalPolysPerNode");
core::stringc newMeshStr = in->getAttributeAsString("Mesh");
IMesh* newMesh = 0;
if (newMeshStr == "")
newMeshStr = MeshName;
IAnimatedMesh* newAnimatedMesh = SceneManager->getMesh(newMeshStr.c_str());
if (newAnimatedMesh)
newMesh = newAnimatedMesh->getMesh(0);
if (newMesh && ((MeshName != newMeshStr) || (MinimalPolysPerNode != oldMinimal)))
{
// recalculate tree
createTree(newMesh);
}
ISceneNode::deserializeAttributes(in, options);
}
示例5: main
int main()
{
// we'll use the OGL driver
IrrlichtDevice *device =
createDevice(EDT_OPENGL, dimension2du(640, 480), 16,
false, false, false, 0);
IVideoDriver* driver = device->getVideoDriver();
ISceneManager* smgr = device->getSceneManager();
IGUIEnvironment* guienv = device->getGUIEnvironment();
// load sydney
IAnimatedMesh* mesh = smgr->getMesh("../../media/sydney.md2");
// squash her!
CSquashingMeshSceneNode* node = new CSquashingMeshSceneNode( mesh->getMesh(0), 0, smgr, 0 );
if (node)
{
node->setMaterialFlag(EMF_LIGHTING, false);
node->setPosition( vector3df(0,0,50));
node->setMaterialTexture( 0, driver->getTexture("../../media/sydney.bmp") );
}
smgr->addCameraSceneNodeFPS();
int lastFPS = -1;
while(device->run())
{
driver->beginScene(true, true, SColor(255,100,101,140));
node->render();
node->OnPostRender(device->getTimer()->getTime());
smgr->drawAll();
guienv->drawAll();
driver->endScene();
int fps = driver->getFPS();
if (lastFPS != fps)
{
core::stringw str = L"Irrlicht Mesh Deformation Contest [";
str += driver->getName();
str += "] FPS:";
str += fps;
device->setWindowCaption(str.c_str());
lastFPS = fps;
}
}
device->drop();
return 0;
}
示例6:
Scenario::Scenario(IrrlichtDevice* dev, stringc file, stringc mapName)
{
device = dev;
device->getFileSystem()->addZipFileArchive(file.c_str());
IAnimatedMesh* mesh = device->getSceneManager()->getMesh(mapName.c_str());
ISceneNode* node = device->getSceneManager()->addOctreeSceneNode(mesh->getMesh(0), 0, -1, 1024);
}
示例7: loadBsp
void Entity::loadBsp(char *filename)
{
if(type == MESH_TYPE || type == MAP_TYPE)
{
IAnimatedMesh *mesh = Scene->getMesh(filename);
sceneNode = Scene->addOctreeSceneNode(mesh->getMesh(0), 0, -1, 1024);
sceneNode->setMaterialFlag(EMF_LIGHTING, true);
bmesh = mesh;
}
}
示例8: GetMeshFromGeom
//------------------------------------------------------------------------------
//! GetMeshFromGeom
//! Helper function to extract mesh data from object geometry
IMesh* CBulletObjectAnimator::GetMeshFromGeom(ISceneManager* pSceneManager,
CBulletObjectAnimatorGeometry* pGeom)
{
IMesh* mesh = pGeom->mesh.irrMesh;
if (mesh == NULL)
{
IAnimatedMesh* animMesh = pSceneManager->getMesh(pGeom->meshFile.c_str());
if (animMesh != NULL)
mesh = animMesh->getMesh(0);
}
return mesh;
}
示例9: CAnimatedMeshMD2
//! 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;
}
示例10: createGround
void viewprt::createGround()
{
// Try to add a ground plane grid
scene::ISceneManager* smgr = device->getSceneManager();
video::IVideoDriver* driver = device->getVideoDriver();
IAnimatedMesh *plane = smgr->addHillPlaneMesh("test",core::dimension2d<f32>(20,20),core::dimension2d<u32>(60,60));
ground = smgr->addWaterSurfaceSceneNode(plane->getMesh(0), 0.0f, 1000, 10);
ground->setPosition(core::vector3df(0,-1,0));
ground->setMaterialFlag(EMF_LIGHTING,false);
ground->setMaterialFlag(EMF_BACK_FACE_CULLING,false);
ground->setMaterialType(EMT_SOLID);
ground->setMaterialTexture(0, driver->getTexture("media/ui/terrain-texture.jpg"));
}
示例11: deserializeAttributes
//! Reads attributes of the scene node.
void CMeshSceneNode::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options)
{
io::path oldMeshStr = SceneManager->getMeshCache()->getMeshName(Mesh);
io::path newMeshStr = in->getAttributeAsString("Mesh");
ReadOnlyMaterials = in->getAttributeAsBool("ReadOnlyMaterials");
if (newMeshStr != "" && oldMeshStr != newMeshStr)
{
IMesh* newMesh = 0;
IAnimatedMesh* newAnimatedMesh = SceneManager->getMesh(newMeshStr.c_str());
if (newAnimatedMesh)
newMesh = newAnimatedMesh->getMesh(0);
if (newMesh)
setMesh(newMesh);
}
// optional attribute to assign the hint to the whole mesh
if (in->existsAttribute("HardwareMappingHint") &&
in->existsAttribute("HardwareMappingBufferType"))
{
scene::E_HARDWARE_MAPPING mapping = scene::EHM_NEVER;
scene::E_BUFFER_TYPE bufferType = scene::EBT_NONE;
core::stringc smapping = in->getAttributeAsString("HardwareMappingHint");
if (smapping.equals_ignore_case("static"))
mapping = scene::EHM_STATIC;
else if (smapping.equals_ignore_case("dynamic"))
mapping = scene::EHM_DYNAMIC;
else if (smapping.equals_ignore_case("stream"))
mapping = scene::EHM_STREAM;
core::stringc sbufferType = in->getAttributeAsString("HardwareMappingBufferType");
if (sbufferType.equals_ignore_case("vertex"))
bufferType = scene::EBT_VERTEX;
else if (sbufferType.equals_ignore_case("index"))
bufferType = scene::EBT_INDEX;
else if (sbufferType.equals_ignore_case("vertexindex"))
bufferType = scene::EBT_VERTEX_AND_INDEX;
IMesh* mesh = getMesh();
if (mesh)
mesh->setHardwareMappingHint(mapping, bufferType);
}
IMeshSceneNode::deserializeAttributes(in, options);
}
示例12: createSmodel
/*----------------------------------------------------------------------------*/
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;
}
示例13: SceneNode
CTriangleSelector::CTriangleSelector(IAnimatedMeshSceneNode* node)
: SceneNode(reinterpret_cast<ISceneNode*>(node)), AnimatedNode(node)
{
#ifdef _DEBUG
setDebugName("CTriangleSelector");
#endif
if (!AnimatedNode)
return;
IAnimatedMesh * animatedMesh = AnimatedNode->getMesh();
if (!animatedMesh)
return;
IMesh * mesh = animatedMesh->getMesh((s32)AnimatedNode->getFrameNr());
if (mesh)
createFromMesh(mesh);
}
示例14: deserializeAttributes
//! Reads attributes of the scene node.
void COctTreeSceneNode::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options)
{
int oldMinimal = MinimalPolysPerNode;
//core::stringc oldMeshStr = SceneManager->getMeshCache()->getMeshFilename(Mesh);
core::stringc oldMeshStr = MeshName;
MinimalPolysPerNode = in->getAttributeAsInt("MinimalPolysPerNode");
core::stringc newMeshStr = in->getAttributeAsString("Mesh");
bool loadedNewMesh = false;
IMesh* newMesh = 0;
if (newMeshStr != "" && oldMeshStr != newMeshStr)
{
IAnimatedMesh* newAnimatedMesh = SceneManager->getMesh(newMeshStr.c_str());
if (newAnimatedMesh)
newMesh = newAnimatedMesh->getMesh(0);
if (newMesh)
{
// if (Mesh)
// Mesh->drop();
// Mesh = newMesh;
// Mesh->grab();
loadedNewMesh = true;
}
}
if (loadedNewMesh || MinimalPolysPerNode != oldMinimal)
{
// recalculate tree
//createTree(Mesh);
createTree ( newMesh );
// newMesh->drop ();
}
ISceneNode::deserializeAttributes(in, options);
}
示例15: deserializeAttributes
//! Reads attributes of the scene node.
void CMeshSceneNode::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options)
{
core::stringc oldMeshStr = SceneManager->getMeshCache()->getMeshFilename(Mesh);
core::stringc newMeshStr = in->getAttributeAsString("Mesh");
ReadOnlyMaterials = in->getAttributeAsBool("ReadOnlyMaterials");
if (newMeshStr != "" && oldMeshStr != newMeshStr)
{
IMesh* newMesh = 0;
IAnimatedMesh* newAnimatedMesh = SceneManager->getMesh(newMeshStr.c_str());
if (newAnimatedMesh)
newMesh = newAnimatedMesh->getMesh(0);
if (newMesh)
setMesh(newMesh);
}
IMeshSceneNode::deserializeAttributes(in, options);
}