本文整理汇总了C++中ISceneNode::getChildren方法的典型用法代码示例。如果您正苦于以下问题:C++ ISceneNode::getChildren方法的具体用法?C++ ISceneNode::getChildren怎么用?C++ ISceneNode::getChildren使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISceneNode
的用法示例。
在下文中一共展示了ISceneNode::getChildren方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SceneNode_GetChildren
void SceneNode_GetChildren(IntPtr scenenode, IntPtr *list)
{
ISceneNode *node = GetSceneNodeFromIntPtr(scenenode);
//u32 size = node->getChildren().getSize();
core::list<ISceneNode*>::ConstIterator it = node->getChildren().begin();
int c = 0;
for (; it != node->getChildren().end(); ++it)
{
list[c] = (*it);
c++;
}
}
示例2: loadScene
static bool loadScene(void)
{
IrrlichtDevice *device = createDevice(video::EDT_BURNINGSVIDEO,
core::dimension2du(160,120), 32);
if (!device)
return false;
IVideoDriver* driver = device->getVideoDriver();
ISceneManager* smgr = device->getSceneManager();
// load scene from example, with correct relative path
device->getFileSystem()->changeWorkingDirectoryTo("results");
smgr->loadScene("../../media/example.irr");
smgr->addCameraSceneNode(0, core::vector3df(0,0,-50));
device->getFileSystem()->changeWorkingDirectoryTo("..");
bool result = false;
device->run();
device->getTimer()->setTime(666); // scene has animations and current scene seems to be saved at that time ... really - best result with just that number :-)
if (driver->beginScene(true, true, video::SColor(0, 80, 80, 80)))
{
smgr->drawAll();
driver->endScene();
// we need to be very sloppy, because the animators will produce a different
// start depending on the actual loading time. 97% seems to be safe, as removing
// an object produces values around 95%
result = takeScreenshotAndCompareAgainstReference(driver, "-loadScene.png", 97.4f);
if (!result)
logTestString("Rendering the loaded scene failed.\n");
}
ISceneNode* node = smgr->getSceneNodeFromId(128);
if (!node)
result=false;
else if (result) // only check if scene was correctly loaded
{
result &= (node->getChildren().size()==0);
if (!result)
logTestString("Node has an illegal child node.\n");
device->getSceneManager()->loadScene("results/scene2.irr", 0, node);
result &= (node->getChildren().size()!=0);
if (!result)
logTestString("Loading second scene as child failed.\n");
}
device->closeDevice();
device->run();
device->drop();
return result;
}
示例3: initComponent
// init
// run when init object
void CObjectCollisionComponent::initComponent()
{
#ifdef GSGAMEPLAY
IMesh *pMesh = NULL;
ISceneNode *node = m_gameObject->getSceneNode();
ISceneManager *smgr = getIView()->getSceneMgr();
if ( node == NULL )
return;
std::vector<SObjectCollisionParam> listMesh;
SObjectCollisionParam temp;
if ( m_gameObject->getComponent( IObjectComponent::StaticMesh ) != NULL )
{
pMesh = ((IMeshSceneNode*) node)->getMesh();
temp.mesh = pMesh;
temp.node = node;
listMesh.push_back( temp );
}
else if ( m_gameObject->getComponent( IObjectComponent::AnimMesh ) != NULL )
{
pMesh = ((IAnimatedMeshSceneNode*) node)->getMesh();
temp.mesh = pMesh;
temp.node = node;
listMesh.push_back( temp );
}
else if ( m_gameObject->getComponent( IObjectComponent::ColladaMesh ) != NULL )
{
CColladaMeshComponent *comp = (CColladaMeshComponent*)m_gameObject->getComponent( IObjectComponent::ColladaMesh );
ISceneNode* colladaNode = comp->getColladaNode();
std::queue<ISceneNode*> listSceneNode;
const core::list<ISceneNode*>* listChild = &colladaNode->getChildren();
core::list<ISceneNode*>::ConstIterator it = listChild->begin(), end = listChild->end();
while ( it != end )
{
listSceneNode.push( (*it) );
it++;
}
while ( listSceneNode.size() )
{
CGameColladaSceneNode* sceneNode = (CGameColladaSceneNode*)listSceneNode.front();
listSceneNode.pop();
if ( sceneNode->getMesh() )
{
temp.mesh = sceneNode->getMesh();
temp.node = sceneNode;
listMesh.push_back( temp );
}
const core::list<ISceneNode*>* listChild = &sceneNode->getChildren();
it = listChild->begin();
end = listChild->end();
while ( it != end )
{
listSceneNode.push( (*it) );
it++;
}
}
}
for ( int i = 0; i < (int)listMesh.size(); i++ )
{
node = listMesh[i].node;
pMesh = listMesh[i].mesh;
switch ( m_collisionType )
{
case CObjectCollisionComponent::BoudingBox:
{
ITriangleSelector *selector = smgr->createTriangleSelectorFromBoundingBox(node);
node->setTriangleSelector( selector );
selector->drop();
}
break;
case CObjectCollisionComponent::Triangle:
{
ITriangleSelector* selector = smgr->createTriangleSelector( pMesh, node );
node->setTriangleSelector(selector);
selector->drop();
}
break;
case CObjectCollisionComponent::OctreeTriange:
{
ITriangleSelector* selector = smgr->createOctreeTriangleSelector( pMesh, node );
node->setTriangleSelector(selector);
selector->drop();
}
break;
}
}
//.........这里部分代码省略.........
示例4: OnAnimate
//! Overide OnAnimate
void CGameColladaContainerSceneNode::OnAnimate(irr::u32 timeMs)
{
if ( IsVisible == false )
return;
// animate this node with all animators
ISceneNodeAnimatorList::Iterator ait = Animators.begin(), aend = Animators.end();
while (ait != aend)
{
(*ait)->animateNode(this, timeMs);
++ait;
}
// update absolute position
updateAbsolutePosition();
// call child OnAnimate and destroy recursive
std::queue<ISceneNode*> queue;
ISceneNodeList::ConstIterator it = Children.begin(), end = Children.end();
while ( it != end )
{
queue.push( (*it) );
it++;
}
while ( queue.size() )
{
ISceneNode* top = queue.front();
queue.pop();
// call child OnAnimate
top->OnAnimate( timeMs );
it = top->getChildren().begin();
end = top->getChildren().end();
while ( it != end )
{
queue.push( (*it) );
it++;
}
}
// update node reference
for ( int i = 0, n = (int)m_nodeReference.size(); i < n; i++)
{
CGameColladaSceneNode *colladaNode1 = (CGameColladaSceneNode*) m_nodeReference[i].node1;
CGameColladaSceneNode *colladaNode2 = (CGameColladaSceneNode*) m_nodeReference[i].node2;
// check anim layer
int currentLayer = colladaNode2->getCurrentAnimLayer();
if ( colladaNode1->getCurrentAnimLayer() != currentLayer )
continue;
// calc reference matrix
core::matrix4 matParentInv = colladaNode2->BaseAbsoluteAnimationMatrixLayer[currentLayer];
core::matrix4 matNode = colladaNode1->BaseAbsoluteAnimationMatrixLayer[currentLayer];
matParentInv.makeInverse();
core::matrix4 relativeMtx = matParentInv*matNode;
// recalc animation matrix
colladaNode1->AbsoluteAnimationMatrix = colladaNode2->AbsoluteAnimationMatrix*relativeMtx;
// calc absolute transform
core::matrix4 absoluteTransform = colladaNode2->getAbsoluteTransformation()*relativeMtx;
colladaNode1->setAbsoluteTransform(absoluteTransform);
colladaNode1->updateChildAbsoluteTransform();
}
// update skin
std::vector<ISceneNode*>::iterator itSkin = m_boudingMeshNode.begin(), endSkin = m_boudingMeshNode.end();
while ( itSkin != endSkin )
{
((CGameColladaSceneNode*)(*itSkin))->skin();
itSkin++;
}
}
示例5: 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;
}