当前位置: 首页>>代码示例>>C++>>正文


C++ CGrid::GetK方法代码示例

本文整理汇总了C++中CGrid::GetK方法的典型用法代码示例。如果您正苦于以下问题:C++ CGrid::GetK方法的具体用法?C++ CGrid::GetK怎么用?C++ CGrid::GetK使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CGrid的用法示例。


在下文中一共展示了CGrid::GetK方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: OnMouseMove


//.........这里部分代码省略.........
			Refresh                        = TRUE;
		}

		// Vertex dragging
		if (m_LBD && kCTRL && kSHIFT && (m_VertexGot != -1) && (mod == MOD_NONE))
		{
			float *z = g_Grid.GetPtr(m_VertexGot);

			*z = floor(*z - g_Prefs.m_fVertexDragStep * (float)Ldelta.y);

			if (*z < ASSUME_ZERO)
			{
				*z = 0;
			}

			m_vGenericPos.Set(g_Grid.GetX(m_VertexGot), g_Grid.GetY(m_VertexGot), *z);

			UpdStatus                      = TRUE;
			pDoc->m_bInvalidateGridPreview = TRUE;
			Refresh                        = TRUE;
		}

		break;
	case (TAB_ALPHAMAP):

		int curindex;

		curindex = g_AlphamapMan.GetCurSel();

		// Alphamap paint
		if (m_LBD && kCTRL && kSHIFT && curindex != -1)
		{
			if (GetXYZ(point, p))
			{
				if (g_Grid.GetInfo(p.x, p.y, &inf))
				{
					m_VertexGot = g_Grid.GetK(inf.i, inf.j);
//					g_Grid.SetAlphaIndex(m_VertexGot, curindex );
					g_Grid.PaintAlphaIndex(inf.i, inf.j, pDoc->m_dwPaintRadius, curindex);
					Refresh = TRUE;
				}
			}
		}

		break;
	case (TAB_MODELS):
		break;
	}

	//	rotate X/Y
	if (m_LBD && !m_RBD && !kCTRL && !kSHIFT)
	{
		m_yRot += (float)(Ldelta.x) / 2.0f; // left / right

		m_xRot += (float)(Ldelta.y) / 2.0f; // up / dn
		if (m_xRot > 85)
		{
			m_xRot = 85;
		}
		if (m_xRot < -85)
		{
			m_xRot = -85;
		}

		Refresh = TRUE;
	}

	//	pan
	if (m_RBD && !m_LBD && !kCTRL && !kSHIFT)
	{
		float f  = (float)u_deg2rad(-m_yRot + 90);
		float dx = -(float)(Ldelta.x) * 16;
		float dy = (float)(Ldelta.y) * 16;
		m_Eye.y += float(sin(f) * dx + cos(f) * dy);
		m_Eye.x += float(cos(f) * dx - sin(f) * dy);

		Refresh = TRUE;
	}

	//	up/dn
	if (m_RBD && m_LBD && !kCTRL && !kSHIFT)
	{
		m_Eye.z -= (float)(Rdelta.y) * 32;

		Refresh = TRUE;
	}

	if (Refresh)
	{
		InvalidateRect(NULL, FALSE);
	}

	if (UpdStatus)
	{
		UpdateStatusBar();
	}

	m_LDP = point;
	m_RDP = point;
}
开发者ID:etlegacy,项目名称:EasyGen,代码行数:101,代码来源:EasyGenView.cpp

示例2: OnLButtonDown

void CEasyGenView::OnLButtonDown(UINT nFlags, CPoint point)
{
	CEasyGenDoc *pDoc = GetDocument();
	S_POSINFO   inf;
	CTris       *t;
	CNmVec3     p;
	int         tab;

	m_LDP = point;

	BOOL kCTRL  = nFlags & MK_CONTROL;
	BOOL kSHIFT = nFlags & MK_SHIFT;

	BOOL Refresh = FALSE;

	int mod = pDoc->GetModifier();

	switch (tab = pDoc->GetActiveTab())
	{
	case (TAB_GRID):
		break;
	case (TAB_MODIFIER):

		// Get a vertex to drag(CTRL+SHIFT+LeftBut)
		if (kCTRL && kSHIFT)
		{
			if (GetXYZ(point, p))
			{
				if (g_Grid.GetInfo(p.x, p.y, &inf))
				{
					m_VertexGot = g_Grid.GetK(inf.i, inf.j);
				}
			}
		}

		// Exclude triangle from export | to prevent erroneus exclusion
		if (!kCTRL && kSHIFT && g_Grid.OptionExcludedTrisGet())
		{
			if (GetXYZ(point, p))
			{
				t = g_Grid.GetTris(g_Grid.GetTris(p.x, p.y));

				if (t)
				{
					t->SetExcluded(!t->GetExcluded());
					pDoc->m_bInvalidateGridColor = TRUE;
					Refresh                      = TRUE;
				}
			}
		}

		break;
	case (TAB_ALPHAMAP):
		int curindex;

		curindex = g_AlphamapMan.GetCurSel();

		// paint the alphamap (CTRL+SHIFT+LeftBut)
		if (kCTRL && kSHIFT && curindex != -1)
		{
			if (GetXYZ(point, p))
			{
				if (g_Grid.GetInfo(p.x, p.y, &inf))
				{
					m_VertexGot = g_Grid.GetK(inf.i, inf.j);
//					g_Grid.SetAlphaIndex(m_VertexGot, curindex );
					g_Grid.PaintAlphaIndex(inf.i, inf.j, pDoc->m_dwPaintRadius, curindex);
					Refresh = TRUE;
				}
			}
		}

		int indexgot;

		// copy alphamap index (SHIFT+LeftBut)
		if (!kCTRL && kSHIFT)
		{
			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;
//.........这里部分代码省略.........
开发者ID:etlegacy,项目名称:EasyGen,代码行数:101,代码来源:EasyGenView.cpp


注:本文中的CGrid::GetK方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。