50 lines
1.7 KiB
C#
50 lines
1.7 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
namespace Parabox.CSG
|
|
{
|
|
// Token: 0x02000015 RID: 21
|
|
public class CSG
|
|
{
|
|
// Token: 0x060000A3 RID: 163 RVA: 0x0000D380 File Offset: 0x0000B780
|
|
public static Mesh Union(GameObject lhs, GameObject rhs)
|
|
{
|
|
CSG_Model csg_Model = new CSG_Model(lhs);
|
|
CSG_Model csg_Model2 = new CSG_Model(rhs);
|
|
CSG_Node csg_Node = new CSG_Node(csg_Model.ToPolygons());
|
|
CSG_Node csg_Node2 = new CSG_Node(csg_Model2.ToPolygons());
|
|
List<CSG_Polygon> list = CSG_Node.Union(csg_Node, csg_Node2).AllPolygons();
|
|
CSG_Model csg_Model3 = new CSG_Model(list);
|
|
return csg_Model3.ToMesh();
|
|
}
|
|
|
|
// Token: 0x060000A4 RID: 164 RVA: 0x0000D3D4 File Offset: 0x0000B7D4
|
|
public static Mesh Subtract(GameObject lhs, GameObject rhs)
|
|
{
|
|
CSG_Model csg_Model = new CSG_Model(lhs);
|
|
CSG_Model csg_Model2 = new CSG_Model(rhs);
|
|
CSG_Node csg_Node = new CSG_Node(csg_Model.ToPolygons());
|
|
CSG_Node csg_Node2 = new CSG_Node(csg_Model2.ToPolygons());
|
|
List<CSG_Polygon> list = CSG_Node.Subtract(csg_Node, csg_Node2).AllPolygons();
|
|
CSG_Model csg_Model3 = new CSG_Model(list);
|
|
return csg_Model3.ToMesh();
|
|
}
|
|
|
|
// Token: 0x060000A5 RID: 165 RVA: 0x0000D428 File Offset: 0x0000B828
|
|
public static Mesh Intersect(GameObject lhs, GameObject rhs)
|
|
{
|
|
CSG_Model csg_Model = new CSG_Model(lhs);
|
|
CSG_Model csg_Model2 = new CSG_Model(rhs);
|
|
CSG_Node csg_Node = new CSG_Node(csg_Model.ToPolygons());
|
|
CSG_Node csg_Node2 = new CSG_Node(csg_Model2.ToPolygons());
|
|
List<CSG_Polygon> list = CSG_Node.Intersect(csg_Node, csg_Node2).AllPolygons();
|
|
CSG_Model csg_Model3 = new CSG_Model(list);
|
|
return csg_Model3.ToMesh();
|
|
}
|
|
|
|
// Token: 0x0400002F RID: 47
|
|
public const float EPSILON = 1E-05f;
|
|
}
|
|
}
|