本文整理汇总了C++中IAnimatedMesh::getMesh方法的典型用法代码示例。如果您正苦于以下问题:C++ IAnimatedMesh::getMesh方法的具体用法?C++ IAnimatedMesh::getMesh怎么用?C++ IAnimatedMesh::getMesh使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IAnimatedMesh
的用法示例。
在下文中一共展示了IAnimatedMesh::getMesh方法的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: 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);
}
示例3: 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;
}
示例4:
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);
}
示例5: 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;
}
}
示例6: load_map
void load_map() {
IAnimatedMesh* mesh = smgr->getMesh("resources/nodes/maps/room.3ds");
smgr->getMeshManipulator()->makePlanarTextureMapping(mesh->getMesh(0), 0.008f);
ISceneNode* node = 0;
node = smgr->addAnimatedMeshSceneNode(mesh);
node->setMaterialTexture(0, driver->getTexture("resources/textures/maps/wall.jpg"));
node->getMaterial(0).SpecularColor.set(0,0,0,0);
mesh = smgr->addHillPlaneMesh("myHill",
dimension2d<f32>(20,20),
dimension2d<u32>(40,40),
0,
0,
dimension2d<f32>(0,0),
dimension2d<f32>(10,10)
);
node = smgr->addWaterSurfaceSceneNode(mesh->getMesh(0), 3.0f, 300.0f, 30.0f);
node->setPosition(vector3df(0,7,0));
node->setMaterialTexture(0, driver->getTexture("resources/textures/maps/stones.jpg"));
node->setMaterialTexture(1, driver->getTexture("resources/textures/maps/water.jpg"));
node->setMaterialType(video::EMT_REFLECTION_2_LAYER);
// create light
node = smgr->addLightSceneNode(0, vector3df(0,0,0), SColorf(1.0f, 0.6f, 0.7f, 1.0f), 600.0f);
ISceneNodeAnimator* anim = 0;
anim = smgr->createFlyCircleAnimator (vector3df(0,150,0),250.0f);
node->addAnimator(anim);
anim->drop();
// attach billboard to light
node = smgr->addBillboardSceneNode(node, dimension2d<f32>(50, 50));
node->setMaterialFlag(EMF_LIGHTING, false);
node->setMaterialType(EMT_TRANSPARENT_ADD_COLOR);
node->setMaterialTexture(0, driver->getTexture("resources/textures/particles/particlewhite.bmp"));
}
示例7: 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;
}
示例8: 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"));
}
示例9: 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);
}
示例10: 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);
}
示例11: 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);
}
示例12: 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);
}
示例13: SceneNode
CTriangleSelector::CTriangleSelector(IAnimatedMeshSceneNode* node)
: SceneNode(node), AnimatedNode(node), LastMeshFrame(0)
{
#ifdef _DEBUG
setDebugName("CTriangleSelector");
#endif
if (!AnimatedNode)
return;
IAnimatedMesh* animatedMesh = AnimatedNode->getMesh();
if (!animatedMesh)
return;
LastMeshFrame = (u32)AnimatedNode->getFrameNr();
IMesh* mesh = animatedMesh->getMesh(LastMeshFrame);
if (mesh)
createFromMesh(mesh);
}
示例14: update
void CTriangleSelector::update(void) const
{
if (!AnimatedNode)
return; //< harmless no-op
const u32 currentFrame = (u32)AnimatedNode->getFrameNr();
if (currentFrame == LastMeshFrame)
return; //< Nothing to do
LastMeshFrame = currentFrame;
IAnimatedMesh * animatedMesh = AnimatedNode->getMesh();
if (animatedMesh)
{
IMesh * mesh = animatedMesh->getMesh(LastMeshFrame);
if (mesh)
updateFromMesh(mesh);
}
}
示例15: meshTransform
// Tests mesh transformations via mesh manipulator.
bool meshTransform(void)
{
// Use EDT_BURNINGSVIDEO since it is not dependent on (e.g.) OpenGL driver versions.
IrrlichtDevice *device = createDevice(EDT_BURNINGSVIDEO, dimension2d<u32>(160, 120), 32);
assert_log(device);
if (!device)
return false;
IVideoDriver* driver = device->getVideoDriver();
ISceneManager * smgr = device->getSceneManager();
IMeshSceneNode* node1 = smgr->addCubeSceneNode(50);
IAnimatedMesh* amesh = smgr->getMesh("../media/sydney.md2");
IAnimatedMesh* smesh = smgr->getMesh("../media/ninja.b3d");
assert_log(node1 && amesh && smesh);
bool result = false;
if (!node1 || !amesh || !smesh)
return false;
// node1->setPosition(core::vector3df(-60,0,150));
node1->setDebugDataVisible(scene::EDS_BBOX_ALL);
IMeshSceneNode* node2 = smgr->addMeshSceneNode(amesh->getMesh(10));
assert_log(node2);
if (!node2)
return false;
// node2->setPosition(core::vector3df(30,10,150));
node2->setDebugDataVisible(scene::EDS_BBOX_ALL);
node2->setMaterialFlag(EMF_LIGHTING, false);
IMeshSceneNode* node3 = smgr->addMeshSceneNode(smesh->getMesh(10));
assert_log(node3);
if (!node3)
return false;
// node3->setPosition(core::vector3df(10,0,0));
node3->setDebugDataVisible(scene::EDS_BBOX_ALL);
node3->setMaterialFlag(EMF_LIGHTING, false);
smgr->addCameraSceneNode()->setPosition(core::vector3df(0,0,-20));
// Just jump to the last frame since that's all we're interested in.
device->run();
driver->beginScene(true, true, SColor(255, 60, 60, 60));
smgr->drawAll();
driver->endScene();
core::matrix4 mat;
mat.setTranslation(core::vector3df(-60,0,150));
driver->getMeshManipulator()->transform(node1->getMesh(), mat);
mat.setTranslation(core::vector3df(30,10,150));
driver->getMeshManipulator()->transform(node2->getMesh(), mat);
mat.setTranslation(core::vector3df(10,0,0));
driver->getMeshManipulator()->transform(node3->getMesh(), mat);
// Just jump to the last frame since that's all we're interested in.
device->run();
driver->beginScene(true, true, SColor(255, 60, 60, 60));
smgr->drawAll();
driver->endScene();
result = takeScreenshotAndCompareAgainstReference(driver, "-meshTransform.png");
device->closeDevice();
device->run();
device->drop();
return result;
}