本文整理汇总了C++中PNode::clone方法的典型用法代码示例。如果您正苦于以下问题:C++ PNode::clone方法的具体用法?C++ PNode::clone怎么用?C++ PNode::clone使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PNode
的用法示例。
在下文中一共展示了PNode::clone方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createTerrainShape_test
bool CTerrainShapeForSpaceTree::createTerrainShape_test( PRootNode *pnodeRoot,
PDatabase *pDatabase,
PString szNameFileTerrain,
float fScaleTerrain )
{
PResult result;
if(PLinkResolver::getDatabase(m_terrainDBID, szNameFileTerrain)!=PE_RESULT_NO_ERROR)
{
return PSSG_SET_LAST_ERROR(false,("Unable to get the default database for this sample."));
}
if(PSSG::Extra::resolveAllLinks()!=PE_RESULT_NO_ERROR)
{
return PSSG_SET_LAST_ERROR(false,("Unable to resolve all outstanding links"));
}
// Database File을 읽어온다.
PDatabaseWriteLock modelWriteLock(m_terrainDBID);
PDatabase *databaseShapeTerr = modelWriteLock.getDatabase();
if(!databaseShapeTerr)
{
return PSSG_SET_LAST_ERROR(false,("Unable to lock model database"));
}
// Bundle Node : 즉 Model Node를 뽑아낸다.
PListIterator modelScenes(databaseShapeTerr->getSceneList());
PNode *pnodeRootShapeTerr = (PNode*)modelScenes.data();
PTraversalFindNodeByType findBUndleNode(PSSG_TYPE(PBundleNode));
findBUndleNode.traverseDepthFirst(*pnodeRootShapeTerr);
PNode *pnodeRenderBundle = (PNode*)findBUndleNode.getFoundNode();
if(!pnodeRenderBundle)
{
PTraversalFindNodeByType findRenderNode(PSSG_TYPE(PRenderNode));
findRenderNode.traverseDepthFirst(*pnodeRootShapeTerr);
pnodeRenderBundle = (PNode*)findRenderNode.getFoundNode();
if(!pnodeRenderBundle)
{
return PSSG_SET_LAST_ERROR(false, ("Unable to find the model node because model has not rendernode."));
}
}
PNode *pmodelNode_clone = (PNode*)pnodeRenderBundle->clone(pDatabase, &result);
bool bNeedTransform = !APPROX_EQ(1.0f,fScaleTerrain);
Matrix4 matTMforTree;
if( true==bNeedTransform )
{
Matrix4 &mat = pmodelNode_clone->m_matrix;
matTMforTree = matTMforTree.identity();
float fscaleMul = 0.0f;
for(int i=0; i<3; ++i)
{
fscaleMul = mat.getElem(i,i)*fScaleTerrain;
mat.setElem( i,i, fscaleMul );
matTMforTree.setElem( i,i,fscaleMul );
}
}
pnodeRoot->addChild( *pmodelNode_clone );
PSegmentSet *segmentSet;
PDatabaseListableIterator<PSegmentSet> it1(*databaseShapeTerr);
while (it1)
{
segmentSet = &(*it1);
for(unsigned int i = 0 ; i < segmentSet->getSegmentCount() ; i++)
{
PRenderDataSource *renderdatasource = segmentSet->getSegment(i);
if(true==bNeedTransform)
{
m_pContainerTri->constructAllTriangles( renderdatasource, &matTMforTree, true );
}
else
{
m_pContainerTri->constructAllTriangles( renderdatasource, NULL, true );
}
}
++it1;
}
m_pSpcTree->constructTree( m_pContainerTri );
return true;
}