Merge pull request #2162 from Bloodknight/issue_2115

Fixes Issue 2115
This commit is contained in:
Areloch 2018-02-14 10:50:56 -06:00 committed by GitHub
commit 78caec2718
13 changed files with 81 additions and 19 deletions

View file

@ -47,10 +47,12 @@
class RenderPassManager;
class ParticleData;
#define AFX_CAP_PARTICLE_POOLS
#if defined(AFX_CAP_PARTICLE_POOLS)
class afxParticlePoolData;
class afxParticlePool;
#ifdef TORQUE_AFX_ENABLED
#define AFX_CAP_PARTICLE_POOLS
#if defined(AFX_CAP_PARTICLE_POOLS)
class afxParticlePoolData;
class afxParticlePool;
#endif
#endif
//*****************************************************************************

View file

@ -41,7 +41,9 @@
#include "T3D/aiConnection.h"
#endif
#ifdef TORQUE_AFX_ENABLED
#include "afx/arcaneFX.h"
#endif
//----------------------------------------------------------------------------
// Ghost update relative priority values
@ -256,8 +258,10 @@ GameBase::GameBase()
GameBase::~GameBase()
{
#ifdef TORQUE_AFX_ENABLED
if (scope_registered)
arcaneFX::unregisterScopedObject(this);
#endif
}
@ -270,6 +274,7 @@ bool GameBase::onAdd()
// Datablock must be initialized on the server.
// Client datablock are initialized by the initial update.
#ifdef TORQUE_AFX_ENABLED
if (isClientObject())
{
if (scope_id > 0 && !scope_registered)
@ -280,6 +285,10 @@ bool GameBase::onAdd()
if ( mDataBlock && !onNewDataBlock( mDataBlock, false ) )
return false;
}
#else
if ( isServerObject() && mDataBlock && !onNewDataBlock( mDataBlock, false ) )
return false;
#endif
setProcessTick( true );
@ -288,8 +297,10 @@ bool GameBase::onAdd()
void GameBase::onRemove()
{
#ifdef TORQUE_AFX_ENABLED
if (scope_registered)
arcaneFX::unregisterScopedObject(this);
#endif
// EDITOR FEATURE: Remove us from the reload signal of our datablock.
if ( mDataBlock )
mDataBlock->mReloadSignal.remove( this, &GameBase::_onDatablockModified );
@ -314,9 +325,11 @@ bool GameBase::onNewDataBlock( GameBaseData *dptr, bool reload )
if ( !mDataBlock )
return false;
#ifdef TORQUE_AFX_ENABLED
// Don't set mask when new datablock is a temp-clone.
if (mDataBlock->isTempClone())
return true;
#endif
setMaskBits(DataBlockMask);
return true;
@ -570,11 +583,13 @@ U32 GameBase::packUpdate( NetConnection *connection, U32 mask, BitStream *stream
stream->writeFlag(mIsAiControlled);
#endif
#ifdef TORQUE_AFX_ENABLED
if (stream->writeFlag(mask & ScopeIdMask))
{
if (stream->writeFlag(scope_refs > 0))
stream->writeInt(scope_id, SCOPE_ID_BITS);
}
#endif
return retMask;
}
@ -613,11 +628,13 @@ void GameBase::unpackUpdate(NetConnection *con, BitStream *stream)
mTicksSinceLastMove = 0;
mIsAiControlled = stream->readFlag();
#endif
#ifdef TORQUE_AFX_ENABLED
if (stream->readFlag())
{
scope_id = (stream->readFlag()) ? (U16) stream->readInt(SCOPE_ID_BITS) : 0;
scope_refs = 0;
}
#endif
}
void GameBase::onMount( SceneObject *obj, S32 node )

View file

@ -59,7 +59,9 @@
#include "core/stream/fileStream.h"
#endif
#ifdef TORQUE_AFX_ENABLED
#include "afx/arcaneFX.h"
#endif
//----------------------------------------------------------------------------
#define MAX_MOVE_PACKET_SENDS 4
@ -190,12 +192,14 @@ bool GameConnection::client_cache_on = false;
//----------------------------------------------------------------------------
GameConnection::GameConnection()
{
#ifdef TORQUE_AFX_ENABLED
mRolloverObj = NULL;
mPreSelectedObj = NULL;
mSelectedObj = NULL;
mChangedSelectedObj = false;
mPreSelectTimestamp = 0;
zoned_in = false;
#endif
#ifdef AFX_CAP_DATABLOCK_CACHE
client_db_stream = new InfiniteBitStream;
@ -1159,6 +1163,7 @@ void GameConnection::readPacket(BitStream *bstream)
{
mMoveList->clientReadMovePacket(bstream);
#ifdef TORQUE_AFX_ENABLED
// selected object - do we have a change in status?
if (bstream->readFlag())
{
@ -1170,6 +1175,8 @@ void GameConnection::readPacket(BitStream *bstream)
else
setSelectedObj(NULL);
}
#endif
bool hadFlash = mDamageFlash > 0 || mWhiteOut > 0;
mDamageFlash = 0;
mWhiteOut = 0;
@ -1413,6 +1420,7 @@ void GameConnection::writePacket(BitStream *bstream, PacketNotify *note)
// all the damage flash & white out
S32 gIndex = -1;
#ifdef TORQUE_AFX_ENABLED
if (mChangedSelectedObj)
{
S32 gidx;
@ -1441,6 +1449,7 @@ void GameConnection::writePacket(BitStream *bstream, PacketNotify *note)
}
else
bstream->writeFlag(false);
#endif
if (!mControlObject.isNull())
{
@ -2436,6 +2445,7 @@ DefineEngineMethod( GameConnection, getVisibleGhostDistance, F32, (),,
return object->getVisibleGhostDistance();
}
#ifdef TORQUE_AFX_ENABLED
// The object selection code here is, in part, based, on functionality described
// in the following resource:
// Object Selection in Torque by Dave Myers
@ -2564,6 +2574,7 @@ void GameConnection::onDeleteNotify(SimObject* obj)
Parent::onDeleteNotify(obj);
}
#endif
#ifdef AFX_CAP_DATABLOCK_CACHE

View file

@ -385,7 +385,8 @@ protected:
DECLARE_CALLBACK( void, setLagIcon, (bool state) );
DECLARE_CALLBACK( void, onDataBlocksDone, (U32 sequence) );
DECLARE_CALLBACK( void, onFlash, (bool state) );
#ifdef TORQUE_AFX_ENABLED
// GameConnection is modified to keep track of object selections which are used in
// spell targeting. This code stores the current object selection as well as the
// current rollover object beneath the cursor. The rollover object is treated as a
@ -415,7 +416,7 @@ private:
public:
bool isZonedIn() const { return zoned_in; }
void setZonedIn() { zoned_in = true; }
#endif
#ifdef AFX_CAP_DATABLOCK_CACHE
private:
static StringTableEntry server_cache_filename;

View file

@ -44,8 +44,9 @@
#include "T3D/physics/physicsPlugin.h"
#include "T3D/physics/physicsBody.h"
#include "T3D/physics/physicsCollision.h"
#ifdef TORQUE_AFX_ENABLED
#include "afx/ce/afxZodiacMgr.h"
#endif
/// Minimum square size allowed. This is a cheap way to limit the amount
/// of geometry possibly generated by the GroundPlane (vertex buffers have a
@ -362,8 +363,9 @@ void GroundPlane::prepRenderImage( SceneRenderState* state )
createGeometry( state->getCullingFrustum() );
if( mVertexBuffer.isNull() )
return;
#ifdef TORQUE_AFX_ENABLED
afxZodiacMgr::renderGroundPlaneZodiacs(state, this);
#endif
// Add a render instance.
RenderPassManager* pass = state->getRenderPass();

View file

@ -58,8 +58,9 @@
using namespace Torque;
extern bool gEditingMission;
#ifdef TORQUE_AFX_ENABLED
#include "afx/ce/afxZodiacMgr.h"
#endif
IMPLEMENT_CO_NETOBJECT_V1(TSStatic);
@ -136,7 +137,9 @@ TSStatic::TSStatic()
mHasGradients = false;
mInvertGradientRange = false;
mGradientRangeUser.set(0.0f, 180.0f);
#ifdef TORQUE_AFX_ENABLED
afxZodiacData::convertGradientRangeFromDegrees(mGradientRange, mGradientRangeUser);
#endif
}
TSStatic::~TSStatic()
@ -721,9 +724,10 @@ void TSStatic::prepRenderImage( SceneRenderState* state )
}
}
mShapeInstance->render( rdata );
#ifdef TORQUE_AFX_ENABLED
if (!mIgnoreZodiacs && mDecalDetailsPtr != 0)
afxZodiacMgr::renderPolysoupZodiacs(state, this);
#endif
if ( mRenderNormalScalar > 0 )
{
ObjectRenderInst *ri = state->getRenderPass()->allocInst<ObjectRenderInst>();
@ -1399,11 +1403,13 @@ void TSStatic::set_special_typing()
void TSStatic::onStaticModified(const char* slotName, const char*newValue)
{
#ifdef TORQUE_AFX_ENABLED
if (slotName == afxZodiacData::GradientRangeSlot)
{
afxZodiacData::convertGradientRangeFromDegrees(mGradientRange, mGradientRangeUser);
return;
}
#endif
set_special_typing();
}

View file

@ -54,8 +54,10 @@
#include "gfx/gfxTextureManager.h"
#include "sfx/sfxSystem.h"
// Including this header provides access to certain system-level AFX methods.
#ifdef TORQUE_AFX_ENABLED
#include "afx/arcaneFX.h"
#endif
#ifdef TORQUE_PLAYER
// See matching #ifdef in editor/editor.cpp
bool gEditingMission = false;
@ -242,9 +244,11 @@ ConsoleFunctionGroupEnd(Platform);
bool clientProcess(U32 timeDelta)
{
#ifdef TORQUE_AFX_ENABLED
// Required heartbeat call on the client side which must come
// before the advanceTime() calls are made to the scene objects.
arcaneFX::advanceTime(timeDelta);
#endif
bool ret = true;
#ifndef TORQUE_TGB_ONLY

View file

@ -516,9 +516,10 @@ public:
TypeValidator *validator; ///< Validator, if any.
SetDataNotify setDataFn; ///< Set data notify Fn
GetDataNotify getDataFn; ///< Get data notify Fn
WriteDataNotify writeDataFn; ///< Function to determine whether data should be written or not.
bool doNotSubstitute;
bool keepClearSubsOnly;
WriteDataNotify writeDataFn; ///< Function to determine whether data should be written or not.
U32 networkMask;
};
typedef Vector<Field> FieldList;

View file

@ -56,8 +56,9 @@
#include "T3D/physics/physicsBody.h"
#include "T3D/physics/physicsCollision.h"
#include "environment/nodeListManager.h"
#ifdef TORQUE_AFX_ENABLED
#include "afx/ce/afxZodiacMgr.h"
#endif
#define MIN_METERS_PER_SEGMENT 1.0f
#define MIN_NODE_DEPTH 0.25f
@ -829,7 +830,9 @@ void MeshRoad::prepRenderImage( SceneRenderState* state )
// otherwise obey the smShowRoad flag
if ( smShowRoad || !smEditorOpen )
{
#ifdef TORQUE_AFX_ENABLED
afxZodiacMgr::renderMeshRoadZodiacs(state, this);
#endif
MeshRenderInst coreRI;
coreRI.clear();
coreRI.objectToWorld = &MatrixF::Identity;

View file

@ -33,7 +33,9 @@
#include "console/consoleTypes.h"
#include "console/engineAPI.h"
#ifdef TORQUE_AFX_ENABLED
#include "afx/arcaneFX.h"
#endif
IMPLEMENT_CONOBJECT(NetObject);
@ -53,9 +55,11 @@ NetObject::NetObject()
mPrevDirtyList = NULL;
mNextDirtyList = NULL;
mDirtyMaskBits = 0;
#ifdef TORQUE_AFX_ENABLED
scope_id = 0;
scope_refs = 0;
scope_registered = false;
#endif
}
NetObject::~NetObject()
@ -470,6 +474,8 @@ DefineEngineMethod( NetObject, isServerObject, bool, (),,
//{
// return object->isServerObject();
//}
#ifdef TORQUE_AFX_ENABLED
U16 NetObject::addScopeRef()
{
if (scope_refs == 0)
@ -492,6 +498,7 @@ void NetObject::removeScopeRef()
onScopeIdChange();
}
}
#endif
//Networked fields
//------------------------------------------------------------------
@ -587,4 +594,4 @@ DefineEngineMethod(NetObject, clearScopeAlways, void, (), ,
"@brief Clears the scope always flag on this object.\n\n")
{
object->clearScopeAlways();
}
}

View file

@ -50,8 +50,11 @@
#include "gfx/gfxDrawUtil.h"
#ifdef TORQUE_AFX_ENABLED
#include "afx/arcaneFX.h"
#include "afx/ce/afxZodiacMgr.h"
#endif
#include "gfx/gfxTransformSaver.h"
#include "gfx/bitmap/gBitmap.h"
#include "gfx/bitmap/ddsFile.h"
@ -428,7 +431,9 @@ void TerrainBlock::_renderBlock( SceneRenderState *state )
if ( isColorDrawPass )
lm = LIGHTMGR;
#ifdef TORQUE_AFX_ENABLED
bool has_zodiacs = afxZodiacMgr::doesBlockContainZodiacs(state, this);
#endif
for ( U32 i=0; i < renderCells.size(); i++ )
{
TerrCell *cell = renderCells[i];
@ -490,10 +495,11 @@ void TerrainBlock::_renderBlock( SceneRenderState *state )
}
inst->defaultKey = (U32)cell->getMaterials();
#ifdef TORQUE_AFX_ENABLED
if (has_zodiacs)
afxZodiacMgr::renderTerrainZodiacs(state, this, cell);
// Submit it for rendering.
#endif
renderPass->addInst( inst );
}

View file

@ -20,8 +20,7 @@
# IN THE SOFTWARE.
# -----------------------------------------------------------------------------
option(TORQUE_AFX "Enable AFX module" ON)
if(TORQUE_AFX)
# files
addPathRec( "${srcDir}/afx" )
option(TORQUE_AFX_ENABLED "Enable AFX module" ON)
if(TORQUE_AFX_ENABLED)
addPathRec( "${srcDir}/afx" )
endif()

View file

@ -41,6 +41,9 @@
/// Human readable application version string.
#define TORQUE_APP_VERSION_STRING "@TORQUE_APP_VERSION_STRING@"
/// Define me if you want to enable Arcane FX support.
#cmakedefine TORQUE_AFX_ENABLED
/// Define me if you want to enable multithreading support.
#cmakedefine TORQUE_MULTITHREAD