本文整理汇总了C++中ISceneNode::getParent方法的典型用法代码示例。如果您正苦于以下问题:C++ ISceneNode::getParent方法的具体用法?C++ ISceneNode::getParent怎么用?C++ ISceneNode::getParent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISceneNode
的用法示例。
在下文中一共展示了ISceneNode::getParent方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Java_zte_irrlib_scene_Scene_nativeRemoveNode
void Java_zte_irrlib_scene_Scene_nativeRemoveNode(
JNIEnv *env, jobject defaultObj, jint id)
{
ISceneNode* node = smgr->getSceneNodeFromId(id);
if (!node) return;
ISceneNode* parentNode = node->getParent();
if (!parentNode) return;
parentNode->removeChild(node);
}
示例2: if
bool CEvolEnviroment::onMessage(xWindowMsg& msg)
{
if(m_xuiWinMgr == NULL || m_pRenderApi == NULL)
return false;
bool bRet = m_xuiWinMgr->dispatchMsg(msg);
if(msg.MsgID == WIN_CLOSE )
{
m_pEngine->platform()->quit();
}
if(msg.MsgID == WIN_RESIZE)
{
onResize();
return true;
}
else if(msg.MsgID == WIN_KEYUP)
{
if(msg.Keyboard.cKeyChar >= '1' && msg.Keyboard.cKeyChar <= '9')
{
//m_Model->setAction( msg.Keyboard.cKeyChar - '1' );
}
if(msg.Keyboard.nKey == VKEY_F9)
{
bool bDrawPlane = m_pEngine->sysValue(L"defualt",L"drawPlane" , false);
}
if(msg.Keyboard.nKey == VKEY_DELETE)
{
bool bAllowOpScene = m_pEngine->sysValue(L"defualt",L"sceneEditable" , true);
if(bAllowOpScene && GetSelection()->GetCurSelNode())
{
ISceneNode* pNode = GetSelection()->GetCurSelNode();
ISceneNode* pParentNode = pNode->getParent();
if(pParentNode == NULL)
{
MessageBox(GetActiveWindow() , L"节点没有父节点", L"错误" , MB_OK);
}
else
{
pParentNode->removeChild(pNode,true);
GetSelection()->setCurSelNode(NULL);
}
}
}
return false;
}
else if(msg.MsgID == WIN_KEYDOWN)
{
if(msg.Keyboard.cKeyChar == 'a' )
{
m_pCamera->shift(-m_cameraStep);
}
else if(msg.Keyboard.cKeyChar == 'd')
{
m_pCamera->shift(m_cameraStep);
}
else if(msg.Keyboard.cKeyChar == 'w')
{
m_pCamera->toward(m_cameraStep);
}
else if(msg.Keyboard.cKeyChar == 's')
{
m_pCamera->toward(-m_cameraStep);
}
else if(msg.Keyboard.nKey == VKEY_UP)
{
m_pCamera->pitch(2);
}
else if(msg.Keyboard.nKey == VKEY_DOWN)
{
m_pCamera->pitch(-2);
}
else if(msg.Keyboard.nKey == VKEY_LEFT)
{
m_pCamera->yaw(2);
}
else if(msg.Keyboard.nKey == VKEY_RIGHT)
{
m_pCamera->yaw(-2);
}
else if(msg.Keyboard.nKey == VKEY_SHIFT)
{
m_pCamera->upDown(m_cameraStep);
}
else if(msg.Keyboard.nKey == VKEY_CONTROL)
{
m_pCamera->upDown(-m_cameraStep);
}
else
{
return false;
}
m_pRightCamera->copyFrom(m_pCamera);
m_pRightCamera->shift(CameraDist);
setSameViewTarget(m_pCamera , m_pRightCamera);
return true;
}
m_pScenePlacementOprator->onMessage(msg);
return false;
//.........这里部分代码省略.........
示例3: selectObject
// selectObject
// detect list objs at mouse xy
void CDocument::selectObject( int mouseX, int mouseY, bool isControlHold )
{
ISceneManager *smgr = getIView()->getSceneMgr();
ICameraSceneNode *camera = smgr->getActiveCamera();
// if no camera
if ( camera == NULL )
return;
ISceneCollisionManager *collMan = smgr->getSceneCollisionManager();
// get select ray
core::line3df selectRay = getIView()->getSelectRay();
// check hit test
core::vector3df intersection;
core::triangle3df hitTriangle;
// check select
ISceneNode *selectedSceneNode = collMan->getSceneNodeAndCollisionPointFromRay
(
selectRay,
intersection,
hitTriangle
);
if ( selectedSceneNode )
{
CGameObject *pObj = searchObject( selectedSceneNode->getID() );
// try find parent
while ( pObj == NULL )
{
selectedSceneNode = selectedSceneNode->getParent();
if ( selectedSceneNode == NULL )
break;
pObj = searchObject( selectedSceneNode->getID() );
}
// add to select list
if ( pObj && pObj->isVisible() )
{
if ( isControlHold == false || pObj->getObjectState() == CGameObject::Normal )
m_selectObjects.push_back( pObj );
else
{
pObj->setObjectState( CGameObject::Normal );
ArrayGameObjectIter i = m_selectObjects.begin(), iEnd = m_selectObjects.end();
while ( i != iEnd )
{
if ( (*i) == pObj )
{
m_selectObjects.erase( i );
break;
}
i++;
}
}
}
}
}