本文整理汇总了C++中smartbody::SBScene类的典型用法代码示例。如果您正苦于以下问题:C++ SBScene类的具体用法?C++ SBScene怎么用?C++ SBScene使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SBScene类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:gsi-upm,项目名称:SmartSim,代码行数:30,代码来源:smartbody-c-dll.cpp
示例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() );
}
}
开发者ID:gsi-upm,项目名称:SmartSim,代码行数:33,代码来源:sbm_pawn.cpp
示例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);
}
开发者ID:gsi-upm,项目名称:SmartSim,代码行数:25,代码来源:SBDebuggerUtility.cpp
示例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;
}
开发者ID:gsi-upm,项目名称:SmartSim,代码行数:35,代码来源:sbm_pawn.cpp
示例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());
}
}
}
}
}
}
开发者ID:gsi-upm,项目名称:SmartSim,代码行数:29,代码来源:ResourceWindow.cpp
示例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;
}
开发者ID:gsi-upm,项目名称:SmartSim,代码行数:27,代码来源:smartbody-c-dll.cpp
示例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());
}
}
开发者ID:gsi-upm,项目名称:SmartSim,代码行数:59,代码来源:sbm_pawn.cpp
示例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());
}
开发者ID:gsi-upm,项目名称:SmartSim,代码行数:10,代码来源:ParamAnimTransitionCreatorWidget.cpp
示例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;
}
开发者ID:gsi-upm,项目名称:SmartSim,代码行数:12,代码来源:smartbody-c-dll.cpp
示例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);
}
开发者ID:gsi-upm,项目名称:SmartSim,代码行数:12,代码来源:smartbody-c-dll.cpp
示例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);
}
开发者ID:gsi-upm,项目名称:SmartSim,代码行数:12,代码来源:smartbody-c-dll.cpp
示例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);
}
开发者ID:gsi-upm,项目名称:SmartSim,代码行数:12,代码来源:smartbody-c-dll.cpp
示例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);
}
开发者ID:gsi-upm,项目名称:SmartSim,代码行数:12,代码来源:smartbody-c-dll.cpp
示例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);
}
开发者ID:gsi-upm,项目名称:SmartSim,代码行数:12,代码来源:smartbody-c-dll.cpp
示例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);
}
开发者ID:gsi-upm,项目名称:SmartSim,代码行数:12,代码来源:smartbody-c-dll.cpp
示例16: SBM_GetCharacter
SBAPI bool SBM_GetCharacter( SBMHANDLE sbmHandle, const char * name, SBM_CharacterFrameDataMarshalFriendly * character )
{
if ( !SBM_HandleExists( sbmHandle ) )
{
LOG("SBM_GetCharcter : Handle %d does not exist", sbmHandle);
return false;
}
SmartBody::SBScene * scene = SmartBody::SBScene::getScene();
SmartBody::SBCharacter * sbcharacter = scene->getCharacter(name);
const SBM_CharacterFrameDataMarshalFriendly & data = sbcharacter->GetFrameDataMarshalFriendly();
if (character->m_numJoints == 0 || character->m_numJoints != data.m_numJoints)
{
SBM_ReleaseCharacterJoints(character);
character->m_numJoints = data.m_numJoints;
character->jname = new char * [ character->m_numJoints ];
character->jx = new float [ character->m_numJoints ];
character->jy = new float [ character->m_numJoints ];
character->jz = new float [ character->m_numJoints ];
character->jrw = new float [ character->m_numJoints ];
character->jrx = new float [ character->m_numJoints ];
character->jry = new float [ character->m_numJoints ];
character->jrz = new float [ character->m_numJoints ];
for ( int i = 0; i < character->m_numJoints; i++ )
{
character->jname[ i ] = new char[ strlen(data.jname[ i ]) + 1 ];
strcpy( character->jname[ i ], data.jname[ i ] );
}
}
character->x = data.x;
character->y = data.y;
character->z = data.z;
character->rw = data.rw;
character->rx = data.rx;
character->ry = data.ry;
character->rz = data.rz;
memcpy(character->jx, data.jx, data.m_numJoints * sizeof(float));
memcpy(character->jy, data.jy, data.m_numJoints * sizeof(float));
memcpy(character->jz, data.jz, data.m_numJoints * sizeof(float));
memcpy(character->jrw, data.jrw, data.m_numJoints * sizeof(float));
memcpy(character->jrx, data.jrx, data.m_numJoints * sizeof(float));
memcpy(character->jry, data.jry, data.m_numJoints * sizeof(float));
memcpy(character->jrz, data.jrz, data.m_numJoints * sizeof(float));
return true;
}
开发者ID:gsi-upm,项目名称:SmartSim,代码行数:52,代码来源:smartbody-c-dll.cpp
示例17: initCharacterFaceDefinition
void SBDebuggerUtility::initCharacterFaceDefinition(const std::string& characterName, const std::string& faceDefName, const std::string& message)
{
SmartBody::SBScene* sbScene = SmartBody::SBScene::getScene();
SmartBody::SBCharacter* sbCharacter = sbScene->getCharacter(characterName);
if (!sbCharacter)
return;
SmartBody::SBFaceDefinition* faceDef = sbScene->getFaceDefinition(faceDefName);
if (!faceDef)
return;
sbCharacter->setFaceDefinition(faceDef);
}
开发者ID:gsi-upm,项目名称:SmartSim,代码行数:13,代码来源:SBDebuggerUtility.cpp
示例18: SBM_SBAssetManager_LoadMotion
SBAPI bool SBM_SBAssetManager_LoadMotion( SBMHANDLE sbmHandle, const void * data, int sizeBytes, const char * motionName )
{
if ( !SBM_HandleExists( sbmHandle ) )
{
return false;
}
SmartBody::SBScene * scene = SmartBody::SBScene::getScene();
SmartBody::SBAssetManager * assetManager = scene->getAssetManager();
int ret = assetManager->load_motion( data, sizeBytes, motionName );
return ret == CMD_SUCCESS;
}
开发者ID:gsi-upm,项目名称:SmartSim,代码行数:13,代码来源:smartbody-c-dll.cpp
示例19: SBM_SBDiphone_AddKey
SBAPI void SBM_SBDiphone_AddKey(SBMHANDLE sbmHandle, const char * fromPhoneme, const char * toPhoneme, const char * name, const char * viseme, float time, float weight)
{
if ( !SBM_HandleExists( sbmHandle ) )
{
return;
}
SmartBody::SBScene * scene = SmartBody::SBScene::getScene();
SmartBody::SBPhonemeManager * diphoneManager = scene->getDiphoneManager();
SmartBody::SBDiphone * diphone = diphoneManager->getDiphone(fromPhoneme, toPhoneme, name);
diphone->addKey(viseme, time, weight);
}
开发者ID:gsi-upm,项目名称:SmartSim,代码行数:13,代码来源:smartbody-c-dll.cpp
示例20: SBM_ProcessVHMsgs
SBAPI bool SBM_ProcessVHMsgs( SBMHANDLE sbmHandle, const char * op, const char * args )
{
if ( !SBM_HandleExists( sbmHandle ) )
{
return false;
}
SmartBody::SBScene * scene = SmartBody::SBScene::getScene();
string s = string(op) + string(" ") + string(args);
scene->command( s.c_str() );
scene->getDebuggerServer()->ProcessVHMsgs(op, args);
return true;
}
开发者ID:gsi-upm,项目名称:SmartSim,代码行数:14,代码来源:smartbody-c-dll.cpp
注:本文中的smartbody::SBScene类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论