mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-11 14:44:36 +00:00
This adds limiting the ghost data to a specific area around the client.
By default it is not included in the build, you must #define GHOSTSCOPING in the torqueConfig.h to enable it. The distance can be set via the mission file by adding visibleGhostDistance = "1000"; Or if it is not set in the mission file it will default to what is defined in torqueConfig.h #defined as GHOSTSCOPING_DEFAULT_DISTANCE_IF_NOT_IN_MISSION The mission default distance can be overridden on a per connection basis by using gameconnection:setVisibleGhostDistance and gameconnection:getVisibleGhostDistance The logic for setting the scoping distance was moved from shapebase in the original design to SceneObject so that it will affect cameras, players, etc.
This commit is contained in:
parent
378a933894
commit
55bdfe5dc3
15 changed files with 138 additions and 1 deletions
|
|
@ -40,7 +40,6 @@
|
|||
// For player object bounds workaround.
|
||||
#include "T3D/player.h"
|
||||
|
||||
|
||||
extern bool gEditingMission;
|
||||
|
||||
|
||||
|
|
@ -113,6 +112,9 @@ SceneManager::SceneManager( bool isClient )
|
|||
mDisplayTargetResolution( 0, 0 ),
|
||||
mDefaultRenderPass( NULL ),
|
||||
mVisibleDistance( 500.f ),
|
||||
#ifdef GHOSTSCOPING
|
||||
mVisibleGhostDistance(GHOSTSCOPING_DEFAULT_DISTANCE_IF_NOT_IN_MISSION),
|
||||
#endif
|
||||
mNearClip( 0.1f ),
|
||||
mAmbientLightColor( ColorF( 0.1f, 0.1f, 0.1f, 1.0f ) ),
|
||||
mZoneManager( NULL )
|
||||
|
|
|
|||
|
|
@ -59,6 +59,8 @@
|
|||
#include "core/util/tSignal.h"
|
||||
#endif
|
||||
|
||||
#include "torqueConfig.h"
|
||||
|
||||
|
||||
class LightManager;
|
||||
class SceneRootZone;
|
||||
|
|
@ -141,6 +143,9 @@ class SceneManager
|
|||
|
||||
F32 mVisibleDistance;
|
||||
|
||||
#ifdef GHOSTSCOPING
|
||||
F32 mVisibleGhostDistance;
|
||||
#endif
|
||||
F32 mNearClip;
|
||||
|
||||
FogData mFogData;
|
||||
|
|
@ -317,6 +322,10 @@ class SceneManager
|
|||
/// Returns the default visible distance for the scene.
|
||||
F32 getVisibleDistance() { return mVisibleDistance; }
|
||||
|
||||
#ifdef GHOSTSCOPING
|
||||
void setVisibleGhostDistance( F32 dist ) { mVisibleGhostDistance = dist; }
|
||||
F32 getVisibleGhostDistance() { return mVisibleGhostDistance;}
|
||||
#endif
|
||||
/// Used by LevelInfo to set the default near clip plane
|
||||
/// for rendering the scene.
|
||||
///
|
||||
|
|
|
|||
|
|
@ -43,6 +43,10 @@
|
|||
#include "math/mTransform.h"
|
||||
#include "T3D/gameBase/gameProcess.h"
|
||||
|
||||
#ifdef GHOSTSCOPING
|
||||
#include "T3D/gameBase/gameConnection.h"
|
||||
#endif
|
||||
|
||||
IMPLEMENT_CONOBJECT(SceneObject);
|
||||
|
||||
ConsoleDocClass( SceneObject,
|
||||
|
|
@ -664,6 +668,16 @@ static void scopeCallback( SceneObject* obj, void* conPtr )
|
|||
|
||||
void SceneObject::onCameraScopeQuery( NetConnection* connection, CameraScopeQuery* query )
|
||||
{
|
||||
|
||||
#ifdef GHOSTSCOPING
|
||||
SceneManager* scenemanager = getSceneManager();
|
||||
GameConnection* conn = dynamic_cast<GameConnection*> (connection);
|
||||
if (conn->getVisibleGhostDistance() == 0.0f)
|
||||
query->visibleDistance = scenemanager->getVisibleGhostDistance();
|
||||
else
|
||||
query->visibleDistance = conn->getVisibleGhostDistance();
|
||||
#endif
|
||||
|
||||
// Object itself is in scope.
|
||||
|
||||
if( this->isScopeable() )
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue