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


C++ CCoreDispInfo::GetEdgeNeighbor方法代码示例

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


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

示例1: VerifyNeighborConnections

static void VerifyNeighborConnections( CCoreDispInfo *pListBase, int nDisps )
{
	while ( 1 )
	{
		bool bHappy = true;

		for ( int i=0; i < nDisps; i++ )
		{
			CCoreDispInfo *pDisp = &pListBase[i];
			CDispUtilsHelper *pHelper = pDisp;

			for ( int iEdge=0; iEdge < 4; iEdge++ )
			{
				CDispEdgeIterator it( pHelper, iEdge );
				while ( it.Next() )
				{
					if ( !VerifyNeighborVertConnection( pHelper, it.GetVertIndex(), it.GetCurrentNeighbor(), it.GetNBVertIndex(), iEdge ) )
					{
						pDisp->GetEdgeNeighbor( iEdge )->SetInvalid();
						Warning( "Warning: invalid neighbor connection on displacement near (%.2f %.2f %.2f)\n", VectorExpand( pDisp->GetCornerPoint(0) ) );
						bHappy = false;
					}
				}			
			}
		}

		if ( bHappy )
			break;
	}
}
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:30,代码来源:disp_vbsp.cpp

示例2: BlendTJuncs

void BlendTJuncs( CCoreDispInfo **ppListBase, int listSize )
{
	for ( int iDisp=0; iDisp < listSize; iDisp++ )
	{
		CCoreDispInfo *pDisp = ppListBase[iDisp];

		for ( int iEdge=0; iEdge < 4; iEdge++ )
		{
			CDispNeighbor *pEdge = pDisp->GetEdgeNeighbor( iEdge );

			CVertIndex viMidPoint = pDisp->GetEdgeMidPoint( iEdge );
			int iMidPoint = pDisp->VertIndexToInt( viMidPoint );

			if ( pEdge->m_SubNeighbors[0].IsValid() && pEdge->m_SubNeighbors[1].IsValid() )
			{
				const Vector &vMidPoint = pDisp->GetVert( iMidPoint );

				CCoreDispInfo *pNeighbor1 = ppListBase[pEdge->m_SubNeighbors[0].GetNeighborIndex()];
				CCoreDispInfo *pNeighbor2 = ppListBase[pEdge->m_SubNeighbors[1].GetNeighborIndex()];

				int iNBCorners[2];
				iNBCorners[0] = FindNeighborCornerVert( pNeighbor1, vMidPoint );
				iNBCorners[1] = FindNeighborCornerVert( pNeighbor2, vMidPoint );
				
				if ( iNBCorners[0] != -1 && iNBCorners[1] != -1 )
				{
					CVertIndex viNBCorners[2] = 
					{
						pNeighbor1->GetCornerPointIndex( iNBCorners[0] ),
						pNeighbor2->GetCornerPointIndex( iNBCorners[1] )
					};

					Vector vAverage = pDisp->GetNormal( iMidPoint );
					vAverage += pNeighbor1->GetNormal( viNBCorners[0] );
					vAverage += pNeighbor2->GetNormal( viNBCorners[1] );

					VectorNormalize( vAverage );
					pDisp->SetNormal( iMidPoint, vAverage );
					pNeighbor1->SetNormal( viNBCorners[0], vAverage );
					pNeighbor2->SetNormal( viNBCorners[1], vAverage );

#if defined( USE_SCRATCHPAD )
					ScratchPad_DrawArrowSimple( g_pPad, pDisp->GetVert( iMidPoint ), pDisp->GetNormal( iMidPoint ), Vector( 0, 1, 1 ), 25 );
#endif
				}
			}
		}
	}
}
开发者ID:Bubbasacs,项目名称:FinalProj,代码行数:49,代码来源:disp_vrad.cpp

示例3: BlendEdges

void BlendEdges( CCoreDispInfo **ppListBase, int listSize )
{
	for ( int iDisp=0; iDisp < listSize; iDisp++ )
	{
		CCoreDispInfo *pDisp = ppListBase[iDisp];

		for ( int iEdge=0; iEdge < 4; iEdge++ )
		{
			CDispNeighbor *pEdge = pDisp->GetEdgeNeighbor( iEdge );

			for ( int iSub=0; iSub < 2; iSub++ )
			{
				CDispSubNeighbor *pSub = &pEdge->m_SubNeighbors[iSub];
				if ( !pSub->IsValid() )
					continue;

				CCoreDispInfo *pNeighbor = ppListBase[ pSub->GetNeighborIndex() ];

				int iEdgeDim = g_EdgeDims[iEdge];

				CDispSubEdgeIterator it;
				it.Start( pDisp, iEdge, iSub, true );

				// Get setup on the first corner vert.
				it.Next();
				CVertIndex viPrevPos = it.GetVertIndex();

				while ( it.Next() )
				{
					// Blend the two.
					if ( !it.IsLastVert() )
					{
						Vector vAverage = pDisp->GetNormal( it.GetVertIndex() ) + pNeighbor->GetNormal( it.GetNBVertIndex() );
						VectorNormalize( vAverage );

						pDisp->SetNormal( it.GetVertIndex(), vAverage );
						pNeighbor->SetNormal( it.GetNBVertIndex(), vAverage );

#if defined( USE_SCRATCHPAD )
						ScratchPad_DrawArrowSimple( g_pPad, pDisp->GetVert( it.GetVertIndex() ), pDisp->GetNormal( it.GetVertIndex() ), Vector( 1, 0, 0 ), 25 );
#endif
					}

					// Now blend the in-between verts (if this edge is high-res).
					int iPrevPos = viPrevPos[ !iEdgeDim ];
					int iCurPos = it.GetVertIndex()[ !iEdgeDim ];
					
					for ( int iTween = iPrevPos+1; iTween < iCurPos; iTween++ )
					{
						float flPercent = RemapVal( iTween, iPrevPos, iCurPos, 0, 1 );
						Vector vNormal;
						VectorLerp( pDisp->GetNormal( viPrevPos ), pDisp->GetNormal( it.GetVertIndex() ), flPercent, vNormal );
						VectorNormalize( vNormal );

						CVertIndex viTween;
						viTween[iEdgeDim] = it.GetVertIndex()[ iEdgeDim ];
						viTween[!iEdgeDim] = iTween;
						pDisp->SetNormal( viTween, vNormal );

#if defined( USE_SCRATCHPAD )
						ScratchPad_DrawArrowSimple( g_pPad, pDisp->GetVert( viTween ), pDisp->GetNormal( viTween ), Vector( 1, 0.5, 0 ), 25 );
#endif
					}
			
					viPrevPos = it.GetVertIndex();
				}
			}
		}
	}
}
开发者ID:Bubbasacs,项目名称:FinalProj,代码行数:70,代码来源:disp_vrad.cpp


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