- Add model rendering to the software renderer

This commit is contained in:
Magnus Norddahl 2017-11-27 23:47:26 +01:00
commit d43ac8b9ae
32 changed files with 792 additions and 87 deletions

View file

@ -132,7 +132,6 @@ TriMatrix TriMatrix::frustum(float left, float right, float bottom, float top, f
return m;
}
#if 0
TriMatrix TriMatrix::worldToView(const FRenderViewpoint &viewpoint)
{
TriMatrix m = null();
@ -145,16 +144,15 @@ TriMatrix TriMatrix::worldToView(const FRenderViewpoint &viewpoint)
return m * translate((float)-viewpoint.Pos.X, (float)-viewpoint.Pos.Y, (float)-viewpoint.Pos.Z);
}
TriMatrix TriMatrix::viewToClip(double focalTangent, double centerY, double invZtoScale)
TriMatrix TriMatrix::viewToClip(double focalTangent, double centerY, double YaspectMul)
{
float near = 5.0f;
float far = 65536.0f;
float width = (float)(focalTangent * near);
float top = (float)(centerY / invZtoScale * near);
float bottom = (float)(top - viewheight / invZtoScale * near);
float top = (float)(centerY / viewheight * YaspectMul * near);
float bottom = (float)(top - YaspectMul * near);
return frustum(-width, width, bottom, top, near, far);
}
#endif
TriMatrix TriMatrix::operator*(const TriMatrix &mult) const
{

View file

@ -36,8 +36,8 @@ struct TriMatrix
static TriMatrix perspective(float fovy, float aspect, float near, float far);
static TriMatrix frustum(float left, float right, float bottom, float top, float near, float far);
//static TriMatrix worldToView(const FRenderViewpoint &viewpoint); // Software renderer world to view space transform
//static TriMatrix viewToClip(double focalTangent, double centerY, double invZtoScale); // Software renderer shearing projection
static TriMatrix worldToView(const FRenderViewpoint &viewpoint); // Software renderer world to view space transform
static TriMatrix viewToClip(double focalTangent, double centerY, double YaspectMul); // Software renderer shearing projection
FVector4 operator*(const FVector4 &v) const;
TriMatrix operator*(const TriMatrix &m) const;