Side by side rendering

- Side by side rendering implemented throughout the graphics pipeline.
- New GuiTSCtrl renderStyle property is set to "stereo side by side" to
activate.
- You set an IDisplayDevice on the GameConnection to define any vertical
FOV, projection offset, and stereo eye offset properties required for
the stereo rendering (no display device included with this commit).
- Full and Empty templates updated with correct scripts and shaders.
This commit is contained in:
DavidWyand-GG 2013-04-09 15:19:18 -04:00
parent b1feed56fd
commit b32e7688c2
28 changed files with 465 additions and 41 deletions

View file

@ -76,6 +76,9 @@ Frustum::Frustum( bool isOrtho,
mNumTiles = 1;
mCurrTile.set(0,0);
mTileOverlap.set(0.0f, 0.0f);
mProjectionOffset.zero();
mProjectionOffsetMatrix.identity();
}
//-----------------------------------------------------------------------------
@ -433,12 +436,27 @@ void Frustum::mulL( const MatrixF& mat )
//-----------------------------------------------------------------------------
void Frustum::setProjectionOffset(const Point2F& offsetMat)
{
mProjectionOffset = offsetMat;
mProjectionOffsetMatrix.identity();
mProjectionOffsetMatrix.setPosition(Point3F(mProjectionOffset.x, mProjectionOffset.y, 0.0f));
}
//-----------------------------------------------------------------------------
void Frustum::getProjectionMatrix( MatrixF *proj, bool gfxRotate ) const
{
if (mIsOrtho)
{
MathUtils::makeOrthoProjection(proj, mNearLeft, mNearRight, mNearTop, mNearBottom, mNearDist, mFarDist, gfxRotate);
proj->mulL(mProjectionOffsetMatrix);
}
else
{
MathUtils::makeProjection(proj, mNearLeft, mNearRight, mNearTop, mNearBottom, mNearDist, mFarDist, gfxRotate);
proj->mulL(mProjectionOffsetMatrix);
}
}
//-----------------------------------------------------------------------------

View file

@ -246,6 +246,12 @@ class Frustum : public PolyhedronImpl< FrustumData >
/// @}
/// Offset used for projection matrix calculations
Point2F mProjectionOffset;
/// The calculated projection offset matrix
MatrixF mProjectionOffsetMatrix;
public:
/// @name Constructors
@ -403,9 +409,23 @@ class Frustum : public PolyhedronImpl< FrustumData >
/// points typically used for early rejection.
const Box3F& getBounds() const { _update(); return mBounds; }
/// Get the offset used when calculating the projection matrix
const Point2F& getProjectionOffset() const { return mProjectionOffset; }
/// Get the offset matrix used when calculating the projection matrix
const MatrixF& getProjectionOffsetMatrix() const { return mProjectionOffsetMatrix; }
/// Set the offset used when calculating the projection matrix
void setProjectionOffset(const Point2F& offsetMat);
/// Clear any offset used when calculating the projection matrix
void clearProjectionOffset() { mProjectionOffset.zero(); mProjectionOffsetMatrix.identity(); }
/// Generates a projection matrix from the frustum.
void getProjectionMatrix( MatrixF *proj, bool gfxRotate=true ) const;
/// Will update the frustum if it is dirty
void update() { _update(); }
/// @}
/// @name Culling