本文整理汇总了C++中CGrid::GetDistanceTrisRay方法的典型用法代码示例。如果您正苦于以下问题:C++ CGrid::GetDistanceTrisRay方法的具体用法?C++ CGrid::GetDistanceTrisRay怎么用?C++ CGrid::GetDistanceTrisRay使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGrid
的用法示例。
在下文中一共展示了CGrid::GetDistanceTrisRay方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnRButtonDown
void CEasyGenView::OnRButtonDown(UINT nFlags, CPoint point)
{
CEasyGenDoc *pDoc = GetDocument();
CNmVec3 ray;
CNmVec3 p;
int tab;
BOOL kCTRL = nFlags & MK_CONTROL;
BOOL kSHIFT = nFlags & MK_SHIFT;
BOOL GotPoint = GetXYZ(point, p);
BOOL GotRay = GetRay(point, ray);
m_RDP = point;
SetCapture();
switch (tab = pDoc->GetActiveTab())
{
case (TAB_GRID):
break;
case (TAB_MODIFIER):
break;
case (TAB_ALPHAMAP):
break;
case (TAB_MODELS):
// MD3 - Move an Md3Highlighted model
if (!kCTRL && kSHIFT && GotRay && m_Md3Highlight)
{
CNmVec3 pos;
float dist;
if (g_Grid.GetDistanceTrisRay(m_Eye, ray, pos, dist))
{
m_Md3Highlight->m_egvPos = pos;
InvalidateRect(NULL, FALSE);
}
}
break;
}
CView::OnRButtonDown(nFlags, point);
}
示例2: 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);
}
示例3: OnLButtonDown
//.........这里部分代码省略.........
{
if (GetXYZ(point, p))
{
if (g_Grid.GetInfo(p.x, p.y, &inf))
{
m_VertexGot = g_Grid.GetK(inf.i, inf.j);
indexgot = g_Grid.GetAlphaIndex(m_VertexGot);
if (indexgot != g_AlphamapMan.GetCurSel())
{
g_AlphamapMan.SetCurSel(indexgot);
pDoc->UpdateFormView(TAB_ALPHAMAP);
}
}
}
}
break;
case (TAB_MODELS):
// MD3 - Selecting
if (!kCTRL && kSHIFT)
{
CNmVec3 ray, dummy;
float md3_dist, hitterra_dist;
bool hitterra;
S_MD3PTR *oldh = m_Md3Highlight;
S_MD3PTR *hit_md3;
if (GetRay(point, ray))
{
if (g_Md3Man.GetByRay(m_Eye, ray, hit_md3, md3_dist))
{
// check if is covered by terrain!!!
hitterra = g_Grid.GetDistanceTrisRay(m_Eye, ray, dummy, hitterra_dist);
if (!hitterra)
{
m_Md3Highlight = hit_md3;
}
else if (hitterra_dist > md3_dist)
{
m_Md3Highlight = hit_md3;
}
}
}
if (m_Md3Highlight != oldh)
{
Refresh = TRUE;
}
}
break;
}
// rotate tris (CTRL+LeftBut)
if ((tab == TAB_GRID || tab == TAB_MODIFIER || tab == TAB_ALPHAMAP) &&
mod == MOD_NONE && kCTRL && !kSHIFT)
{
if (GetXYZ(point, p))
{
if (g_Grid.GetInfo(p.x, p.y, &inf))
{
int i, j, k;
int mt1;
S_FACEDATAEX *f;