mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-16 09:04:38 +00:00
USe correct frustum projections in reflections in separate rt mode
This commit is contained in:
parent
1b2abbeaaa
commit
de48afc00c
2 changed files with 33 additions and 14 deletions
|
|
@ -28,6 +28,7 @@
|
||||||
#include "console/consoleTypes.h"
|
#include "console/consoleTypes.h"
|
||||||
#include "core/tAlgorithm.h"
|
#include "core/tAlgorithm.h"
|
||||||
#include "math/mMathFn.h"
|
#include "math/mMathFn.h"
|
||||||
|
#include "math/mathUtils.h"
|
||||||
#include "T3D/gameBase/gameConnection.h"
|
#include "T3D/gameBase/gameConnection.h"
|
||||||
#include "ts/tsShapeInstance.h"
|
#include "ts/tsShapeInstance.h"
|
||||||
#include "gui/3d/guiTSControl.h"
|
#include "gui/3d/guiTSControl.h"
|
||||||
|
|
@ -134,12 +135,22 @@ void ReflectionManager::update( F32 timeSlice,
|
||||||
// Setup a culler for testing the
|
// Setup a culler for testing the
|
||||||
// visibility of reflectors.
|
// visibility of reflectors.
|
||||||
Frustum culler;
|
Frustum culler;
|
||||||
culler.set( false,
|
|
||||||
query.fov,
|
S32 stereoTarget = GFX->getCurrentStereoTarget();
|
||||||
(F32)resolution.x / (F32)resolution.y,
|
if (stereoTarget != -1)
|
||||||
query.nearPlane,
|
{
|
||||||
query.farPlane,
|
MathUtils::makeFovPortFrustum(&culler, false, query.nearPlane, query.farPlane, query.fovPort[stereoTarget]);
|
||||||
query.cameraMatrix );
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
culler.set(false,
|
||||||
|
query.fov,
|
||||||
|
(F32)resolution.x / (F32)resolution.y,
|
||||||
|
query.nearPlane,
|
||||||
|
query.farPlane,
|
||||||
|
query.cameraMatrix);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Manipulate the frustum for tiled screenshots
|
// Manipulate the frustum for tiled screenshots
|
||||||
const bool screenShotMode = gScreenShot && gScreenShot->isPending();
|
const bool screenShotMode = gScreenShot && gScreenShot->isPending();
|
||||||
|
|
|
||||||
|
|
@ -548,16 +548,24 @@ void PlaneReflector::updateReflection( const ReflectParams ¶ms )
|
||||||
|
|
||||||
// store current matrices
|
// store current matrices
|
||||||
GFXTransformSaver saver;
|
GFXTransformSaver saver;
|
||||||
|
|
||||||
Point2I viewport(params.viewportExtent);
|
|
||||||
if(GFX->getCurrentRenderStyle() == GFXDevice::RS_StereoSideBySide)
|
|
||||||
{
|
|
||||||
viewport.x *= 0.5f;
|
|
||||||
}
|
|
||||||
F32 aspectRatio = F32( viewport.x ) / F32( viewport.y );
|
|
||||||
|
|
||||||
Frustum frustum;
|
Frustum frustum;
|
||||||
frustum.set(false, params.query->fov, aspectRatio, params.query->nearPlane, params.query->farPlane);
|
|
||||||
|
S32 stereoTarget = GFX->getCurrentStereoTarget();
|
||||||
|
if (stereoTarget != -1)
|
||||||
|
{
|
||||||
|
MathUtils::makeFovPortFrustum(&frustum, false, params.query->nearPlane, params.query->farPlane, params.query->fovPort[stereoTarget]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Point2I viewport(params.viewportExtent);
|
||||||
|
if (GFX->getCurrentRenderStyle() == GFXDevice::RS_StereoSideBySide)
|
||||||
|
{
|
||||||
|
viewport.x *= 0.5f;
|
||||||
|
}
|
||||||
|
F32 aspectRatio = F32(viewport.x) / F32(viewport.y);
|
||||||
|
frustum.set(false, params.query->fov, aspectRatio, params.query->nearPlane, params.query->farPlane);
|
||||||
|
}
|
||||||
|
|
||||||
// Manipulate the frustum for tiled screenshots
|
// Manipulate the frustum for tiled screenshots
|
||||||
const bool screenShotMode = gScreenShot && gScreenShot->isPending();
|
const bool screenShotMode = gScreenShot && gScreenShot->isPending();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue