本文整理汇总了C++中GeometryPtr::clone方法的典型用法代码示例。如果您正苦于以下问题:C++ GeometryPtr::clone方法的具体用法?C++ GeometryPtr::clone怎么用?C++ GeometryPtr::clone使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GeometryPtr
的用法示例。
在下文中一共展示了GeometryPtr::clone方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: convert
void FaceSpatializeIndexed<BasicTraits>::Category::addData (OpenSGFaceBase<OpenSGTraits>* arg)
{
FaceIterator face = arg->getOriginal();
if (
face.getGeometry()->getMaterial()->isTransparent() // transparent face
&& m_trans.find(arg->getObjectAdapter().getNode()) != m_trans.end() // not processed
) {
// create object adapter
OSGObjectBase convert(arg->getObjectAdapter().getNode());
convert.setObjectAdapter(&arg->getObjectAdapter());
NodePtr newNode = Node::create();
m_trans[convert.getOriginal()] = newNode;
GeometryPtr oldCore = GeometryPtr::dcast(convert.getOriginal()->getCore());
GeometryPtr newCore = oldCore->clone();
beginEditCP(newNode);
newNode->setCore(newCore);
endEditCP(newNode);
beginEditCP(newCore);
newCore->setPositions(convert.getPositions());
newCore->setNormals (convert.getNormals());
endEditCP(newCore);
beginEditCP(m_root);
m_root->addChild(newNode);
endEditCP(m_root);
return;
}
++m_totalFaces;
typename CategoryList::iterator c;
for (c = m_all.begin();
c != m_all.end();
++c) {
if ((*c)->isThisCategory(face)) {
break;
}
}
if (c == m_all.end()) { // new category
#if 0
MaterialGroupPtr mat = MaterialGroup::create();
beginEditCP(mat);
mat->setMaterial(face.getGeometry()->getMaterial());
endEditCP(mat);
NodePtr matNode = Node::create();
beginEditCP(matNode);
matNode->setCore(mat);
endEditCP(matNode);
beginEditCP(m_root);
m_root->addChild(matNode);
endEditCP(m_root);
c = m_all.insert(m_all.end(), new CategoryGeneral(matNode, arg, face));
#else
c = m_all.insert(m_all.end(), new CategoryGeneral(m_root, arg, face));
#endif
++m_numGeom;
}
(*c)->addData(arg, face);
}
示例2: beginEditCP
typename Spatialize<BasicTraits>::ResultT
Spatialize<BasicTraits>::LeafEnter (AdapterType* node)
{
// create new node with transformed positions and normals
NodePtr newNode = Node::create();
GeometryPtr oldCore = GeometryPtr::dcast(node->getOriginal()->getCore());
GeometryPtr newCore = oldCore->clone();
beginEditCP(newNode);
newNode->setCore(newCore);
endEditCP(newNode);
beginEditCP(newCore);
newCore->setPositions(node->getPositions());
newCore->setNormals (node->getNormals());
endEditCP(newCore);
m_rootLevel->addChild(newNode);
return SingleTraverserBase<BasicTraits>::CONTINUE;
}