예제 #1
0
        /// <summary> Combine with another buffer </summary>
        public void Append(Buffer3 v, bool mergeSubmesh, int startingSubmesh)
        {
            var offset = m_Verts.Count;

            m_Verts.AddRange(v.m_Verts);
            m_Uv0.AddRange(v.m_Uv0);
            m_Uv2.AddRange(v.m_Uv2);
            m_Uv3.AddRange(v.m_Uv3);

            for (int i = 0; i < v.m_Tris.Count; i++)
            {
                if (i == 0)
                {
                    SetSubmesh(startingSubmesh);
                }
                else if (!mergeSubmesh)
                {
                    SetSubmesh();
                }
                var t = v.m_Tris[i];

                for (int j = 0; j < t.Count; j++)
                {
                    AddTris(offset + t[j]);
                }
            }
        }
예제 #2
0
        /// <summary> Import from a mesh </summary>
        public void AddMesh(Mesh m, bool mergeSubmesh = true, int subMeshIdx = -1)
        {
            if (m.vertexCount == 0)
            {
                return;
            }
            var v = new Buffer3(m, subMeshIdx);

            Append(v, mergeSubmesh, mergeSubmesh || m_Tris[m_subMesh].Count == 0 ? m_subMesh : m_subMesh + 1);
        }