add uCameraNormal

This commit is contained in:
Ricardo Luís Vaz Silva 2025-02-16 04:07:25 -03:00 committed by Magnus Norddahl
commit 7c2b228c46
4 changed files with 15 additions and 0 deletions

View file

@ -40,6 +40,8 @@ struct HWViewpointUniforms
int mLightTilesWidth = 0;
FVector3 mCameraNormal;
void CalcDependencies()
{
mNormalViewMatrix.computeNormalMatrix(mViewMatrix);

View file

@ -710,6 +710,13 @@ struct TVector3
*this = *this ^ other;
return *this;
}
// returns a version with swapped Z/Y
constexpr const TVector3 ToXZY() const
{
return {X, Z, Y};
}
};
template<class vec_t>

View file

@ -356,6 +356,10 @@ void HWDrawInfo::SetViewMatrix(const FRotator &angles, float vx, float vy, float
VPUniforms.mViewMatrix.rotate(angles.Yaw.Degrees(), 0.0f, mult, 0.0f);
VPUniforms.mViewMatrix.translate(vx * mult, -vz * planemult, -vy);
VPUniforms.mViewMatrix.scale(-mult, planemult, 1);
FRotator unfuckedAngles(angles.Pitch, FAngle::fromDeg(90 - angles.Yaw.Degrees()), angles.Roll);
VPUniforms.mCameraNormal = FVector3(unfuckedAngles).ToXZY();
}

View file

@ -18,6 +18,8 @@ layout(set = 1, binding = 0, std140) uniform readonly ViewpointUBO
float uClipHeightDirection;
int uLightTilesWidth; // Levelmesh light tiles
vec3 uCameraNormal;
};
layout(set = 1, binding = 1, std140) uniform readonly MatricesUBO