public void GetContour(List <List <Vector3> > buffer) { if (this.circleResolution < 3) { this.circleResolution = 3; } NavmeshCut.MeshType meshType = this.type; if (meshType != NavmeshCut.MeshType.Rectangle) { if (meshType != NavmeshCut.MeshType.Circle) { if (meshType == NavmeshCut.MeshType.CustomMesh) { if (this.mesh != this.lastMesh || this.contours == null) { this.CalculateMeshContour(); this.lastMesh = this.mesh; } if (this.contours != null) { bool reverse = this.meshScale < 0f; for (int i = 0; i < this.contours.Length; i++) { Vector3[] array = this.contours[i]; List <Vector3> list = ListPool <Vector3> .Claim(array.Length); for (int j = 0; j < array.Length; j++) { list.Add(array[j] * this.meshScale); } this.TransformBuffer(list, reverse); buffer.Add(list); } } } } else { List <Vector3> list = ListPool <Vector3> .Claim(this.circleResolution); for (int k = 0; k < this.circleResolution; k++) { list.Add(new Vector3(Mathf.Cos((float)(k * 2) * 3.14159274f / (float)this.circleResolution), 0f, Mathf.Sin((float)(k * 2) * 3.14159274f / (float)this.circleResolution)) * this.circleRadius); } bool reverse = this.circleRadius < 0f; this.TransformBuffer(list, reverse); buffer.Add(list); } } else { List <Vector3> list = ListPool <Vector3> .Claim(); list.Add(new Vector3(-this.rectangleSize.x, 0f, -this.rectangleSize.y) * 0.5f); list.Add(new Vector3(this.rectangleSize.x, 0f, -this.rectangleSize.y) * 0.5f); list.Add(new Vector3(this.rectangleSize.x, 0f, this.rectangleSize.y) * 0.5f); list.Add(new Vector3(-this.rectangleSize.x, 0f, this.rectangleSize.y) * 0.5f); bool reverse = this.rectangleSize.x < 0f ^ this.rectangleSize.y < 0f; this.TransformBuffer(list, reverse); buffer.Add(list); } }
public void GetContour(List<List<IntPoint>> buffer) { if (this.circleResolution < 3) { this.circleResolution = 3; } Vector3 a = this.tr.position; Matrix4x4 matrix = Matrix4x4.identity; bool flag = false; if (this.useRotation) { matrix = this.tr.localToWorldMatrix; flag = VectorMath.ReversesFaceOrientationsXZ(matrix); } NavmeshCut.MeshType meshType = this.type; if (meshType != NavmeshCut.MeshType.Rectangle) { if (meshType != NavmeshCut.MeshType.Circle) { if (meshType == NavmeshCut.MeshType.CustomMesh) { if (this.mesh != this.lastMesh || this.contours == null) { this.CalculateMeshContour(); this.lastMesh = this.mesh; } if (this.contours != null) { a += this.center; flag ^= (this.meshScale < 0f); for (int i = 0; i < this.contours.Length; i++) { Vector3[] array = this.contours[i]; List<IntPoint> list = ListPool<IntPoint>.Claim(array.Length); if (this.useRotation) { for (int j = 0; j < array.Length; j++) { list.Add(NavmeshCut.V3ToIntPoint(matrix.MultiplyPoint3x4(this.center + array[j] * this.meshScale))); } } else { for (int k = 0; k < array.Length; k++) { list.Add(NavmeshCut.V3ToIntPoint(a + array[k] * this.meshScale)); } } if (flag) { list.Reverse(); } buffer.Add(list); } } } } else { List<IntPoint> list = ListPool<IntPoint>.Claim(this.circleResolution); flag ^= (this.circleRadius < 0f); if (this.useRotation) { for (int l = 0; l < this.circleResolution; l++) { list.Add(NavmeshCut.V3ToIntPoint(matrix.MultiplyPoint3x4(this.center + new Vector3(Mathf.Cos((float)(l * 2) * 3.14159274f / (float)this.circleResolution), 0f, Mathf.Sin((float)(l * 2) * 3.14159274f / (float)this.circleResolution)) * this.circleRadius))); } } else { a += this.center; for (int m = 0; m < this.circleResolution; m++) { list.Add(NavmeshCut.V3ToIntPoint(a + new Vector3(Mathf.Cos((float)(m * 2) * 3.14159274f / (float)this.circleResolution), 0f, Mathf.Sin((float)(m * 2) * 3.14159274f / (float)this.circleResolution)) * this.circleRadius)); } } if (flag) { list.Reverse(); } buffer.Add(list); } } else { List<IntPoint> list = ListPool<IntPoint>.Claim(); flag ^= (this.rectangleSize.x < 0f ^ this.rectangleSize.y < 0f); if (this.useRotation) { list.Add(NavmeshCut.V3ToIntPoint(matrix.MultiplyPoint3x4(this.center + new Vector3(-this.rectangleSize.x, 0f, -this.rectangleSize.y) * 0.5f))); list.Add(NavmeshCut.V3ToIntPoint(matrix.MultiplyPoint3x4(this.center + new Vector3(this.rectangleSize.x, 0f, -this.rectangleSize.y) * 0.5f))); list.Add(NavmeshCut.V3ToIntPoint(matrix.MultiplyPoint3x4(this.center + new Vector3(this.rectangleSize.x, 0f, this.rectangleSize.y) * 0.5f))); list.Add(NavmeshCut.V3ToIntPoint(matrix.MultiplyPoint3x4(this.center + new Vector3(-this.rectangleSize.x, 0f, this.rectangleSize.y) * 0.5f))); } else { a += this.center; list.Add(NavmeshCut.V3ToIntPoint(a + new Vector3(-this.rectangleSize.x, 0f, -this.rectangleSize.y) * 0.5f)); list.Add(NavmeshCut.V3ToIntPoint(a + new Vector3(this.rectangleSize.x, 0f, -this.rectangleSize.y) * 0.5f)); list.Add(NavmeshCut.V3ToIntPoint(a + new Vector3(this.rectangleSize.x, 0f, this.rectangleSize.y) * 0.5f)); list.Add(NavmeshCut.V3ToIntPoint(a + new Vector3(-this.rectangleSize.x, 0f, this.rectangleSize.y) * 0.5f)); } if (flag) { list.Reverse(); } buffer.Add(list); } }
// Token: 0x06000715 RID: 1813 RVA: 0x0004537C File Offset: 0x0004377C public Bounds GetBounds() { NavmeshCut.MeshType meshType = this.type; if (meshType != NavmeshCut.MeshType.Rectangle) { if (meshType != NavmeshCut.MeshType.Circle) { if (meshType == NavmeshCut.MeshType.CustomMesh) { if (!(this.mesh == null)) { Bounds bounds = this.mesh.bounds; if (this.useRotation) { Matrix4x4 localToWorldMatrix = this.tr.localToWorldMatrix; bounds.center *= this.meshScale; bounds.size *= this.meshScale; this.bounds = new Bounds(localToWorldMatrix.MultiplyPoint3x4(this.center + bounds.center), Vector3.zero); Vector3 max = bounds.max; Vector3 min = bounds.min; this.bounds.Encapsulate(localToWorldMatrix.MultiplyPoint3x4(this.center + new Vector3(max.x, max.y, max.z))); this.bounds.Encapsulate(localToWorldMatrix.MultiplyPoint3x4(this.center + new Vector3(min.x, max.y, max.z))); this.bounds.Encapsulate(localToWorldMatrix.MultiplyPoint3x4(this.center + new Vector3(min.x, max.y, min.z))); this.bounds.Encapsulate(localToWorldMatrix.MultiplyPoint3x4(this.center + new Vector3(max.x, max.y, min.z))); this.bounds.Encapsulate(localToWorldMatrix.MultiplyPoint3x4(this.center + new Vector3(max.x, min.y, max.z))); this.bounds.Encapsulate(localToWorldMatrix.MultiplyPoint3x4(this.center + new Vector3(min.x, min.y, max.z))); this.bounds.Encapsulate(localToWorldMatrix.MultiplyPoint3x4(this.center + new Vector3(min.x, min.y, min.z))); this.bounds.Encapsulate(localToWorldMatrix.MultiplyPoint3x4(this.center + new Vector3(max.x, min.y, min.z))); Vector3 size = this.bounds.size; size.y = Mathf.Max(size.y, this.height * this.tr.lossyScale.y); this.bounds.size = size; } else { Vector3 size2 = bounds.size * this.meshScale; size2.y = Mathf.Max(size2.y, this.height); this.bounds = new Bounds(base.transform.position + this.center + bounds.center * this.meshScale, size2); } } } } else if (this.useRotation) { this.bounds = new Bounds(this.tr.localToWorldMatrix.MultiplyPoint3x4(this.center), new Vector3(this.circleRadius * 2f, this.height, this.circleRadius * 2f)); } else { this.bounds = new Bounds(base.transform.position + this.center, new Vector3(this.circleRadius * 2f, this.height, this.circleRadius * 2f)); } } else if (this.useRotation) { Matrix4x4 localToWorldMatrix2 = this.tr.localToWorldMatrix; this.bounds = new Bounds(localToWorldMatrix2.MultiplyPoint3x4(this.center + new Vector3(-this.rectangleSize.x, -this.height, -this.rectangleSize.y) * 0.5f), Vector3.zero); this.bounds.Encapsulate(localToWorldMatrix2.MultiplyPoint3x4(this.center + new Vector3(this.rectangleSize.x, -this.height, -this.rectangleSize.y) * 0.5f)); this.bounds.Encapsulate(localToWorldMatrix2.MultiplyPoint3x4(this.center + new Vector3(this.rectangleSize.x, -this.height, this.rectangleSize.y) * 0.5f)); this.bounds.Encapsulate(localToWorldMatrix2.MultiplyPoint3x4(this.center + new Vector3(-this.rectangleSize.x, -this.height, this.rectangleSize.y) * 0.5f)); this.bounds.Encapsulate(localToWorldMatrix2.MultiplyPoint3x4(this.center + new Vector3(-this.rectangleSize.x, this.height, -this.rectangleSize.y) * 0.5f)); this.bounds.Encapsulate(localToWorldMatrix2.MultiplyPoint3x4(this.center + new Vector3(this.rectangleSize.x, this.height, -this.rectangleSize.y) * 0.5f)); this.bounds.Encapsulate(localToWorldMatrix2.MultiplyPoint3x4(this.center + new Vector3(this.rectangleSize.x, this.height, this.rectangleSize.y) * 0.5f)); this.bounds.Encapsulate(localToWorldMatrix2.MultiplyPoint3x4(this.center + new Vector3(-this.rectangleSize.x, this.height, this.rectangleSize.y) * 0.5f)); } else { this.bounds = new Bounds(this.tr.position + this.center, new Vector3(this.rectangleSize.x, this.height, this.rectangleSize.y)); } return(this.bounds); }