mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-13 23:54:35 +00:00
Fix for Issue #128 for Player First Person Shadow
IMPROVEMENT: By default we stop rendering all Player shadows when in first person and 'renderFirstPerson' is disabled. Added flag 'firstPersonShadows' to disable this behavior.
This commit is contained in:
parent
4290c1d985
commit
88bb577c82
2 changed files with 16 additions and 1 deletions
|
|
@ -252,6 +252,7 @@ PlayerData::PlayerData()
|
||||||
shadowProjectionDistance = 14.0f;
|
shadowProjectionDistance = 14.0f;
|
||||||
|
|
||||||
renderFirstPerson = true;
|
renderFirstPerson = true;
|
||||||
|
firstPersonShadows = false;
|
||||||
|
|
||||||
// Used for third person image rendering
|
// Used for third person image rendering
|
||||||
imageAnimPrefix = StringTable->insert("");
|
imageAnimPrefix = StringTable->insert("");
|
||||||
|
|
@ -679,6 +680,9 @@ void PlayerData::initPersistFields()
|
||||||
addField( "renderFirstPerson", TypeBool, Offset(renderFirstPerson, PlayerData),
|
addField( "renderFirstPerson", TypeBool, Offset(renderFirstPerson, PlayerData),
|
||||||
"@brief Flag controlling whether to render the player shape in first person view.\n\n" );
|
"@brief Flag controlling whether to render the player shape in first person view.\n\n" );
|
||||||
|
|
||||||
|
addField( "firstPersonShadows", TypeBool, Offset(firstPersonShadows, PlayerData),
|
||||||
|
"@brief Forces shadows to be rendered in first person when renderFirstPerson is disabled. Defaults to false.\n\n" );
|
||||||
|
|
||||||
addField( "minLookAngle", TypeF32, Offset(minLookAngle, PlayerData),
|
addField( "minLookAngle", TypeF32, Offset(minLookAngle, PlayerData),
|
||||||
"@brief Lowest angle (in radians) the player can look.\n\n"
|
"@brief Lowest angle (in radians) the player can look.\n\n"
|
||||||
"@note An angle of zero is straight ahead, with positive up and negative down." );
|
"@note An angle of zero is straight ahead, with positive up and negative down." );
|
||||||
|
|
@ -1180,7 +1184,8 @@ void PlayerData::packData(BitStream* stream)
|
||||||
Parent::packData(stream);
|
Parent::packData(stream);
|
||||||
|
|
||||||
stream->writeFlag(renderFirstPerson);
|
stream->writeFlag(renderFirstPerson);
|
||||||
|
stream->writeFlag(firstPersonShadows);
|
||||||
|
|
||||||
stream->write(minLookAngle);
|
stream->write(minLookAngle);
|
||||||
stream->write(maxLookAngle);
|
stream->write(maxLookAngle);
|
||||||
stream->write(maxFreelookAngle);
|
stream->write(maxFreelookAngle);
|
||||||
|
|
@ -1361,6 +1366,7 @@ void PlayerData::unpackData(BitStream* stream)
|
||||||
Parent::unpackData(stream);
|
Parent::unpackData(stream);
|
||||||
|
|
||||||
renderFirstPerson = stream->readFlag();
|
renderFirstPerson = stream->readFlag();
|
||||||
|
firstPersonShadows = stream->readFlag();
|
||||||
|
|
||||||
stream->read(&minLookAngle);
|
stream->read(&minLookAngle);
|
||||||
stream->read(&maxLookAngle);
|
stream->read(&maxLookAngle);
|
||||||
|
|
@ -6947,6 +6953,11 @@ void Player::prepRenderImage( SceneRenderState* state )
|
||||||
GameConnection* connection = GameConnection::getConnectionToServer();
|
GameConnection* connection = GameConnection::getConnectionToServer();
|
||||||
if( connection && connection->getControlObject() == this && connection->isFirstPerson() )
|
if( connection && connection->getControlObject() == this && connection->isFirstPerson() )
|
||||||
{
|
{
|
||||||
|
// If we're first person and we are not rendering the player
|
||||||
|
// then disable all shadow rendering... a floating gun shadow sucks.
|
||||||
|
if ( state->isShadowPass() && !mDataBlock->renderFirstPerson && !mDataBlock->firstPersonShadows )
|
||||||
|
return;
|
||||||
|
|
||||||
renderPlayer = mDataBlock->renderFirstPerson || !state->isDiffusePass();
|
renderPlayer = mDataBlock->renderFirstPerson || !state->isDiffusePass();
|
||||||
|
|
||||||
if( !sRenderMyPlayer )
|
if( !sRenderMyPlayer )
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,10 @@ struct PlayerData: public ShapeBaseData {
|
||||||
};
|
};
|
||||||
bool renderFirstPerson; ///< Render the player shape in first person
|
bool renderFirstPerson; ///< Render the player shape in first person
|
||||||
|
|
||||||
|
/// Render shadows while in first person when
|
||||||
|
/// renderFirstPerson is disabled.
|
||||||
|
bool firstPersonShadows;
|
||||||
|
|
||||||
StringTableEntry imageAnimPrefix; ///< Passed along to mounted images to modify
|
StringTableEntry imageAnimPrefix; ///< Passed along to mounted images to modify
|
||||||
/// animation sequences played in third person. [optional]
|
/// animation sequences played in third person. [optional]
|
||||||
bool allowImageStateAnimation; ///< When true a new thread is added to the player to allow for
|
bool allowImageStateAnimation; ///< When true a new thread is added to the player to allow for
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue