- detached the poly renderer from the software renderer
This commit is contained in:
parent
f45371e231
commit
11e5759913
33 changed files with 327 additions and 315 deletions
|
|
@ -132,6 +132,7 @@ 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();
|
||||
|
|
@ -144,15 +145,16 @@ TriMatrix TriMatrix::worldToView(const FRenderViewpoint &viewpoint)
|
|||
return m * translate((float)-viewpoint.Pos.X, (float)-viewpoint.Pos.Y, (float)-viewpoint.Pos.Z);
|
||||
}
|
||||
|
||||
TriMatrix TriMatrix::viewToClip(swrenderer::RenderViewport *viewport)
|
||||
TriMatrix TriMatrix::viewToClip(double focalTangent, double centerY, double invZtoScale)
|
||||
{
|
||||
float near = 5.0f;
|
||||
float far = 65536.0f;
|
||||
float width = (float)(viewport->viewwindow.FocalTangent * near);
|
||||
float top = (float)(viewport->CenterY / viewport->InvZtoScale * near);
|
||||
float bottom = (float)(top - viewheight / viewport->InvZtoScale * near);
|
||||
float width = (float)(focalTangent * near);
|
||||
float top = (float)(centerY / invZtoScale * near);
|
||||
float bottom = (float)(top - viewheight / invZtoScale * near);
|
||||
return frustum(-width, width, bottom, top, near, far);
|
||||
}
|
||||
#endif
|
||||
|
||||
TriMatrix TriMatrix::operator*(const TriMatrix &mult) const
|
||||
{
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
struct TriVertex;
|
||||
struct ShadedTriVertex;
|
||||
namespace swrenderer { class RenderViewport; }
|
||||
struct FRenderViewpoint;
|
||||
|
||||
struct TriMatrix
|
||||
{
|
||||
|
|
@ -37,8 +37,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(swrenderer::RenderViewport *viewport); // 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 invZtoScale); // Software renderer shearing projection
|
||||
|
||||
ShadedTriVertex operator*(TriVertex v) const;
|
||||
TriMatrix operator*(const TriMatrix &m) const;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue