Merge branch 'development' of https://github.com/GarageGames/Torque3D into memberMess

# Conflicts:
#	Engine/source/sfx/sfxSystem.cpp
This commit is contained in:
Azaezel 2018-04-23 10:08:14 -05:00
commit 13334b4d5c
22 changed files with 72 additions and 71 deletions

View file

@ -131,7 +131,7 @@ bool DecalDataFile::write( Stream& stream )
{
DecalInstance *inst = allDecals[i];
dataIter = find( allDatablocks.begin(), allDatablocks.end(), inst->mDataBlock );
dataIter = T3D::find( allDatablocks.begin(), allDatablocks.end(), inst->mDataBlock );
U8 dataIndex = dataIter - allDatablocks.begin();
stream.write( dataIndex );

View file

@ -47,7 +47,7 @@ WindEmitter::WindEmitter()
WindEmitter::~WindEmitter()
{
WindEmitterList::iterator iter = find( smAllEmitters.begin(), smAllEmitters.end(), this );
WindEmitterList::iterator iter = T3D::find( smAllEmitters.begin(), smAllEmitters.end(), this );
smAllEmitters.erase( iter );
}

View file

@ -330,7 +330,7 @@ void ClippedPolyList::cullUnusedVerts()
for ( vIter = mVertexList.begin(); vIter != mVertexList.end(); vIter++, i++ )
{
// Is this vertex used?
iNextIter = find( mIndexList.begin(), mIndexList.end(), i );
iNextIter = T3D::find( mIndexList.begin(), mIndexList.end(), i );
if ( iNextIter != mIndexList.end() )
continue;
@ -346,7 +346,7 @@ void ClippedPolyList::cullUnusedVerts()
for ( nextVIter = vIter + 1; nextVIter != mVertexList.end(); nextVIter++, n++ )
{
iNextIter = find( mIndexList.begin(), mIndexList.end(), n );
iNextIter = T3D::find( mIndexList.begin(), mIndexList.end(), n );
// If we found a used vertex
// grab its index for later use

View file

@ -108,7 +108,7 @@ private:
std::tie(std::get<I + (sizeof...(ArgTs) - sizeof...(TailTs))>(args)...) = defaultArgs;
}
#if _MSC_VER >= 1910
#if defined(_MSC_VER) && (_MSC_VER >= 1910)
template<typename ...TailTs>
struct DodgyVCHelper
{

View file

@ -33,7 +33,7 @@ String SimObjectList::smSortScriptCallbackFn;
bool SimObjectList::pushBack(SimObject* obj)
{
if (find(begin(),end(),obj) == end())
if (T3D::find(begin(),end(),obj) == end())
{
push_back(obj);
return true;
@ -44,7 +44,7 @@ bool SimObjectList::pushBack(SimObject* obj)
bool SimObjectList::pushBackForce(SimObject* obj)
{
iterator itr = find(begin(),end(),obj);
iterator itr = T3D::find(begin(),end(),obj);
if (itr == end())
{
push_back(obj);
@ -64,7 +64,7 @@ bool SimObjectList::pushBackForce(SimObject* obj)
bool SimObjectList::pushFront(SimObject* obj)
{
if (find(begin(),end(),obj) == end())
if (T3D::find(begin(),end(),obj) == end())
{
push_front(obj);
return true;
@ -75,7 +75,7 @@ bool SimObjectList::pushFront(SimObject* obj)
bool SimObjectList::remove(SimObject* obj)
{
iterator ptr = find(begin(),end(),obj);
iterator ptr = T3D::find(begin(),end(),obj);
if (ptr != end())
{
erase(ptr);
@ -87,7 +87,7 @@ bool SimObjectList::remove(SimObject* obj)
bool SimObjectList::removeStable(SimObject* obj)
{
iterator ptr = find(begin(),end(),obj);
iterator ptr = T3D::find(begin(),end(),obj);
if (ptr != end())
{
erase(ptr);

View file

@ -154,9 +154,9 @@ class SimSet : public SimObject, public TamlChildren
value operator[] (S32 index) { return mObjectList[U32(index)]; }
inline iterator find( iterator first, iterator last, SimObject *obj)
{ return ::find(first, last, obj); }
{ return T3D::find(first, last, obj); }
inline iterator find(SimObject *obj)
{ return ::find(begin(), end(), obj); }
{ return T3D::find(begin(), end(), obj); }
/// Reorder the position of "obj" to either be the last object in the list or, if
/// "target" is given, to come before "target" in the list of children.

View file

@ -23,40 +23,41 @@
#ifndef _TALGORITHM_H_
#define _TALGORITHM_H_
/// Finds the first matching value within the container
/// returning the the element or last if its not found.
template <class Iterator, class Value>
Iterator find(Iterator first, Iterator last, Value value)
namespace T3D
{
while (first != last && *first != value)
++first;
return first;
/// Finds the first matching value within the container
/// returning the the element or last if its not found.
template <class Iterator, class Value>
Iterator find(Iterator first, Iterator last, Value value)
{
while (first != last && *first != value)
++first;
return first;
}
/// Exchanges the values of the two elements.
template <typename T>
inline void swap(T &left, T &right)
{
T temp = right;
right = left;
left = temp;
}
/// Steps thru the elements of an array calling detete for each.
template <class Iterator, class Functor>
void for_each(Iterator first, Iterator last, Functor func)
{
for (; first != last; first++)
func(*first);
}
/// Functor for deleting a pointer.
/// @see for_each
struct delete_pointer
{
template <typename T>
void operator()(T *ptr) { delete ptr; }
};
}
/// Exchanges the values of the two elements.
template <typename T>
inline void swap( T &left, T &right )
{
T temp = right;
right = left;
left = temp;
}
/// Steps thru the elements of an array calling detete for each.
template <class Iterator, class Functor>
void for_each( Iterator first, Iterator last, Functor func )
{
for ( ; first != last; first++ )
func( *first );
}
/// Functor for deleting a pointer.
/// @see for_each
struct delete_pointer
{
template <typename T>
void operator()(T *ptr){ delete ptr;}
};
#endif //_TALGORITHM_H_

View file

@ -213,7 +213,7 @@ bool ForestData::write( const char *path )
Vector<ForestItem>::const_iterator iter = items.begin();
for ( ; iter != items.end(); iter++ )
{
U8 dataIndex = find( allDatablocks.begin(), allDatablocks.end(), iter->getData() ) - allDatablocks.begin();
U8 dataIndex = T3D::find( allDatablocks.begin(), allDatablocks.end(), iter->getData() ) - allDatablocks.begin();
stream.write( dataIndex );
@ -770,7 +770,7 @@ U32 ForestData::getDatablocks( Vector<ForestItemData*> *outVector ) const
{
ForestItemData *data = item->getData();
if ( find( outVector->begin(), outVector->end(), data ) != outVector->end() )
if (T3D::find( outVector->begin(), outVector->end(), data ) != outVector->end() )
continue;
count++;

View file

@ -85,7 +85,7 @@ void ForestWindMgr::addEmitter( ForestWindEmitter *emitter )
void ForestWindMgr::removeEmitter( ForestWindEmitter *emitter )
{
ForestWindEmitterList::iterator iter = find( mEmitters.begin(),
ForestWindEmitterList::iterator iter = T3D::find( mEmitters.begin(),
mEmitters.end(),
emitter );
@ -161,7 +161,7 @@ void ForestWindMgr::processTick()
PROFILE_SCOPE( ForestWindMgr_AdvanceTime_SwapSources );
AssertFatal( mPrevSources->isEmpty(), "prev sources not empty!" );
swap( mSources, mPrevSources );
T3D::swap( mSources, mPrevSources );
AssertFatal( mSources->isEmpty(), "swap failed!" );
}

View file

@ -1015,7 +1015,7 @@ void GuiEditCtrl::removeSelection( GuiControl* ctrl )
{
if( selectionContains( ctrl ) )
{
Vector< GuiControl* >::iterator i = ::find( mSelectedControls.begin(), mSelectedControls.end(), ctrl );
Vector< GuiControl* >::iterator i = T3D::find( mSelectedControls.begin(), mSelectedControls.end(), ctrl );
if ( i != mSelectedControls.end() )
mSelectedControls.erase( i );

View file

@ -103,7 +103,7 @@ ProcessedMaterial::ProcessedMaterial()
ProcessedMaterial::~ProcessedMaterial()
{
for_each( mPasses.begin(), mPasses.end(), delete_pointer() );
T3D::for_each( mPasses.begin(), mPasses.end(), T3D::delete_pointer() );
}
void ProcessedMaterial::_setBlendState(Material::BlendOp blendOp, GFXStateBlockDesc& desc )

View file

@ -228,7 +228,7 @@ void PolyhedronBoxIntersector< Polyhedron >::_preprocess( const MatrixF& objToWo
Point2F p = _project( i, v2 ); // Second point on line.
if( frontFace != 0 )
swap( p, q );
T3D::swap( p, q );
Point2F normal( - ( p.y - q.y ), p.x - q.x );
normal.normalize();

View file

@ -441,7 +441,7 @@ U32 PlaneSet< T >::clipPolygon( const Point3F* inVertices, U32 inNumVertices, Po
// Make the output of the last iteration the
// input of this iteration.
swap( tempPolygon, clippedPolygon );
T3D::swap( tempPolygon, clippedPolygon );
numTempPolygonVertices = numClippedPolygonVertices;
if( maxOutVertices < numTempPolygonVertices + 1 )

View file

@ -1706,7 +1706,7 @@ bool clipFrustumByPolygon( const Point3F* points, U32 numPoints, const RectI& vi
// Make the output of the last iteration the
// input of this iteration.
swap( tempPolygon, clippedPolygon );
T3D::swap( tempPolygon, clippedPolygon );
numTempPolygonVertices = numClippedPolygonVertices;
// Clip our current remainder of the original polygon

View file

@ -198,7 +198,7 @@ bool PostEffectManager::_addEffect( PostEffect *effect )
bool PostEffectManager::_removeEffect( PostEffect *effect )
{
// Check the end of frame list.
EffectVector::iterator iter = find( mEndOfFrameList.begin(), mEndOfFrameList.end(), effect );
EffectVector::iterator iter = T3D::find( mEndOfFrameList.begin(), mEndOfFrameList.end(), effect );
if ( iter != mEndOfFrameList.end() )
{
mEndOfFrameList.erase( iter );
@ -206,7 +206,7 @@ bool PostEffectManager::_removeEffect( PostEffect *effect )
}
// Check the diffuse list.
iter = find( mAfterDiffuseList.begin(), mAfterDiffuseList.end(), effect );
iter = T3D::find( mAfterDiffuseList.begin(), mAfterDiffuseList.end(), effect );
if ( iter != mAfterDiffuseList.end() )
{
mAfterDiffuseList.erase( iter );
@ -218,7 +218,7 @@ bool PostEffectManager::_removeEffect( PostEffect *effect )
for( ; mapIter != mAfterBinMap.end(); mapIter++ )
{
EffectVector &effects = mapIter->value;
iter = find( effects.begin(), effects.end(), effect );
iter = T3D::find( effects.begin(), effects.end(), effect );
if ( iter != effects.end() )
{
effects.erase( iter );
@ -230,7 +230,7 @@ bool PostEffectManager::_removeEffect( PostEffect *effect )
for( ; mapIter != mBeforeBinMap.end(); mapIter++ )
{
EffectVector &effects = mapIter->value;
iter = find( effects.begin(), effects.end(), effect );
iter = T3D::find( effects.begin(), effects.end(), effect );
if ( iter != effects.end() )
{
effects.erase( iter );

View file

@ -183,7 +183,7 @@ bool SceneContainer::removeObject(SceneObject* obj)
// Remove water and physical zone types from the special vector.
if ( obj->getTypeMask() & ( WaterObjectType | PhysicalZoneObjectType ) )
{
Vector<SceneObject*>::iterator iter = find( mWaterAndZones.begin(), mWaterAndZones.end(), obj );
Vector<SceneObject*>::iterator iter = T3D::find( mWaterAndZones.begin(), mWaterAndZones.end(), obj );
if( iter != mTerrains.end() )
mWaterAndZones.erase_fast(iter);
}
@ -191,7 +191,7 @@ bool SceneContainer::removeObject(SceneObject* obj)
// Remove terrain objects from special vector.
if( obj->getTypeMask() & TerrainObjectType )
{
Vector< SceneObject* >::iterator iter = find( mTerrains.begin(), mTerrains.end(), obj );
Vector< SceneObject* >::iterator iter = T3D::find( mTerrains.begin(), mTerrains.end(), obj );
if( iter != mTerrains.end() )
mTerrains.erase_fast(iter);
}

View file

@ -142,7 +142,7 @@ void SFXController::_compileList( SFXPlayList* playList )
{
// Randomly exchange slots in the list.
for( U32 i = 0; i < SFXPlayList::NUM_SLOTS; ++ i )
swap( slotList[ gRandGen.randI( 0, SFXPlayList::NUM_SLOTS - 1 ) ], slotList[ i ] );
T3D::swap( slotList[ gRandGen.randI( 0, SFXPlayList::NUM_SLOTS - 1 ) ], slotList[ i ] );
}
break;

View file

@ -165,7 +165,7 @@ void SFXDevice::_removeBuffer( SFXBuffer* buffer )
{
AssertFatal( buffer, "SFXDevice::_removeBuffer() - Got a null buffer!" );
BufferIterator iter = find( mBuffers.begin(), mBuffers.end(), buffer );
BufferIterator iter = T3D::find( mBuffers.begin(), mBuffers.end(), buffer );
if( iter != mBuffers.end() )
{
SFXBuffer* curBuf = *iter;
@ -201,7 +201,7 @@ void SFXDevice::_removeVoice( SFXVoice* voice )
{
AssertFatal( voice, "SFXDevice::_removeVoice() - Got null voice!" );
VoiceIterator iter = find( mVoices.begin(), mVoices.end(), voice );
VoiceIterator iter = T3D::find( mVoices.begin(), mVoices.end(), voice );
if( iter != mVoices.end() )
{
mStatNumVoices --;

View file

@ -647,7 +647,7 @@ void SFXSystem::deleteWhenStopped( SFXSource* source )
// If the source isn't already on the play-once source list,
// put it there now.
Vector< SFXSource* >::iterator iter = find( mPlayOnceSources.begin(), mPlayOnceSources.end(), source );
Vector< SFXSource* >::iterator iter = T3D::find( mPlayOnceSources.begin(), mPlayOnceSources.end(), source );
if( iter == mPlayOnceSources.end() )
mPlayOnceSources.push_back( source );
}
@ -674,7 +674,7 @@ void SFXSystem::_onRemoveSource( SFXSource* source )
{
// Check if it was a play once source.
Vector< SFXSource* >::iterator sourceIter = find( mPlayOnceSources.begin(), mPlayOnceSources.end(), source );
Vector< SFXSource* >::iterator sourceIter = T3D::find( mPlayOnceSources.begin(), mPlayOnceSources.end(), source );
if (sourceIter != mPlayOnceSources.end() )
mPlayOnceSources.erase_fast(sourceIter);
@ -684,7 +684,7 @@ void SFXSystem::_onRemoveSource( SFXSource* source )
if( dynamic_cast< SFXSound* >( source ) )
{
SFXSoundVector::iterator vectorIter = find( mSounds.begin(), mSounds.end(), static_cast< SFXSound* >( source ) );
SFXSoundVector::iterator vectorIter = T3D::find( mSounds.begin(), mSounds.end(), static_cast< SFXSound* >( source ) );
if(vectorIter != mSounds.end() )
mSounds.erase_fast(vectorIter);

View file

@ -289,7 +289,7 @@ void TerrainCellMaterial::init( TerrainBlock *block,
// The pass failed to be generated... give up.
mPasses.last().materials.clear();
mPasses.clear();
for_each( materials.begin(), materials.end(), delete_pointer() );
T3D::for_each( materials.begin(), materials.end(), T3D::delete_pointer() );
return;
}
@ -298,7 +298,7 @@ void TerrainCellMaterial::init( TerrainBlock *block,
}
// Cleanup any remaining matinfo.
for_each( materials.begin(), materials.end(), delete_pointer() );
T3D::for_each( materials.begin(), materials.end(), T3D::delete_pointer() );
// If we have attached mats then update them too.
if ( mDeferredMat )

View file

@ -101,7 +101,7 @@ TSLastDetail::~TSLastDetail()
mMaterial->deleteObject();
// Remove ourselves from the list.
Vector<TSLastDetail*>::iterator iter = find( smLastDetails.begin(), smLastDetails.end(), this );
Vector<TSLastDetail*>::iterator iter = T3D::find( smLastDetails.begin(), smLastDetails.end(), this );
smLastDetails.erase( iter );
}

View file

@ -477,7 +477,7 @@ if(TORQUE_SDL)
set(SDL_SHARED ON CACHE BOOL "Build a shared version of the library" FORCE)
set(SDL_STATIC OFF CACHE BOOL "Build a static version of the library" FORCE)
endif()
add_subdirectory( ${libDir}/sdl ${CMAKE_CURRENT_BINARY_DIR}/sdl2)
add_subdirectory( ${libDir}/sdl ${CMAKE_CURRENT_BINARY_DIR}/sdl2 EXCLUDE_FROM_ALL)
link_directories( ${libDir}/sdl ${CMAKE_CURRENT_BINARY_DIR}/sdl2)
endif()