Exemple #1
0
 /// <summary>
 /// Get an array of Color values from the mesh.
 /// </summary>
 /// <returns>The colors array for this mesh. If mesh does not contain colors, a new array is returned filled with the default value (Color.white).</returns>
 public Color[] GetColors()
 {
     if (HasArrays(MeshArrays.Color))
     {
         return(colors.ToArray());
     }
     return(ArrayUtility.Fill(Color.white, vertexCount));
 }
Exemple #2
0
        /// <summary>
        /// Set the vertex colors for a @"UnityEngine.ProBuilder.Face".
        /// </summary>
        /// <param name="face">The target face.</param>
        /// <param name="color">The color to set this face's referenced vertices to.</param>
        public void SetFaceColor(Face face, Color color)
        {
            if (face == null)
            {
                throw new ArgumentNullException("face");
            }

            if (!HasArrays(MeshArrays.Color))
            {
                m_Colors = ArrayUtility.Fill(Color.white, vertexCount);
            }

            foreach (int i in face.distinctIndexes)
            {
                m_Colors[i] = color;
            }
        }
 /// <summary>
 /// Get an array of Color values from the mesh.
 /// </summary>
 /// <returns>The colors array for this mesh. If mesh does not contain colors, a new array is returned filled with the default value (Color.white).</returns>
 public Color[] GetColors()
 {
     if (HasArrays(MeshArrays.Color))
         return colors.ToArray();
     return ArrayUtility.Fill(Color.white, vertexCount);
 }