Merged main in

This commit is contained in:
Aristo7
2021-05-04 10:13:50 -05:00
427 changed files with 9465 additions and 26529 deletions
+1 -1
View File
@@ -55,7 +55,7 @@ public:
Matrix34 m_matInv;
Vec3 m_eyePosInWS;
Vec3 m_eyePosInOS;
Plane m_volumeTraceStartPlane;
Plane_tpl<f32> m_volumeTraceStartPlane;
AABB m_renderBoundsOS;
bool m_viewerInsideVolume;
bool m_nearPlaneIntersectsVolume;
+1 -1
View File
@@ -25,7 +25,7 @@ public:
virtual void mfPrepare(bool bCheckOverflow);
virtual bool mfDraw(CShader* ef, SShaderPass* sfm);
virtual void mfGetPlane(Plane& pl);
virtual void mfGetPlane(Plane_tpl<f32>& pl);
virtual void Create(uint32 nVerticesCount, SVF_P3F_C4B_T2F* pVertices, uint32 nIndicesCount, const void* pIndices, uint32 nIndexSizeof);
void ReleaseOcean();
+2 -2
View File
@@ -27,7 +27,7 @@ public:
virtual ~CREWaterVolume();
virtual void mfPrepare(bool bCheckOverflow);
virtual bool mfDraw(CShader* ef, SShaderPass* sfm);
virtual void mfGetPlane(Plane& pl);
virtual void mfGetPlane(Plane_tpl<f32>& pl);
virtual void mfCenter(Vec3& vCenter, CRenderObject* pObj);
virtual void GetMemoryUsage(ICrySizer* pSizer) const
@@ -69,7 +69,7 @@ public:
Vec3 m_center;
AABB m_WSBBox;
Plane m_fogPlane;
Plane_tpl<f32> m_fogPlane;
float m_fogDensity;
Vec3 m_fogColor;
bool m_fogColorAffectedBySun;
+9 -9
View File
@@ -594,7 +594,7 @@ public:
ILINE const Vec3& GetFPVertex(int nId) const; //get far-plane vertices
ILINE const Vec3& GetPPVertex(int nId) const; //get projection-plane vertices
ILINE const Plane* GetFrustumPlane(int numplane) const { return &m_fp[numplane]; }
ILINE const Plane_tpl<f32>* GetFrustumPlane(int numplane) const { return &m_fp[numplane]; }
//////////////////////////////////////////////////////////////////////////
// Z-Buffer ranges.
@@ -720,7 +720,7 @@ private:
Vec3 m_cltn, m_crtn, m_clbn, m_crbn; //this are the 4 vertices of the near-plane in cam-space
Vec3 m_cltf, m_crtf, m_clbf, m_crbf; //this are the 4 vertices of the farclip-plane in cam-space
Plane m_fp [FRUSTUM_PLANES]; //
Plane_tpl<f32> m_fp [FRUSTUM_PLANES]; //
uint32 m_idx1[FRUSTUM_PLANES], m_idy1[FRUSTUM_PLANES], m_idz1[FRUSTUM_PLANES]; //
uint32 m_idx2[FRUSTUM_PLANES], m_idy2[FRUSTUM_PLANES], m_idz2[FRUSTUM_PLANES]; //
@@ -742,7 +742,7 @@ public:
m_crtp = arrvVerts[2];
m_crbp = arrvVerts[3];
}
inline void SetFrustumPlane(int i, const Plane& plane)
inline void SetFrustumPlane(int i, const Plane_tpl<f32>& plane)
{
m_fp[i] = plane;
//do not break strict aliasing rules, use union instead of reinterpret_casts
@@ -1180,12 +1180,12 @@ inline void CCamera::UpdateFrustum()
//-------------------------------------------------------------------------------
//--- calculate the six frustum-planes using the frustum edges in world-space ---
//-------------------------------------------------------------------------------
m_fp[FR_PLANE_NEAR ] = Plane::CreatePlane(m_crtn + GetPosition(), m_cltn + GetPosition(), m_crbn + GetPosition());
m_fp[FR_PLANE_RIGHT ] = Plane::CreatePlane(m_crbf + GetPosition(), m_crtf + GetPosition(), GetPosition());
m_fp[FR_PLANE_LEFT ] = Plane::CreatePlane(m_cltf + GetPosition(), m_clbf + GetPosition(), GetPosition());
m_fp[FR_PLANE_TOP ] = Plane::CreatePlane(m_crtf + GetPosition(), m_cltf + GetPosition(), GetPosition());
m_fp[FR_PLANE_BOTTOM] = Plane::CreatePlane(m_clbf + GetPosition(), m_crbf + GetPosition(), GetPosition());
m_fp[FR_PLANE_FAR ] = Plane::CreatePlane(m_crtf + GetPosition(), m_crbf + GetPosition(), m_cltf + GetPosition()); //clip-plane
m_fp[FR_PLANE_NEAR ] = Plane_tpl<f32>::CreatePlane(m_crtn + GetPosition(), m_cltn + GetPosition(), m_crbn + GetPosition());
m_fp[FR_PLANE_RIGHT ] = Plane_tpl<f32>::CreatePlane(m_crbf + GetPosition(), m_crtf + GetPosition(), GetPosition());
m_fp[FR_PLANE_LEFT ] = Plane_tpl<f32>::CreatePlane(m_cltf + GetPosition(), m_clbf + GetPosition(), GetPosition());
m_fp[FR_PLANE_TOP ] = Plane_tpl<f32>::CreatePlane(m_crtf + GetPosition(), m_cltf + GetPosition(), GetPosition());
m_fp[FR_PLANE_BOTTOM] = Plane_tpl<f32>::CreatePlane(m_clbf + GetPosition(), m_crbf + GetPosition(), GetPosition());
m_fp[FR_PLANE_FAR ] = Plane_tpl<f32>::CreatePlane(m_crtf + GetPosition(), m_crbf + GetPosition(), m_cltf + GetPosition()); //clip-plane
uint32 rh = m_Matrix.IsOrthonormalRH();
if (rh == 0)
@@ -1168,17 +1168,6 @@ namespace Distance {
return fDist2;
}
// Compute both the min and max distances of a box to a plane, in the sense of the plane normal.
inline void AABB_Plane(float* pfDistMin, float* pfDistMax, const AABB& box, const Plane& pl)
{
float fDist0 = pl.DistFromPlane(box.min),
fDistX = (box.max.x - box.min.x) * pl.n.x,
fDistY = (box.max.y - box.min.y) * pl.n.y,
fDistZ = (box.max.z - box.min.z) * pl.n.z;
*pfDistMin = fDist0 + min(fDistX, 0.f) + min(fDistY, 0.f) + min(fDistZ, 0.f);
*pfDistMax = fDist0 + max(fDistX, 0.f) + max(fDistY, 0.f) + max(fDistZ, 0.f);
}
//----------------------------------------------------------------------------------
// Distance: Sphere_Triangle
//----------------------------------------------------------------------------------
+2 -2
View File
@@ -22,7 +22,7 @@
#include <Cry_Geo.h>
namespace Intersect {
inline bool Ray_Plane(const Ray& ray, const Plane& plane, Vec3& output, bool bSingleSidePlane = true)
inline bool Ray_Plane(const Ray& ray, const Plane_tpl<f32>& plane, Vec3& output, bool bSingleSidePlane = true)
{
float cosine = plane.n | ray.direction;
@@ -49,7 +49,7 @@ namespace Intersect {
return true; //intersection occurred
}
inline bool Line_Plane(const Line& line, const Plane& plane, Vec3& output, bool bSingleSidePlane = true)
inline bool Line_Plane(const Line& line, const Plane_tpl<f32>& plane, Vec3& output, bool bSingleSidePlane = true)
{
float cosine = plane.n | line.direction;
+2 -25
View File
@@ -945,29 +945,6 @@ namespace Overlap {
}
}
/*!
*
* we use the SEPARATING-AXIS-TEST for OBB/Plane overlap.
*
* Example:
* bool result=Overlap::OBB_Plane( pos,obb, plane );
*
*/
inline bool OBB_Plane(const Vec3& pos, const OBB& obb, const Plane& plane)
{
//the new center-position in world-space
Vec3 p = obb.m33 * obb.c + pos;
//extract the orientation-vectors from the columns of the 3x3 matrix
//and scale them by the half-lengths
Vec3 ax = Vec3(obb.m33.m00, obb.m33.m10, obb.m33.m20) * obb.h.x;
Vec3 ay = Vec3(obb.m33.m01, obb.m33.m11, obb.m33.m21) * obb.h.y;
Vec3 az = Vec3(obb.m33.m02, obb.m33.m12, obb.m33.m22) * obb.h.z;
//check OBB against Plane, using the plane-normal as separating axis
return fabsf(plane | p) < (fabsf(plane.n | ax) + fabsf(plane.n | ay) + fabsf(plane.n | az));
}
/*!
*
* we use the SEPARATING AXIS TEST to check if a triangle and AABB overlap.
@@ -1214,7 +1191,7 @@ namespace Overlap {
//test if the box intersects the plane of the triangle
//compute plane equation of triangle: normal*x+d=0
Plane plane = Plane::CreatePlane((e0 % e1), v0);
Plane_tpl<f32> plane = Plane_tpl<f32>::CreatePlane((e0 % e1), v0);
Vec3 vmin, vmax;
if (plane.n.x > 0.0f)
@@ -1505,7 +1482,7 @@ namespace Overlap {
//test if the box overlaps the plane of the triangle
//compute plane equation of triangle: normal*x+d=0
Plane plane = Plane::CreatePlane((e0 % e1), v0);
Plane_tpl<f32> plane = Plane_tpl<f32>::CreatePlane((e0 % e1), v0);
Vec3 vmin, vmax;
if (plane.n.x > 0.0f)
+1 -1
View File
@@ -458,7 +458,7 @@ struct SClipVolumeBlendInfo
{
static const int BlendPlaneCount = 2;
Plane blendPlanes[BlendPlaneCount];
Plane_tpl<f32> blendPlanes[BlendPlaneCount];
struct IClipVolume* blendVolumes[BlendPlaneCount];
};
@@ -731,8 +731,8 @@ struct IWaterVolumeRenderNode
virtual void SetAuxPhysParams(pe_params_area*) = 0;
virtual void CreateOcean(uint64 volumeID, /* TBD */ bool keepSerializationParams = false) = 0;
virtual void CreateArea(uint64 volumeID, const Vec3* pVertices, unsigned int numVertices, const Vec2& surfUVScale, const Plane& fogPlane, bool keepSerializationParams = false, int nSID = -1) = 0;
virtual void CreateRiver(uint64 volumeID, const Vec3* pVertices, unsigned int numVertices, float uTexCoordBegin, float uTexCoordEnd, const Vec2& surfUVScale, const Plane& fogPlane, bool keepSerializationParams = false, int nSID = -1) = 0;
virtual void CreateArea(uint64 volumeID, const Vec3* pVertices, unsigned int numVertices, const Vec2& surfUVScale, const Plane_tpl<f32>& fogPlane, bool keepSerializationParams = false, int nSID = -1) = 0;
virtual void CreateRiver(uint64 volumeID, const Vec3* pVertices, unsigned int numVertices, float uTexCoordBegin, float uTexCoordEnd, const Vec2& surfUVScale, const Plane_tpl<f32>& fogPlane, bool keepSerializationParams = false, int nSID = -1) = 0;
virtual void CreateRiver(uint64 volumeID, const AZStd::vector<AZ::Vector3>& verticies, const AZ::Transform& transform, float uTexCoordBegin, float uTexCoordEnd, const AZ::Vector2& surfUVScale, const AZ::Plane& fogPlane, bool keepSerializationParams = false, int nSID = -1) = 0;
virtual void SetAreaPhysicsArea(const Vec3* pVertices, unsigned int numVertices, bool keepSerializationParams = false) = 0;
-1
View File
@@ -52,7 +52,6 @@ struct SShaderItem;
class ITexture;
struct IMaterial;
struct SParam;
class CMaterial;
struct SShaderSerializeContext;
struct IAnimNode;
struct SSkinningData;
+2 -2
View File
@@ -119,7 +119,7 @@ struct IRenderElement
virtual void mfCenter(Vec3& centr, CRenderObject* pObj) = 0;
virtual void mfGetBBox(Vec3& vMins, Vec3& vMaxs) = 0;
virtual void mfReset() = 0;
virtual void mfGetPlane(Plane& pl) = 0;
virtual void mfGetPlane(Plane_tpl<f32>& pl) = 0;
virtual void mfExport(struct SShaderSerializeContext& SC) = 0;
virtual void mfImport(struct SShaderSerializeContext& SC, uint32& offset) = 0;
virtual void mfPrecache(const SShaderItem& SH) = 0;
@@ -265,7 +265,7 @@ public:
void mfPrecache([[maybe_unused]] const SShaderItem& SH) override {}
void mfExport([[maybe_unused]] struct SShaderSerializeContext& SC) override { CryFatalError("mfExport has not been implemented for this render element type"); }
void mfImport([[maybe_unused]] struct SShaderSerializeContext& SC, [[maybe_unused]] uint32& offset) override { CryFatalError("mfImport has not been implemented for this render element type"); }
void mfGetPlane(Plane& pl) override;
void mfGetPlane(Plane_tpl<f32>& pl) override;
void* mfGetPointer([[maybe_unused]] ESrcPointer ePT, [[maybe_unused]] int* Stride, [[maybe_unused]] EParamType Type, [[maybe_unused]] ESrcPointer Dst, [[maybe_unused]] int Flags) override { return nullptr; }
uint16 mfGetFlags() override { return m_Flags; }