diff --git a/Engine/lib/convexDecomp/NvRemoveTjunctions.cpp b/Engine/lib/convexDecomp/NvRemoveTjunctions.cpp index 67ecd287c..f9ac21ce8 100644 --- a/Engine/lib/convexDecomp/NvRemoveTjunctions.cpp +++ b/Engine/lib/convexDecomp/NvRemoveTjunctions.cpp @@ -67,6 +67,9 @@ NvRemoveTjunctions.cpp : A code snippet to remove tjunctions from a triangle mes #include "NvHashMap.h" #include "NvRemoveTjunctions.h" #include "NvFloatMath.h" +#ifdef LINUX + #include +#endif #pragma warning(disable:4189) diff --git a/Engine/source/T3D/physics/bullet/btWorld.cpp b/Engine/source/T3D/physics/bullet/btWorld.cpp index 3ca43d793..9ef5d8a50 100644 --- a/Engine/source/T3D/physics/bullet/btWorld.cpp +++ b/Engine/source/T3D/physics/bullet/btWorld.cpp @@ -33,7 +33,11 @@ #include "console/consoleTypes.h" #include "scene/sceneRenderState.h" #include "T3D/gameBase/gameProcess.h" - +#ifdef _WIN32 +#include "BulletMultiThreaded/Win32ThreadSupport.h" +#elif defined (USE_PTHREADS) +#include "BulletMultiThreaded/PosixThreadSupport.h" +#endif BtWorld::BtWorld() : mProcessList( NULL ), diff --git a/Engine/source/console/dynamicTypes.h b/Engine/source/console/dynamicTypes.h index f03beead2..a10ab0def 100644 --- a/Engine/source/console/dynamicTypes.h +++ b/Engine/source/console/dynamicTypes.h @@ -252,7 +252,7 @@ const EngineTypeInfo* _MAPTYPE() { return TYPE< T >(); } extern S32 type; \ extern const char* castConsoleTypeToString( _ConsoleConstType< nativeType >::ConstType &arg ); \ extern bool castConsoleTypeFromString( nativeType &arg, const char *str ); \ - template<> extern S32 TYPEID< nativeType >(); + template<> S32 TYPEID< nativeType >(); #define DefineUnmappedConsoleType( type, nativeType ) \ DefineConsoleType( type, nativeType ) \ diff --git a/Engine/source/console/engineTypes.h b/Engine/source/console/engineTypes.h index 397d67c16..208a16322 100644 --- a/Engine/source/console/engineTypes.h +++ b/Engine/source/console/engineTypes.h @@ -416,7 +416,7 @@ namespace _Private { #define _DECLARE_TYPE( type ) \ - template<> extern const EngineTypeInfo* TYPE< type >(); \ + template<> const EngineTypeInfo* TYPE< type >(); \ template<> struct _SCOPE< type > { \ EngineExportScope& operator()() const { \ return *reinterpret_cast< EngineExportScope* >( \ diff --git a/Engine/source/gui/controls/guiTreeViewCtrl.cpp b/Engine/source/gui/controls/guiTreeViewCtrl.cpp index 4bd98b640..5e71b7188 100644 --- a/Engine/source/gui/controls/guiTreeViewCtrl.cpp +++ b/Engine/source/gui/controls/guiTreeViewCtrl.cpp @@ -33,7 +33,9 @@ #include "platform/event.h" #include "gfx/gfxDrawUtil.h" #include "gui/controls/guiTextEditCtrl.h" -#include "gui/editor/editorFunctions.h" +#ifdef TORQUE_TOOLS + #include "gui/editor/editorFunctions.h" +#endif #include "console/engineAPI.h" @@ -4042,7 +4044,10 @@ void GuiTreeViewCtrl::onRenderCell(Point2I offset, Point2I cell, bool, bool ) // If this item is a VirtualParent we can use the generic SimGroup123 icons. // However if there is already an icon in the EditorIconRegistry for this // exact class (not counting parent class icons) we want to use that instead. - bool hasClassIcon = gEditorIcons.hasIconNoRecurse( pObject ); + bool hasClassIcon = false; +#ifdef TORQUE_TOOLS + hasClassIcon = gEditorIcons.hasIconNoRecurse( pObject ); +#endif // draw the icon associated with the item if ( !hasClassIcon && item->mState.test(Item::VirtualParent)) @@ -5280,7 +5285,10 @@ void GuiTreeViewCtrl::onRenameValidate() if ( mRenameInternal ) obj->setInternalName( data ); - else if ( validateObjectName( data, obj ) ) + else +#ifdef TORQUE_TOOLS + if ( validateObjectName( data, obj ) ) +#endif obj->assignName( data ); } diff --git a/Engine/source/lighting/advanced/advancedLightingFeatures.cpp b/Engine/source/lighting/advanced/advancedLightingFeatures.cpp index 159eb113a..fb61494b5 100644 --- a/Engine/source/lighting/advanced/advancedLightingFeatures.cpp +++ b/Engine/source/lighting/advanced/advancedLightingFeatures.cpp @@ -31,7 +31,7 @@ #include "gfx/gfxDevice.h" #include "core/util/safeDelete.h" -#ifndef TORQUE_OS_MAC +#if !defined( TORQUE_OS_MAC ) && !defined( TORQUE_OS_LINUX ) # include "lighting/advanced/hlsl/gBufferConditionerHLSL.h" # include "lighting/advanced/hlsl/advancedLightingFeaturesHLSL.h" #else @@ -54,7 +54,7 @@ void AdvancedLightingFeatures::registerFeatures( const GFXFormat &prepassTargetF if(GFX->getAdapterType() == OpenGL) { -#ifdef TORQUE_OS_MAC +#if defined( TORQUE_OS_MAC ) || defined( TORQUE_OS_LINUX ) cond = new GBufferConditionerGLSL( prepassTargetFormat ); FEATUREMGR->registerFeature(MFT_PrePassConditioner, cond); FEATUREMGR->registerFeature(MFT_RTLighting, new DeferredRTLightingFeatGLSL()); @@ -66,7 +66,7 @@ void AdvancedLightingFeatures::registerFeatures( const GFXFormat &prepassTargetF } else { -#ifndef TORQUE_OS_MAC +#if !defined( TORQUE_OS_MAC ) && !defined( TORQUE_OS_LINUX ) cond = new GBufferConditionerHLSL( prepassTargetFormat, GBufferConditionerHLSL::ViewSpace ); FEATUREMGR->registerFeature(MFT_PrePassConditioner, cond); FEATUREMGR->registerFeature(MFT_RTLighting, new DeferredRTLightingFeatHLSL()); diff --git a/Engine/source/lighting/basic/basicLightManager.cpp b/Engine/source/lighting/basic/basicLightManager.cpp index 18db77cb6..0ca0e0bde 100644 --- a/Engine/source/lighting/basic/basicLightManager.cpp +++ b/Engine/source/lighting/basic/basicLightManager.cpp @@ -49,7 +49,7 @@ #include "lighting/common/projectedShadow.h" -#ifdef TORQUE_OS_MAC +#if defined( TORQUE_OS_MAC ) || defined( TORQUE_OS_LINUX ) #include "shaderGen/GLSL/shaderFeatureGLSL.h" #include "shaderGen/GLSL/bumpGLSL.h" #include "shaderGen/GLSL/pixSpecularGLSL.h" @@ -167,7 +167,7 @@ void BasicLightManager::activate( SceneManager *sceneManager ) if( GFX->getAdapterType() == OpenGL ) { - #ifdef TORQUE_OS_MAC + #if defined( TORQUE_OS_MAC ) || defined( TORQUE_OS_LINUX ) FEATUREMGR->registerFeature( MFT_LightMap, new LightmapFeatGLSL ); FEATUREMGR->registerFeature( MFT_ToneMap, new TonemapFeatGLSL ); FEATUREMGR->registerFeature( MFT_NormalMap, new BumpFeatGLSL ); @@ -177,7 +177,7 @@ void BasicLightManager::activate( SceneManager *sceneManager ) } else { - #ifndef TORQUE_OS_MAC + #if !defined( TORQUE_OS_MAC ) && !defined( TORQUE_OS_LINUX ) FEATUREMGR->registerFeature( MFT_LightMap, new LightmapFeatHLSL ); FEATUREMGR->registerFeature( MFT_ToneMap, new TonemapFeatHLSL ); FEATUREMGR->registerFeature( MFT_NormalMap, new BumpFeatHLSL ); diff --git a/Engine/source/lighting/common/lightMapParams.cpp b/Engine/source/lighting/common/lightMapParams.cpp index bc161cb32..e7c2f39de 100644 --- a/Engine/source/lighting/common/lightMapParams.cpp +++ b/Engine/source/lighting/common/lightMapParams.cpp @@ -22,8 +22,17 @@ #include "lighting/common/lightMapParams.h" #include "core/stream/bitStream.h" +#include "core/module.h" -const LightInfoExType LightMapParams::Type( "LightMapParams" ); +MODULE_BEGIN( LightMapParams ) +MODULE_INIT_AFTER( ShadowMapParams ) +MODULE_INIT +{ + LightMapParams::Type = "LightMapParams"; +} +MODULE_END; + +LightInfoExType LightMapParams::Type( "" ); LightMapParams::LightMapParams( LightInfo *light ) : representedInLightmap(false), diff --git a/Engine/source/lighting/common/lightMapParams.h b/Engine/source/lighting/common/lightMapParams.h index fa83c063c..7a1b2bcec 100644 --- a/Engine/source/lighting/common/lightMapParams.h +++ b/Engine/source/lighting/common/lightMapParams.h @@ -34,7 +34,7 @@ public: virtual ~LightMapParams(); /// The LightInfoEx hook type. - static const LightInfoExType Type; + static LightInfoExType Type; // LightInfoEx virtual void set( const LightInfoEx *ex ); diff --git a/Engine/source/lighting/lightManager.cpp b/Engine/source/lighting/lightManager.cpp index fb7660c04..c26ec3db4 100644 --- a/Engine/source/lighting/lightManager.cpp +++ b/Engine/source/lighting/lightManager.cpp @@ -314,7 +314,7 @@ void LightManager::_update4LightConsts( const SceneData &sgData, // NOTE: We haven't ported the lighting shaders on OSX // to the optimized HLSL versions. - #ifdef TORQUE_OS_MAC + #if defined( TORQUE_OS_MAC ) || defined( TORQUE_OS_LINUX ) static AlignedArray lightPositions( 4, sizeof( Point4F ) ); #else static AlignedArray lightPositions( 3, sizeof( Point4F ) ); @@ -342,7 +342,7 @@ void LightManager::_update4LightConsts( const SceneData &sgData, if ( !light ) break; - #ifdef TORQUE_OS_MAC + #if defined( TORQUE_OS_MAC ) || defined( TORQUE_OS_LINUX ) lightPositions[i] = light->getPosition(); @@ -381,7 +381,7 @@ void LightManager::_update4LightConsts( const SceneData &sgData, shaderConsts->setSafe( lightDiffuseSC, lightColors ); shaderConsts->setSafe( lightInvRadiusSqSC, lightInvRadiusSq ); - #ifndef TORQUE_OS_MAC + #if !defined( TORQUE_OS_MAC ) && !defined( TORQUE_OS_LINUX ) shaderConsts->setSafe( lightSpotDirSC, lightSpotDirs ); shaderConsts->setSafe( lightSpotAngleSC, lightSpotAngle ); diff --git a/Engine/source/lighting/shadowMap/lightShadowMap.cpp b/Engine/source/lighting/shadowMap/lightShadowMap.cpp index 7e7e03242..a25b7e706 100644 --- a/Engine/source/lighting/shadowMap/lightShadowMap.cpp +++ b/Engine/source/lighting/shadowMap/lightShadowMap.cpp @@ -34,7 +34,7 @@ #include "materials/baseMatInstance.h" #include "scene/sceneManager.h" #include "scene/sceneRenderState.h" -#include "scene/zones/SceneZoneSpace.h" +#include "scene/zones/sceneZoneSpace.h" #include "lighting/lightManager.h" #include "math/mathUtils.h" #include "shaderGen/shaderGenVars.h" @@ -42,6 +42,7 @@ #include "core/stream/bitStream.h" #include "math/mathIO.h" #include "materials/shaderData.h" +#include "core/module.h" // Used for creation in ShadowMapParams::getOrCreateShadowMap() #include "lighting/shadowMap/singleLightShadowMap.h" @@ -545,8 +546,15 @@ void LightingShaderConstants::_onShaderReload() init( mShader ); } +MODULE_BEGIN( ShadowMapParams ) +MODULE_INIT_BEFORE( LightMapParams ) +MODULE_INIT +{ + ShadowMapParams::Type = "ShadowMapParams" ; +} +MODULE_END; -const LightInfoExType ShadowMapParams::Type( "ShadowMapParams" ); +LightInfoExType ShadowMapParams::Type( "" ); ShadowMapParams::ShadowMapParams( LightInfo *light ) : mLight( light ), diff --git a/Engine/source/lighting/shadowMap/lightShadowMap.h b/Engine/source/lighting/shadowMap/lightShadowMap.h index 1de278932..94746d806 100644 --- a/Engine/source/lighting/shadowMap/lightShadowMap.h +++ b/Engine/source/lighting/shadowMap/lightShadowMap.h @@ -287,7 +287,7 @@ public: virtual ~ShadowMapParams(); /// The LightInfoEx hook type. - static const LightInfoExType Type; + static LightInfoExType Type; // LightInfoEx virtual void set( const LightInfoEx *ex ); diff --git a/Engine/source/math/mSilhouetteExtractor.h b/Engine/source/math/mSilhouetteExtractor.h index a166000e0..e602c0ecc 100644 --- a/Engine/source/math/mSilhouetteExtractor.h +++ b/Engine/source/math/mSilhouetteExtractor.h @@ -92,14 +92,14 @@ struct SilhouetteExtractorBasePerspective : public SilhouetteExtractorBase< Poly // Determine orientation of each of the polygons. - const U32 numPolygons = mPolyhedron->getNumPlanes(); + const U32 numPolygons = this->mPolyhedron->getNumPlanes(); mPolygonOrientations = ( Orientation* ) FrameAllocator::alloc( sizeof( Orientation ) * numPolygons ); Point3F camPos = camView.getPosition(); for( U32 i = 0; i < numPolygons; ++ i ) { - if (mPolyhedron->getPlanes()[i].whichSide( camPos ) == PlaneF::Front) + if (this->mPolyhedron->getPlanes()[i].whichSide( camPos ) == PlaneF::Front) mPolygonOrientations[i] = FrontFacing; else mPolygonOrientations[i] = BackFacing; diff --git a/Engine/source/platformX86UNIX/threads/semaphore.cpp b/Engine/source/platformX86UNIX/threads/semaphore.cpp index 2bdaade06..64e73454f 100644 --- a/Engine/source/platformX86UNIX/threads/semaphore.cpp +++ b/Engine/source/platformX86UNIX/threads/semaphore.cpp @@ -55,13 +55,25 @@ Semaphore::~Semaphore() delete mData; } -bool Semaphore::acquire(bool block) +bool Semaphore::acquire(bool block, S32 timeoutMS) { - AssertFatal(mData, "Semaphore::acquire - Invalid semaphore."); + AssertFatal(mData && mData->semaphore, "Semaphore::acquire - Invalid semaphore."); if (block) { - if (SDL_SemWait(mData->semaphore) < 0) - AssertFatal(false, "Semaphore::acquie - Wait failed."); + // Semaphore acquiring is different from the MacOS/Win realization because SDL_SemWaitTimeout() with "infinite" timeout can be too heavy on some platforms. + // (see "man SDL_SemWaitTimeout(3)" for more info) + // "man" states to avoid the use of SDL_SemWaitTimeout at all, but at current stage this looks like a valid and working solution, so keeping it this way. + // [bank / Feb-2010] + if (timeoutMS == -1) + { + if (SDL_SemWait(mData->semaphore) < 0) + AssertFatal(false, "Semaphore::acquie - Wait failed."); + } + else + { + if (SDL_SemWaitTimeout(mData->semaphore, timeoutMS) < 0) + AssertFatal(false, "Semaphore::acquie - Wait with timeout failed."); + } return (true); } else diff --git a/Engine/source/platformX86UNIX/x86UNIXStub.dedicated.cpp b/Engine/source/platformX86UNIX/x86UNIXStub.dedicated.cpp index b9814862a..b13b72f3f 100644 --- a/Engine/source/platformX86UNIX/x86UNIXStub.dedicated.cpp +++ b/Engine/source/platformX86UNIX/x86UNIXStub.dedicated.cpp @@ -81,6 +81,8 @@ void OpenALDLLShutdown() {} // Platform Stubs +bool Platform::excludeOtherInstances(const char*) { return true; } + // clipboard const char* Platform::getClipboard() { return ""; } bool Platform::setClipboard(const char *text) { return false; } diff --git a/Engine/source/renderInstance/renderPassManager.cpp b/Engine/source/renderInstance/renderPassManager.cpp index 95f8e4f71..8a2e44c11 100644 --- a/Engine/source/renderInstance/renderPassManager.cpp +++ b/Engine/source/renderInstance/renderPassManager.cpp @@ -42,7 +42,7 @@ #include "console/engineAPI.h" -const RenderInstType RenderInstType::Invalid( String::EmptyString ); +const RenderInstType RenderInstType::Invalid( "" ); const RenderInstType RenderPassManager::RIT_Interior("Interior"); const RenderInstType RenderPassManager::RIT_Mesh("Mesh");