scripts
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Parabox.CSG
|
||||
{
|
||||
// Token: 0x02000016 RID: 22
|
||||
internal class CSG_Model
|
||||
{
|
||||
// Token: 0x060000A6 RID: 166 RVA: 0x0000D479 File Offset: 0x0000B879
|
||||
public CSG_Model()
|
||||
{
|
||||
this.vertices = new List<CSG_Vertex>();
|
||||
this.indices = new List<int>();
|
||||
}
|
||||
|
||||
// Token: 0x060000A7 RID: 167 RVA: 0x0000D498 File Offset: 0x0000B898
|
||||
public CSG_Model(GameObject go)
|
||||
{
|
||||
this.vertices = new List<CSG_Vertex>();
|
||||
Mesh sharedMesh = go.GetComponent<MeshFilter>().sharedMesh;
|
||||
Transform component = go.GetComponent<Transform>();
|
||||
Vector3[] array = sharedMesh.vertices;
|
||||
Vector3[] normals = sharedMesh.normals;
|
||||
Vector2[] uv = sharedMesh.uv;
|
||||
Color[] colors = sharedMesh.colors;
|
||||
for (int i = 0; i < array.Length; i++)
|
||||
{
|
||||
this.vertices.Add(new CSG_Vertex(component.TransformPoint(array[i]), component.TransformDirection(normals[i]), uv[i], colors[i]));
|
||||
}
|
||||
this.indices = new List<int>(sharedMesh.triangles);
|
||||
}
|
||||
|
||||
// Token: 0x060000A8 RID: 168 RVA: 0x0000D564 File Offset: 0x0000B964
|
||||
public CSG_Model(List<CSG_Polygon> list)
|
||||
{
|
||||
this.vertices = new List<CSG_Vertex>();
|
||||
this.indices = new List<int>();
|
||||
int num = 0;
|
||||
for (int i = 0; i < list.Count; i++)
|
||||
{
|
||||
CSG_Polygon csg_Polygon = list[i];
|
||||
for (int j = 2; j < csg_Polygon.vertices.Count; j++)
|
||||
{
|
||||
this.vertices.Add(csg_Polygon.vertices[0]);
|
||||
this.indices.Add(num++);
|
||||
this.vertices.Add(csg_Polygon.vertices[j - 1]);
|
||||
this.indices.Add(num++);
|
||||
this.vertices.Add(csg_Polygon.vertices[j]);
|
||||
this.indices.Add(num++);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060000A9 RID: 169 RVA: 0x0000D644 File Offset: 0x0000BA44
|
||||
public List<CSG_Polygon> ToPolygons()
|
||||
{
|
||||
List<CSG_Polygon> list = new List<CSG_Polygon>();
|
||||
for (int i = 0; i < this.indices.Count; i += 3)
|
||||
{
|
||||
List<CSG_Vertex> list2 = new List<CSG_Vertex>
|
||||
{
|
||||
this.vertices[this.indices[i]],
|
||||
this.vertices[this.indices[i + 1]],
|
||||
this.vertices[this.indices[i + 2]]
|
||||
};
|
||||
list.Add(new CSG_Polygon(list2));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
// Token: 0x060000AA RID: 170 RVA: 0x0000D6E4 File Offset: 0x0000BAE4
|
||||
public Mesh ToMesh()
|
||||
{
|
||||
Mesh mesh = new Mesh();
|
||||
int count = this.vertices.Count;
|
||||
Vector3[] array = new Vector3[count];
|
||||
Vector3[] array2 = new Vector3[count];
|
||||
Vector2[] array3 = new Vector2[count];
|
||||
Color[] array4 = new Color[count];
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
array[i] = this.vertices[i].position;
|
||||
array2[i] = this.vertices[i].normal;
|
||||
array3[i] = this.vertices[i].uv;
|
||||
array4[i] = this.vertices[i].color;
|
||||
}
|
||||
mesh.vertices = array;
|
||||
mesh.normals = array2;
|
||||
mesh.colors = array4;
|
||||
mesh.uv = array3;
|
||||
mesh.triangles = this.indices.ToArray();
|
||||
return mesh;
|
||||
}
|
||||
|
||||
// Token: 0x04000030 RID: 48
|
||||
public List<CSG_Vertex> vertices;
|
||||
|
||||
// Token: 0x04000031 RID: 49
|
||||
public List<int> indices;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,218 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Parabox.CSG
|
||||
{
|
||||
// Token: 0x02000017 RID: 23
|
||||
internal class CSG_Node
|
||||
{
|
||||
// Token: 0x060000AB RID: 171 RVA: 0x0000D7F5 File Offset: 0x0000BBF5
|
||||
public CSG_Node()
|
||||
{
|
||||
this.front = null;
|
||||
this.back = null;
|
||||
}
|
||||
|
||||
// Token: 0x060000AC RID: 172 RVA: 0x0000D80B File Offset: 0x0000BC0B
|
||||
public CSG_Node(List<CSG_Polygon> list)
|
||||
{
|
||||
this.Build(list);
|
||||
}
|
||||
|
||||
// Token: 0x060000AD RID: 173 RVA: 0x0000D81A File Offset: 0x0000BC1A
|
||||
public CSG_Node(List<CSG_Polygon> list, CSG_Plane plane, CSG_Node front, CSG_Node back)
|
||||
{
|
||||
this.polygons = list;
|
||||
this.plane = plane;
|
||||
this.front = front;
|
||||
this.back = back;
|
||||
}
|
||||
|
||||
// Token: 0x060000AE RID: 174 RVA: 0x0000D840 File Offset: 0x0000BC40
|
||||
public CSG_Node Clone()
|
||||
{
|
||||
return new CSG_Node(this.polygons, this.plane, this.front, this.back);
|
||||
}
|
||||
|
||||
// Token: 0x060000AF RID: 175 RVA: 0x0000D86C File Offset: 0x0000BC6C
|
||||
public void ClipTo(CSG_Node other)
|
||||
{
|
||||
this.polygons = other.ClipPolygons(this.polygons);
|
||||
if (this.front != null)
|
||||
{
|
||||
this.front.ClipTo(other);
|
||||
}
|
||||
if (this.back != null)
|
||||
{
|
||||
this.back.ClipTo(other);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060000B0 RID: 176 RVA: 0x0000D8BC File Offset: 0x0000BCBC
|
||||
public void Invert()
|
||||
{
|
||||
for (int i = 0; i < this.polygons.Count; i++)
|
||||
{
|
||||
this.polygons[i].Flip();
|
||||
}
|
||||
this.plane.Flip();
|
||||
if (this.front != null)
|
||||
{
|
||||
this.front.Invert();
|
||||
}
|
||||
if (this.back != null)
|
||||
{
|
||||
this.back.Invert();
|
||||
}
|
||||
CSG_Node csg_Node = this.front;
|
||||
this.front = this.back;
|
||||
this.back = csg_Node;
|
||||
}
|
||||
|
||||
// Token: 0x060000B1 RID: 177 RVA: 0x0000D948 File Offset: 0x0000BD48
|
||||
public void Build(List<CSG_Polygon> list)
|
||||
{
|
||||
if (list.Count < 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (this.plane == null || !this.plane.Valid())
|
||||
{
|
||||
this.plane = new CSG_Plane();
|
||||
this.plane.normal = list[0].plane.normal;
|
||||
this.plane.w = list[0].plane.w;
|
||||
}
|
||||
if (this.polygons == null)
|
||||
{
|
||||
this.polygons = new List<CSG_Polygon>();
|
||||
}
|
||||
List<CSG_Polygon> list2 = new List<CSG_Polygon>();
|
||||
List<CSG_Polygon> list3 = new List<CSG_Polygon>();
|
||||
for (int i = 0; i < list.Count; i++)
|
||||
{
|
||||
this.plane.SplitPolygon(list[i], this.polygons, this.polygons, list2, list3);
|
||||
}
|
||||
if (list2.Count > 0)
|
||||
{
|
||||
if (this.front == null)
|
||||
{
|
||||
this.front = new CSG_Node();
|
||||
}
|
||||
this.front.Build(list2);
|
||||
}
|
||||
if (list3.Count > 0)
|
||||
{
|
||||
if (this.back == null)
|
||||
{
|
||||
this.back = new CSG_Node();
|
||||
}
|
||||
this.back.Build(list3);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060000B2 RID: 178 RVA: 0x0000DA78 File Offset: 0x0000BE78
|
||||
public List<CSG_Polygon> ClipPolygons(List<CSG_Polygon> list)
|
||||
{
|
||||
if (!this.plane.Valid())
|
||||
{
|
||||
return list;
|
||||
}
|
||||
List<CSG_Polygon> list2 = new List<CSG_Polygon>();
|
||||
List<CSG_Polygon> list3 = new List<CSG_Polygon>();
|
||||
for (int i = 0; i < list.Count; i++)
|
||||
{
|
||||
this.plane.SplitPolygon(list[i], list2, list3, list2, list3);
|
||||
}
|
||||
if (this.front != null)
|
||||
{
|
||||
list2 = this.front.ClipPolygons(list2);
|
||||
}
|
||||
if (this.back != null)
|
||||
{
|
||||
list3 = this.back.ClipPolygons(list3);
|
||||
}
|
||||
else
|
||||
{
|
||||
list3.Clear();
|
||||
}
|
||||
list2.AddRange(list3);
|
||||
return list2;
|
||||
}
|
||||
|
||||
// Token: 0x060000B3 RID: 179 RVA: 0x0000DB14 File Offset: 0x0000BF14
|
||||
public List<CSG_Polygon> AllPolygons()
|
||||
{
|
||||
List<CSG_Polygon> list = this.polygons;
|
||||
List<CSG_Polygon> list2 = new List<CSG_Polygon>();
|
||||
List<CSG_Polygon> list3 = new List<CSG_Polygon>();
|
||||
if (this.front != null)
|
||||
{
|
||||
list2 = this.front.AllPolygons();
|
||||
}
|
||||
if (this.back != null)
|
||||
{
|
||||
list3 = this.back.AllPolygons();
|
||||
}
|
||||
list.AddRange(list2);
|
||||
list.AddRange(list3);
|
||||
return list;
|
||||
}
|
||||
|
||||
// Token: 0x060000B4 RID: 180 RVA: 0x0000DB74 File Offset: 0x0000BF74
|
||||
public static CSG_Node Union(CSG_Node a1, CSG_Node b1)
|
||||
{
|
||||
CSG_Node csg_Node = a1.Clone();
|
||||
CSG_Node csg_Node2 = b1.Clone();
|
||||
csg_Node.ClipTo(csg_Node2);
|
||||
csg_Node2.ClipTo(csg_Node);
|
||||
csg_Node2.Invert();
|
||||
csg_Node2.ClipTo(csg_Node);
|
||||
csg_Node2.Invert();
|
||||
csg_Node.Build(csg_Node2.AllPolygons());
|
||||
return new CSG_Node(csg_Node.AllPolygons());
|
||||
}
|
||||
|
||||
// Token: 0x060000B5 RID: 181 RVA: 0x0000DBCC File Offset: 0x0000BFCC
|
||||
public static CSG_Node Subtract(CSG_Node a1, CSG_Node b1)
|
||||
{
|
||||
CSG_Node csg_Node = a1.Clone();
|
||||
CSG_Node csg_Node2 = b1.Clone();
|
||||
csg_Node.Invert();
|
||||
csg_Node.ClipTo(csg_Node2);
|
||||
csg_Node2.ClipTo(csg_Node);
|
||||
csg_Node2.Invert();
|
||||
csg_Node2.ClipTo(csg_Node);
|
||||
csg_Node2.Invert();
|
||||
csg_Node.Build(csg_Node2.AllPolygons());
|
||||
csg_Node.Invert();
|
||||
return new CSG_Node(csg_Node.AllPolygons());
|
||||
}
|
||||
|
||||
// Token: 0x060000B6 RID: 182 RVA: 0x0000DC30 File Offset: 0x0000C030
|
||||
public static CSG_Node Intersect(CSG_Node a1, CSG_Node b1)
|
||||
{
|
||||
CSG_Node csg_Node = a1.Clone();
|
||||
CSG_Node csg_Node2 = b1.Clone();
|
||||
csg_Node.Invert();
|
||||
csg_Node2.ClipTo(csg_Node);
|
||||
csg_Node2.Invert();
|
||||
csg_Node.ClipTo(csg_Node2);
|
||||
csg_Node2.ClipTo(csg_Node);
|
||||
csg_Node.Build(csg_Node2.AllPolygons());
|
||||
csg_Node.Invert();
|
||||
return new CSG_Node(csg_Node.AllPolygons());
|
||||
}
|
||||
|
||||
// Token: 0x04000032 RID: 50
|
||||
public List<CSG_Polygon> polygons;
|
||||
|
||||
// Token: 0x04000033 RID: 51
|
||||
public CSG_Node front;
|
||||
|
||||
// Token: 0x04000034 RID: 52
|
||||
public CSG_Node back;
|
||||
|
||||
// Token: 0x04000035 RID: 53
|
||||
public CSG_Plane plane;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Parabox.CSG
|
||||
{
|
||||
// Token: 0x02000018 RID: 24
|
||||
internal class CSG_Plane
|
||||
{
|
||||
// Token: 0x060000B7 RID: 183 RVA: 0x0000DC8B File Offset: 0x0000C08B
|
||||
public CSG_Plane()
|
||||
{
|
||||
this.normal = Vector3.zero;
|
||||
this.w = 0f;
|
||||
}
|
||||
|
||||
// Token: 0x060000B8 RID: 184 RVA: 0x0000DCA9 File Offset: 0x0000C0A9
|
||||
public CSG_Plane(Vector3 a, Vector3 b, Vector3 c)
|
||||
{
|
||||
this.normal = Vector3.Cross(b - a, c - a);
|
||||
this.w = Vector3.Dot(this.normal, a);
|
||||
}
|
||||
|
||||
// Token: 0x060000B9 RID: 185 RVA: 0x0000DCDC File Offset: 0x0000C0DC
|
||||
public bool Valid()
|
||||
{
|
||||
return this.normal.magnitude > 0f;
|
||||
}
|
||||
|
||||
// Token: 0x060000BA RID: 186 RVA: 0x0000DCF0 File Offset: 0x0000C0F0
|
||||
public void Flip()
|
||||
{
|
||||
this.normal *= -1f;
|
||||
this.w *= -1f;
|
||||
}
|
||||
|
||||
// Token: 0x060000BB RID: 187 RVA: 0x0000DD1C File Offset: 0x0000C11C
|
||||
public void SplitPolygon(CSG_Polygon polygon, List<CSG_Polygon> coplanarFront, List<CSG_Polygon> coplanarBack, List<CSG_Polygon> front, List<CSG_Polygon> back)
|
||||
{
|
||||
CSG_Plane.EPolygonType epolygonType = CSG_Plane.EPolygonType.Coplanar;
|
||||
List<CSG_Plane.EPolygonType> list = new List<CSG_Plane.EPolygonType>();
|
||||
for (int i = 0; i < polygon.vertices.Count; i++)
|
||||
{
|
||||
float num = Vector3.Dot(this.normal, polygon.vertices[i].position) - this.w;
|
||||
CSG_Plane.EPolygonType epolygonType2 = ((num >= -1E-05f) ? ((num <= 1E-05f) ? CSG_Plane.EPolygonType.Coplanar : CSG_Plane.EPolygonType.Front) : CSG_Plane.EPolygonType.Back);
|
||||
epolygonType |= epolygonType2;
|
||||
list.Add(epolygonType2);
|
||||
}
|
||||
switch (epolygonType)
|
||||
{
|
||||
case CSG_Plane.EPolygonType.Coplanar:
|
||||
if (Vector3.Dot(this.normal, polygon.plane.normal) > 0f)
|
||||
{
|
||||
coplanarFront.Add(polygon);
|
||||
}
|
||||
else
|
||||
{
|
||||
coplanarBack.Add(polygon);
|
||||
}
|
||||
break;
|
||||
case CSG_Plane.EPolygonType.Front:
|
||||
front.Add(polygon);
|
||||
break;
|
||||
case CSG_Plane.EPolygonType.Back:
|
||||
back.Add(polygon);
|
||||
break;
|
||||
case CSG_Plane.EPolygonType.Spanning:
|
||||
{
|
||||
List<CSG_Vertex> list2 = new List<CSG_Vertex>();
|
||||
List<CSG_Vertex> list3 = new List<CSG_Vertex>();
|
||||
for (int j = 0; j < polygon.vertices.Count; j++)
|
||||
{
|
||||
int num2 = (j + 1) % polygon.vertices.Count;
|
||||
CSG_Plane.EPolygonType epolygonType3 = list[j];
|
||||
CSG_Plane.EPolygonType epolygonType4 = list[num2];
|
||||
CSG_Vertex csg_Vertex = polygon.vertices[j];
|
||||
CSG_Vertex csg_Vertex2 = polygon.vertices[num2];
|
||||
if (epolygonType3 != CSG_Plane.EPolygonType.Back)
|
||||
{
|
||||
list2.Add(csg_Vertex);
|
||||
}
|
||||
if (epolygonType3 != CSG_Plane.EPolygonType.Front)
|
||||
{
|
||||
list3.Add(csg_Vertex);
|
||||
}
|
||||
if ((epolygonType3 | epolygonType4) == CSG_Plane.EPolygonType.Spanning)
|
||||
{
|
||||
float num3 = (this.w - Vector3.Dot(this.normal, csg_Vertex.position)) / Vector3.Dot(this.normal, csg_Vertex2.position - csg_Vertex.position);
|
||||
CSG_Vertex csg_Vertex3 = CSG_Vertex.Interpolate(csg_Vertex, csg_Vertex2, num3);
|
||||
list2.Add(csg_Vertex3);
|
||||
list3.Add(csg_Vertex3);
|
||||
}
|
||||
}
|
||||
if (list2.Count >= 3)
|
||||
{
|
||||
front.Add(new CSG_Polygon(list2));
|
||||
}
|
||||
if (list3.Count >= 3)
|
||||
{
|
||||
back.Add(new CSG_Polygon(list3));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x04000036 RID: 54
|
||||
public Vector3 normal;
|
||||
|
||||
// Token: 0x04000037 RID: 55
|
||||
public float w;
|
||||
|
||||
// Token: 0x02000019 RID: 25
|
||||
[Flags]
|
||||
private enum EPolygonType
|
||||
{
|
||||
// Token: 0x04000039 RID: 57
|
||||
Coplanar = 0,
|
||||
// Token: 0x0400003A RID: 58
|
||||
Front = 1,
|
||||
// Token: 0x0400003B RID: 59
|
||||
Back = 2,
|
||||
// Token: 0x0400003C RID: 60
|
||||
Spanning = 3
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Parabox.CSG
|
||||
{
|
||||
// Token: 0x0200001A RID: 26
|
||||
internal class CSG_Polygon
|
||||
{
|
||||
// Token: 0x060000BC RID: 188 RVA: 0x0000DF48 File Offset: 0x0000C348
|
||||
public CSG_Polygon(List<CSG_Vertex> list)
|
||||
{
|
||||
this.vertices = list;
|
||||
this.plane = new CSG_Plane(list[0].position, list[1].position, list[2].position);
|
||||
}
|
||||
|
||||
// Token: 0x060000BD RID: 189 RVA: 0x0000DF9C File Offset: 0x0000C39C
|
||||
public void Flip()
|
||||
{
|
||||
this.vertices.Reverse();
|
||||
for (int i = 0; i < this.vertices.Count; i++)
|
||||
{
|
||||
this.vertices[i].Flip();
|
||||
}
|
||||
this.plane.Flip();
|
||||
}
|
||||
|
||||
// Token: 0x060000BE RID: 190 RVA: 0x0000DFEF File Offset: 0x0000C3EF
|
||||
public override string ToString()
|
||||
{
|
||||
return "N: " + this.plane.normal;
|
||||
}
|
||||
|
||||
// Token: 0x0400003D RID: 61
|
||||
public List<CSG_Vertex> vertices;
|
||||
|
||||
// Token: 0x0400003E RID: 62
|
||||
public CSG_Plane plane;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Parabox.CSG
|
||||
{
|
||||
// Token: 0x0200001B RID: 27
|
||||
internal struct CSG_Vertex
|
||||
{
|
||||
// Token: 0x060000BF RID: 191 RVA: 0x0000E00B File Offset: 0x0000C40B
|
||||
public CSG_Vertex(Vector3 position, Vector3 normal, Vector2 uv, Color color)
|
||||
{
|
||||
this.position = position;
|
||||
this.normal = normal;
|
||||
this.uv = uv;
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
// Token: 0x060000C0 RID: 192 RVA: 0x0000E02A File Offset: 0x0000C42A
|
||||
public void Flip()
|
||||
{
|
||||
this.normal *= -1f;
|
||||
}
|
||||
|
||||
// Token: 0x060000C1 RID: 193 RVA: 0x0000E044 File Offset: 0x0000C444
|
||||
public static CSG_Vertex Interpolate(CSG_Vertex a, CSG_Vertex b, float t)
|
||||
{
|
||||
return new CSG_Vertex
|
||||
{
|
||||
position = Vector3.Lerp(a.position, b.position, t),
|
||||
normal = Vector3.Lerp(a.normal, b.normal, t),
|
||||
uv = Vector2.Lerp(a.uv, b.uv, t),
|
||||
color = (a.color + b.color) / 2f
|
||||
};
|
||||
}
|
||||
|
||||
// Token: 0x0400003F RID: 63
|
||||
public Vector3 position;
|
||||
|
||||
// Token: 0x04000040 RID: 64
|
||||
public Color color;
|
||||
|
||||
// Token: 0x04000041 RID: 65
|
||||
public Vector3 normal;
|
||||
|
||||
// Token: 0x04000042 RID: 66
|
||||
public Vector2 uv;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user