本文整理汇总了C++中MenuManager::is3dMenuEnabled方法的典型用法代码示例。如果您正苦于以下问题:C++ MenuManager::is3dMenuEnabled方法的具体用法?C++ MenuManager::is3dMenuEnabled怎么用?C++ MenuManager::is3dMenuEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MenuManager
的用法示例。
在下文中一共展示了MenuManager::is3dMenuEnabled方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: placeOnWand
void Menu::placeOnWand(const Event& evt)
{
MenuManager* mm = MenuManager::instance();
if(mm->is3dMenuEnabled())
{
float distance = mm->getDefaultMenuDistance();
float scale = mm->getDefaultMenuScale();
Ray ray;
if(SystemManager::instance()->getDisplaySystem()->getViewRayFromEvent(evt, ray))
{
Vector3f pos = ray.getPoint(distance);
Vector3f dir = ray.getDirection();
// If the menu is attached to a node (usually the default camera)
// use untransformed values for its position and direction, since the node transform applied during draw will
// take care of transformations.
if(my3dSettings.node != NULL)
{
pos = my3dSettings.node->convertWorldToLocalPosition(pos);
// This is a bit of trickery: If the event is a pointer event we use the orientation of the node
// to determine the menu orientation.
// If the event is a Wand event (with 6DOF tracking) we use the actual wand orientation.
if(evt.getServiceType() == static_cast<enum Service::ServiceType>(Event::ServiceTypeWand))
{
dir = evt.getOrientation() * -Vector3f::UnitZ();
}
else
{
dir = -Vector3f::UnitZ(); //my3dSettings.node->getOrientation() * dir;
}
}
//ofmsg("menu position: %1%", %pos);
Container3dSettings& c3ds = get3dSettings();
Widget* menuWidget = myContainer;
Vector3f offset = Vector3f(0, 0, 0); //-menuWidget->getHeight() * c3ds.scale, 0);
c3ds.position = pos - offset;
c3ds.normal = -dir;
// If the menu widget is not attached to a node, set the up vector using the default camera orientation.
if(my3dSettings.node == NULL)
{
DisplaySystem* ds = SystemManager::instance()->getDisplaySystem();
Camera* cam = Engine::instance()->getDefaultCamera();
Vector3f up = Vector3f::UnitY();
c3ds.up = cam->getOrientation() * up;
}
else
{
// If the menu is attached to a node, the up vector is just positive Y (the node transform applied later will do the rest)
c3ds.up = Vector3f::UnitY();
}
//c3ds.normal = Vector3f(0, 0, 1);
c3ds.scale = scale;
}
}
else
{
// Place 2D menu
if(evt.getServiceType() == static_cast<enum Service::ServiceType>(Event::ServiceTypePointer))
{
myContainer->setPosition(
Vector2f(evt.getPosition()[0], evt.getPosition()[1]));
}
}
}