Made some tweaks so I'm happy with it.

* Removed #defines
 * Fall back to using visible distance if ghost distance is not used
 * Removed ghost distance from level files as it will default
 * Renamed mConnectionVisibleDistance for consistency
This commit is contained in:
Daniel Buckmaster 2014-12-07 19:11:10 +11:00
parent 578c4e8f4f
commit a928d142f7
15 changed files with 21 additions and 100 deletions

View file

@ -389,12 +389,7 @@ F32 GameBase::getUpdatePriority(CameraScopeQuery *camInfo, U32 updateMask, S32 u
// will be weighted 1, objects behind will be 0
F32 dot = mDot(pos,camInfo->orientation);
#ifdef GHOSTSCOPING
bool inFov = dot > camInfo->cosFov*1.5f;
#else
bool inFov = dot > camInfo->cosFov;
#endif
bool inFov = dot > camInfo->cosFov * 1.5f;
F32 wFov = inFov? 1.0f: 0;
@ -413,11 +408,7 @@ F32 GameBase::getUpdatePriority(CameraScopeQuery *camInfo, U32 updateMask, S32 u
// Weight by interest.
F32 wInterest;
#ifdef GHOSTSCOPING
if (getTypeMask() & (PlayerObjectType || VehicleObjectType ))
#else
if (getTypeMask() & PlayerObjectType)
#endif
wInterest = 0.75f;
else if (getTypeMask() & ProjectileObjectType)
{

View file

@ -35,13 +35,9 @@
#ifndef _DYNAMIC_CONSOLETYPES_H_
#include "console/dynamicTypes.h"
#endif
#include "torqueConfig.h"
#ifdef GHOSTSCOPING
#ifndef __SCENEMANAGER_H__
#include "scene/sceneManager.h"
#define __SCENEMANAGER_H__
#endif
#endif
class NetConnection;

View file

@ -226,9 +226,7 @@ GameConnection::GameConnection()
mAddYawToAbsRot = false;
mAddPitchToAbsRot = false;
#ifdef GHOSTSCOPING
mConnectionVisibleDistance = 0.0f;
#endif
mVisibleGhostDistance = 0.0f;
clearDisplayDevice();
}
@ -243,16 +241,16 @@ GameConnection::~GameConnection()
}
//----------------------------------------------------------------------------
#ifdef GHOSTSCOPING
void GameConnection::setVisibleGhostDistance(F32 dist)
{
mConnectionVisibleDistance = dist;
mVisibleGhostDistance = dist;
}
F32 GameConnection::getVisibleGhostDistance()
{
return mConnectionVisibleDistance;
return mVisibleGhostDistance;
}
#endif
bool GameConnection::canRemoteCreate()
{
@ -2215,13 +2213,12 @@ DefineEngineMethod( GameConnection, getControlSchemeAbsoluteRotation, bool, (),,
}
DefineEngineMethod( GameConnection, setVisibleGhostDistance, void, (F32 dist),,
"@brief Sets the distance that objects around it will be ghosted.\n\n"
"@brief Sets the distance that objects around it will be ghosted. If set to 0, "
"it may be defined by the LevelInfo.\n\n"
"@dist - is the max distance\n\n"
)
{
#ifdef GHOSTSCOPING
object->setVisibleGhostDistance(dist);
#endif
object->setVisibleGhostDistance(dist);
}
DefineEngineMethod( GameConnection, getVisibleGhostDistance, F32, (),,
@ -2230,9 +2227,5 @@ DefineEngineMethod( GameConnection, getVisibleGhostDistance, F32, (),,
"@return S32 of distance.\n\n"
)
{
#ifdef GHOSTSCOPING
return object->getVisibleGhostDistance();
#else
return 0;
#endif
return object->getVisibleGhostDistance();
}

View file

@ -39,8 +39,6 @@
#include "core/bitVector.h"
#endif
#include "torqueConfig.h"
enum GameConnectionConstants
{
MaxClients = 126,
@ -74,9 +72,7 @@ private:
U32 mMissionCRC; // crc of the current mission file from the server
#ifdef GHOSTSCOPING
F32 mConnectionVisibleDistance;
#endif
F32 mVisibleGhostDistance;
private:
U32 mLastControlRequestTime;
@ -161,10 +157,8 @@ public:
bool canRemoteCreate();
#ifdef GHOSTSCOPING
void setVisibleGhostDistance(F32 dist);
F32 getVisibleGhostDistance();
#endif
private:
/// @name Connection State

View file

@ -79,9 +79,7 @@ static SFXAmbience sDefaultAmbience;
LevelInfo::LevelInfo()
: mNearClip( 0.1f ),
mVisibleDistance( 1000.0f ),
#ifdef GHOSTSCOPING
mVisibleGhostDistance (200.0f),
#endif
mVisibleGhostDistance ( 0 ),
mDecalBias( 0.0015f ),
mCanvasClearColor( 255, 0, 255, 255 ),
mSoundAmbience( NULL ),
@ -118,10 +116,8 @@ void LevelInfo::initPersistFields()
addGroup( "Visibility" );
addField( "nearClip", TypeF32, Offset( mNearClip, LevelInfo ), "Closest distance from the camera's position to render the world." );
addField( "visibleDistance", TypeF32, Offset( mVisibleDistance, LevelInfo ), "Furthest distance fromt he camera's position to render the world." );
#ifdef GHOSTSCOPING
addField( "visibleGhostDistance", TypeF32, Offset( mVisibleGhostDistance, LevelInfo ), "Furthest distance from the camera's position to render players." );
#endif
addField( "visibleDistance", TypeF32, Offset( mVisibleDistance, LevelInfo ), "Furthest distance from the camera's position to render the world." );
addField( "visibleGhostDistance", TypeF32, Offset( mVisibleGhostDistance, LevelInfo ), "Furthest distance from the camera's position to render players. Defaults to visibleDistance." );
addField( "decalBias", TypeF32, Offset( mDecalBias, LevelInfo ),
"NearPlane bias used when rendering Decal and DecalRoad. This should be tuned to the visibleDistance in your level." );
@ -308,9 +304,7 @@ void LevelInfo::_updateSceneGraph()
scene->setNearClip( mNearClip );
scene->setVisibleDistance( mVisibleDistance );
#ifdef GHOSTSCOPING
scene->setVisibleGhostDistance( mVisibleGhostDistance );
#endif
gDecalBias = mDecalBias;

View file

@ -36,8 +36,6 @@
#include "sfx/sfxCommon.h"
#endif
#include "torqueConfig.h"
class SFXAmbience;
class SFXSoundscape;
@ -56,9 +54,8 @@ class LevelInfo : public NetObject
F32 mVisibleDistance;
#ifdef GHOSTSCOPING
F32 mVisibleGhostDistance;
#endif
F32 mDecalBias;
ColorI mCanvasClearColor;