Procházet zdrojové kódy

Added skeleton for Physics

BearishSun před 10 roky
rodič
revize
88e6d42f38

+ 4 - 0
BansheeCore/BansheeCore.vcxproj

@@ -306,6 +306,7 @@
     <ClInclude Include="Include\BsMeshRTTI.h" />
     <ClInclude Include="Include\BsMeshUtility.h" />
     <ClInclude Include="Include\BsParamBlocks.h" />
+    <ClInclude Include="Include\BsPhysics.h" />
     <ClInclude Include="Include\BsPrefab.h" />
     <ClInclude Include="Include\BsPrefabDiff.h" />
     <ClInclude Include="Include\BsPrefabDiffRTTI.h" />
@@ -453,6 +454,7 @@
     <ClInclude Include="Include\BsVertexDeclarationRTTI.h" />
     <ClInclude Include="Include\BsTechnique.h" />
     <ClInclude Include="Include\BsViewportRTTI.h" />
+    <ClInclude Include="Include\BsPhysicsManager.h" />
     <ClInclude Include="Include\Win32\BsWin32Defs.h" />
     <ClInclude Include="Include\Win32\BsWin32Platform.h" />
     <ClInclude Include="Include\Win32\BsWin32DropTarget.h" />
@@ -468,6 +470,8 @@
     <ClCompile Include="Source\BsMaterialParam.cpp" />
     <ClCompile Include="Source\BsMeshImportOptions.cpp" />
     <ClCompile Include="Source\BsMeshUtility.cpp" />
+    <ClCompile Include="Source\BsPhysics.cpp" />
+    <ClCompile Include="Source\BsPhysicsManager.cpp" />
     <ClCompile Include="Source\BsPrefab.cpp" />
     <ClCompile Include="Source\BsPrefabDiff.cpp" />
     <ClCompile Include="Source\BsPrefabUtility.cpp" />

+ 18 - 0
BansheeCore/BansheeCore.vcxproj.filters

@@ -93,6 +93,12 @@
     <Filter Include="Header Files\CoreThread">
       <UniqueIdentifier>{62281c40-1fc0-47f6-bc61-ff28314d8e13}</UniqueIdentifier>
     </Filter>
+    <Filter Include="Header Files\Physics">
+      <UniqueIdentifier>{3a7a5aa1-38d4-4db1-af3a-0ece60598879}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="Source Files\Physics">
+      <UniqueIdentifier>{d8f2a51b-1e51-4594-a369-a496b0de73bf}</UniqueIdentifier>
+    </Filter>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="Include\BsCommonTypes.h">
@@ -581,6 +587,12 @@
     <ClInclude Include="Include\BsMeshRTTI.h">
       <Filter>Header Files\RTTI</Filter>
     </ClInclude>
+    <ClInclude Include="Include\BsPhysicsManager.h">
+      <Filter>Header Files\Physics</Filter>
+    </ClInclude>
+    <ClInclude Include="Include\BsPhysics.h">
+      <Filter>Header Files\Physics</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="Source\BsCoreApplication.cpp">
@@ -913,5 +925,11 @@
     <ClCompile Include="Source\Win32\BsWin32BrowseDialogs.cpp">
       <Filter>Source Files\Platform</Filter>
     </ClCompile>
+    <ClCompile Include="Source\BsPhysicsManager.cpp">
+      <Filter>Source Files\Physics</Filter>
+    </ClCompile>
+    <ClCompile Include="Source\BsPhysics.cpp">
+      <Filter>Source Files\Physics</Filter>
+    </ClCompile>
   </ItemGroup>
 </Project>

+ 1 - 1
BansheeCore/Include/BsCoreApplication.h

@@ -19,7 +19,7 @@ namespace BansheeEngine
 	{
 		String renderAPI; /**< Name of the render system plugin to use. */
 		String renderer; /**< Name of the renderer plugin to use. */
-
+		String physics; /**< Name of physics plugin to use. */
 		String input; /**< Name of the input plugin to use. */
 
 		RENDER_WINDOW_DESC primaryWindowDesc; /**< Describes the window to create during start-up. */

+ 5 - 0
BansheeCore/Include/BsCorePrerequisites.h

@@ -230,6 +230,11 @@ namespace BansheeEngine
 	class Light;
 	class Win32Window;
 	class RenderAPIFactory;
+	class PhysicsManager;
+	class Physics;
+	class Collider;
+	class Rigidbody;
+	class PhysicsMaterial;
 	// Asset import
 	class SpecificImporter;
 	class Importer;

+ 13 - 0
BansheeCore/Include/BsPhysics.h

@@ -0,0 +1,13 @@
+#pragma once
+
+#include "BsCorePrerequisites.h"
+#include "BsModule.h"
+
+namespace BansheeEngine
+{
+	class BS_CORE_EXPORT Physics : public Module<Physics>
+	{
+	public:
+		virtual ~Physics() { }
+	};
+}

+ 27 - 0
BansheeCore/Include/BsPhysicsManager.h

@@ -0,0 +1,27 @@
+#pragma once
+
+#include "BsCorePrerequisites.h"
+#include "BsModule.h"
+
+namespace BansheeEngine
+{
+	class BS_CORE_EXPORT PhysicsFactory
+	{
+	public:
+		virtual ~PhysicsFactory() { }
+
+		virtual void startUp() = 0;
+		virtual void shutDown() = 0;
+	};
+
+	class BS_CORE_EXPORT PhysicsManager : public Module<PhysicsManager>
+	{
+	public:
+		PhysicsManager(const String& pluginName);
+		~PhysicsManager();
+
+	private:
+		DynLib* mPlugin;
+		PhysicsFactory* mFactory;
+	};
+}

+ 4 - 16
BansheeCore/Source/BsCoreApplication.cpp

@@ -43,6 +43,7 @@
 #include "BsResourceListenerManager.h"
 #include "BsRenderStateManager.h"
 #include "BsShaderManager.h"
+#include "BsPhysicsManager.h"
 
 namespace BansheeEngine
 {
@@ -56,6 +57,7 @@ namespace BansheeEngine
 		mPrimaryWindow->destroy();
 		mPrimaryWindow = nullptr;
 
+		PhysicsManager::shutDown();
 		Importer::shutDown();
 		FontManager::shutDown();
 		MaterialManager::shutDown();
@@ -148,8 +150,8 @@ namespace BansheeEngine
 		MeshManager::startUp();
 		MaterialManager::startUp();
 		FontManager::startUp();
-
 		Importer::startUp();
+		PhysicsManager::startUp(mStartUpDesc.physics);
 
 		for (auto& importerName : mStartUpDesc.importers)
 			loadPlugin(importerName);
@@ -325,21 +327,7 @@ namespace BansheeEngine
 
 	void* CoreApplication::loadPlugin(const String& pluginName, DynLib** library, void* passThrough)
 	{
-		String name = pluginName;
-#if BS_PLATFORM == BS_PLATFORM_LINUX
-		if (name.substr(name.length() - 3, 3) != ".so")
-			name += ".so";
-#elif BS_PLATFORM == BS_PLATFORM_APPLE
-		if (name.substr(name.length() - 6, 6) != ".dylib")
-			name += ".dylib";
-#elif BS_PLATFORM == BS_PLATFORM_WIN32
-		// Although LoadLibraryEx will add .dll itself when you only specify the library name,
-		// if you include a relative path then it does not. So, add it to be sure.
-		if (name.substr(name.length() - 4, 4) != ".dll")
-			name += ".dll";
-#endif
-
-		DynLib* loadedLibrary = gDynLibManager().load(name);
+		DynLib* loadedLibrary = gDynLibManager().load(pluginName);
 		if(library != nullptr)
 			*library = loadedLibrary;
 

+ 6 - 0
BansheeCore/Source/BsPhysics.cpp

@@ -0,0 +1,6 @@
+#include "BsPhysics.h"
+
+namespace BansheeEngine
+{
+	
+}

+ 41 - 0
BansheeCore/Source/BsPhysicsManager.cpp

@@ -0,0 +1,41 @@
+#include "BsPhysicsManager.h"
+#include "BsDynLibManager.h"
+#include "BsDynLib.h"
+
+namespace BansheeEngine
+{
+	PhysicsManager::PhysicsManager(const String& pluginName)
+		:mPlugin(nullptr), mFactory(nullptr)
+	{
+		mPlugin = DynLibManager::instance().load(pluginName);
+
+		if(mPlugin != nullptr)
+		{
+			typedef PhysicsFactory* (*LoadPluginFunc)();
+
+			LoadPluginFunc loadPluginFunc = (LoadPluginFunc)mPlugin->getSymbol("loadPlugin");
+			mFactory = loadPluginFunc();
+
+			if (mFactory != nullptr)
+				mFactory->startUp();
+		}
+	}
+
+	PhysicsManager::~PhysicsManager()
+	{
+		if (mPlugin != nullptr)
+		{
+			if (mFactory != nullptr)
+			{
+				typedef void (*UnloadPluginFunc)(PhysicsFactory*);
+
+				UnloadPluginFunc unloadPluginFunc = (UnloadPluginFunc)mPlugin->getSymbol("unloadPlugin");
+
+				mFactory->shutDown();
+				unloadPluginFunc(mFactory);
+			}
+
+			DynLibManager::instance().unload(mPlugin);
+		}
+	}
+}

+ 29 - 0
BansheeEngine.sln

@@ -188,6 +188,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
 		Scripts\VSVisualizations.natvis = Scripts\VSVisualizations.natvis
 	EndProjectSection
 EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BansheePhysX", "BansheePhysX\BansheePhysX.vcxproj", "{69517850-7050-4A1A-B03F-6DC4498B0340}"
+	ProjectSection(ProjectDependencies) = postProject
+		{9B21D41C-516B-43BF-9B10-E99B599C7589} = {9B21D41C-516B-43BF-9B10-E99B599C7589}
+		{CC7F9445-71C9-4559-9976-FF0A64DCB582} = {CC7F9445-71C9-4559-9976-FF0A64DCB582}
+	EndProjectSection
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
@@ -651,6 +657,28 @@ Global
 		{796B6DFF-BA04-42B7-A43A-2B14D707A33A}.Release|Win32.Build.0 = Release|Win32
 		{796B6DFF-BA04-42B7-A43A-2B14D707A33A}.Release|x64.ActiveCfg = Release|x64
 		{796B6DFF-BA04-42B7-A43A-2B14D707A33A}.Release|x64.Build.0 = Release|x64
+		{69517850-7050-4A1A-B03F-6DC4498B0340}.Debug|Any CPU.ActiveCfg = Debug|Win32
+		{69517850-7050-4A1A-B03F-6DC4498B0340}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
+		{69517850-7050-4A1A-B03F-6DC4498B0340}.Debug|Mixed Platforms.Build.0 = Debug|Win32
+		{69517850-7050-4A1A-B03F-6DC4498B0340}.Debug|Win32.ActiveCfg = Debug|Win32
+		{69517850-7050-4A1A-B03F-6DC4498B0340}.Debug|Win32.Build.0 = Debug|Win32
+		{69517850-7050-4A1A-B03F-6DC4498B0340}.Debug|x64.ActiveCfg = Debug|x64
+		{69517850-7050-4A1A-B03F-6DC4498B0340}.Debug|x64.Build.0 = Debug|x64
+		{69517850-7050-4A1A-B03F-6DC4498B0340}.DebugRelease|Any CPU.ActiveCfg = Release|x64
+		{69517850-7050-4A1A-B03F-6DC4498B0340}.DebugRelease|Any CPU.Build.0 = Release|x64
+		{69517850-7050-4A1A-B03F-6DC4498B0340}.DebugRelease|Mixed Platforms.ActiveCfg = Release|Win32
+		{69517850-7050-4A1A-B03F-6DC4498B0340}.DebugRelease|Mixed Platforms.Build.0 = Release|Win32
+		{69517850-7050-4A1A-B03F-6DC4498B0340}.DebugRelease|Win32.ActiveCfg = DebugRelease|Win32
+		{69517850-7050-4A1A-B03F-6DC4498B0340}.DebugRelease|Win32.Build.0 = DebugRelease|Win32
+		{69517850-7050-4A1A-B03F-6DC4498B0340}.DebugRelease|x64.ActiveCfg = DebugRelease|x64
+		{69517850-7050-4A1A-B03F-6DC4498B0340}.DebugRelease|x64.Build.0 = DebugRelease|x64
+		{69517850-7050-4A1A-B03F-6DC4498B0340}.Release|Any CPU.ActiveCfg = Release|Win32
+		{69517850-7050-4A1A-B03F-6DC4498B0340}.Release|Mixed Platforms.ActiveCfg = Release|Win32
+		{69517850-7050-4A1A-B03F-6DC4498B0340}.Release|Mixed Platforms.Build.0 = Release|Win32
+		{69517850-7050-4A1A-B03F-6DC4498B0340}.Release|Win32.ActiveCfg = Release|Win32
+		{69517850-7050-4A1A-B03F-6DC4498B0340}.Release|Win32.Build.0 = Release|Win32
+		{69517850-7050-4A1A-B03F-6DC4498B0340}.Release|x64.ActiveCfg = Release|x64
+		{69517850-7050-4A1A-B03F-6DC4498B0340}.Release|x64.Build.0 = Release|x64
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
@@ -673,6 +701,7 @@ Global
 		{F58FF869-2EA6-4FFF-AB84-328C531BA9D9} = {32E4E2B7-1B4D-4B06-AD87-57CEE00BC247}
 		{B280B769-1BA4-42AF-8263-D644A67B4473} = {7E093EC6-24C6-4832-9482-2D8C0551D3B6}
 		{796B6DFF-BA04-42B7-A43A-2B14D707A33A} = {32E4E2B7-1B4D-4B06-AD87-57CEE00BC247}
+		{69517850-7050-4A1A-B03F-6DC4498B0340} = {32E4E2B7-1B4D-4B06-AD87-57CEE00BC247}
 	EndGlobalSection
 	GlobalSection(SubversionScc) = preSolution
 		Svn-Managed = True

+ 3 - 2
BansheeEngine/Source/BsApplication.cpp

@@ -28,9 +28,10 @@ namespace BansheeEngine
 		START_UP_DESC desc;
 		desc.renderAPI = renderAPI;
 		desc.renderer = renderer;
-		desc.primaryWindowDesc = primaryWindowDesc;
-
+		desc.physics = "BansheePhysX";
 		desc.input = "BansheeOISInput";
+
+		desc.primaryWindowDesc = primaryWindowDesc;
 		desc.importers = importers;
 
 		return desc;

+ 257 - 0
BansheePhysX/BansheePhysX.vcxproj

@@ -0,0 +1,257 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="DebugRelease|Win32">
+      <Configuration>DebugRelease</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="DebugRelease|x64">
+      <Configuration>DebugRelease</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{69517850-7050-4A1A-B03F-6DC4498B0340}</ProjectGuid>
+    <RootNamespace>BansheePhysX</RootNamespace>
+    <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <PlatformToolset>v140</PlatformToolset>
+    <CharacterSet>NotSet</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <PlatformToolset>v140</PlatformToolset>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>NotSet</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugRelease|Win32'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <PlatformToolset>v140</PlatformToolset>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>NotSet</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <PlatformToolset>v140</PlatformToolset>
+    <CharacterSet>NotSet</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <PlatformToolset>v140</PlatformToolset>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>NotSet</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugRelease|x64'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <PlatformToolset>v140</PlatformToolset>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>NotSet</CharacterSet>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Label="Shared">
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='DebugRelease|Win32'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='DebugRelease|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <OutDir>..\bin\$(Platform)\$(Configuration)\</OutDir>
+    <IntDir>.\Intermediate\$(Platform)\$(Configuration)\</IntDir>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <OutDir>..\bin\$(Platform)\$(Configuration)\</OutDir>
+    <IntDir>.\Intermediate\$(Platform)\$(Configuration)\</IntDir>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugRelease|x64'">
+    <OutDir>..\bin\$(Platform)\$(Configuration)\</OutDir>
+    <IntDir>.\Intermediate\$(Platform)\$(Configuration)\</IntDir>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <OutDir>..\bin\x86\$(Configuration)\</OutDir>
+    <IntDir>.\Intermediate\$(Platform)\$(Configuration)\</IntDir>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <OutDir>..\bin\x86\$(Configuration)\</OutDir>
+    <IntDir>.\Intermediate\$(Platform)\$(Configuration)\</IntDir>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugRelease|Win32'">
+    <OutDir>..\bin\x86\$(Configuration)\</OutDir>
+    <IntDir>.\Intermediate\$(Platform)\$(Configuration)\</IntDir>
+  </PropertyGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>Disabled</Optimization>
+      <SDLCheck>true</SDLCheck>
+      <AdditionalIncludeDirectories>.\Include;.\Dependencies\Include;..\BansheeCore\Include;..\BansheeUtility\Include;..\Dependencies\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <ExceptionHandling>false</ExceptionHandling>
+      <RuntimeTypeInfo>false</RuntimeTypeInfo>
+      <PreprocessorDefinitions>BS_PHYSX_EXPORTS;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <DisableSpecificWarnings>4577</DisableSpecificWarnings>
+    </ClCompile>
+    <Link>
+      <AdditionalLibraryDirectories>..\lib\x86\$(Configuration);..\Dependencies\lib\x86\$(Configuration);.\Dependencies\lib\x86\$(Configuration)</AdditionalLibraryDirectories>
+      <AdditionalDependencies>PhysX3CHECKED_x86.lib;PhysX3CommonCHECKED_x86.lib;PhysX3CookingCHECKED_x86.lib;PhysX3CharacterKinematicCHECKED_x86.lib;BansheeCore.lib;BansheeUtility.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <ImportLibrary>..\lib\x86\$(Configuration)\$(TargetName).lib</ImportLibrary>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>Disabled</Optimization>
+      <SDLCheck>true</SDLCheck>
+      <AdditionalIncludeDirectories>.\Include;.\Dependencies\Include;..\BansheeCore\Include;..\BansheeUtility\Include;..\Dependencies\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <ExceptionHandling>false</ExceptionHandling>
+      <RuntimeTypeInfo>false</RuntimeTypeInfo>
+      <PreprocessorDefinitions>BS_PHYSX_EXPORTS;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <DisableSpecificWarnings>4577</DisableSpecificWarnings>
+    </ClCompile>
+    <Link>
+      <AdditionalLibraryDirectories>..\lib\x64\$(Configuration);..\Dependencies\lib\x64\$(Configuration);.\Dependencies\lib\x64\$(Configuration)</AdditionalLibraryDirectories>
+      <AdditionalDependencies>PhysX3CHECKED_x64.lib;PhysX3CommonCHECKED_x64.lib;PhysX3CookingCHECKED_x64.lib;PhysX3CharacterKinematicCHECKED_x64.lib;BansheeCore.lib;BansheeUtility.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <ImportLibrary>..\lib\$(Platform)\$(Configuration)\$(TargetName).lib</ImportLibrary>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>MaxSpeed</Optimization>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <SDLCheck>true</SDLCheck>
+      <AdditionalIncludeDirectories>.\Include;.\Dependencies\Include;..\BansheeCore\Include;..\BansheeUtility\Include;..\Dependencies\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <ExceptionHandling>false</ExceptionHandling>
+      <RuntimeTypeInfo>false</RuntimeTypeInfo>
+      <PreprocessorDefinitions>BS_PHYSX_EXPORTS;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <DebugInformationFormat>None</DebugInformationFormat>
+      <DisableSpecificWarnings>4577</DisableSpecificWarnings>
+    </ClCompile>
+    <Link>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+      <AdditionalLibraryDirectories>..\lib\x86\$(Configuration);..\Dependencies\lib\x86\$(Configuration);.\Dependencies\lib\x86\$(Configuration)</AdditionalLibraryDirectories>
+      <AdditionalDependencies>PhysX3_x86.lib;PhysX3Common_x86.lib;PhysX3Cooking_x86.lib;PhysX3CharacterKinematic_x86.lib;BansheeCore.lib;BansheeUtility.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <ImportLibrary>..\lib\x86\$(Configuration)\$(TargetName).lib</ImportLibrary>
+      <GenerateDebugInformation>No</GenerateDebugInformation>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugRelease|Win32'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>MaxSpeed</Optimization>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <SDLCheck>true</SDLCheck>
+      <AdditionalIncludeDirectories>.\Include;.\Dependencies\Include;..\BansheeCore\Include;..\BansheeUtility\Include;..\Dependencies\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <ExceptionHandling>false</ExceptionHandling>
+      <RuntimeTypeInfo>false</RuntimeTypeInfo>
+      <PreprocessorDefinitions>BS_PHYSX_EXPORTS;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MinimalRebuild>true</MinimalRebuild>
+      <DisableSpecificWarnings>4577</DisableSpecificWarnings>
+    </ClCompile>
+    <Link>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+      <AdditionalLibraryDirectories>..\lib\x86\$(Configuration);..\Dependencies\lib\x86\$(Configuration);.\Dependencies\lib\x86\$(Configuration)</AdditionalLibraryDirectories>
+      <AdditionalDependencies>PhysX3_x86.lib;PhysX3Common_x86.lib;PhysX3Cooking_x86.lib;PhysX3CharacterKinematic_x86.lib;BansheeCore.lib;BansheeUtility.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <ImportLibrary>..\lib\x86\$(Configuration)\$(TargetName).lib</ImportLibrary>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>MaxSpeed</Optimization>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <SDLCheck>true</SDLCheck>
+      <AdditionalIncludeDirectories>.\Include;.\Dependencies\Include;..\BansheeCore\Include;..\BansheeUtility\Include;..\Dependencies\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <ExceptionHandling>false</ExceptionHandling>
+      <RuntimeTypeInfo>false</RuntimeTypeInfo>
+      <PreprocessorDefinitions>BS_PHYSX_EXPORTS;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <DebugInformationFormat>None</DebugInformationFormat>
+      <DisableSpecificWarnings>4577</DisableSpecificWarnings>
+    </ClCompile>
+    <Link>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+      <AdditionalLibraryDirectories>..\lib\x64\$(Configuration);..\Dependencies\lib\x64\$(Configuration);.\Dependencies\lib\x64\$(Configuration)</AdditionalLibraryDirectories>
+      <AdditionalDependencies>PhysX3_x64.lib;PhysX3Common_x64.lib;PhysX3Cooking_x64.lib;PhysX3CharacterKinematic_x64.lib;BansheeCore.lib;BansheeUtility.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <ImportLibrary>..\lib\$(Platform)\$(Configuration)\$(TargetName).lib</ImportLibrary>
+      <GenerateDebugInformation>No</GenerateDebugInformation>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugRelease|x64'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>MaxSpeed</Optimization>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <SDLCheck>true</SDLCheck>
+      <AdditionalIncludeDirectories>.\Include;.\Dependencies\Include;..\BansheeCore\Include;..\BansheeUtility\Include;..\Dependencies\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <ExceptionHandling>false</ExceptionHandling>
+      <RuntimeTypeInfo>false</RuntimeTypeInfo>
+      <PreprocessorDefinitions>BS_PHYSX_EXPORTS;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MinimalRebuild>true</MinimalRebuild>
+      <DisableSpecificWarnings>4577</DisableSpecificWarnings>
+    </ClCompile>
+    <Link>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+      <AdditionalLibraryDirectories>..\lib\x64\$(Configuration);..\Dependencies\lib\x64\$(Configuration);.\Dependencies\lib\x64\$(Configuration)</AdditionalLibraryDirectories>
+      <AdditionalDependencies>PhysX3_x64.lib;PhysX3Common_x64.lib;PhysX3Cooking_x64.lib;PhysX3CharacterKinematic_x64.lib;BansheeCore.lib;BansheeUtility.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <ImportLibrary>..\lib\$(Platform)\$(Configuration)\$(TargetName).lib</ImportLibrary>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <ClCompile Include="Source\BsPhysXPlugin.cpp" />
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="Include\BsPhysX.h" />
+    <ClInclude Include="Include\BsPhysXPrerequisites.h" />
+  </ItemGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+</Project>

+ 26 - 0
BansheePhysX/BansheePhysX.vcxproj.filters

@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup>
+    <Filter Include="Source Files">
+      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+    </Filter>
+    <Filter Include="Header Files">
+      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+      <Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
+    </Filter>
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="Source\BsPhysXPlugin.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="Include\BsPhysXPrerequisites.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="Include\BsPhysX.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+  </ItemGroup>
+</Project>

+ 12 - 0
BansheePhysX/Include/BsPhysX.h

@@ -0,0 +1,12 @@
+#pragma once
+
+#include "BsPhysXPrerequisites.h"
+#include "BsPhysics.h"
+
+namespace BansheeEngine
+{
+	class PhysX : public Physics
+	{
+		
+	};
+}

+ 22 - 0
BansheePhysX/Include/BsPhysXPrerequisites.h

@@ -0,0 +1,22 @@
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsCorePrerequisites.h"
+
+namespace BansheeEngine
+{
+#if (BS_PLATFORM == BS_PLATFORM_WIN32) && !defined(BS_STATIC_LIB)
+#	ifdef BS_PHYSX_EXPORTS
+#		define BS_PHYSX_EXPORT __declspec(dllexport)
+#	else
+#       if defined( __MINGW32__ )
+#           define BS_PHYSX_EXPORT
+#       else
+#    		define BS_PHYSX_EXPORT __declspec(dllimport)
+#       endif
+#	endif
+#else
+#	define BS_PHYSX_EXPORT
+#endif
+}

+ 30 - 0
BansheePhysX/Source/BsPhysXPlugin.cpp

@@ -0,0 +1,30 @@
+#include "BsPhysXPrerequisites.h"
+#include "BsPhysicsManager.h"
+#include "BsPhysX.h"
+
+namespace BansheeEngine
+{
+	class BS_PHYSX_EXPORT PhysXFactory : public PhysicsFactory
+	{
+	public:
+		void startUp() override
+		{
+			Physics::startUp<PhysX>();
+		}
+
+		void shutDown() override
+		{
+			Physics::shutDown();
+		}
+	};
+
+	extern "C" BS_PHYSX_EXPORT PhysXFactory* loadPlugin()
+	{
+		return bs_new<PhysXFactory>();
+	}
+
+	extern "C" BS_PHYSX_EXPORT void unloadPlugin(PhysXFactory* instance)
+	{
+		bs_delete(instance);
+	}
+}

+ 1 - 1
BansheeUtility/Include/BsDynLibManager.h

@@ -28,7 +28,7 @@ namespace BansheeEngine
          *
          * @param[in]	filename	The name of the library. The extension can be omitted.
          */
-        DynLib* load(const String& filename);
+        DynLib* load(const String& name);
 
 		/** Unloads the given library. */
 		void unload(DynLib* lib);

+ 15 - 1
BansheeUtility/Source/BsDynLibManager.cpp

@@ -9,8 +9,22 @@ namespace BansheeEngine
 	{
 	}
 
-    DynLib* DynLibManager::load(const String& filename)
+    DynLib* DynLibManager::load(const String& name)
     {
+		String filename = name;
+#if BS_PLATFORM == BS_PLATFORM_LINUX
+		if (name.substr(name.length() - 3, 3) != ".so")
+			name += ".so";
+#elif BS_PLATFORM == BS_PLATFORM_APPLE
+		if (name.substr(name.length() - 6, 6) != ".dylib")
+			name += ".dylib";
+#elif BS_PLATFORM == BS_PLATFORM_WIN32
+		// Although LoadLibraryEx will add .dll itself when you only specify the library name,
+		// if you include a relative path then it does not. So, add it to be sure.
+		if (filename.substr(filename.length() - 4, 4) != ".dll")
+			filename += ".dll";
+#endif
+
 		auto iterFind = mLoadedLibraries.find(filename);
 		if (iterFind != mLoadedLibraries.end())
 		{

+ 8 - 4
Documentation/CompilingDependenciesManually.txt

@@ -1,7 +1,6 @@
-This document lists all Banshee 3rd party libraries and provides information on how to compile
-and include them in your own project. It is meant to be used as a guide to create your own Banshee
-project file, potentially for compiler/IDE other than Visual Studio. Normally these files will be
-provided pre-compiled for you.
+This document lists all Banshee 3rd party libraries and provides information on how to compile them. It is meant to be used
+as a guide if you wish to recompile all the dependencies manually. Normally dependencies will be pre-compiled for all
+supported platforms and environments.
 
 BansheeEngine relies on the following 3rd party libraries:
  - Mono 3.8.0
@@ -66,6 +65,11 @@ BansheeMono (optional if not using scripting or editor) relies on:
   - http://www.mono-project.com/
   - See Mono-3.8.0-IntegrationGuide.txt for instructions how to compile and set it up
 
+BansheePhysX (optional) relies on:
+ - PhysX 3.3
+  - https://github.com/NVIDIAGameWorks/PhysX-3.3
+  - You will need PhysX3, PhysX3Common, PhysX3Cooking and PhysX3CharacterKinematic libraries
+
 BansheeCore relies on:
  - nVidia Texture Tools 2.0.8
   - https://github.com/castano/nvidia-texture-tools