コード例 #1
0
 /// <summary> Marks the end of the visualizing function </summary>
 public abstract void End(Mesh m, VertexProfiles profile);
コード例 #2
0
 /// <summary>
 /// Is Color calculated?
 /// </summary>
 public static bool HasColor(this VertexProfiles v)
 {
     return(((int)v & 8) > 0);
 }
コード例 #3
0
        /// <summary> Apply to the mesh with given policy </summary>
        public void Apply(Mesh m, VertexProfiles profile, MeshTopology topology = MeshTopology.Triangles)
        {
            m.Clear();

            if (m_Verts.Count == 0)
            {
                return;
            }

#if !(UNITY_5 || UNITY_2017_1 || UNITY_2017_2)
            if (m_Verts.Count >= 0xFFFF)
            {
                m.indexFormat = UnityEngine.Rendering.IndexFormat.UInt32;
            }
#endif

            m.SetVertices(m_Verts);

            m.subMeshCount = m_Tris.Count;

            for (int i = 0; i < m_Tris.Count; i++)
            {
                if (topology == MeshTopology.Triangles)
                {
                    m.SetTriangles(m_Tris[i], i, false);
                }
                else
                {
                    Reflected.SetIndices(m, m_Tris[i], topology, i, false);
                }
            }

            m.RecalculateBounds();

            if (topology <= MeshTopology.Quads)
            {
                m.RecalculateNormals();
                m.RecalculateTangents();

                if (profile > 0)
                {
                    var uv = (int)profile;
                    if ((uv & 1) > 0)
                    {
                        m.SetUVs(0, m_Uv0);
                    }
                    if ((uv & 2) > 0)
                    {
                        m.SetUVs(1, m_Uv2);
                    }
                    if ((uv & 4) > 0)
                    {
                        m.SetUVs(2, m_Uv3);
                    }
                }
            }

            if ((profile & VertexProfiles.Color) > 0)
            {
                m.SetColors(m_Colors);
            }
        }
コード例 #4
0
 /// <summary>
 /// Is UV3 calculated?
 /// </summary>
 public static bool HasUV3(this VertexProfiles v)
 {
     return(((int)v & 4) > 0);
 }