forked from mirrors/0ad
Renames sgn function to Sign to fit the naming of other MathUtil functions.
This was SVN commit r26276.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2021 Wildfire Games.
|
||||
/* Copyright (C) 2022 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@@ -45,13 +45,14 @@ inline T SmoothStep(T edge0, T edge1, T value)
|
||||
return value * value * (3 - 2 * value);
|
||||
}
|
||||
|
||||
inline float sgn(float a)
|
||||
template<typename T>
|
||||
inline T Sign(const T value)
|
||||
{
|
||||
if (a > 0.0f)
|
||||
return 1.0f;
|
||||
if (a < 0.0f)
|
||||
return -1.0f;
|
||||
return 0.0f;
|
||||
if (value > T(0))
|
||||
return T(1);
|
||||
if (value < T(0))
|
||||
return T(-1);
|
||||
return T(0);
|
||||
}
|
||||
|
||||
#endif // INCLUDED_MATHUTIL
|
||||
|
||||
@@ -501,10 +501,10 @@ void CSceneRenderer::SetObliqueFrustumClipping(CCamera& camera, const CVector4D&
|
||||
// by the inverse of the projection matrix
|
||||
|
||||
CVector4D q;
|
||||
q.X = (sgn(camPlane.X) - matrix[8]/matrix[11]) / matrix[0];
|
||||
q.Y = (sgn(camPlane.Y) - matrix[9]/matrix[11]) / matrix[5];
|
||||
q.Z = 1.0f/matrix[11];
|
||||
q.W = (1.0f - matrix[10]/matrix[11]) / matrix[14];
|
||||
q.X = (Sign(camPlane.X) - matrix[8] / matrix[11]) / matrix[0];
|
||||
q.Y = (Sign(camPlane.Y) - matrix[9] / matrix[11]) / matrix[5];
|
||||
q.Z = 1.0f / matrix[11];
|
||||
q.W = (1.0f - matrix[10] / matrix[11]) / matrix[14];
|
||||
|
||||
// Calculate the scaled plane vector
|
||||
CVector4D c = camPlane * (2.0f * matrix[11] / camPlane.Dot(q));
|
||||
|
||||
Reference in New Issue
Block a user