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


C# UnityEngine.Clear方法代码示例

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


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

示例1: OnPopulateMesh

    protected override void OnPopulateMesh(UnityEngine.UI.VertexHelper vh)
    {
        if (!HollowRect) return;

        Color32 color32 = color;

        vh.Clear();

        Rect innerRect = new Rect(pos, size);

        Rect outerRect = GetPixelAdjustedRect();

        AddQuad(vh, new Vector2(outerRect.xMin, outerRect.yMax), new Vector2(outerRect.xMax, innerRect.center.y), color);

        AddQuad(vh, new Vector2(outerRect.xMin, innerRect.center.y), new Vector2(HollowRect.anchoredPosition.x - innerRect.width/2, HollowRect.anchoredPosition.y - innerRect.height/2), color);

        AddQuad(vh, new Vector2(HollowRect.anchoredPosition.x + innerRect.width / 2, innerRect.center.y), new Vector2(outerRect.xMax, HollowRect.anchoredPosition.y -  innerRect.height/2), color);

        AddQuad(vh, new Vector2(outerRect.xMin, HollowRect.anchoredPosition.y - innerRect.height / 2), new Vector2(outerRect.xMax, -outerRect.yMax), color);
    }
开发者ID:meta-42,项目名称:uEasyKit,代码行数:20,代码来源:HollowImage.cs

示例2: Bind

        /// Collect and bind geometry from stream
        public void Bind(UnityEngine.Mesh mesh)
        {
            var vertices = new List<Vector3>();
            var triangles = new List<int>();
            var uv = useUV ? new List<Vector2>() : null;
            var color = useColor ? new List<Color32>() : null;
            var normals = useUV ? new List<Vector3>() : null;

            // Collect
            foreach (var gp in geometry.Geometry)
            {
                gp.VertexOffset = vertices.Count;
                vertices.AddRange(gp.Vertices);
                triangles.AddRange(gp.Triangles);
                if (uv != null) { uv.AddRange(gp.UV); }
                if (color != null) { color.AddRange(gp.Color); }
                if (normals != null) { normals.AddRange(gp.Normals); }
            }

            // Attach
            mesh.Clear();
            mesh.vertices = vertices.ToArray();
            mesh.triangles = triangles.ToArray();
            if (useUV) { mesh.uv = uv.ToArray(); }
            if (useColor) { mesh.colors32 = color.ToArray(); }
            if (useNormals) { mesh.normals = normals.ToArray(); }

            // Bind
            if (!useNormals) { mesh.RecalculateNormals(); }
            mesh.RecalculateBounds();
            mesh.Optimize();

            // Summary
            vertexGen = vertices.Count;
            triangleGen = triangles.Count;
        }
开发者ID:shadowmint,项目名称:unity-n-procedural,代码行数:37,代码来源:MeshFactory.cs

示例3: OnPopulateMesh

	protected override void OnPopulateMesh(UnityEngine.UI.VertexHelper vh)
	{
		if (buffer.modified) {
			buffer.modified = false;
			vh.Clear();
			int count = rectangleCount * 4;
			List<UIVertex> vertices = new List<UIVertex>();
			for (int i = 0; i < count; i += 4) {
				vertices.Add(buffer.vertices[i + 0]);
				vertices.Add(buffer.vertices[i + 1]);
				vertices.Add(buffer.vertices[i + 2]);
				vertices.Add(buffer.vertices[i + 2]);
				vertices.Add(buffer.vertices[i + 3]);
				vertices.Add(buffer.vertices[i + 0]);
			}
			vh.AddUIVertexTriangleStream(vertices);
		}
	}
开发者ID:DelSystem32,项目名称:lwf,代码行数:18,代码来源:lwf_uivertex_factory.cs

示例4: MakeMesh

    public static void MakeMesh(UnityEngine.Mesh mesh, Face face, int vertices_begin, int vertices_end, int indices_begin, int indices_end, int indices_offset)
    {
        //we have to clear the mesh first, otherwise there will be exceptions.
        mesh.Clear();

        int vertices_count = vertices_end - vertices_begin + 1;
        UnityEngine.Vector3[] vertices = new UnityEngine.Vector3[vertices_count];
        UnityEngine.Vector3[] normals = new UnityEngine.Vector3[vertices_count];
        UnityEngine.Vector2[] uv = new UnityEngine.Vector2[vertices_count];
        for (int k = vertices_begin, i = 0; k <= vertices_end; ++k, ++i)
        {
            vertices[i].x = face.Vertices[k].Position.X;
            vertices[i].y = face.Vertices[k].Position.Y;
            //HACK: unity3d uses left-hand coordinate, so we have to mirror z corrd
            vertices[i].z = -face.Vertices[k].Position.Z;

            normals[i].x = face.Vertices[k].Normal.X;
            normals[i].y = face.Vertices[k].Normal.Y;
            //HACK: unity3d uses left-hand coordinate, so we have to mirror z corrd
            normals[i].z = -face.Vertices[k].Normal.Z;

            uv[i].x = face.Vertices[k].TexCoord.X;
            //HACK: unity3d uses left-bottom corner as the origin of the texture
            uv[i].y = 1 - face.Vertices[k].TexCoord.Y;
        }
        //indices for this face
        int[] triangles = new int[indices_end - indices_begin + 1];
        for (int k = indices_begin, i = 0; k <= indices_end; k += 3, i += 3)
        {
            //HACK: OpenGL's default front face is counter-clock-wise
            triangles[i] = face.Indices[k + 2] - indices_offset;
            triangles[i + 1] = face.Indices[k + 1] - indices_offset;
            triangles[i + 2] = face.Indices[k + 0] - indices_offset;
        }

        mesh.vertices = vertices;
        mesh.normals = normals;
        mesh.uv = uv;
        mesh.triangles = triangles;
    }
开发者ID:justasabc,项目名称:UnityOpenSimClient,代码行数:40,代码来源:UnityClient.cs


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