本文整理汇总了C++中osg::NodePtr::getCore方法的典型用法代码示例。如果您正苦于以下问题:C++ NodePtr::getCore方法的具体用法?C++ NodePtr::getCore怎么用?C++ NodePtr::getCore使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类osg::NodePtr
的用法示例。
在下文中一共展示了NodePtr::getCore方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: process
//method that will be called when entering
//a new node
osg::Action::ResultE enter(osg::NodePtr& node)
{
if (node->getCore()->getType().isDerivedFrom(OSG::CharacterBase::getClassType()))
{
osg::CharacterPtr charac = osg::CharacterPtr::dcast(node->getCore());
std::string name;
if (getName(node))
{
name = getName(node);
}
else
{
osg::CharacterModelPtr model = charac->getModel();
name = model->getConfigFile();
std::cout << "character model file " << name << std::endl;
std::string::size_type slashpos = name.size()-1;
slashpos = name.find_last_of("/");
if(slashpos != name.npos)
name = name.substr(slashpos+1);
slashpos = name.size()-1;
slashpos = name.find_last_of("\\");
if(slashpos != name.npos)
name = name.substr(slashpos+1);
std::string::size_type dotpos = 0;
dotpos = name.find_last_of(".");
if(dotpos != name.npos)
name = name.substr(0, dotpos);
}
std::cout << name << " is a character" << std::endl;
return process(node, charac, name);
}
return osg::Action::Continue;
}
示例2: addWithHull
void addWithHull( osg::NodePtr testObj )
{
testGeom = osg::GeometryPtr::dcast( testObj->getCore() );
testHull = testGeom;
testHullObj = testHull.getGeomNode();
testHull.print();
// set material
osg::SimpleMaterialPtr mat = osg::SimpleMaterial::create();
mat->setDiffuse( osg::Color3f( 1.0,0.7,1.0 ) );
mat->setAmbient( osg::Color3f( 0.2,0.2,0.2 ) );
mat->setSpecular( osg::Color3f( 1,1,1 ) );
mat->setShininess( 20 );
testGeom->setMaterial( mat );
osg::GeometryPtr::dcast(testHullObj->getCore())->setMaterial( mat );
// add to scene graph
beginEditCP(root);
root->addChild( testObj );
root->addChild( testHullObj );
endEditCP(root);
}
示例3: NodeBase
Geometry::Geometry(OSG::NodePtr node) : NodeBase(node)
{
_geometry = OSG::cast_dynamic<OSG::GeometryPtr>(node->getCore());
// OSG::beginEditCP(_node);
_node->setCore(_geometry);
// OSG::endEditCP(_node);
}
示例4: Group
Transform::Transform(OSG::NodePtr node) : Group(node)
{
_transform = OSG::cast_dynamic<OSG::TransformPtr>(node->getCore());
// OSG::beginEditCP(_node);
_node->setCore(_transform);
// OSG::endEditCP(_node);
}
示例5: enter
osg::Action::ResultE enter(osg::NodePtr& node)
{
//if (osg::getName(node))
if (node->getCore()->getType().isDerivedFrom(OSG::CharacterBase::getClassType()))
{
std::cout << osg::getName(node) << "is a character" << std::endl;
}
//else
//{
// std::cout << osg::getName(node) << "is not a character" << std::endl;
//}
return osg::Action::Continue;
}
示例6: next
NodeBase NodeIterator::next(void)
{
while(!_stack.empty())
{
OSG::NodePtr act = _stack.back();
_stack.pop_back();
for(OSG::UInt32 i = 0; i < act->getNChildren(); ++i)
_stack.push_back(act->getChild(i));
if(act->getCore()->getType().isDerivedFrom(*_type))
{
return NodeBase(act);
}
}
PyErr_SetString(PyExc_StopIteration, "Out of Nodes");
boost::python::throw_error_already_set();
}
示例7: main
//.........这里部分代码省略.........
file << patt_trans[0][0] << " " << patt_trans[0][1] << " " << patt_trans[0][2] << " " << patt_trans[0][3] << " "<<endl;
file << patt_trans[1][0] << " " << patt_trans[1][1] << " " << patt_trans[1][2] << " " << patt_trans[1][3] << " "<<endl;
file << patt_trans[2][0] << " " << patt_trans[2][1] << " " << patt_trans[2][2] << " " << patt_trans[2][3] << " "<<endl;
//file << patt_center[0] << " " << patt_center[1] <<endl;
//cout << "patt width: " << patt_width <<endl;
file << marker_info[k].pos[0] << " " << marker_info[k].pos[1] <<endl;
cout << "p1: " << marker_info[k].vertex[0][0] << " " << marker_info[k].vertex[0][1]<< endl;
cout << "p2: " << marker_info[k].vertex[1][0] << " " << marker_info[k].vertex[1][1]<< endl;
cout << "p3: " << marker_info[k].vertex[2][0] << " " << marker_info[k].vertex[2][1]<< endl;
cout << "p4: " << marker_info[k].vertex[3][0] << " " << marker_info[k].vertex[3][1]<< endl;
cv::line(newAR,cv::Point(marker_info[k].vertex[0][0],marker_info[k].vertex[0][1]),cv::Point(marker_info[k].vertex[1][0],marker_info[k].vertex[1][1]),CV_RGB(255,0,0));
cv::line(newAR,cv::Point(marker_info[k].vertex[1][0],marker_info[k].vertex[1][1]),cv::Point(marker_info[k].vertex[2][0],marker_info[k].vertex[2][1]),CV_RGB(255,0,0));
cv::line(newAR,cv::Point(marker_info[k].vertex[2][0],marker_info[k].vertex[2][1]),cv::Point(marker_info[k].vertex[3][0],marker_info[k].vertex[3][1]),CV_RGB(255,0,0));
cv::line(newAR,cv::Point(marker_info[k].vertex[3][0],marker_info[k].vertex[3][1]),cv::Point(marker_info[k].vertex[0][0],marker_info[k].vertex[0][1]),CV_RGB(255,0,0));
cv::line(newAR,cv::Point(marker_info[k].vertex[0][0],marker_info[k].vertex[0][1]),cv::Point(marker_info[k].vertex[2][0],marker_info[k].vertex[2][1]),CV_RGB(255,0,0));
cv::line(newAR,cv::Point(marker_info[k].vertex[1][0],marker_info[k].vertex[1][1]),cv::Point(marker_info[k].vertex[3][0],marker_info[k].vertex[3][1]),CV_RGB(255,0,0));
cv::line(RGB,cv::Point(marker_info[k].vertex[0][0],marker_info[k].vertex[0][1]),cv::Point(marker_info[k].vertex[1][0],marker_info[k].vertex[1][1]),CV_RGB(255,0,0));
cv::line(RGB,cv::Point(marker_info[k].vertex[1][0],marker_info[k].vertex[1][1]),cv::Point(marker_info[k].vertex[2][0],marker_info[k].vertex[2][1]),CV_RGB(255,0,0));
cv::line(RGB,cv::Point(marker_info[k].vertex[2][0],marker_info[k].vertex[2][1]),cv::Point(marker_info[k].vertex[3][0],marker_info[k].vertex[3][1]),CV_RGB(255,0,0));
cv::line(RGB,cv::Point(marker_info[k].vertex[3][0],marker_info[k].vertex[3][1]),cv::Point(marker_info[k].vertex[0][0],marker_info[k].vertex[0][1]),CV_RGB(255,0,0));
cv::line(RGB,cv::Point(marker_info[k].vertex[0][0],marker_info[k].vertex[0][1]),cv::Point(marker_info[k].vertex[2][0],marker_info[k].vertex[2][1]),CV_RGB(255,0,0));
cv::line(RGB,cv::Point(marker_info[k].vertex[1][0],marker_info[k].vertex[1][1]),cv::Point(marker_info[k].vertex[3][0],marker_info[k].vertex[3][1]),CV_RGB(255,0,0));
cv::waitKey(1);
}
stringstream stream2;
stream2 << "pics/new/";
stream2 << u;
stream2 << ".bmp";
//cv::imwrite(stream2.str().c_str(),RGB);
file<< "##"<<endl;
cv::imshow("looky looky",RGB);
cv::waitKey(1);
}
file.close();
*/
// AR _ENDE_ !!
//}
// QCoreApplication a(argc, argv);
OSG::osgInit(argc,argv);
cout << "argc " << argc <<endl;
for(int ar(0);ar<argc;++ar)
cout << argv[ar] << " ";
cout << endl;
int winid = setupGLUT(&argc,argv);
//GLUTWindowPtr gwin = GLUTWindow::create();
//gwin->setGlutId(winid);
//gwin->init();
OSG::NodePtr scene = SceneFileHandler::the().read("data/test__1.obj");
//OSG::NodePtr scene = SceneFileHandler::the().read("data/test3_4.obj");
//GroupPtr scene = GroupPtr::dcast(scene);
cout << "type: " << scene.getCore()->getTypeName()<< endl;
cout << "children in scene: " << scene->getNChildren()<<endl;
GeometryPtr geo = GeometryPtr::dcast(scene->getCore());
GeoPTypesPtr type = GeoPTypesUI8::create();
type->addValue(GL_LINE);
LineIterator lit;
int lines(0);
TEST = geo;
for(lit = geo->beginLines();lit != geo->endLines();++lit){
lines++;
}
cout << "lines: " << lines <<endl;
SimpleMaterialPtr mat = SimpleMaterial::create();
geo->setMaterial(mat);
// Create and setup our little friend - the SSM
mgr = new SimpleSceneManager;
//mgr->setWindow(gwin);
//mgr->setRoot(scene);
//mgr->showAll();
//glutCreateWindow("test");
glutMainLoop();
return 0;
}