本文整理汇总了C++中node::SPtr::getObject方法的典型用法代码示例。如果您正苦于以下问题:C++ SPtr::getObject方法的具体用法?C++ SPtr::getObject怎么用?C++ SPtr::getObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类node::SPtr
的用法示例。
在下文中一共展示了SPtr::getObject方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: checkDeprecatedAttribute
void checkDeprecatedAttribute()
{
EXPECT_MSG_EMIT(Deprecated) ;
std::stringstream scene ;
scene << "<?xml version='1.0'?>"
"<Node name='Root' gravity='0 -9.81 0' time='0' animate='0' > \n"
" <OglLabel name='label1' color='contrast' printLog='true'/> \n"
"</Node> \n" ;
Node::SPtr root = SceneLoaderXML::loadFromMemory ("testscene",
scene.str().c_str(),
scene.str().size()) ;
ASSERT_NE(nullptr, root.get()) ;
root->init(ExecParams::defaultInstance()) ;
BaseObject* lm = root->getObject("label1") ;
ASSERT_NE(nullptr, lm) ;
OglLabel* ogllabel = dynamic_cast<OglLabel*>(lm);
ASSERT_NE(nullptr, ogllabel) ;
EXPECT_TRUE(ogllabel->d_selectContrastingColor.getValue()) ;
EXPECT_EQ(RGBAColor::fromFloat(1,1,1,1), ogllabel->d_color.getValue()) ;
}
示例2: checkAttributes
void checkAttributes()
{
std::stringstream scene ;
scene << "<?xml version='1.0'?>"
"<Node name='Root' gravity='0 -9.81 0' time='0' animate='0' > \n"
" <OglLabel name='label1'/> \n"
"</Node> \n" ;
Node::SPtr root = SceneLoaderXML::loadFromMemory ("testscene",
scene.str().c_str(),
scene.str().size()) ;
ASSERT_NE(root.get(), nullptr) ;
root->init(ExecParams::defaultInstance()) ;
BaseObject* lm = root->getObject("label1") ;
ASSERT_NE(lm, nullptr) ;
/// List of the supported attributes the user expect to find
/// This list needs to be updated if you add an attribute.
vector<string> attrnames = {
"prefix", "label", "suffix", "x", "y", "fontsize", "color",
"selectContrastingColor", "updateLabelEveryNbSteps",
"visible"};
for(auto& attrname : attrnames)
EXPECT_NE( lm->findData(attrname), nullptr ) << "Missing attribute with name '" << attrname << "'." ;
}
示例3: checkDefaultPipelineWithMissingIntersection
void TestDefaultPipeLine::checkDefaultPipelineWithMissingIntersection()
{
EXPECT_MSG_EMIT(Warning) ;
EXPECT_MSG_NOEMIT(Error) ;
std::stringstream scene ;
scene << "<?xml version='1.0'?> \n"
"<Node name='Root' gravity='0 -9.81 0' time='0' animate='0' > \n"
" <DefaultPipeline name='pipeline'/> \n"
"</Node> \n" ;
Node::SPtr root = SceneLoaderXML::loadFromMemory ("testscene",
scene.str().c_str(),
scene.str().size()) ;
ASSERT_NE(root.get(), nullptr) ;
root->init(ExecParams::defaultInstance()) ;
BaseObject* clp = root->getObject("pipeline") ;
ASSERT_NE(clp, nullptr) ;
clearSceneGraph();
}
示例4: checkDefaultPipelineWithMonkeyValueForDepth
int TestDefaultPipeLine::checkDefaultPipelineWithMonkeyValueForDepth(int dvalue)
{
std::stringstream scene ;
scene << "<?xml version='1.0'?> \n"
"<Node name='Root' gravity='0 -9.81 0' time='0' animate='0' > \n"
" <DefaultPipeline name='pipeline' depth='"<< dvalue <<"'/> \n"
" <DiscreteIntersection name='interaction'/> \n"
"</Node> \n" ;
Node::SPtr root = SceneLoaderXML::loadFromMemory ("testscene",
scene.str().c_str(),
scene.str().size()) ;
//EXPECT_NE( (root.get()), NULL) ;
root->init(ExecParams::defaultInstance()) ;
DefaultPipeline* clp = dynamic_cast<DefaultPipeline*>(root->getObject("pipeline")) ;
//ASSERT_NE( (clp), nullptr) ;
int rv = clp->d_depth.getValue() ;
clearSceneGraph();
return rv;
}