本文整理汇总了C++中Solid::getMesh方法的典型用法代码示例。如果您正苦于以下问题:C++ Solid::getMesh方法的具体用法?C++ Solid::getMesh怎么用?C++ Solid::getMesh使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Solid
的用法示例。
在下文中一共展示了Solid::getMesh方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: check
void DetectorObjectView::check()
{
InternalMessage("Model","Model::DetectorObjectView::check entering") ;
Detector* detector = getViewPoint()->getObserver() ;
if (!detector)
return ;
bool in_range = detector ? detector->canDetect(getObject()) : false ;
if (!detector->getComputer())
return ;
Computer* computer = detector->getComputer()->getTrait<Computer>() ;
if (! computer)
return ;
if (!in_range && m_detection_information)
{
// destroy object
computer->getMemoryModel()->destroyObject(m_detection_information) ;
m_detection_information = NULL ;
}
else if (in_range)
{
InternalMessage(
"Model",
"Model::DetectorObjectView::check in range updating detection data") ;
bool mobile = false ;
if (! m_detection_information)
{
Solid* solid = getObject()->getTrait<Solid>() ;
// create object
m_detection_information = computer->getMemoryModel()->createObject() ;
m_detection_information->addTrait(new DetectionData(detector->getComputer())) ;
m_detection_information->addTrait(new Positionned()) ;
m_detection_information->addTrait(new Solid(solid->getMesh())) ;
m_detection_information->getTrait<DetectionData>()->m_detected = getObject() ;
}
// update object position
Position position = getRelativePosition(getObject(),
computer->getObject()) ;
m_detection_information->getTrait<Positionned>()->setPosition(position) ;
// update speed if exists
Mobile* mobileTrait = getObject()->getTrait<Mobile>() ;
if (mobileTrait)
{
Mobile* data = m_detection_information->getTrait<Mobile>() ;
if (! data)
{
data = new Mobile() ;
m_detection_information->addTrait(data) ;
}
data->setSpeed(mobileTrait->getSpeed()) ;
data->setAngularSpeed(mobileTrait->getAngularSpeed()) ;
}
// update identification
Transponder* identified =
getObject()->getTrait<Transponder>() ;
Transponder* identifedData =
m_detection_information->getTrait<Transponder>() ;
if (identified)
{
if (! identifedData)
{
// gained identification
m_detection_information->addTrait(new Transponder(*identified)) ;
}
else if (identifedData->getCode() != identified->getCode())
{
// changed identification
identifedData->setCode(identified) ;
}
}
else if (identifedData)
{
// lost identification
m_detection_information->destroyTrait(identifedData) ;
}
// update Targetting
std::set<TargetingSystem*> systems = getObject()->getChildren<TargetingSystem>() ;
TargetingSystem* system_data =
m_detection_information->getTrait<TargetingSystem>() ;
if (systems.size() == 1)
{
TargetingSystem* system = *(systems.begin()) ;
if (! system_data)
{
//.........这里部分代码省略.........