本文整理汇总了C++中kernel::Object::changeParent方法的典型用法代码示例。如果您正苦于以下问题:C++ Object::changeParent方法的具体用法?C++ Object::changeParent怎么用?C++ Object::changeParent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kernel::Object
的用法示例。
在下文中一共展示了Object::changeParent方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: basicTest
void TestSoundEnvironnement::basicTest()
{
std::cerr << "TestSoundEnvironnement::basicTest" ;
std::cerr.flush() ;
/*!
- build a SoundEnvironnement
- build an Engine in this environnement
- build a listener in the same environnement
- change a parent and listen the sound continue with just a little artefact between the close and init
*/
std::auto_ptr<Kernel::Model> model(new Kernel::Model("TestSoundEnvironnement::basicTest"));
model->init() ;
Kernel::Object* system = model->createObject() ;
system->addTrait(new Model::Positioned()) ;
system->addTrait(new Model::Oriented()) ;
Kernel::Object* listener = system->createObject() ;
listener->addTrait(new Model::Listener()) ;
listener->addTrait(new Model::Positioned()) ;
listener->addTrait(new Model::Oriented(Model::Orientation(Ogre::Quaternion(1.0, 0.0, 10.0, 0.0)))) ;
listener->addTrait(new Model::Mobile());
Kernel::Object* ship = Model::createShip(system) ;
ship->getChild<Model::Throttle>()->set(100) ;
Kernel::Timer timer;
Kernel::Timer global_timer;
std::cerr << " normal... " ;
std::cerr.flush() ;
while (global_timer.getSecond() <= 3)
{
float seconds = timer.getSecond() ;
timer.reset() ;
model->update(seconds) ;
}
Kernel::Object* env = system->createObject() ;
Model::SoundEnvironnement* soundEnv = new Model::SoundEnvironnement();
// soundEnv->setDensity(0.5) ;
// soundEnv->setDiffusion(1.0) ;
// soundEnv->setGain(0.5) ;
// soundEnv->setGainHF(1.0) ;
// soundEnv->setDecayTime(2.0) ;
// soundEnv->setDecayHFRatio(1.1) ;
// soundEnv->setReflexionsGain(1.0) ;
// soundEnv->setReflexionsDelay(2.0) ;
// soundEnv->setLateReverbGain(1.0) ;
// soundEnv->setLateReverbDelay(2.5) ;
env->addTrait(soundEnv) ;
ship->changeParent(env) ;
std::cerr << " switching environement... " << std::endl ;
std::cerr.flush() ;
while (global_timer.getSecond() <= 6)
{
float seconds = timer.getSecond() ;
timer.reset() ;
model->update(seconds) ;
}
}