瀏覽代碼

Made samples compile under MinGW (#205)

- Also configured all github actions to use 2 compile jobs instead of 1
- Now also building Release version as there were too many errors that only triggered in one of the builds
Jorrit Rouwe 3 年之前
父節點
當前提交
1cb0b2cd1a

+ 7 - 7
.github/workflows/build.yml

@@ -30,7 +30,7 @@ jobs:
     - name: Configure CMake
     - name: Configure CMake
       run: cmake -B ${{github.workspace}}/Build/Linux_${{matrix.build_type}}_${{matrix.clang_version}} -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DCMAKE_CXX_COMPILER=${{matrix.clang_version}} Build
       run: cmake -B ${{github.workspace}}/Build/Linux_${{matrix.build_type}}_${{matrix.clang_version}} -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DCMAKE_CXX_COMPILER=${{matrix.clang_version}} Build
     - name: Build
     - name: Build
-      run: cmake --build ${{github.workspace}}/Build/Linux_${{matrix.build_type}}_${{matrix.clang_version}} --config ${{matrix.build_type}}
+      run: cmake --build ${{github.workspace}}/Build/Linux_${{matrix.build_type}}_${{matrix.clang_version}} -j 2
     - name: Test
     - name: Test
       working-directory: ${{github.workspace}}/Build/Linux_${{matrix.build_type}}_${{matrix.clang_version}}
       working-directory: ${{github.workspace}}/Build/Linux_${{matrix.build_type}}_${{matrix.clang_version}}
       run: ctest --output-on-failure
       run: ctest --output-on-failure
@@ -50,7 +50,7 @@ jobs:
     - name: Configure CMake
     - name: Configure CMake
       run: cmake -B ${{github.workspace}}/Build/Linux_${{matrix.build_type}}_${{matrix.clang_version}} -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DCMAKE_CXX_COMPILER=${{matrix.clang_version}} Build
       run: cmake -B ${{github.workspace}}/Build/Linux_${{matrix.build_type}}_${{matrix.clang_version}} -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DCMAKE_CXX_COMPILER=${{matrix.clang_version}} Build
     - name: Build
     - name: Build
-      run: cmake --build ${{github.workspace}}/Build/Linux_${{matrix.build_type}}_${{matrix.clang_version}} --config ${{matrix.build_type}}
+      run: cmake --build ${{github.workspace}}/Build/Linux_${{matrix.build_type}}_${{matrix.clang_version}} -j 2
     - name: Test
     - name: Test
       working-directory: ${{github.workspace}}/Build/Linux_${{matrix.build_type}}_${{matrix.clang_version}}
       working-directory: ${{github.workspace}}/Build/Linux_${{matrix.build_type}}_${{matrix.clang_version}}
       run: ctest --output-on-failure
       run: ctest --output-on-failure
@@ -64,7 +64,7 @@ jobs:
     strategy:
     strategy:
         fail-fast: false
         fail-fast: false
         matrix:
         matrix:
-            build_type: [Debug]
+            build_type: [Debug, Release]
 
 
     steps:
     steps:
     - name: Checkout Code
     - name: Checkout Code
@@ -76,9 +76,9 @@ jobs:
         install: mingw-w64-x86_64-toolchain mingw-w64-x86_64-cmake
         install: mingw-w64-x86_64-toolchain mingw-w64-x86_64-cmake
         update: true
         update: true
     - name: Configure CMake
     - name: Configure CMake
-      run: cmake -B Build/MSYS2_MinGW_GCC -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DTARGET_SAMPLES=OFF -DTARGET_VIEWER=OFF Build
+      run: cmake -B Build/MSYS2_MinGW_GCC -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=${{matrix.build_type}} Build
     - name: Build
     - name: Build
-      run: cmake --build Build/MSYS2_MinGW_GCC
+      run: cmake --build Build/MSYS2_MinGW_GCC -j 2
     - name: Test
     - name: Test
       working-directory: Build/MSYS2_MinGW_GCC
       working-directory: Build/MSYS2_MinGW_GCC
       run: ctest --output-on-failure
       run: ctest --output-on-failure
@@ -110,7 +110,7 @@ jobs:
     strategy:
     strategy:
         fail-fast: false
         fail-fast: false
         matrix:
         matrix:
-            build_type: [Debug]
+            build_type: [Debug, Release]
 
 
     steps:
     steps:
     - name: Checkout Code
     - name: Checkout Code
@@ -141,7 +141,7 @@ jobs:
       # github macos-latest runs on a 2013 Ivy Bridge CPU so doesn't have AVX2, LZCNT, TZCNT or FMADD
       # github macos-latest runs on a 2013 Ivy Bridge CPU so doesn't have AVX2, LZCNT, TZCNT or FMADD
       run: cmake -B ${{github.workspace}}/Build/MacOS_${{matrix.build_type}}_${{matrix.clang_version}} -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DCMAKE_CXX_COMPILER=${{matrix.clang_version}} -DUSE_AVX2=OFF -DUSE_AVX512=OFF -DUSE_LZCNT=OFF -DUSE_TZCNT=OFF -DUSE_FMADD=OFF Build
       run: cmake -B ${{github.workspace}}/Build/MacOS_${{matrix.build_type}}_${{matrix.clang_version}} -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DCMAKE_CXX_COMPILER=${{matrix.clang_version}} -DUSE_AVX2=OFF -DUSE_AVX512=OFF -DUSE_LZCNT=OFF -DUSE_TZCNT=OFF -DUSE_FMADD=OFF Build
     - name: Build
     - name: Build
-      run: cmake --build ${{github.workspace}}/Build/MacOS_${{matrix.build_type}}_${{matrix.clang_version}} --config ${{matrix.build_type}}
+      run: cmake --build ${{github.workspace}}/Build/MacOS_${{matrix.build_type}}_${{matrix.clang_version}} -j 2
     - name: Test
     - name: Test
       working-directory: ${{github.workspace}}/Build/MacOS_${{matrix.build_type}}_${{matrix.clang_version}}
       working-directory: ${{github.workspace}}/Build/MacOS_${{matrix.build_type}}_${{matrix.clang_version}}
       run: ctest --output-on-failure
       run: ctest --output-on-failure

+ 2 - 2
Build/cmake_mingw.sh

@@ -14,6 +14,6 @@ echo Usage: ./cmake_mingw.sh [Configuration]
 echo "Possible configurations: Debug (default), Release, Distribution"
 echo "Possible configurations: Debug (default), Release, Distribution"
 echo Generating Makefile for build type \"$BUILD_TYPE\" in folder \"$BUILD_DIR\"
 echo Generating Makefile for build type \"$BUILD_TYPE\" in folder \"$BUILD_DIR\"
 
 
-cmake -S . -B $BUILD_DIR -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DTARGET_SAMPLES=OFF -DTARGET_VIEWER=OFF "${@}"
+cmake -S . -B $BUILD_DIR -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=$BUILD_TYPE "${@}"
 
 
-echo Compile by running \"cmake --build $BUILD_DIR\"
+echo Compile by running \"cmake --build $BUILD_DIR -j 8\"

+ 6 - 0
Jolt/Math/Mat44.h

@@ -75,6 +75,12 @@ public:
 	/// Returns matrix MR so that \f$MR(q) \: p = p \: q\f$ (where p and q are quaternions)
 	/// Returns matrix MR so that \f$MR(q) \: p = p \: q\f$ (where p and q are quaternions)
 	static JPH_INLINE Mat44		sQuatRightMultiply(QuatArg inQ);
 	static JPH_INLINE Mat44		sQuatRightMultiply(QuatArg inQ);
 
 
+	/// Returns a look at matrix that transforms from world space to view space
+	/// @param inPos Position of the camera
+	/// @param inTarget Target of the camera
+	/// @param inUp Up vector
+	static JPH_INLINE Mat44		sLookAt(Vec3Arg inPos, Vec3Arg inTarget, Vec3Arg inUp);
+
 	/// Get float component by element index
 	/// Get float component by element index
 	JPH_INLINE float			operator () (uint inRow, uint inColumn) const			{ JPH_ASSERT(inRow < 4); JPH_ASSERT(inColumn < 4); return mCol[inColumn].mF32[inRow]; }
 	JPH_INLINE float			operator () (uint inRow, uint inColumn) const			{ JPH_ASSERT(inRow < 4); JPH_ASSERT(inColumn < 4); return mCol[inColumn].mF32[inRow]; }
 	JPH_INLINE float &			operator () (uint inRow, uint inColumn)					{ JPH_ASSERT(inRow < 4); JPH_ASSERT(inColumn < 4); return mCol[inColumn].mF32[inRow]; }
 	JPH_INLINE float &			operator () (uint inRow, uint inColumn)					{ JPH_ASSERT(inRow < 4); JPH_ASSERT(inColumn < 4); return mCol[inColumn].mF32[inRow]; }

+ 9 - 0
Jolt/Math/Mat44.inl

@@ -196,6 +196,15 @@ Mat44 Mat44::sCrossProduct(Vec3Arg inV)
 #endif
 #endif
 }
 }
 
 
+Mat44 Mat44::sLookAt(Vec3Arg inPos, Vec3Arg inTarget, Vec3Arg inUp)
+{
+	Vec3 direction = (inTarget - inPos).NormalizedOr(-Vec3::sAxisZ());
+	Vec3 right = direction.Cross(inUp).NormalizedOr(Vec3::sAxisX());
+	Vec3 up = right.Cross(direction);
+
+	return Mat44(Vec4(right, 0), Vec4(up, 0), Vec4(-direction, 0), Vec4(inPos, 1)).InversedRotationTranslation();	
+}
+
 bool Mat44::operator == (Mat44Arg inM2) const
 bool Mat44::operator == (Mat44Arg inM2) const
 {
 {
 	return UVec4::sAnd(
 	return UVec4::sAnd(

+ 5 - 0
Jolt/Physics/DeterminismLog.h

@@ -128,7 +128,12 @@ JPH_NAMESPACE_END
 
 
 #else
 #else
 
 
+JPH_SUPPRESS_WARNING_PUSH
+JPH_SUPPRESS_WARNINGS
+
 /// By default we log nothing
 /// By default we log nothing
 #define JPH_DET_LOG(...)
 #define JPH_DET_LOG(...)
 
 
+JPH_SUPPRESS_WARNING_POP
+
 #endif // JPH_ENABLE_DETERMINISM_LOG
 #endif // JPH_ENABLE_DETERMINISM_LOG

+ 1 - 1
Samples/SamplesApp.cpp

@@ -381,7 +381,7 @@ SamplesApp::SamplesApp()
 			mDebugUI->CreateSlider(phys_settings, "Min Velocity For Restitution (m/s)", mPhysicsSettings.mMinVelocityForRestitution, 0.0f, 10.0f, 0.1f, [this](float inValue) { mPhysicsSettings.mMinVelocityForRestitution = inValue; mPhysicsSystem->SetPhysicsSettings(mPhysicsSettings); });
 			mDebugUI->CreateSlider(phys_settings, "Min Velocity For Restitution (m/s)", mPhysicsSettings.mMinVelocityForRestitution, 0.0f, 10.0f, 0.1f, [this](float inValue) { mPhysicsSettings.mMinVelocityForRestitution = inValue; mPhysicsSystem->SetPhysicsSettings(mPhysicsSettings); });
 			mDebugUI->CreateSlider(phys_settings, "Time Before Sleep (s)", mPhysicsSettings.mTimeBeforeSleep, 0.1f, 1.0f, 0.1f, [this](float inValue) { mPhysicsSettings.mTimeBeforeSleep = inValue; mPhysicsSystem->SetPhysicsSettings(mPhysicsSettings); });
 			mDebugUI->CreateSlider(phys_settings, "Time Before Sleep (s)", mPhysicsSettings.mTimeBeforeSleep, 0.1f, 1.0f, 0.1f, [this](float inValue) { mPhysicsSettings.mTimeBeforeSleep = inValue; mPhysicsSystem->SetPhysicsSettings(mPhysicsSettings); });
 			mDebugUI->CreateSlider(phys_settings, "Point Velocity Sleep Threshold (m/s)", mPhysicsSettings.mPointVelocitySleepThreshold, 0.01f, 1.0f, 0.01f, [this](float inValue) { mPhysicsSettings.mPointVelocitySleepThreshold = inValue; mPhysicsSystem->SetPhysicsSettings(mPhysicsSettings); });
 			mDebugUI->CreateSlider(phys_settings, "Point Velocity Sleep Threshold (m/s)", mPhysicsSettings.mPointVelocitySleepThreshold, 0.01f, 1.0f, 0.01f, [this](float inValue) { mPhysicsSettings.mPointVelocitySleepThreshold = inValue; mPhysicsSystem->SetPhysicsSettings(mPhysicsSettings); });
-		#if defined(_DEBUG) && !defined(JPH_DISABLE_CUSTOM_ALLOCATOR)
+		#if defined(_DEBUG) && !defined(JPH_DISABLE_CUSTOM_ALLOCATOR) && !defined(JPH_COMPILER_MINGW)
 			mDebugUI->CreateCheckBox(phys_settings, "Enable Checking Memory Hook", IsCustomMemoryHookEnabled(), [](UICheckBox::EState inState) { EnableCustomMemoryHook(inState == UICheckBox::STATE_CHECKED); });
 			mDebugUI->CreateCheckBox(phys_settings, "Enable Checking Memory Hook", IsCustomMemoryHookEnabled(), [](UICheckBox::EState inState) { EnableCustomMemoryHook(inState == UICheckBox::STATE_CHECKED); });
 		#endif
 		#endif
 			mDebugUI->CreateCheckBox(phys_settings, "Constraint Warm Starting", mPhysicsSettings.mConstraintWarmStart, [this](UICheckBox::EState inState) { mPhysicsSettings.mConstraintWarmStart = inState == UICheckBox::STATE_CHECKED; mPhysicsSystem->SetPhysicsSettings(mPhysicsSettings); });
 			mDebugUI->CreateCheckBox(phys_settings, "Constraint Warm Starting", mPhysicsSettings.mConstraintWarmStart, [this](UICheckBox::EState inState) { mPhysicsSettings.mConstraintWarmStart = inState == UICheckBox::STATE_CHECKED; mPhysicsSystem->SetPhysicsSettings(mPhysicsSettings); });

+ 1 - 0
TestFramework/Application/Application.cpp

@@ -12,6 +12,7 @@
 #include <Jolt/Core/Factory.h>
 #include <Jolt/Core/Factory.h>
 #include <Jolt/RegisterTypes.h>
 #include <Jolt/RegisterTypes.h>
 #include <Renderer/DebugRendererImp.h>
 #include <Renderer/DebugRendererImp.h>
+#include <crtdbg.h>
 
 
 // Constructor
 // Constructor
 Application::Application() : 
 Application::Application() : 

+ 0 - 4
TestFramework/Input/Keyboard.cpp

@@ -9,10 +9,6 @@
 
 
 class Renderer;
 class Renderer;
 
 
-// Used libraries
-#pragma comment ( lib, "dxguid.lib" )
-#pragma comment ( lib, "dinput8.lib" )
-
 Keyboard::Keyboard()
 Keyboard::Keyboard()
 {
 {
 	Reset();
 	Reset();

+ 0 - 4
TestFramework/Input/Mouse.cpp

@@ -7,10 +7,6 @@
 #include <Renderer/Renderer.h>
 #include <Renderer/Renderer.h>
 #include <Jolt/Core/Profiler.h>
 #include <Jolt/Core/Profiler.h>
 
 
-// Used libraries
-#pragma comment ( lib, "dxguid.lib" )
-#pragma comment ( lib, "dinput8.lib" )
-
 Mouse::Mouse()
 Mouse::Mouse()
 {
 {
 	Reset();
 	Reset();

+ 30 - 57
TestFramework/Renderer/Renderer.cpp

@@ -10,31 +10,24 @@
 #include <Utils/ReadData.h>
 #include <Utils/ReadData.h>
 #include <Utils/Log.h>
 #include <Utils/Log.h>
 
 
-#pragma warning (push, 0)
-#pragma warning (disable : 4668) // DirectXMath.h(22): warning C4668: '_MANAGED' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
 #include <d3dcompiler.h>
 #include <d3dcompiler.h>
+#include <d3d12sdklayers.h>
 #include <ShellScalingApi.h>
 #include <ShellScalingApi.h>
-#include <DirectXMath.h>
-#pragma warning (pop)
-
-#pragma comment(lib, "dxgi.lib")
-#pragma comment(lib, "d3d12.lib")
-#pragma comment(lib, "d3dcompiler.lib")
 
 
 static Renderer *sRenderer = nullptr;
 static Renderer *sRenderer = nullptr;
 
 
 struct VertexShaderConstantBuffer
 struct VertexShaderConstantBuffer
 {
 {
-	DirectX::XMFLOAT4X4		mView;
-	DirectX::XMFLOAT4X4		mProjection;
-	DirectX::XMFLOAT4X4		mLightView;
-	DirectX::XMFLOAT4X4		mLightProjection;
+	Mat44		mView;
+	Mat44		mProjection;
+	Mat44		mLightView;
+	Mat44		mLightProjection;
 };
 };
 
 
 struct PixelShaderConstantBuffer
 struct PixelShaderConstantBuffer
 {
 {
-	DirectX::XMFLOAT4		mCameraPos;
-	DirectX::XMFLOAT4		mLightPos;
+	Vec4		mCameraPos;
+	Vec4		mLightPos;
 };
 };
 
 
 //--------------------------------------------------------------------------------------
 //--------------------------------------------------------------------------------------
@@ -177,7 +170,7 @@ void Renderer::Initialize()
 	wcex.hCursor = LoadCursor(nullptr, IDC_ARROW);
 	wcex.hCursor = LoadCursor(nullptr, IDC_ARROW);
 	wcex.hbrBackground = nullptr;
 	wcex.hbrBackground = nullptr;
 	wcex.lpszMenuName = nullptr;
 	wcex.lpszMenuName = nullptr;
-	wcex.lpszClassName = L"TestFrameworkClass";
+	wcex.lpszClassName = TEXT("TestFrameworkClass");
 	wcex.hIconSm = nullptr;
 	wcex.hIconSm = nullptr;
 	if (!RegisterClassEx(&wcex))
 	if (!RegisterClassEx(&wcex))
 		FatalError("Failed to register window class");
 		FatalError("Failed to register window class");
@@ -185,7 +178,7 @@ void Renderer::Initialize()
 	// Create window
 	// Create window
 	RECT rc = { 0, 0, mWindowWidth, mWindowHeight };
 	RECT rc = { 0, 0, mWindowWidth, mWindowHeight };
 	AdjustWindowRect(&rc, WS_OVERLAPPEDWINDOW, FALSE);
 	AdjustWindowRect(&rc, WS_OVERLAPPEDWINDOW, FALSE);
-	mhWnd = CreateWindow(L"TestFrameworkClass", L"TestFramework", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 
+	mhWnd = CreateWindow(TEXT("TestFrameworkClass"), TEXT("TestFramework"), WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 
 		rc.right - rc.left, rc.bottom - rc.top, nullptr, nullptr, wcex.hInstance, nullptr);
 		rc.right - rc.left, rc.bottom - rc.top, nullptr, nullptr, wcex.hInstance, nullptr);
 	if (!mhWnd)
 	if (!mhWnd)
 		FatalError("Failed to create window");
 		FatalError("Failed to create window");
@@ -436,6 +429,16 @@ void Renderer::OnWindowResize()
 	CreateDepthBuffer();
 	CreateDepthBuffer();
 }
 }
 
 
+/// Construct a perspective matrix
+static inline Mat44 sPerspective(float inFovY, float inAspect, float inNear, float inFar)
+{
+    float height = 1.0f / Tan(0.5f * inFovY);
+    float width = height / inAspect;
+    float range = inFar / (inNear - inFar);
+
+    return Mat44(Vec4(width, 0.0f, 0.0f, 0.0f), Vec4(0.0f, height, 0.0f, 0.0f), Vec4(0.0f, 0.0f, range, -1.0f), Vec4(0.0f, 0.0f, range * inNear, 0.0f));
+}
+
 void Renderer::BeginFrame(const CameraState &inCamera, float inWorldScale)
 void Renderer::BeginFrame(const CameraState &inCamera, float inWorldScale)
 {
 {
 	JPH_PROFILE_FUNCTION();
 	JPH_PROFILE_FUNCTION();
@@ -494,56 +497,26 @@ void Renderer::BeginFrame(const CameraState &inCamera, float inWorldScale)
 	VertexShaderConstantBuffer *vs = mVertexShaderConstantBufferProjection[mFrameIndex]->Map<VertexShaderConstantBuffer>();
 	VertexShaderConstantBuffer *vs = mVertexShaderConstantBufferProjection[mFrameIndex]->Map<VertexShaderConstantBuffer>();
 
 
 	// Camera projection and view
 	// Camera projection and view
-	DirectX::XMStoreFloat4x4(
-		&vs->mProjection,
-			DirectX::XMMatrixPerspectiveFovRH(
-				camera_fovy,
-				camera_aspect,
-				camera_near,
-				camera_far));
+	vs->mProjection = sPerspective(camera_fovy, camera_aspect, camera_near, camera_far);
 	Vec3 tgt = inCamera.mPos + inCamera.mForward;
 	Vec3 tgt = inCamera.mPos + inCamera.mForward;
-	DirectX::XMStoreFloat4x4(
-		&vs->mView,
-		DirectX::XMMatrixLookAtRH(reinterpret_cast<const DirectX::XMVECTOR &>(inCamera.mPos), reinterpret_cast<const DirectX::XMVECTOR &>(tgt), reinterpret_cast<const DirectX::XMVECTOR &>(inCamera.mUp)));
+	vs->mView = Mat44::sLookAt(inCamera.mPos, tgt, inCamera.mUp);
 
 
 	// Light projection and view
 	// Light projection and view
-	DirectX::XMStoreFloat4x4(
-		&vs->mLightProjection,
-			DirectX::XMMatrixPerspectiveFovRH(
-				light_fov,
-				1.0f,
-				light_near,
-				light_far));
-	DirectX::XMStoreFloat4x4(
-		&vs->mLightView,
-		DirectX::XMMatrixLookAtRH(reinterpret_cast<const DirectX::XMVECTOR &>(light_pos), reinterpret_cast<const DirectX::XMVECTOR &>(light_tgt), reinterpret_cast<const DirectX::XMVECTOR &>(light_up)));
+	vs->mLightProjection = sPerspective(light_fov, 1.0f, light_near, light_far);
+	vs->mLightView = Mat44::sLookAt(light_pos, light_tgt, light_up);
 
 
 	mVertexShaderConstantBufferProjection[mFrameIndex]->Unmap();
 	mVertexShaderConstantBufferProjection[mFrameIndex]->Unmap();
 
 
 	// Set constants for vertex shader in ortho mode
 	// Set constants for vertex shader in ortho mode
 	vs = mVertexShaderConstantBufferOrtho[mFrameIndex]->Map<VertexShaderConstantBuffer>();
 	vs = mVertexShaderConstantBufferOrtho[mFrameIndex]->Map<VertexShaderConstantBuffer>();
 
 
-	// Camera projection and view
-	DirectX::XMStoreFloat4x4(
-		&vs->mProjection,
-		DirectX::XMMatrixOrthographicOffCenterRH(
-			0.0f,
-			float(mWindowWidth),
-			float(mWindowHeight),
-			0.0f,
-			0.0f,
-			1.0f));
-	DirectX::XMStoreFloat4x4(
-		&vs->mView,
-		DirectX::XMMatrixIdentity());
+	// Camera ortho projection and view
+    vs->mProjection = Mat44(Vec4(2.0f / mWindowWidth, 0.0f, 0.0f, 0.0f), Vec4(0.0f, -2.0f / mWindowHeight, 0.0f, 0.0f), Vec4(0.0f, 0.0f, -1.0f, 0.0f), Vec4(-1.0f, 1.0f, 0.0f, 1.0f));
+	vs->mView = Mat44::sIdentity();
 
 
 	// Light projection and view are unused in ortho mode
 	// Light projection and view are unused in ortho mode
-	DirectX::XMStoreFloat4x4(
-		&vs->mLightView,
-		DirectX::XMMatrixIdentity());
-	DirectX::XMStoreFloat4x4(
-		&vs->mLightProjection,
-		DirectX::XMMatrixIdentity());
+	vs->mLightView = Mat44::sIdentity();
+	vs->mLightProjection = Mat44::sIdentity();
 
 
 	mVertexShaderConstantBufferOrtho[mFrameIndex]->Unmap();
 	mVertexShaderConstantBufferOrtho[mFrameIndex]->Unmap();
 
 
@@ -552,8 +525,8 @@ void Renderer::BeginFrame(const CameraState &inCamera, float inWorldScale)
 	
 	
 	// Set constants for pixel shader
 	// Set constants for pixel shader
 	PixelShaderConstantBuffer *ps = mPixelShaderConstantBuffer[mFrameIndex]->Map<PixelShaderConstantBuffer>();
 	PixelShaderConstantBuffer *ps = mPixelShaderConstantBuffer[mFrameIndex]->Map<PixelShaderConstantBuffer>();
-	ps->mCameraPos = DirectX::XMFLOAT4(inCamera.mPos.GetX(), inCamera.mPos.GetY(), inCamera.mPos.GetZ(), 0);
-	ps->mLightPos = DirectX::XMFLOAT4(light_pos.GetX(), light_pos.GetY(), light_pos.GetZ(), 0);
+	ps->mCameraPos = Vec4(inCamera.mPos, 0);
+	ps->mLightPos = Vec4(light_pos, 0);
 	mPixelShaderConstantBuffer[mFrameIndex]->Unmap();
 	mPixelShaderConstantBuffer[mFrameIndex]->Unmap();
 
 
 	// Set the pixel shader constant buffer data.
 	// Set the pixel shader constant buffer data.

+ 1 - 1
TestFramework/TestFramework.cmake

@@ -120,5 +120,5 @@ source_group(TREE ${PHYSICS_REPO_ROOT} FILES ${TEST_FRAMEWORK_SRC_FILES_SHADERS}
 # Create TestFramework lib
 # Create TestFramework lib
 add_library(TestFramework STATIC ${TEST_FRAMEWORK_SRC_FILES} ${TEST_FRAMEWORK_SRC_FILES_SHADERS})
 add_library(TestFramework STATIC ${TEST_FRAMEWORK_SRC_FILES} ${TEST_FRAMEWORK_SRC_FILES_SHADERS})
 target_include_directories(TestFramework PUBLIC ${TEST_FRAMEWORK_ROOT})
 target_include_directories(TestFramework PUBLIC ${TEST_FRAMEWORK_ROOT})
-target_link_libraries(TestFramework LINK_PUBLIC Jolt)
+target_link_libraries(TestFramework LINK_PUBLIC Jolt dxguid.lib dinput8.lib dxgi.lib d3d12.lib d3dcompiler.lib)
 target_precompile_headers(TestFramework PUBLIC ${TEST_FRAMEWORK_ROOT}/TestFramework.h)
 target_precompile_headers(TestFramework PUBLIC ${TEST_FRAMEWORK_ROOT}/TestFramework.h)

+ 4 - 0
TestFramework/TestFramework.h

@@ -5,6 +5,10 @@
 
 
 #include <Jolt/Jolt.h>
 #include <Jolt/Jolt.h>
 
 
+// Targetting Windows 10 and above
+#define WINVER 0x0A00
+#define _WIN32_WINNT 0x0A00
+
 // Disable common warnings
 // Disable common warnings
 JPH_SUPPRESS_WARNINGS
 JPH_SUPPRESS_WARNINGS
 JPH_CLANG_SUPPRESS_WARNING("-Wheader-hygiene")
 JPH_CLANG_SUPPRESS_WARNING("-Wheader-hygiene")

+ 1 - 0
TestFramework/UI/UIManager.h

@@ -6,6 +6,7 @@
 #include <UI/UIElement.h>
 #include <UI/UIElement.h>
 #include <UI/UITexturedQuad.h>
 #include <UI/UITexturedQuad.h>
 #include <Renderer/PipelineState.h>
 #include <Renderer/PipelineState.h>
+#include <memory>
 
 
 class Font;
 class Font;
 
 

+ 2 - 2
TestFramework/Utils/CustomMemoryHook.cpp

@@ -5,7 +5,7 @@
 
 
 #include <Utils/CustomMemoryHook.h>
 #include <Utils/CustomMemoryHook.h>
 
 
-#if defined(_DEBUG) && !defined(JPH_DISABLE_CUSTOM_ALLOCATOR)
+#if defined(_DEBUG) && !defined(JPH_DISABLE_CUSTOM_ALLOCATOR) && !defined(JPH_COMPILER_MINGW)
 
 
 // Global to turn checking on/off
 // Global to turn checking on/off
 static bool sEnableCustomMemoryHook = false;
 static bool sEnableCustomMemoryHook = false;
@@ -121,4 +121,4 @@ DisableCustomMemoryHook::~DisableCustomMemoryHook()
 {
 {
 }
 }
 
 
-#endif // _DEBUG && !JPH_DISABLE_CUSTOM_ALLOCATOR
+#endif // _DEBUG && !JPH_DISABLE_CUSTOM_ALLOCATOR && !JPH_COMPILER_MINGW

+ 2 - 2
TestFramework/Utils/CustomMemoryHook.h

@@ -3,7 +3,7 @@
 
 
 #pragma once
 #pragma once
 
 
-#if defined(_DEBUG) && !defined(JPH_DISABLE_CUSTOM_ALLOCATOR)
+#if defined(_DEBUG) && !defined(JPH_DISABLE_CUSTOM_ALLOCATOR) && !defined(JPH_COMPILER_MINGW)
 
 
 /// Register hook that detects allocations that aren't made through the custom allocator
 /// Register hook that detects allocations that aren't made through the custom allocator
 void RegisterCustomMemoryHook();
 void RegisterCustomMemoryHook();
@@ -18,7 +18,7 @@ bool IsCustomMemoryHookEnabled();
 
 
 inline void RegisterCustomMemoryHook() { RegisterDefaultAllocator(); }
 inline void RegisterCustomMemoryHook() { RegisterDefaultAllocator(); }
 
 
-#endif // _DEBUG && !JPH_DISABLE_CUSTOM_ALLOCATOR
+#endif // _DEBUG && !JPH_DISABLE_CUSTOM_ALLOCATOR && !JPH_COMPILER_MINGW
 
 
 /// Struct that, when put on the stack, temporarily disables checking that all allocations go through the custom memory allocator
 /// Struct that, when put on the stack, temporarily disables checking that all allocations go through the custom memory allocator
 struct DisableCustomMemoryHook
 struct DisableCustomMemoryHook

+ 7 - 7
UnitTests/Math/Vec4Tests.cpp

@@ -540,8 +540,8 @@ TEST_SUITE("Vec4Tests")
 			}
 			}
 		}
 		}
 
 
-		CHECK(ms < 1.0e-7f);
-		CHECK(mc < 1.0e-7f);
+		CHECK(ms < 1.0e-7);
+		CHECK(mc < 1.0e-7);
 	}
 	}
 
 
 	TEST_CASE("TestVec4Tan")
 	TEST_CASE("TestVec4Tan")
@@ -570,7 +570,7 @@ TEST_SUITE("Vec4Tests")
 			}
 			}
 		}
 		}
 
 
-		CHECK(mt < 1.5e-7f);
+		CHECK(mt < 1.5e-7);
 	}
 	}
 
 
 	TEST_CASE("TestVec4ASin")
 	TEST_CASE("TestVec4ASin")
@@ -599,7 +599,7 @@ TEST_SUITE("Vec4Tests")
 			}
 			}
 		}
 		}
 
 
-		CHECK(ma < 2.0e-7f);
+		CHECK(ma < 2.0e-7);
 
 
 		// Check that inputs are clamped as promised
 		// Check that inputs are clamped as promised
 		CHECK(Vec4::sReplicate(-1.1f).ASin() == Vec4::sReplicate(-0.5f * JPH_PI));
 		CHECK(Vec4::sReplicate(-1.1f).ASin() == Vec4::sReplicate(-0.5f * JPH_PI));
@@ -632,7 +632,7 @@ TEST_SUITE("Vec4Tests")
 			}
 			}
 		}
 		}
 
 
-		CHECK(ma < 3.5e-7f);
+		CHECK(ma < 3.5e-7);
 
 
 		// Check that inputs are clamped as promised
 		// Check that inputs are clamped as promised
 		CHECK(Vec4::sReplicate(-1.1f).ACos() == Vec4::sReplicate(JPH_PI));
 		CHECK(Vec4::sReplicate(-1.1f).ACos() == Vec4::sReplicate(JPH_PI));
@@ -665,7 +665,7 @@ TEST_SUITE("Vec4Tests")
 			}
 			}
 		}
 		}
 
 
-		CHECK(ma < 1.5e-7f);
+		CHECK(ma < 1.5e-7);
 	}
 	}
 
 
 	TEST_CASE("TestVec4ATan2")
 	TEST_CASE("TestVec4ATan2")
@@ -707,6 +707,6 @@ TEST_SUITE("Vec4Tests")
 			}
 			}
 		}
 		}
 
 
-		CHECK(ma < 3.0e-7f);
+		CHECK(ma < 3.0e-7);
 	}
 	}
 }
 }