Ver código fonte

Fix some debug compile errors introduced by https://github.com/o3de/o3de/pull/3903

Signed-off-by: bosnichd <[email protected]>
bosnichd 4 anos atrás
pai
commit
12fb91a484

+ 0 - 2
Code/Legacy/CryCommon/Cry_Camera.h

@@ -279,8 +279,6 @@ inline void CCamera::SetFrustum(int nWidth, int nHeight, f32 FOV, f32 nearplane,
     m_edge_plt.y = projLeftTopY;
     m_edge_plt.y = projLeftTopY;
     m_edge_plt.z = projLeftTopZ;
     m_edge_plt.z = projLeftTopZ;
 
 
-    assert(fabs(acos_tpl(Vec3d(0, m_edge_plt.y, m_edge_plt.z).GetNormalized().y) * 2 - m_fov) < 0.001);
-
     float invProjLeftTopY = 1.0f / projLeftTopY;
     float invProjLeftTopY = 1.0f / projLeftTopY;
 
 
     //Apply asym shift to the camera frustum - Necessary for properly culling tessellated objects in VR
     //Apply asym shift to the camera frustum - Necessary for properly culling tessellated objects in VR

+ 77 - 0
Code/Legacy/CryCommon/Cry_Matrix34.h

@@ -587,6 +587,30 @@ struct Matrix34_tpl
         m22 = m33.m22;
         m22 = m33.m22;
     }
     }
 
 
+    //check if we have an orthonormal-base (general case, works even with reflection matrices)
+    int IsOrthonormal(F threshold = 0.001) const
+    {
+        f32 d0 = fabs_tpl(GetColumn0() | GetColumn1());
+        if  (d0 > threshold)
+        {
+            return 0;
+        }
+        f32 d1 = fabs_tpl(GetColumn0() | GetColumn2());
+        if  (d1 > threshold)
+        {
+            return 0;
+        }
+        f32 d2 = fabs_tpl(GetColumn1() | GetColumn2());
+        if  (d2 > threshold)
+        {
+            return 0;
+        }
+        int a = (fabs_tpl(1 - (GetColumn0() | GetColumn0()))) < threshold;
+        int b = (fabs_tpl(1 - (GetColumn1() | GetColumn1()))) < threshold;
+        int c = (fabs_tpl(1 - (GetColumn2() | GetColumn2()))) < threshold;
+        return a & b & c;
+    }
+
     //check if we have an orthonormal-base (assuming we are using a right-handed coordinate system)
     //check if we have an orthonormal-base (assuming we are using a right-handed coordinate system)
     int IsOrthonormalRH(F threshold = 0.001) const
     int IsOrthonormalRH(F threshold = 0.001) const
     {
     {
@@ -604,6 +628,59 @@ struct Matrix34_tpl
             );
             );
     }
     }
 
 
+    bool IsValid() const
+    {
+        if (!NumberValid(m00))
+        {
+            return false;
+        }
+        if (!NumberValid(m01))
+        {
+            return false;
+        }
+        if (!NumberValid(m02))
+        {
+            return false;
+        }
+        if (!NumberValid(m03))
+        {
+            return false;
+        }
+        if (!NumberValid(m10))
+        {
+            return false;
+        }
+        if (!NumberValid(m11))
+        {
+            return false;
+        }
+        if (!NumberValid(m12))
+        {
+            return false;
+        }
+        if (!NumberValid(m13))
+        {
+            return false;
+        }
+        if (!NumberValid(m20))
+        {
+            return false;
+        }
+        if (!NumberValid(m21))
+        {
+            return false;
+        }
+        if (!NumberValid(m22))
+        {
+            return false;
+        }
+        if (!NumberValid(m23))
+        {
+            return false;
+        }
+        return true;
+    }
+
     /*!
     /*!
     * Create a matrix with SCALING, ROTATION and TRANSLATION (in this order).
     * Create a matrix with SCALING, ROTATION and TRANSLATION (in this order).
     *
     *

+ 1 - 1
Code/Legacy/CryCommon/Cry_Vector4.h

@@ -27,7 +27,7 @@ struct Vec4
     f32 x, y, z, w;
     f32 x, y, z, w;
 
 
 #if defined(_DEBUG)
 #if defined(_DEBUG)
-    ILINE Vec4_tpl()
+    ILINE Vec4()
     {
     {
         if constexpr (sizeof(f32) == 4)
         if constexpr (sizeof(f32) == 4)
         {
         {