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 e079536122
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 81 additions and 19 deletions

View file

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

View file

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

View file

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

View file

@ -386,6 +386,7 @@ protected:
DECLARE_CALLBACK( void, onDataBlocksDone, (U32 sequence) ); DECLARE_CALLBACK( void, onDataBlocksDone, (U32 sequence) );
DECLARE_CALLBACK( void, onFlash, (bool state) ); DECLARE_CALLBACK( void, onFlash, (bool state) );
#ifdef TORQUE_AFX_ENABLED
// GameConnection is modified to keep track of object selections which are used in // 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 // 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 // current rollover object beneath the cursor. The rollover object is treated as a
@ -415,7 +416,7 @@ private:
public: public:
bool isZonedIn() const { return zoned_in; } bool isZonedIn() const { return zoned_in; }
void setZonedIn() { zoned_in = true; } void setZonedIn() { zoned_in = true; }
#endif
#ifdef AFX_CAP_DATABLOCK_CACHE #ifdef AFX_CAP_DATABLOCK_CACHE
private: private:
static StringTableEntry server_cache_filename; static StringTableEntry server_cache_filename;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -41,6 +41,9 @@
/// Human readable application version string. /// Human readable application version string.
#define TORQUE_APP_VERSION_STRING "@TORQUE_APP_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. /// Define me if you want to enable multithreading support.
#cmakedefine TORQUE_MULTITHREAD #cmakedefine TORQUE_MULTITHREAD