You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
866 B
C#
38 lines
866 B
C#
using UnityEngine;
|
|
using System.Collections.Generic;
|
|
|
|
namespace UnityEngine.ProBuilder.Csg
|
|
{
|
|
/// <summary>
|
|
/// Represents a polygon face with an arbitrary number of vertices.
|
|
/// </summary>
|
|
sealed class Polygon
|
|
{
|
|
public List<Vertex> vertices;
|
|
public Plane plane;
|
|
public Material material;
|
|
|
|
public Polygon(List<Vertex> list, Material mat)
|
|
{
|
|
vertices = list;
|
|
plane = new Plane(list[0].position, list[1].position, list[2].position);
|
|
material = mat;
|
|
}
|
|
|
|
public void Flip()
|
|
{
|
|
vertices.Reverse();
|
|
|
|
for (int i = 0; i < vertices.Count; i++)
|
|
vertices[i].Flip();
|
|
|
|
plane.Flip();
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
return "normal: " + plane.normal;
|
|
}
|
|
}
|
|
}
|