mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-13 15:44:36 +00:00
Fix GroundCover banking with camera
Fix for issue https://github.com/GarageGames/Torque3D/issues/527
This commit is contained in:
parent
ea2592a83d
commit
3be3cc6589
1 changed files with 11 additions and 3 deletions
|
|
@ -1572,12 +1572,20 @@ void GroundCover::prepRenderImage( SceneRenderState *state )
|
||||||
|
|
||||||
mShaderConstData.gustInfo.set( mWindGustLength, mWindGustFrequency * simTime, mWindGustStrength );
|
mShaderConstData.gustInfo.set( mWindGustLength, mWindGustFrequency * simTime, mWindGustStrength );
|
||||||
mShaderConstData.turbInfo.set( mWindTurbulenceFrequency * simTime, mWindTurbulenceStrength );
|
mShaderConstData.turbInfo.set( mWindTurbulenceFrequency * simTime, mWindTurbulenceStrength );
|
||||||
|
|
||||||
|
// Use the camera's forward vector to calculate the camera's right
|
||||||
|
// and up vectors. This removes any camera banking from affecting
|
||||||
|
// the ground cover.
|
||||||
const MatrixF &camMat = state->getDiffuseCameraTransform();
|
const MatrixF &camMat = state->getDiffuseCameraTransform();
|
||||||
Point3F camDir, camUp, camRight;
|
Point3F camDir, camUp, camRight;
|
||||||
camMat.getColumn( 1, &camDir );
|
camMat.getColumn( 1, &camDir );
|
||||||
camMat.getColumn( 2, &camUp );
|
mCross( camDir, Point3F::UnitZ, &camRight );
|
||||||
camMat.getColumn( 0, &camRight );
|
if ( camRight.magnitudeSafe() == 0.0f )
|
||||||
|
{
|
||||||
|
camRight.set( 0.0f, -1.0f, 0.0f );
|
||||||
|
}
|
||||||
|
camRight.normalizeSafe();
|
||||||
|
mCross( camRight, camDir, &camUp );
|
||||||
|
|
||||||
// Limit the camera up vector to keep the billboards
|
// Limit the camera up vector to keep the billboards
|
||||||
// from leaning too far down into the terrain.
|
// from leaning too far down into the terrain.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue