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


C# Face.Side方法代码示例

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


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

示例1: PerformNode

	private void PerformNode( BspNode inNode, Face inFace, int nodeSide, OperationInfo info )
	{
		while( inNode != null )
		{
			Face.EPlaneSide side = inFace.Side( inNode.plane );			
			
			switch( side )
			{
			case Face.EPlaneSide.Side_Front:
				
				// 
				nodeSide = nodeSide | (inNode.IsCsg() ? 1 : 0);
				
				// leaf node
				if( inNode.front == null )
				{
					// set operation infos
					info.leafNode = inNode;
					info.leafLocation = BspNode.EBspLocation.BspLocation_Front;
					
					// we are done, process face
					ProcessFace( inFace, SIDE_Outside, info );
				}
				
				// get to next front node (if any)
				inNode = inNode.front;
				
				break;
			case Face.EPlaneSide.Side_Back:
				
				int backSide = inNode.IsCsg() ? 0 : 1;
				// 
				nodeSide = nodeSide & backSide;
				
				// leaf node
				if( inNode.back == null )
				{
					// set leaf infos
					info.leafNode = inNode;
					info.leafLocation = BspNode.EBspLocation.BspLocation_Back;
					
					// we are done, process face
					ProcessFace( inFace, SIDE_Inside, info );
				}
				
				// get to next front node (if any)
				inNode = inNode.back;
				break;
			case Face.EPlaneSide.Side_Split:
				
				// split face and process front and back
				Face frontFace, backFace;
				
				// 
				inFace.Split( inNode.plane, out frontFace, out backFace );
				
				// TODO: set polygon cutted flags
				frontFace.flags |= Face.FaceFlags_WasCutted;
				backFace.flags |= Face.FaceFlags_WasCutted;
				
				
				// front node is a leaf node
				if( inNode.front == null )
				{
					// 	
					info.leafNode = inNode;
					info.leafLocation = BspNode.EBspLocation.BspLocation_Front;
		
					
					ProcessFace( frontFace, SIDE_Outside, info );
				}
				else
				{
					PerformNode( inNode.front, frontFace, nodeSide, info );
				}
				
				// Prcess back node with back face
				if( inNode.back == null )
				{
					// 
					info.leafNode = inNode;
					info.leafLocation = BspNode.EBspLocation.BspLocation_Back;
		
					
					ProcessFace( backFace, SIDE_Inside, info );
				}
				else
				{
					// process back node with new face
					PerformNode( inNode.back, backFace, nodeSide, info );	
				}
				
				// stop loop
				inNode = null;
				break;
			case Face.EPlaneSide.Side_Planar:
				
				BspNode front, back;
				
				if( info.wasPlanar == true )
//.........这里部分代码省略.........
开发者ID:icegbq,项目名称:csg-unity,代码行数:101,代码来源:CsgOperation.cs

示例2: AddNodeRecursive

	public static BspNode AddNodeRecursive( BspNode inNode, Face inFace, int inFlags )
	{
		while( inNode != null )
		{
			Face.EPlaneSide planeSide = inFace.Side( inNode.plane );	
			
			switch( planeSide )
			{
			case Face.EPlaneSide.Side_Front:
				
				if( inNode.front == null )
					return AddNode( inNode, BspNode.EBspLocation.BspLocation_Front, inFace, inFlags );
				
				inNode = inNode.front;
				break;
			case Face.EPlaneSide.Side_Back:
				
				if( inNode.back == null )
					return AddNode( inNode, BspNode.EBspLocation.BspLocation_Back, inFace, inFlags );
				
				inNode = inNode.back;
				break;
			case Face.EPlaneSide.Side_Planar:
				return AddNode( inNode, BspNode.EBspLocation.BspLocation_Planar, inFace, inFlags );
				
			case Face.EPlaneSide.Side_Split:
				
				Face frontFace, backFace;
				
				inFace.Split( inNode.plane, out frontFace, out backFace );
				
				if( inNode.front == null )
				{
					AddNode( inNode, BspNode.EBspLocation.BspLocation_Front, frontFace, inFlags );
				}
				else
				{
					AddNodeRecursive( inNode.front, frontFace, inFlags );	
				}
				
				if( inNode.back == null )
				{
					AddNode( inNode, BspNode.EBspLocation.BspLocation_Back, inFace, inFlags );	
				}
				else
				{
					AddNodeRecursive( inNode.back, backFace, inFlags );	
				}
				
				inNode = null;
				break;
			}
		}
		
		// happens when face get splitted...
		return null;
	}
开发者ID:icegbq,项目名称:csg-unity,代码行数:57,代码来源:BspGen.cs


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