当前位置: 首页>>代码示例>>C++>>正文


C++ SBScene::getCharacter方法代码示例

本文整理汇总了C++中smartbody::SBScene::getCharacter方法的典型用法代码示例。如果您正苦于以下问题:C++ SBScene::getCharacter方法的具体用法?C++ SBScene::getCharacter怎么用?C++ SBScene::getCharacter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在smartbody::SBScene的用法示例。


在下文中一共展示了SBScene::getCharacter方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: 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

示例2: 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

示例3: updateGUI


//.........这里部分代码省略.........
		Fl_Tree_Item* meshItem = resourceTree->add(getTreeFromName("mesh"), mesh->getName().c_str());
		updateMesh(meshItem, mesh);
	}


	// update face definition map
	resourceTree->clear_children(getTreeFromName("facedefinition"));
	std::vector<std::string> faceNames = scene->getFaceDefinitionNames();
	for (size_t i = 0; i < faceNames.size(); i++)
	{
		//resourceTree->add(treeItemList[ITEM_MOTION],mi->first.c_str());
		SmartBody::SBFaceDefinition * face = scene->getFaceDefinition(faceNames[i]);
		if (!face)
			continue;
		Fl_Tree_Item* faceTree = resourceTree->add(getTreeFromName("facedefinition"), face->getName().c_str());
		updateFaceDefinition(faceTree, face);
	}

	// update event handler list
	SmartBody::SBEventManager* eventManager = SmartBody::SBScene::getScene()->getEventManager();
	std::map<std::string, SmartBody::SBEventHandler*>& eventMap = eventManager->getEventHandlers();
	std::map<std::string, SmartBody::SBEventHandler*>::iterator ei;
	resourceTree->clear_children(getTreeFromName("eventhandler"));
	for ( ei  = eventMap.begin();
		  ei != eventMap.end();
		  ei++)
	{
		updateEventHandler(getTreeFromName("eventhandler"), ei->second);
	}
	// Below are instance objects :

	// update pawn objects
	resourceTree->clear_children(getTreeFromName("pawn"));
	const std::vector<std::string>& pawnNames = scene->getPawnNames();
	for (size_t i = 0; i < pawnNames.size(); i++)
	{
		SmartBody::SBPawn* pawn = scene->getPawn(pawnNames[i]);
		updatePawn(getTreeFromName("pawn"), pawn);
	}

	// update characters
	resourceTree->clear_children(getTreeFromName("character"));
	const std::vector<std::string>& charNames = scene->getCharacterNames();
	for (size_t i = 0; i < charNames.size(); i++)
	{
		SmartBody::SBCharacter* character = scene->getCharacter(charNames[i]);
		resourceTree->sortorder(FL_TREE_SORT_ASCENDING);
		updateCharacter(getTreeFromName("character"), character);
	}

	
// 	for (SBPhysicsObjMap::iterator iter = phySim->getPhysicsObjMap().begin();
// 		 iter != phySim->getPhysicsObjMap().end();
// 		 iter++)
// 	{
// 		SBPhysicsObj* obj = (*iter).second;
// 		if (dynamic_cast<SbmJointObj*>(obj) == NULL)
// 		{
// 
// 		}
// 	}

	// update services
	SmartBody::SBServiceManager* serviceManager = scene->getServiceManager();
	std::map<std::string, SmartBody::SBService*>& serviceMap = serviceManager->getServices();

	resourceTree->clear_children(getTreeFromName("service"));
	for (std::map<std::string, SmartBody::SBService*>::iterator iter = serviceMap.begin();
		iter != serviceMap.end();
		iter++)
	{
		SmartBody::SBService* service = (*iter).second;
		resourceTree->sortorder(FL_TREE_SORT_ASCENDING);	
		SmartBody::SBPhysicsManager* phyManager = dynamic_cast<SmartBody::SBPhysicsManager*>(service);
		if (phyManager)
			updatePhysicsManager(getTreeFromName("service"),phyManager);
		else
			updateService(getTreeFromName("service"), service);
	}

	// update behavior sets
	resourceTree->clear_children(getTreeFromName("behaviorset"));
	std::map<std::string, SmartBody::SBBehaviorSet*>& behaviorSets = scene->getBehaviorSetManager()->getBehaviorSets();
	for (std::map<std::string, SmartBody::SBBehaviorSet*>::iterator iter = behaviorSets.begin();
		 iter != behaviorSets.end();
		 iter++)
	{
		SmartBody::SBBehaviorSet* behaviorSet = (*iter).second;
		updateBehaviorSet(getTreeFromName("behaviorset"), behaviorSet);
	}


	_dirty = false;

	if (_firstTime)
	{
		hideTree();
		_firstTime = false;
	}
}
开发者ID:gsi-upm,项目名称:SmartSim,代码行数:101,代码来源:ResourceWindow.cpp


注:本文中的smartbody::SBScene::getCharacter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。