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


C# pb_Object.GetVertices方法代码示例

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


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

示例1: ExplodeObject

	// breaks a pb_object into a zillion* faces
	public static GameObject[] ExplodeObject(pb_Object pb)
	{
		// disable 'ze donor
		pb.gameObject.SetActive(false);
		
		GameObject[] pieces = new GameObject[pb.faces.Length];
		
		// extract mesh and material information for every face, and assign it to a gameobject
		for(int i = 0; i < pieces.Length; i++)
		{
			Mesh m = new Mesh();
			m.vertices 	= pb.GetVertices(pb.faces[i]);
			m.triangles	= new int[6] {0,1,2, 1,3,2};
			m.normals  	= pb.GetNormals(pb.faces[i]);
			m.uv	  	= pb.GetUVs(pb.faces[i]);
			m.RecalculateBounds();

			GameObject go = new GameObject();
			go.transform.position = pb.transform.position + pb_Math.PlaneNormal(m.vertices).normalized * .3f;
			go.transform.localRotation = pb.transform.localRotation;
			
			go.AddComponent<MeshFilter>().sharedMesh = m;
			go.AddComponent<MeshRenderer>().sharedMaterial = pb.GetMaterial(pb.faces[i]);

			pieces[i] = go;
		}

		return pieces;
	}
开发者ID:flickenmaste,项目名称:R6Demake,代码行数:30,代码来源:ExplodeFaces.cs

示例2: HiddenFace

    public static bool HiddenFace(pb_Object pb, pb_Face q, float dist)
    {
        // Grab the face normal
        Vector3 dir = pb_Math.Normal(pb.VerticesInWorldSpace(q.indices));

        // If casting from the center of the plane hits, chekc the rest of the points for collisions
        Vector3 orig = pb.transform.TransformPoint(pb_Math.Average(pb.GetVertices(q)));

        bool hidden = true;
        Transform hitObj = RaycastFaceCheck(orig, dir, dist, null);
        if(hitObj != null)
        {
            Vector3[] v = pb.VerticesInWorldSpace(q.indices);
            for(int i = 0; i < v.Length; i++)
            {
                if(null == RaycastFaceCheck(v[i], dir, dist, hitObj))
                {
                    hidden = false;
                    break;
                }
            }
        }
        else
            hidden = false;

        return hidden;
    }
开发者ID:BaptisteBillet,项目名称:Prochain_Arret,代码行数:27,代码来源:AutoNodraw.cs

示例3: DrawStats

		void DrawStats(pb_Object pb)
		{
			StringBuilder sb = new StringBuilder();

			Handles.BeginGUI();

			if(edgeInfo)
			foreach(pb_Edge f in pb.SelectedEdges)
			{
				Vector2 cen = HandleUtility.WorldToGUIPoint( pb.transform.TransformPoint((pb.vertices[f.x] + pb.vertices[f.y])/ 2f) );
				GUIContent gc = new GUIContent(f.ToString(), "");
				DrawSceneLabel(gc, cen);
			}

			/**
			 * SHARED INDICES
			 */
			// foreach(pb_IntArray arr in pb.sharedIndices)
			// {
			// 	Vector2 cen = HandleUtility.WorldToGUIPoint( pb.transform.TransformPoint(pb.vertices[arr[0]]) );
							
			// 	GUI.Label(new Rect(cen.x, cen.y, 200, 200), ((int[])arr).ToFormattedString("\n"));
			// }

			if(faceInfo)
			foreach(pb_Face f in pb.SelectedFaces)
			{
				Vector2 cen = HandleUtility.WorldToGUIPoint( pb.transform.TransformPoint( pb_Math.Average( pb.GetVertices(f.distinctIndices) ) ) );
				
				GUIContent gc = new GUIContent("Face: " + f.ToString(), "");

				if(smoothingGroupInfo || elementGroupInfo || textureGroupInfo)
					gc.text += "\nGroups:";

				if(smoothingGroupInfo)
					gc.text += "\nSmoothing: " + f.smoothingGroup;
				if(elementGroupInfo)
					gc.text += "\nElement: " + f.elementGroup;
				if(textureGroupInfo)
					gc.text += "\nTexture: " + f.textureGroup;

				DrawSceneLabel(gc, cen);
			}

			// sb.AppendLine(f.ToString() + ", ");


			// foreach(pb_Face face in pb.SelectedFaces)
			// 	sb.AppendLine(face.colors.ToFormattedString("\n") + "\n");

			// sb.AppendLine("\n");

			// foreach(pb_IntArray si in pb.sharedIndices)
			// {
			// 	sb.AppendLine(si.array.ToFormattedString(", "));
			// }

			// sb.AppendLine("\n");

			// if(vertexInfo)
			// {
			// 	try
			// 	{
			// 		Camera cam = SceneView.lastActiveSceneView.camera;
			// 		Vector3[] normals = pb.msh.normals;
			// 		int index = 0;
			// 		foreach(pb_IntArray arr in pb.sharedIndices)
			// 		{
			// 			Vector3 v = pb.transform.TransformPoint(pb.vertices[arr[0]] + normals[arr[0]] * .01f);

			// 			if(!pb_HandleUtility.PointIsOccluded(cam, pb, v))
			// 			{
			// 				Vector2 cen = HandleUtility.WorldToGUIPoint( v );
							
			// 				GUIContent gc = new GUIContent(index++ + ": " + arr.array.ToFormattedString(", "), "");

			// 				DrawSceneLabel(gc, cen);
			// 			}
			// 		}
			// 	} catch { /* do not care */; }
			// }

			Handles.EndGUI();

			Handles.BeginGUI();
			{
				GUI.Label(new Rect(10, 10, 400, 800), sb.ToString());
			}
			Handles.EndGUI();
		}
开发者ID:itubeasts,项目名称:I-eaT-U,代码行数:90,代码来源:pb_Debug_Window.cs

示例4: PokeFace_Internal

	/**
	 *	Inserts a split from each selected vertex to the center of the face
	 */
	private static bool PokeFace_Internal(pb_Object pb, pb_Face face, int[] indices_nonFaceSpecific,
		out pb_Face[] splitFaces,
		out Vector3[][] splitVertices,
		out int[][] splitSharedIndices)
	{
		splitFaces = null;
		splitVertices = null;
		splitSharedIndices = null;

		pb_IntArray[] sharedIndices = pb.sharedIndices;

		///** Sort index array such that it only uses indices local to the passed face
		int[] indices = new int[indices_nonFaceSpecific.Length];
		int[] dist_ind_si = new int[face.distinctIndices.Length];

		// figure out sharedIndices index of distinct Indices
		for(int i = 0; i < face.distinctIndices.Length; i++)
			dist_ind_si[i] = sharedIndices.IndexOf(face.distinctIndices[i]);

		// now do the same for non-face specific indices, assigning matching groups
		for(int i = 0; i < indices.Length; i++)
		{
			int ind = System.Array.IndexOf(dist_ind_si, sharedIndices.IndexOf(indices_nonFaceSpecific[i]));
			if(ind < 0) return false;

			indices[i] = face.distinctIndices[ind];
		}
		///** Sort index array such that it only uses indices local to the passed face

		Vector3 cen3d = pb_Math.Average(pb.GetVertices(face));
		
		Vector3[] verts 	= pb.GetVertices(face.distinctIndices);
		Vector3 nrm 		= pb_Math.Normal(pb.GetVertices(face.indices));
		Vector2[] plane 	= pb_Math.VerticesTo2DPoints(verts, nrm);
		Vector2[] indPlane 	= pb_Math.VerticesTo2DPoints(pb.GetVertices(indices), nrm);
		Vector2 cen2d 		= pb_Math.VerticesTo2DPoints( new Vector3[1] { cen3d }, nrm)[0];

		// Get the directions from which to segment this face
		Vector2[] dividers = new Vector2[indices.Length];
		for(int i = 0; i < indices.Length; i++)
			dividers[i] = (indPlane[i] - cen2d).normalized;

		List<Vector2>[] quadrants2d = new List<Vector2>[indices.Length];
		List<Vector3>[] quadrants3d = new List<Vector3>[indices.Length];
		List<int>[]		sharedIndex = new List<int>[indices.Length];

		for(int i = 0; i < quadrants2d.Length; i++)
		{
			quadrants2d[i] = new List<Vector2>(1) { cen2d };
			quadrants3d[i] = new List<Vector3>(1) { cen3d };
			sharedIndex[i] = new List<int>(1) { -2 };		// any negative value less than -1 will be treated as a new group
		}

		for(int i = 0; i < face.distinctIndices.Length; i++)
		{
			// if this index is a divider, it needs to belong to the leftmost and 
			// rightmost quadrant
			int indexInPokeVerts = System.Array.IndexOf(indices, face.distinctIndices[i]);
			int ignore = -1;
			if( indexInPokeVerts > -1)
			{	
				// Add vert to this quadrant
				quadrants2d[indexInPokeVerts].Add(plane[i]);
				quadrants3d[indexInPokeVerts].Add(verts[i]);
				sharedIndex[indexInPokeVerts].Add(pb.sharedIndices.IndexOf(face.distinctIndices[i]));

				// And also the one closest counter clockwise
				ignore = indexInPokeVerts;
			}

			Vector2 dir = (plane[i]-cen2d).normalized;	// plane corresponds to distinctIndices
			float largestClockwiseDistance = 0f;
			int quad = -1;
			for(int j = 0; j < dividers.Length; j++)
			{
				if(j == ignore) continue;	// this is a dividing vertex - ignore

				float dist = Vector2.Angle(dividers[j], dir);
				if( Vector2.Dot(pb_Math.Perpendicular(dividers[j]), dir) < 0f )
					dist = 360f - dist;

				if(dist > largestClockwiseDistance)
				{
					largestClockwiseDistance = dist;
					quad = j;
				}
			}

			quadrants2d[quad].Add(plane[i]);
			quadrants3d[quad].Add(verts[i]);
			sharedIndex[quad].Add(pb.sharedIndices.IndexOf(face.distinctIndices[i]));
		}

		int len = quadrants2d.Length;

		// Triangulate
		int[][] tris = new int[len][];
//.........这里部分代码省略.........
开发者ID:BasmanovDaniil,项目名称:RoyalDefenestrator,代码行数:101,代码来源:pbSubdivideSplit.cs

示例5: SubdivideFace_Internal

	// todo - there's a lot of duplicate code between this and poke face.
	/**
	 *	Inserts a vertex at the center of each edge, then connects the new vertices to another new
	 *	vertex placed at the center of the face.
	 */
	// internal method - so it's allow to be messy, right?
	private static bool SubdivideFace_Internal(pb_Object pb, EdgeConnection edgeConnection, 
		out Vector3?[] appendedVertices,	
		out pb_Face[] splitFaces,
		out Vector3[][] splitVertices,
		out int[][] splitSharedIndices)
	{
		splitFaces = null;
		splitVertices = null;
		splitSharedIndices = null;
		appendedVertices = new Vector3?[edgeConnection.edges.Count];

		// cache all the things
		pb_Face face = edgeConnection.face;
		pb_IntArray[] sharedIndices = pb.sharedIndices;
		Vector3[] vertices = pb.vertices;

		List<Vector3> edgeCenters3d = new List<Vector3>();//pb.GetVertices(edgeConnection.face));
		
		// filter duplicate edges
		int u = 0;
		List<int> usedEdgeIndices = new List<int>();
		foreach(pb_Edge edge in edgeConnection.edges)
		{
			int ind = face.edges.IndexOf(edge, sharedIndices);
			if(!usedEdgeIndices.Contains(ind))
			{
				Vector3 cen = (vertices[edge.x] + vertices[edge.y]) / 2f;
				edgeCenters3d.Add(cen);
				usedEdgeIndices.Add(ind);
				appendedVertices[u] = cen;
			}
			else
				appendedVertices[u] = null;

			u++;
		}

		// now we have all the vertices of the old face, plus the new edge center vertices

		Vector3[] verts3d = pb.GetVertices(face.distinctIndices);
		Vector3 nrm = pb_Math.Normal(pb.GetVertices(face.indices));

		Vector2[] verts2d = pb_Math.VerticesTo2DPoints(verts3d, nrm);
		Vector2[] edgeCenters2d = pb_Math.VerticesTo2DPoints(edgeCenters3d.ToArray(), nrm);
		
		Vector3 cen3d = pb_Math.Average(verts3d);
		Vector2 cen2d = pb_Math.VerticesTo2DPoints( new Vector3[1] { cen3d }, nrm)[0];

		// Get the directions from which to segment this face
		Vector2[] dividers = new Vector2[edgeCenters2d.Length];
		for(int i = 0; i < edgeCenters2d.Length; i++)
			dividers[i] = (edgeCenters2d[i] - cen2d).normalized;

		List<Vector2>[] quadrants2d = new List<Vector2>[edgeCenters2d.Length];
		List<Vector3>[] quadrants3d = new List<Vector3>[edgeCenters2d.Length];
		List<int>[]		sharedIndex = new List<int>[edgeCenters2d.Length];

		for(int i = 0; i < quadrants2d.Length; i++)
		{
			quadrants2d[i] = new List<Vector2>(1) { cen2d };
			quadrants3d[i] = new List<Vector3>(1) { cen3d };
			sharedIndex[i] = new List<int>(1) { -2 };		// any negative value less than -1 will be treated as a new group
		}

		// add the divisors
		for(int i = 0; i < edgeCenters2d.Length; i++)
		{
			quadrants2d[i].Add(edgeCenters2d[i]);
			quadrants3d[i].Add(edgeCenters3d[i]);
			sharedIndex[i].Add(-1);	// -(i+2) to group new vertices in AppendFace

			// and add closest in the counterclockwise direction
			Vector2 dir = (edgeCenters2d[i]-cen2d).normalized;
			float largestClockwiseDistance = 0f;
			int quad = -1;
			for(int j = 0; j < dividers.Length; j++)
			{
				if(j == i) continue;	// this is a dividing vertex - ignore

				float dist = Vector2.Angle(dividers[j], dir);
				if( Vector2.Dot(pb_Math.Perpendicular(dividers[j]), dir) < 0f )
					dist = 360f - dist;

				if(dist > largestClockwiseDistance)
				{
					largestClockwiseDistance = dist;
					quad = j;
				}
			}

			quadrants2d[quad].Add(edgeCenters2d[i]);
			quadrants3d[quad].Add(edgeCenters3d[i]);
			sharedIndex[quad].Add(-1);
		}
//.........这里部分代码省略.........
开发者ID:BasmanovDaniil,项目名称:RoyalDefenestrator,代码行数:101,代码来源:pbSubdivideSplit.cs

示例6: PokeFace_Internal

	/**
	 *	Inserts a split from each selected vertex to the center of the face
	 */
	private static bool PokeFace_Internal(pb_Object pb, pb_Face face, int[] indices_nonFaceSpecific,
		out Vector3 pokedVertex,
		out pb_Face[] splitFaces,
		out Vector3[][] splitVertices,
		out Color[][] splitColors,
		out Vector2[][] splitUVs,
		out int[][] splitSharedIndices)
	{
		pokedVertex = Vector3.zero;
		splitFaces = null;
		splitVertices = null;
		splitColors = null;
		splitUVs = null;
		splitSharedIndices = null;

		pb_IntArray[] sharedIndices = pb.sharedIndices;

		///** Sort index array such that it only uses indices local to the passed face
		int[] dist_indices = new int[indices_nonFaceSpecific.Length];
		int[] dist_ind_si = new int[face.distinctIndices.Length];

		// figure out sharedIndices index of distinct Indices
		for(int i = 0; i < face.distinctIndices.Length; i++)
			dist_ind_si[i] = sharedIndices.IndexOf(face.distinctIndices[i]);

		// now do the same for non-face specific indices, assigning matching groups
		
		///** Sort index array such that it only uses indices local to the passed face
		for(int i = 0; i < dist_indices.Length; i++)
		{
			int ind = System.Array.IndexOf(dist_ind_si, sharedIndices.IndexOf(indices_nonFaceSpecific[i]));
			if(ind < 0) return false;

			dist_indices[i] = face.distinctIndices[ind];
		}

		int[] indices = dist_indices.Distinct().ToArray();

		// throw out splits with less than 2 vertices, or splits composed 
		// of a single edge
		switch(indices.Length)
		{
			case 0:
			case 1:
				return false;

			case 2:
				if( System.Array.IndexOf(face.edges, new pb_Edge(indices[0], indices[1]) ) > -1)
					return false;
				break;
			default:
				break;
		}
		
		// end triangle sorting

		/**
		 *	The general idea here is to project the face into 2d space,
		 *	split the 2d points into groups based on the intersecting lines,
		 *	then triangulate those groups.  once the groups have been 
		 *	triangulated, rebuild the 3d vertices using the new groups
		 *	(building new verts for seams).
		 *	
		 *	Think like you're cutting a pie... but first the pie is a basketball,
		 *	then a pie, then a basketball again.  I'm on a horse.
		 */

		Vector3[] verts 	= pb.GetVertices(face.distinctIndices);
		Vector2[] uvs 		= pb.GetUVs(face.distinctIndices);
		Color[] colors  	= pbUtil.ValuesWithIndices(pb.colors, face.distinctIndices);

		Vector2 cenUV		= pb_Bounds2D.Center(uvs);
		Vector3 cen3d 		= pb_Math.Average(verts);
		pokedVertex 		= cen3d;
		Vector3 nrm 		= pb_Math.Normal(pb.GetVertices(face.indices));
		Color cenColor 		= pb_Math.Average(colors);

		// this should be cleaned up
		Vector2[] plane 	= pb_Math.PlanarProject(verts, nrm);
		Vector2[] indPlane 	= pb_Math.PlanarProject(pb.GetVertices(indices), nrm);
		Vector2 cen2d 		= pb_Math.PlanarProject( new Vector3[1] { cen3d }, nrm)[0];

		// Get the directions from which to segment this face
		Vector2[] dividers = new Vector2[indices.Length];
		for(int i = 0; i < indices.Length; i++)
			dividers[i] = (indPlane[i] - cen2d).normalized;

		List<Vector2>[] quadrants2d 	= new List<Vector2>[indices.Length];
		List<Vector3>[] quadrants3d 	= new List<Vector3>[indices.Length];
		List<Vector2>[] quadrantsUV_2d 	= new List<Vector2>[indices.Length];
		List<Color>[] 	quadrantsCol 	= new List<Color>[indices.Length];

		List<int>[]		sharedIndex = new List<int>[indices.Length];

		for(int i = 0; i < quadrants2d.Length; i++)
		{
			quadrants2d[i] = new List<Vector2>(1) { cen2d };
//.........这里部分代码省略.........
开发者ID:itubeasts,项目名称:I-eaT-U,代码行数:101,代码来源:pbSubdivideSplit.cs

示例7: SubdivideFace_Internal

	/**
	 *	Inserts a vertex at the center of each edge, then connects the new vertices to another new
	 *	vertex placed at the center of the face.
	 */
	private static bool SubdivideFace_Internal(pb_Object pb, pb_EdgeConnection pb_edgeConnection, 
		out DanglingVertex?[] appendedVertices,	
		out pb_Face[] splitFaces,
		out Vector3[][] splitVertices,
		out Color[][] splitColors,
		out Vector2[][] splitUVs,
		out int[][] splitSharedIndices)
	{
		splitFaces 			= null;
		splitVertices 		= null;
		splitColors 		= null;
		splitUVs 			= null;
		splitSharedIndices 	= null;
		appendedVertices 	= new DanglingVertex?[pb_edgeConnection.edges.Count];

		// cache all the things
		pb_Face face = pb_edgeConnection.face;
		Dictionary<int, int> sharedIndices = pb.sharedIndices.ToDictionary();
		Vector3[] vertices = pb.vertices;
		Vector2[] uvs = pb.uv;

		List<Vector2> edgeCentersUV = new List<Vector2>();
		List<Vector3> edgeCenters3d = new List<Vector3>();
		List<Color> edgeCentersCol = new List<Color>();
		
		// filter duplicate edges
		int u = 0;
		List<int> usedEdgeIndices = new List<int>();
		foreach(pb_Edge edge in pb_edgeConnection.edges)
		{
			int ind = face.edges.IndexOf(edge, sharedIndices);
			if(!usedEdgeIndices.Contains(ind))
			{
				Vector3 cen = (vertices[edge.x] + vertices[edge.y]) / 2f;

				appendedVertices[u] = new DanglingVertex(cen, (pb.colors[edge.x] + pb.colors[edge.y]) / 2f);
				
				edgeCenters3d.Add(cen);
				edgeCentersUV.Add( (uvs[edge.x] + uvs[edge.y])/2f );
				edgeCentersCol.Add( (pb.colors[edge.x] + pb.colors[edge.y])/2f );

				usedEdgeIndices.Add(ind);
			}
			else
			{
				appendedVertices[u] = null;
			}

			u++;
		}

		// now we have all the vertices of the old face, plus the new edge center vertices
		Vector3 nrm = pb_Math.Normal(pb.GetVertices(face.indices));

		Vector3[] verts3d = pb.GetVertices(face.distinctIndices);
		Vector2[] faceUVs = pb.GetUVs(face.distinctIndices);
		Color[] colors = pbUtil.ValuesWithIndices(pb.colors, face.distinctIndices);

		Vector2[] verts2d = pb_Math.PlanarProject(verts3d, nrm);
		Vector2[] edgeCenters2d = pb_Math.PlanarProject(edgeCenters3d.ToArray(), nrm);
		
		Vector3 cen3d = pb_Math.Average(verts3d);
		Vector2 cenUV = pb_Bounds2D.Center(faceUVs);

		Vector2 cen2d = pb_Math.PlanarProject( new Vector3[1] { cen3d }, nrm)[0];

		// Get the directions from which to segment this face
		Vector2[] dividers = new Vector2[edgeCenters2d.Length];
		for(int i = 0; i < edgeCenters2d.Length; i++)
			dividers[i] = (edgeCenters2d[i] - cen2d).normalized;

		List<Vector2>[] quadrants2d = new List<Vector2>[edgeCenters2d.Length];
		List<Vector3>[] quadrants3d = new List<Vector3>[edgeCenters2d.Length];
		List<Vector2>[] quadrantsUV = new List<Vector2>[edgeCenters2d.Length];
		List<Color>[] 	quadrantsCol = new List<Color>[edgeCenters2d.Length];

		List<int>[]		sharedIndex = new List<int>[edgeCenters2d.Length];

		for(int i = 0; i < quadrants2d.Length; i++)
		{
			quadrants2d[i] = new List<Vector2>(1) { cen2d };
			quadrants3d[i] = new List<Vector3>(1) { cen3d };			
			quadrantsUV[i] = new List<Vector2>(1) { cenUV };
			quadrantsCol[i] = new List<Color>(1) { pb_Math.Average(pbUtil.ValuesWithIndices(pb.colors, face.distinctIndices)) };

			sharedIndex[i] = new List<int>(1) { -2 };		// any negative value less than -1 will be treated as a new group
		}

		// add the divisors
		for(int i = 0; i < edgeCenters2d.Length; i++)
		{
			quadrants2d[i].Add(edgeCenters2d[i]);
			quadrants3d[i].Add(edgeCenters3d[i]);
			quadrantsUV[i].Add(edgeCentersUV[i]);
			quadrantsCol[i].Add(edgeCentersCol[i]);

//.........这里部分代码省略.........
开发者ID:itubeasts,项目名称:I-eaT-U,代码行数:101,代码来源:pbSubdivideSplit.cs

示例8: ProjectFacesBox

	/**
	 * Projects UVs for each face using the closest normal on a box.
	 */
	public  static void ProjectFacesBox(pb_Object pb, pb_Face[] faces)
	{
		Vector2[] uv = pb.uv;

		Dictionary<ProjectionAxis, List<pb_Face>> sorted = new Dictionary<ProjectionAxis, List<pb_Face>>();

		for(int i = 0; i < faces.Length; i++)
		{
			Vector3 nrm = pb_Math.Normal(pb, faces[i]);
			ProjectionAxis axis = pb_Math.VectorToProjectionAxis(nrm);

			if(sorted.ContainsKey(axis))
			{
				sorted[axis].Add(faces[i]);
			}
			else
			{
				sorted.Add(axis, new List<pb_Face>() { faces[i] });
			}

			// clean up UV stuff - no shared UV indices and remove element group
			faces[i].elementGroup = -1;
		}

		foreach(KeyValuePair<ProjectionAxis, List<pb_Face>> kvp in sorted)
		{
			int[] distinct = pb_Face.AllTrianglesDistinct(kvp.Value.ToArray());

			Vector2[] uvs = pb_Math.PlanarProject( pb.GetVertices(distinct), pb_Math.ProjectionAxisToVector(kvp.Key), kvp.Key );

			for(int n = 0; n < distinct.Length; n++)
				uv[distinct[n]] = uvs[n];
				
			SplitUVs(pb, distinct);
		}

		/* and set the msh uv array using the new coordintaes */
		pb.SetUV(uv);
		
		pb.ToMesh();
		pb.Refresh();
	}
开发者ID:itubeasts,项目名称:I-eaT-U,代码行数:45,代码来源:pbUVOps.cs


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