Merge pull request #1018 from eightyeight/ghost-scoping

Add the option to limit ghost scoping range
This commit is contained in:
Daniel Buckmaster 2014-12-21 19:03:02 +11:00
commit 8a104a5222
9 changed files with 63 additions and 5 deletions

View file

@ -40,7 +40,6 @@
// For player object bounds workaround.
#include "T3D/player.h"
extern bool gEditingMission;
@ -113,6 +112,7 @@ SceneManager::SceneManager( bool isClient )
mDisplayTargetResolution( 0, 0 ),
mDefaultRenderPass( NULL ),
mVisibleDistance( 500.f ),
mVisibleGhostDistance( 0 ),
mNearClip( 0.1f ),
mAmbientLightColor( ColorF( 0.1f, 0.1f, 0.1f, 1.0f ) ),
mZoneManager( NULL )

View file

@ -141,6 +141,7 @@ class SceneManager
F32 mVisibleDistance;
F32 mVisibleGhostDistance;
F32 mNearClip;
FogData mFogData;
@ -317,6 +318,9 @@ class SceneManager
/// Returns the default visible distance for the scene.
F32 getVisibleDistance() { return mVisibleDistance; }
void setVisibleGhostDistance( F32 dist ) { mVisibleGhostDistance = dist; }
F32 getVisibleGhostDistance() { return mVisibleGhostDistance;}
/// Used by LevelInfo to set the default near clip plane
/// for rendering the scene.
///

View file

@ -42,6 +42,7 @@
#include "math/mathIO.h"
#include "math/mTransform.h"
#include "T3D/gameBase/gameProcess.h"
#include "T3D/gameBase/gameConnection.h"
IMPLEMENT_CONOBJECT(SceneObject);
@ -664,6 +665,12 @@ static void scopeCallback( SceneObject* obj, void* conPtr )
void SceneObject::onCameraScopeQuery( NetConnection* connection, CameraScopeQuery* query )
{
SceneManager* sceneManager = getSceneManager();
GameConnection* conn = dynamic_cast<GameConnection*> (connection);
if (conn && (query->visibleDistance = conn->getVisibleGhostDistance()) == 0.0f)
if ((query->visibleDistance = sceneManager->getVisibleGhostDistance()) == 0.0f)
query->visibleDistance = sceneManager->getVisibleDistance();
// Object itself is in scope.
if( this->isScopeable() )