ProceduralMeshFactory.cs 637 B

1234567891011121314151617181920212223
  1. #if UNITY_EDITOR
  2. using UnityEngine;
  3. using System.Collections.Generic;
  4. namespace O3DWB
  5. {
  6. public static class ProceduralMeshFactory
  7. {
  8. #region Public Static Functions
  9. public static Mesh CreateTriangleMesh(Vector3[] vertexPositions, int[] vertexIndices, Color[] vertexColors, Vector3[] vertexNormals)
  10. {
  11. var mesh = new Mesh();
  12. mesh.vertices = vertexPositions;
  13. mesh.SetIndices(vertexIndices, MeshTopology.Triangles, 0);
  14. mesh.colors = vertexColors;
  15. mesh.normals = vertexNormals;
  16. return mesh;
  17. }
  18. #endregion
  19. }
  20. }
  21. #endif