本文整理汇总了C++中ISceneNode::getType方法的典型用法代码示例。如果您正苦于以下问题:C++ ISceneNode::getType方法的具体用法?C++ ISceneNode::getType怎么用?C++ ISceneNode::getType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISceneNode
的用法示例。
在下文中一共展示了ISceneNode::getType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
//vector3df(0, -HEIGHT, 0), //const core::vector3df & position
//vector3df(0, 0, 0), //const core::vector3df & rotation
//vector3df(1.0f, 2.*HEIGHT, 1.0f) //const core::vector3df & scale
//);
//node->getMaterial(0).AmbientColor.set(0,0,0,255);
//node->getMaterial(0).DiffuseColor.set(0,0,0,255);
//sphere
//node = smgr->addSphereSceneNode(
//0.1, // radius
//50, // poly count
//0, // parent
//FruitID, // id
//vector3df(0, 0, 0), // center
//vector3df(0, 0, 0), // rotation
//vector3df(1.0f, 1.0f, 1.0f) // scale
//);
//node->getMaterial(0).AmbientColor.set(0,0,0,255);
//node->getMaterial(0).DiffuseColor.set(0,0,0,255);
//node->getMaterial(0).Lighting = true;
//-- collision ------------------------------------------------------------//
/* Put everything we want to do collision checking with inside the meta selector. */
IMetaTriangleSelector * meta = smgr->createMetaTriangleSelector();
array<ISceneNode *> nodes;
smgr->getSceneNodesFromType(ESNT_ANY, nodes); // Find all nodes
for (u32 i=0; i < nodes.size(); ++i)
{
ISceneNode * node = nodes[i];
ITriangleSelector * selector = 0;
switch(node->getType())
{
case ESNT_CUBE:
case ESNT_ANIMATED_MESH:
// Because the selector won't animate with the mesh,
// and is only being used for camera collision, we'll just use an approximate
// bounding box instead of ((IAnimatedMeshSceneNode*)node)->getMesh(0)
selector = smgr->createTriangleSelectorFromBoundingBox(node);
break;
case ESNT_MESH:
case ESNT_SPHERE: // Derived from IMeshSceneNode
selector = smgr->createTriangleSelector(((IMeshSceneNode*)node)->getMesh(), node);
break;
case ESNT_TERRAIN:
selector = smgr->createTerrainTriangleSelector((ITerrainSceneNode*)node);
break;
case ESNT_OCTREE:
selector = smgr->createOctreeTriangleSelector(((IMeshSceneNode*)node)->getMesh(), node);
break;
default:
// Don't create a selector for this node type
break;
}
if(selector)
{
// Add it to the meta selector, which will take a reference to it
meta->addTriangleSelector(selector);
// And drop my reference to it, so that the meta selector owns it.
示例2: SelectNode
ISceneNode* CCombatSimulatorView::SelectNode(position2di mouse_pos)
{
scene::ISceneCollisionManager* pCollMgr = p_smgr->getSceneCollisionManager();
vector2d<s32> cursor = p_device->getCursorControl()->getPosition();
core::line3d<f32> ln(0,0,0,0,0,0);
ICameraSceneNode* camera = p_smgr->getActiveCamera();
const scene::SViewFrustum* f = camera->getViewFrustum();
core::vector3df farLeftUp = f->getFarLeftUp();
core::vector3df lefttoright = f->getFarRightUp() - farLeftUp;
core::vector3df uptodown = f->getFarLeftDown() - farLeftUp;
RECT m_rect;
this->GetWindowRect( &m_rect);
f32 dx = (cursor.X + m_rect.left) / (f32) (m_rect.right - m_rect.left) ;
f32 dy = (cursor.Y + m_rect.top) / (f32) (m_rect.bottom - m_rect.top);
if (camera->isOrthogonal())
ln.start = f->cameraPosition + (lefttoright * (dx-0.5f)) + (uptodown * (dy-0.5f));
else
ln.start = f->cameraPosition;
ln.end = farLeftUp + (lefttoright * dx) + (uptodown * dy);
if ( ln.start == ln.end )
return 0;
ISceneNode* pNode = pCollMgr->getSceneNodeFromRayBB(ln, 0, true, p_ShipParent);
if( pNode )
{
irr::core::list<ISceneNode*> list = pNode->getChildren();
irr::core::list<ISceneNode*>::Iterator it = list.begin();
ESCENE_NODE_TYPE t = pNode->getType();
if (pNode->getType() == ESNT_SPHERE)
pNode->setVisible(false);
for (it;it != list.end(); it++)
{
if ((*it)->getType() ==ESNT_SPHERE)
{
if ( (*it)->isVisible())
(*it)->setVisible(false);
else
(*it)->setVisible(true);
}
}
}
return pNode;
}