本文整理汇总了C++中node::SPtr::init方法的典型用法代码示例。如果您正苦于以下问题:C++ SPtr::init方法的具体用法?C++ SPtr::init怎么用?C++ SPtr::init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类node::SPtr
的用法示例。
在下文中一共展示了SPtr::init方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: loadFromAnInvalidPathname
void loadFromAnInvalidPathname(){
string scene =
"<?xml version='1.0'?>"
"<Node name='Root' gravity='0 0 0' time='0' animate='0' > "
" <MechanicalObject position='0 0 0'/> "
" <UniformMass filename='invalid_uniformmatrix.txt'/> "
"</Node> " ;
Node::SPtr root = SceneLoaderXML::loadFromMemory ("loadFromAnInValidFile",
scene.c_str(), (int)scene.size()) ;
root->init(ExecParams::defaultInstance()) ;
}
示例4: loadFromAFileForNonRigid
void loadFromAFileForNonRigid(){
string scene =
"<?xml version='1.0'?>"
"<Node name='Root' gravity='0 0 0' time='0' animate='0' > "
" <MechanicalObject position='0 0 0'/> "
" <UniformMass filename='BehaviorModels/card.rigid'/> "
"</Node> " ;
Node::SPtr root = SceneLoaderXML::loadFromMemory ("loadFromAValidFile",
scene.c_str(), (int)scene.size()) ;
root->init(ExecParams::defaultInstance()) ;
}
示例5: testNoParameter
void testNoParameter()
{
EXPECT_MSG_EMIT(Error) ;
std::stringstream scene ;
scene << "<?xml version='1.0'?>"
"<Node name='Root' gravity='0 -9.81 0' time='0' animate='0' > \n"
" <RequiredPlugin /> \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()) ;
}
示例6: loadFromAFileForRigid
void loadFromAFileForRigid(){
string scene =
"<?xml version='1.0'?>"
"<Node name='Root' gravity='0 0 0' time='0' animate='0' > "
" <MechanicalObject template='Rigid3' position='0 0 0 1 0 0 1 0 0 0 1 0 0 1'/> "
" <UniformMass filename='BehaviorModels/card.rigid'/> "
"</Node> " ;
Node::SPtr root = SceneLoaderXML::loadFromMemory ("loadFromAValidFile",
scene.c_str(), (int)scene.size()) ;
root->init(ExecParams::defaultInstance()) ;
UniformMassRigid* mass = root->getTreeObject<UniformMassRigid>() ;
EXPECT_TRUE( mass != nullptr ) ;
if(mass!=nullptr){
EXPECT_EQ( mass->getMass(), 40.0 ) ;
EXPECT_EQ( mass->getTotalMass(), 80.0 ) ;
}
}
示例7: checkNegativeMassNotAllowed
/// if masses are negative we refuse them and use the default values.
void checkNegativeMassNotAllowed(){
string scene =
"<?xml version='1.0'?>"
"<Node name='Root' gravity='0 0 0' time='0' animate='0' > "
" <MechanicalObject position='0 0 0 4 5 6'/> "
" <UniformMass name='m_mass' totalmass='-1.0' mass=-3.0/> "
"</Node> " ;
Node::SPtr root = SceneLoaderXML::loadFromMemory ("loadWithNoParam",
scene.c_str(),
scene.size()) ;
root->init(ExecParams::defaultInstance()) ;
TheUniformMass* mass = root->getTreeObject<TheUniformMass>() ;
EXPECT_TRUE( mass != nullptr ) ;
if(mass!=nullptr){
EXPECT_EQ( mass->getMass(), 1.0 ) ;
EXPECT_EQ( mass->getTotalMass(), 2.0 ) ;
}
}
示例8: 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();
}
示例9: 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;
}