コード例 #1
0
 private void AddTriangleNormal(DecalsMesh a_DecalsMesh, int a_TriangleIndex)
 {
     if (!this.m_TriangleNormals.HasTriangleNormal(a_TriangleIndex))
     {
         int     num     = a_DecalsMesh.Triangles[a_TriangleIndex];
         int     num2    = a_DecalsMesh.Triangles[a_TriangleIndex + 1];
         int     num3    = a_DecalsMesh.Triangles[a_TriangleIndex + 2];
         Vector3 vector4 = GeometryUtilities.TriangleNormal(a_DecalsMesh.Vertices[num], a_DecalsMesh.Vertices[num2], a_DecalsMesh.Vertices[num3]);
         this.m_TriangleNormals.AddTriangleNormal(a_TriangleIndex, vector4);
     }
 }
コード例 #2
0
 private void AddNewTriangles(DecalsMesh a_DecalsMesh)
 {
     while (true)
     {
         bool flag;
         while (true)
         {
             if (this.m_SortedNeighboringVertices.Count >= 3)
             {
                 flag = false;
                 for (int i = 0; i < this.m_SortedNeighboringVertices.Count; i++)
                 {
                     int num2  = i;
                     int index = i + 1;
                     int num4  = i + 2;
                     if (index >= this.m_SortedNeighboringVertices.Count)
                     {
                         index -= this.m_SortedNeighboringVertices.Count;
                         num4  -= this.m_SortedNeighboringVertices.Count;
                     }
                     else if (num4 >= this.m_SortedNeighboringVertices.Count)
                     {
                         num4 -= this.m_SortedNeighboringVertices.Count;
                     }
                     int     item = this.m_SortedNeighboringVertices[num2];
                     int     num6 = this.m_SortedNeighboringVertices[index];
                     int     num7 = this.m_SortedNeighboringVertices[num4];
                     Vector3 rhs  = GeometryUtilities.TriangleNormal(a_DecalsMesh.Vertices[item], a_DecalsMesh.Vertices[num6], a_DecalsMesh.Vertices[num7]);
                     if (Vector3.Dot(this.m_ReferenceTriangleNormal, rhs) >= 0f)
                     {
                         a_DecalsMesh.Triangles.Add(item);
                         a_DecalsMesh.Triangles.Add(num6);
                         a_DecalsMesh.Triangles.Add(num7);
                         this.m_SortedNeighboringVertices.RemoveAt(index);
                         flag = true;
                         break;
                     }
                 }
             }
             else
             {
                 return;
             }
             break;
         }
         if (!flag)
         {
             return;
         }
     }
 }
コード例 #3
0
        private void InitializeNeighboringTriangles(DecalsMesh a_DecalsMesh, int a_VertexIndex)
        {
            bool flag = false;

            for (int i = a_DecalsMesh.ActiveDecalProjector.DecalsMeshLowerTriangleIndex; i < a_DecalsMesh.Triangles.Count; i += 3)
            {
                int num2 = a_DecalsMesh.Triangles[i];
                int num3 = a_DecalsMesh.Triangles[i + 1];
                int num4 = a_DecalsMesh.Triangles[i + 2];
                if ((num2 == a_VertexIndex) || ((num3 == a_VertexIndex) || (num4 == a_VertexIndex)))
                {
                    this.m_NeighboringTriangles.Add(i);
                    if (!flag)
                    {
                        Vector3 vector = a_DecalsMesh.Vertices[num2];
                        this.m_ReferenceTriangleNormal = GeometryUtilities.TriangleNormal(vector, a_DecalsMesh.Vertices[num3], a_DecalsMesh.Vertices[num4]);
                        if (!Vector3Extension.Approximately(this.m_ReferenceTriangleNormal, Vector3.zero, DecalsMeshMinimizer.s_CurrentMaximumAbsoluteError, DecalsMeshMinimizer.s_CurrentMaximumRelativeError))
                        {
                            flag = true;
                        }
                    }
                }
            }
        }