本文整理汇总了C++中CVideo::screenPosToWorldRay方法的典型用法代码示例。如果您正苦于以下问题:C++ CVideo::screenPosToWorldRay方法的具体用法?C++ CVideo::screenPosToWorldRay怎么用?C++ CVideo::screenPosToWorldRay使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CVideo
的用法示例。
在下文中一共展示了CVideo::screenPosToWorldRay方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnTouchClick
void GuiIconCarousel::OnTouchClick(GuiButton *button, const GuiController *controller, GuiTrigger *trigger)
{
if(!controller->data.validPointer)
return;
bWasDragging = false;
selectedGameOnDragStart = getSelectedGame();
lastPosition.x = controller->data.x;
lastPosition.y = controller->data.y;
//! calculate ray origin and direction
glm::vec3 rayOrigin;
glm::vec3 rayDir;
CVideo *video = Application::instance()->getVideo();
video->screenPosToWorldRay(controller->data.x, controller->data.y, rayOrigin, rayDir);
glm::vec3 rayDirFrac((rayDir.x != 0.0f) ? (1.0f / rayDir.x) : 0.0f, (rayDir.y != 0.0f) ? (1.0f / rayDir.y) : 0.0f, (rayDir.z != 0.0f) ? (1.0f / rayDir.z) : 0.0f);
for(u32 i = 0; i < drawOrder.size(); ++i)
{
int idx = drawOrder[i];
if(gameIcons[idx]->checkRayIntersection(rayOrigin, rayDirFrac))
{
if(buttonClickSound)
buttonClickSound->Play();
setSelectedGame(idx);
gameSelectionChanged(this, idx);
//! TODO: change this to a button assigned image
gameIcons[idx]->setState(STATE_CLICKED);
gameIcons[idx]->setEffect(EFFECT_SCALE, 4, 125);
if(selectedGame == idx)
{
if(gameLaunchTimer < 30)
OnLaunchClick(button, controller, trigger);
gameLaunchTimer = 0;
}
}
}
}