本文整理汇总了C++中smartbody::SBScene类的典型用法代码示例。如果您正苦于以下问题:C++ SBScene类的具体用法?C++ SBScene怎么用?C++ SBScene使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SBScene类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SBM_Init
SBAPI bool SBM_Init( SBMHANDLE sbmHandle, const char * pythonLibPath, bool logToFile )
{
if ( !SBM_HandleExists( sbmHandle ) )
{
return false;
}
// this is the first getScene() called by the system
SmartBody::SBScene* scene = SmartBody::SBScene::getScene();
scene->addSceneListener(g_smartbodyDLLInstances[ g_handleId_DLL ]->m_listener);
vhcl::Log::g_log.AddListener(g_smartbodyDLLInstances[ g_handleId_DLL ]->m_logListener);
vhcl::Log::g_log.AddListener(new vhcl::Log::DebuggerListener());
initPython(pythonLibPath);
SBM_InitLocalSpeechRelay();
srArgBuffer arg_buf( "" );
mcu_vrAllCall_func( arg_buf, scene->getCommandManager() );
if (logToFile)
{
scene->startFileLogging("./smartbody.log");
}
return true;
}
示例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: queryResources
void SBDebuggerUtility::queryResources()
{
SmartBody::SBScene* sbScene = SmartBody::SBScene::getScene();
SmartBody::SBDebuggerClient* client = sbScene->getDebuggerClient();
if (!client)
return;
// get assets
std::string assetTypes[4] = {"script", "motion", "audio", "mesh"};
NetRequest::RequestId correspondingIds[4] = {NetRequest::Get_Seq_Asset_Paths, NetRequest::Get_ME_Asset_Paths, NetRequest::Get_Audio_Asset_Paths, NetRequest::Get_Mesh_Asset_Paths};
for (int i = 0; i < 4; i++)
{
std::string command = vhcl::Format("scene.getAssetPaths(\'%s\')", assetTypes[i].c_str());
client->SendSBMCommand(correspondingIds[i], "string-array", command, QueryResourcesCB, this);
}
// get scripts, service, motion
client->SendSBMCommand(NetRequest::Get_Script_Names, "string-array", "scene.getScriptNames()", QueryResourcesCB, this);
client->SendSBMCommand(NetRequest::Get_Service_Names, "string-array", "scene.getServiceManager().getServiceNames()", QueryResourcesCB, this);
client->SendSBMCommand(NetRequest::Get_Motion_Names, "string-array", "scene.getMotionNames()", QueryResourcesCB, this);
// client->SendSBMCommand(NetRequest::Get_Skeleton_Names, "string-array", "scene.getSkeletonNames()", QueryResourcesCB, this);
// client->SendSBMCommand(NetRequest::Get_BoneMap_Names, "string-array", "scene.getBoneMapNames()", QueryResourcesCB, this);
// client->SendSBMCommand(NetRequest::Get_EventHandler_Names, "string-array", "scene.getEventHandlerNames()", QueryResourcesCB, this);
client->SendSBMCommand(NetRequest::Get_Scene_Scale, "float", "scene.getScale()", QueryResourcesCB, this);
}
示例4: 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;
}
示例5: updateScriptFiles
void ResourceWindow::updateScriptFiles( Fl_Tree_Item* tree, std::string pname )
{
SmartBody::SBScene* scene = SmartBody::SBScene::getScene();
const std::vector<std::string>& scriptPaths = scene->getAssetManager()->getAssetPaths("script");
for (std::vector<std::string>::const_iterator pathIter = scriptPaths.begin();
pathIter != scriptPaths.end();
pathIter++)
{
boost::filesystem::path path(*pathIter);
if (boost::filesystem::is_directory(path))
{
boost::filesystem::directory_iterator end;
for (boost::filesystem::directory_iterator iter(path); iter != end; iter++)
{
const boost::filesystem::path& cur = (*iter);
std::string ext = boost::filesystem::extension( cur );
if (ext == ".seq" || ext == ".SEQ" || ext == ".py" || ext == ".PY")
{
std::string fileName = boost::filesystem::basename(cur);
if (tree->find_child(fileName.c_str()) == -1) // if the script name does not exist in the tree list
{
Fl_Tree_Item* item = resourceTree->add(tree, fileName.c_str());
}
}
}
}
}
}
示例6: SBM_Shutdown
SBAPI bool SBM_Shutdown( SBMHANDLE sbmHandle )
{
if ( !SBM_HandleExists( sbmHandle ) )
{
return false;
}
#ifndef SB_NO_VHMSG
SmartBody::SBScene::getScene()->getVHMsgManager()->send("vrProcEnd sbm");
//SmartBody::SBScene::getScene()->getVHMsgManager()->setEnable(false);
vhmsg::ttu_close();
#endif
XMLPlatformUtils::Terminate();
std::map< int, Smartbody_c_Dll * >::iterator itdll = g_smartbodyDLLInstances.find( sbmHandle );
Smartbody_c_Dll * sbmdll = g_smartbodyDLLInstances[ sbmHandle ];
g_smartbodyDLLInstances.erase( itdll );
SmartBody::SBScene* scene = SmartBody::SBScene::getScene();
scene->removeSceneListener(sbmdll->m_listener);
vhcl::Log::g_log.RemoveListener(sbmdll->m_logListener);
delete sbmdll;
return true;
}
示例7: initSteeringSpaceObject
void SbmPawn::initSteeringSpaceObject()
{
SmartBody::SBScene* scene = SmartBody::SBScene::getScene();
if (!scene->getSteerManager()->getEngineDriver()->isInitialized()) return;
if (!scene->getSteerManager()->getEngineDriver()->_engine) return;
float steerScale = 1.0f / scene->getScale();
// get the size of the steering object
float x, y, z, h, p, r;
this->get_world_offset(x, y, z, h, p, r);
gwiz::quat_t q = gwiz::euler_t(p,h,r);
SrQuat pawnQ = SrQuat((float)q.w(), (float)q.x(), (float)q.y(), (float)q.z());
SrVec size = this->getVec3Attribute("collisionShapeScale");
size = size*pawnQ;
steeringSpaceObjSize.x = fabs(size.x);
steeringSpaceObjSize.y = fabs(size.y);
steeringSpaceObjSize.z = fabs(size.z);
float xmin = (x - steeringSpaceObjSize.x) / steerScale;
float xmax = (x + steeringSpaceObjSize.x) / steerScale;
float ymin = (y - steeringSpaceObjSize.y) / steerScale;
float ymax = (y + steeringSpaceObjSize.y) / steerScale;
float zmin = (z - steeringSpaceObjSize.z) / steerScale;
float zmax = (z + steeringSpaceObjSize.z) / steerScale;
//LOG("steeringSpaceObjSize = %f %f %f, scale = %f", steeringSpaceObjSize.x, steeringSpaceObjSize.y, steeringSpaceObjSize.z, steerScale);
if (steeringSpaceObj_p)
{
const Util::AxisAlignedBox& box = steeringSpaceObj_p->getBounds();
if (fabs(box.xmax - xmax) > .0001 ||
fabs(box.xmin - xmin) > .0001 ||
fabs(box.ymax - ymax) > .0001 ||
fabs(box.ymin - ymin) > .0001 ||
fabs(box.zmax - zmax) > .0001 ||
fabs(box.zmin - zmin) > .0001)
{
SmartBody::SBScene::getScene()->getSteerManager()->getEngineDriver()->_engine->getSpatialDatabase()->removeObject(steeringSpaceObj_p, steeringSpaceObj_p->getBounds());
Util::AxisAlignedBox& mutableBox = const_cast<Util::AxisAlignedBox&>(box);
mutableBox.xmax = xmax;
mutableBox.xmin = xmin;
mutableBox.ymax = ymax;
mutableBox.ymin = ymin;
mutableBox.zmax = zmax;
mutableBox.zmin = zmin;
SmartBody::SBScene::getScene()->getSteerManager()->getEngineDriver()->_engine->getSpatialDatabase()->addObject(steeringSpaceObj_p, steeringSpaceObj_p->getBounds());
}
}
else
{
steeringSpaceObj_p = new SteerLib::BoxObstacle(xmin, xmax, ymin, ymax, zmin, zmax);
SmartBody::SBScene::getScene()->getSteerManager()->getEngineDriver()->_engine->addObstacle(steeringSpaceObj_p);
SmartBody::SBScene::getScene()->getSteerManager()->getEngineDriver()->_engine->getSpatialDatabase()->addObject(steeringSpaceObj_p, steeringSpaceObj_p->getBounds());
}
}
示例8: loadMotions
void PATransitionCreator::loadMotions()
{
SmartBody::SBScene* scene = SmartBody::SBScene::getScene();
std::vector<std::string> motionNames = scene->getMotionNames();
std::map<std::string, SkMotion*>::iterator iter;
for (std::vector<std::string>::iterator iter = motionNames.begin();
iter != motionNames.end();
iter++)
animationList->add(iter->c_str());
}
示例9: SBM_SBDebuggerServer_SetRendererIsRightHanded
SBAPI void SBM_SBDebuggerServer_SetRendererIsRightHanded( SBMHANDLE sbmHandle, bool enabled )
{
if ( !SBM_HandleExists( sbmHandle ) )
{
return;
}
SmartBody::SBScene * scene = SmartBody::SBScene::getScene();
SmartBody::SBDebuggerServer * debuggerServer = scene->getDebuggerServer();
debuggerServer->m_rendererIsRightHanded = enabled;
}
示例10: SBM_SBMotion_AddChannel
SBAPI void SBM_SBMotion_AddChannel( SBMHANDLE sbmHandle, const char * motionName, const char * channelName, const char * channelType )
{
if ( !SBM_HandleExists( sbmHandle ) )
{
return;
}
SmartBody::SBScene * scene = SmartBody::SBScene::getScene();
SmartBody::SBMotion * motion = scene->getMotion(motionName);
motion->addChannel(channelName, channelType);
}
示例11: SBM_SBDiphoneManager_CreateDiphone
SBAPI void SBM_SBDiphoneManager_CreateDiphone(SBMHANDLE sbmHandle, const char * fromPhoneme, const char * toPhoneme, const char * name)
{
if ( !SBM_HandleExists( sbmHandle ) )
{
return;
}
SmartBody::SBScene * scene = SmartBody::SBScene::getScene();
SmartBody::SBPhonemeManager * diphoneManager = scene->getDiphoneManager();
diphoneManager->createDiphone(fromPhoneme, toPhoneme, name);
}
示例12: SBM_SBVHMsgManager_SetPort
SBAPI void SBM_SBVHMsgManager_SetPort( SBMHANDLE sbmHandle, const char * port )
{
if ( !SBM_HandleExists( sbmHandle ) )
{
return;
}
SmartBody::SBScene * scene = SmartBody::SBScene::getScene();
SmartBody::SBVHMsgManager * vhmsgManager = scene->getVHMsgManager();
vhmsgManager->setPort(port);
}
示例13: SBM_SBDebuggerServer_SetID
SBAPI void SBM_SBDebuggerServer_SetID( SBMHANDLE sbmHandle, const char * id )
{
if ( !SBM_HandleExists( sbmHandle ) )
{
return;
}
SmartBody::SBScene * scene = SmartBody::SBScene::getScene();
SmartBody::SBDebuggerServer * debuggerServer = scene->getDebuggerServer();
debuggerServer->setStringAttribute("id", id);
}
示例14: SBM_SBVHMsgManager_SetEnable
SBAPI void SBM_SBVHMsgManager_SetEnable( SBMHANDLE sbmHandle, bool enable )
{
if ( !SBM_HandleExists( sbmHandle ) )
{
return;
}
SmartBody::SBScene * scene = SmartBody::SBScene::getScene();
SmartBody::SBVHMsgManager * vhmsgManager = scene->getVHMsgManager();
vhmsgManager->setEnable(enable);
}
示例15: SBM_SBMotion_SetSyncPoint
SBAPI void SBM_SBMotion_SetSyncPoint( SBMHANDLE sbmHandle, const char * motionName, const char * syncTag, double time )
{
if ( !SBM_HandleExists( sbmHandle ) )
{
return;
}
SmartBody::SBScene * scene = SmartBody::SBScene::getScene();
SmartBody::SBMotion * motion = scene->getMotion(motionName);
motion->setSyncPoint(syncTag, time);
}