Reverse Y axis (+Y is now up)

This commit is contained in:
Jérôme Leclercq
2021-06-06 15:59:25 +02:00
parent 86097b331b
commit b85cb174ce
6 changed files with 61 additions and 66 deletions

View File

@@ -914,15 +914,14 @@ namespace Nz
template<typename T>
Matrix4<T>& Matrix4<T>::MakePerspective(RadianAngle<T> angle, T ratio, T zNear, T zFar)
{
// https://docs.microsoft.com/fr-fr/windows/win32/direct3d10/d3d10-d3dxmatrixperspectivefovrh
angle = RadianAngle<T>(HalfPi<T>) - angle / T(2.0);
angle /= T(2.0);
T yScale = angle.GetTan();
Set(yScale / ratio, T(0.0), T(0.0), T(0.0),
T(0.0), yScale, T(0.0), T(0.0),
T(0.0), T(0.0), zFar / (zNear - zFar), T(-1.0),
T(0.0), T(0.0), zNear * zFar / (zNear - zFar), T(0.0));
Set(T(1.0) / (ratio * yScale), T(0.0), T(0.0), T(0.0),
T(0.0), T(-1.0) / (yScale), T(0.0), T(0.0),
T(0.0), T(0.0), zFar / (zNear - zFar), T(-1.0),
T(0.0), T(0.0), -(zNear * zFar) / (zFar - zNear), T(0.0));
return *this;
}

View File

@@ -21,7 +21,7 @@ namespace Nz
{
FaceFilling faceFilling = FaceFilling::Fill;
FaceSide cullingSide = FaceSide::Back;
FrontFace frontFace = FrontFace::Clockwise;
FrontFace frontFace = FrontFace::CounterClockwise;
RendererComparison depthCompare = RendererComparison::Less;
PrimitiveMode primitiveMode = PrimitiveMode::TriangleList;