本文整理汇总了C++中CGrid::PtInGrid方法的典型用法代码示例。如果您正苦于以下问题:C++ CGrid::PtInGrid方法的具体用法?C++ CGrid::PtInGrid怎么用?C++ CGrid::PtInGrid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGrid
的用法示例。
在下文中一共展示了CGrid::PtInGrid方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnLButtonDblClk
void CEasyGenView::OnLButtonDblClk(UINT nFlags, CPoint point)
{
CEasyGenDoc *pDoc = GetDocument();
CNmVec3 ray;
CNmVec3 p;
BOOL kCTRL = nFlags & MK_CONTROL;
BOOL kSHIFT = nFlags & MK_SHIFT;
BOOL GotPoint = GetXYZ(point, p);
BOOL GotRay = GetRay(point, ray);
switch (pDoc->GetActiveTab())
{
case (TAB_GRID):
// player place
if (!kCTRL && kSHIFT && GotPoint && g_Grid.PtInGrid(p.x, p.y))
{
pDoc->m_vPlayer.x = p.x;
pDoc->m_vPlayer.y = p.y;
S_POSINFO inf;
if (g_Grid.GetInfo(pDoc->m_vPlayer.x, pDoc->m_vPlayer.y, &inf))
{
pDoc->m_vPlayer.z = inf.z;
}
m_vGenericPos.Set(p.x, p.y, pDoc->m_vPlayer.z);
UpdateStatusBar();
InvalidateRect(NULL, FALSE);
}
break;
case (TAB_MODIFIER):
// modifier place
if (kCTRL && !kSHIFT && GotPoint && g_Grid.PtInGrid(p.x, p.y))
{
pDoc->m_modX = p.x;
pDoc->m_modY = p.y;
g_Mod.PositionSet(p.x, p.y);
UpdateStatusBar();
InvalidateRect(NULL, FALSE);
pDoc->m_bInvalidateGridPreview = TRUE;
}
break;
case (TAB_ALPHAMAP):
break;
case (TAB_MODELS):
// MD3 - Insert model
if (kCTRL && !kSHIFT && GotRay)
{
CNmVec3 pos;
float dist;
S_MD3PTR *md3ptr;
if (g_Grid.GetDistanceTrisRay(m_Eye, ray, pos, dist))
{
md3ptr = g_Md3Man.m_Placed.Append(); // g_Md3Man.m_Placed.Append( pDoc->GetMd3SelectedTabModels() );
if (md3ptr)
{
md3ptr->pMd3 = pDoc->GetMd3SelectedTabModels();
md3ptr->m_egvPos = pos;
InvalidateRect(NULL, FALSE);
}
}
}
break;
}
// CAMERA - camera place [EVERY TAB]
if (!kSHIFT && !kCTRL && GotPoint && g_Grid.PtInGrid(p.x, p.y))
{
m_Eye.x = p.x;
m_Eye.y = p.y;
InvalidateRect(NULL, FALSE);
}
CView::OnLButtonDblClk(nFlags, point);
}