本文整理汇总了C++中smartbody::SBScene::getSceneListeners方法的典型用法代码示例。如果您正苦于以下问题:C++ SBScene::getSceneListeners方法的具体用法?C++ SBScene::getSceneListeners怎么用?C++ SBScene::getSceneListeners使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类smartbody::SBScene
的用法示例。
在下文中一共展示了SBScene::getSceneListeners方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init
int SbmPawn::init( SkSkeleton* new_skeleton_p ) {
if( _skeleton ) {
ct_tree_p->remove_skeleton( _skeleton->getName() );
//_skeleton->unref();
delete _skeleton;
}
_skeleton = new_skeleton_p;
if( _skeleton ) {
_skeleton->ref();
if( init_skeleton()!=CMD_SUCCESS ) {
return CMD_FAILURE;
}
ct_tree_p->add_skeleton( _skeleton->getName(), _skeleton );
SmartBody::SBScene* scene = SmartBody::SBScene::getScene();
std::vector<SmartBody::SBSceneListener*>& listeners = scene->getSceneListeners();
for (size_t i = 0; i < listeners.size(); i++)
{
listeners[i]->OnCharacterUpdate( getName() );
}
}
// if (colObj_p)
// {
// initPhysicsObj();
// }
// Name the controllers
string ct_name( getName() );
ct_name += "'s world_offset writer";
world_offset_writer_p->setName( ct_name.c_str() );
return CMD_SUCCESS;
}
示例2: setSkeleton
void SbmPawn::setSkeleton(SkSkeleton* sk)
{
if (!sk)
{
LOG("Cannot set a null skeleton on object %s", getName().c_str());
return;
}
if (_skeleton)
{
ct_tree_p->remove_skeleton( _skeleton->getName() );
//_skeleton->unref();
delete _skeleton;
}
_skeleton = sk;
_skeleton->ref();
ct_tree_p->add_skeleton( _skeleton->getName(), _skeleton );
//scene_p->init(_skeleton);
//int err = mcu.add_scene(scene_p);
float height = _skeleton->getCurrentHeight();
setHeight(height);
//_skeleton->ref();
SmartBody::SBScene* scene = SmartBody::SBScene::getScene();
std::vector<SmartBody::SBSceneListener*>& listeners = scene->getSceneListeners();
for (size_t i = 0; i < listeners.size(); i++)
{
listeners[i]->OnCharacterUpdate( getName() );
}
}
示例3: setup
int SbmPawn::setup() {
// Verifiy the joint name is not already in use.
if( _skeleton->search_joint( SbmPawn::WORLD_OFFSET_JOINT_NAME ) ) {
std::stringstream strstr;
strstr << "ERROR: SbmPawn::init_skeleton_offset: Skeleton already contains joint \"" << SbmPawn::WORLD_OFFSET_JOINT_NAME << "\".";
LOG(strstr.str().c_str());
return( CMD_FAILURE );
}
SkJoint* world_offset_joint = _skeleton->insert_new_root_joint( SkJoint::TypeQuat );
world_offset_joint->name( SbmPawn::WORLD_OFFSET_JOINT_NAME );
world_offset_joint->extName( SbmPawn::WORLD_OFFSET_JOINT_NAME );
// Make sure the world_offset accepts new pos and quat values
SkJointPos* world_offset_pos = world_offset_joint->pos();
world_offset_pos->limits( SkVecLimits::X, false );
world_offset_pos->limits( SkVecLimits::Y, false );
world_offset_pos->limits( SkVecLimits::Z, false );
world_offset_joint->quat()->activate();
_skeleton->compress();
_skeleton->make_active_channels();
if( WORLD_OFFSET_CHANNELS_P.size()==0 ) {
std::string world_offset_joint_name( WORLD_OFFSET_JOINT_NAME );
WORLD_OFFSET_CHANNELS_P.add( world_offset_joint_name, SkChannel::XPos );
WORLD_OFFSET_CHANNELS_P.add( world_offset_joint_name, SkChannel::YPos );
WORLD_OFFSET_CHANNELS_P.add( world_offset_joint_name, SkChannel::ZPos );
WORLD_OFFSET_CHANNELS_P.add( world_offset_joint_name, SkChannel::Quat );
}
world_offset_writer_p->init( this, WORLD_OFFSET_CHANNELS_P, true );
wo_cache.x = 0;
wo_cache.y = 0;
wo_cache.z = 0;
wo_cache.h = 0;
wo_cache.p = 0;
wo_cache.r = 0;
SmartBody::SBScene* scene = SmartBody::SBScene::getScene();
std::vector<SmartBody::SBSceneListener*>& listeners = scene->getSceneListeners();
for (size_t i = 0; i < listeners.size(); i++)
{
listeners[i]->OnCharacterUpdate( getName() );
}
return( CMD_SUCCESS );
}