Пример #1
0
        private bool AreVertexPropertiesIdentical(DecalsMesh a_DecalsMesh, int a_VertexIndex1, int a_VertexIndex2)
        {
            Decals decals = a_DecalsMesh.Decals;
            bool   flag   = Vector3Extension.Approximately(a_DecalsMesh.Vertices[a_VertexIndex1], a_DecalsMesh.Vertices[a_VertexIndex2], DecalsMeshMinimizer.s_CurrentMaximumAbsoluteError, DecalsMeshMinimizer.s_CurrentMaximumRelativeError);

            if (flag && (decals.CurrentNormalsMode == NormalsMode.Target))
            {
                flag = Vector3Extension.Approximately(a_DecalsMesh.Normals[a_VertexIndex1], a_DecalsMesh.Normals[a_VertexIndex2], DecalsMeshMinimizer.s_CurrentMaximumAbsoluteError, DecalsMeshMinimizer.s_CurrentMaximumRelativeError);
            }
            if (flag && (decals.CurrentTangentsMode == TangentsMode.Target))
            {
                Vector4 vector6 = a_DecalsMesh.Tangents[a_VertexIndex2];
                flag = Vector3Extension.Approximately(a_DecalsMesh.Tangents[a_VertexIndex1], (Vector3)vector6, DecalsMeshMinimizer.s_CurrentMaximumAbsoluteError, DecalsMeshMinimizer.s_CurrentMaximumRelativeError);
            }
            if (flag && ((decals.CurrentUVMode == UVMode.TargetUV) || (decals.CurrentUVMode == UVMode.TargetUV2)))
            {
                flag = Vector2Extension.Approximately(a_DecalsMesh.UVs[a_VertexIndex1], a_DecalsMesh.UVs[a_VertexIndex2], DecalsMeshMinimizer.s_CurrentMaximumAbsoluteError, DecalsMeshMinimizer.s_CurrentMaximumRelativeError);
            }
            if (flag && ((decals.CurrentUV2Mode == UV2Mode.TargetUV) || (decals.CurrentUV2Mode == UV2Mode.TargetUV2)))
            {
                flag = Vector2Extension.Approximately(a_DecalsMesh.UV2s[a_VertexIndex1], a_DecalsMesh.UV2s[a_VertexIndex2], DecalsMeshMinimizer.s_CurrentMaximumAbsoluteError, DecalsMeshMinimizer.s_CurrentMaximumRelativeError);
            }
            return(flag);
        }
Пример #2
0
        private bool AreWeightedVertexPropertiesApproximatelyVertexProperties(DecalsMesh a_DecalsMesh, int a_VertexIndex)
        {
            bool   flag   = true;
            Decals decals = a_DecalsMesh.Decals;

            if (flag)
            {
                Vector3 vector = a_DecalsMesh.Vertices[a_VertexIndex];
                Vector3 zero   = Vector3.zero;
                int     num    = 0;
                while (true)
                {
                    if (num >= this.m_NeighboringVertexIndices.Count)
                    {
                        flag = flag && Vector3Extension.Approximately(vector, zero, DecalsMeshMinimizer.s_CurrentMaximumAbsoluteError, DecalsMeshMinimizer.s_CurrentMaximumRelativeError);
                        break;
                    }
                    int     num2    = this.m_NeighboringVertexIndices[num];
                    float   num3    = this.m_NeighboringVertexWeight[num];
                    Vector3 vector3 = a_DecalsMesh.Vertices[num2];
                    zero += num3 * vector3;
                    num++;
                }
            }
            if (flag && (decals.CurrentNormalsMode == NormalsMode.Target))
            {
                Vector3 vector4 = a_DecalsMesh.Normals[a_VertexIndex];
                Vector3 zero    = Vector3.zero;
                int     num4    = 0;
                while (true)
                {
                    if (num4 >= this.m_NeighboringVertexIndices.Count)
                    {
                        flag = flag && Vector3Extension.Approximately(vector4, zero, DecalsMeshMinimizer.s_CurrentMaximumAbsoluteError, DecalsMeshMinimizer.s_CurrentMaximumRelativeError);
                        break;
                    }
                    int     num5    = this.m_NeighboringVertexIndices[num4];
                    float   num6    = this.m_NeighboringVertexWeight[num4];
                    Vector3 vector6 = a_DecalsMesh.Normals[num5];
                    (zero + (num6 * vector6)).Normalize();
                    num4++;
                }
            }
            if (flag && (decals.CurrentTangentsMode == TangentsMode.Target))
            {
                Vector4 vector7 = a_DecalsMesh.Tangents[a_VertexIndex];
                Vector4 zero    = Vector3.zero;
                int     num7    = 0;
                while (true)
                {
                    if (num7 >= this.m_NeighboringVertexIndices.Count)
                    {
                        flag = flag && Vector4Extension.Approximately(vector7, zero, DecalsMeshMinimizer.s_CurrentMaximumAbsoluteError, DecalsMeshMinimizer.s_CurrentMaximumRelativeError);
                        break;
                    }
                    int     num8    = this.m_NeighboringVertexIndices[num7];
                    float   num9    = this.m_NeighboringVertexWeight[num7];
                    Vector4 vector9 = a_DecalsMesh.Tangents[num8];
                    (zero + (num9 * vector9)).Normalize();
                    num7++;
                }
            }
            if (flag && ((decals.CurrentUVMode == UVMode.TargetUV) || (decals.CurrentUVMode == UVMode.TargetUV2)))
            {
                Vector2 vector10 = a_DecalsMesh.UVs[a_VertexIndex];
                Vector2 zero     = Vector3.zero;
                int     num10    = 0;
                while (true)
                {
                    if (num10 >= this.m_NeighboringVertexIndices.Count)
                    {
                        flag = flag && Vector2Extension.Approximately(vector10, zero, DecalsMeshMinimizer.s_CurrentMaximumAbsoluteError, DecalsMeshMinimizer.s_CurrentMaximumRelativeError);
                        break;
                    }
                    int     num11    = this.m_NeighboringVertexIndices[num10];
                    float   num12    = this.m_NeighboringVertexWeight[num10];
                    Vector2 vector12 = a_DecalsMesh.UVs[num11];
                    zero += num12 * vector12;
                    num10++;
                }
            }
            if (flag && ((decals.CurrentUV2Mode == UV2Mode.TargetUV) || (decals.CurrentUV2Mode == UV2Mode.TargetUV2)))
            {
                Vector2 vector13 = a_DecalsMesh.UV2s[a_VertexIndex];
                Vector2 zero     = Vector3.zero;
                int     num13    = 0;
                while (true)
                {
                    if (num13 >= this.m_NeighboringVertexIndices.Count)
                    {
                        flag = flag && Vector2Extension.Approximately(vector13, zero, DecalsMeshMinimizer.s_CurrentMaximumAbsoluteError, DecalsMeshMinimizer.s_CurrentMaximumRelativeError);
                        break;
                    }
                    int     num14    = this.m_NeighboringVertexIndices[num13];
                    float   num15    = this.m_NeighboringVertexWeight[num13];
                    Vector2 vector15 = a_DecalsMesh.UV2s[num14];
                    zero += num15 * vector15;
                    num13++;
                }
            }
            return(true);
        }