diff --git a/samples/D3D11Image net core 3.1/D3D11Visualization/D3DVisualization.cpp b/samples/D3D11Image net core 3.1/D3D11Visualization/D3DVisualization.cpp
new file mode 100644
index 0000000..1ebadd4
--- /dev/null
+++ b/samples/D3D11Image net core 3.1/D3D11Visualization/D3DVisualization.cpp
@@ -0,0 +1,528 @@
+//------------------------------------------------------------------------------
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+//------------------------------------------------------------------------------
+
+#include "D3DVisualization.h"
+
+#ifndef DIRECTX_SDK
+ using namespace DirectX;
+ using namespace DirectX::PackedVector;
+#endif
+
+// Global Variables
+CCube * pApplication; // Application class
+
+//--------------------------------------------------------------------------------------
+// Structures
+//--------------------------------------------------------------------------------------
+struct SimpleVertex
+{
+ XMFLOAT3 Pos;
+ XMFLOAT4 Color;
+};
+
+struct ConstantBuffer
+{
+ XMMATRIX mWorld;
+ XMMATRIX mView;
+ XMMATRIX mProjection;
+};
+
+BOOL WINAPI DllMain(HINSTANCE hInstance,DWORD fwdReason, LPVOID lpvReserved)
+{
+ return TRUE;
+}
+
+///
+/// Init global class instance
+///
+extern HRESULT __cdecl Init()
+{
+ pApplication = new CCube();
+
+ HRESULT hr = S_OK;
+
+ if ( FAILED( hr = pApplication->InitDevice() ) )
+ {
+ return hr;
+ }
+
+ return hr;
+}
+
+///
+/// Cleanup global class instance
+///
+extern void __cdecl Cleanup()
+{
+ delete pApplication;
+ pApplication = NULL;
+}
+
+///
+/// Render for global class instance
+///
+extern HRESULT __cdecl Render(void * pResource, bool isNewSurface)
+{
+ if ( NULL == pApplication )
+ {
+ return E_FAIL;
+ }
+
+ return pApplication->Render(pResource, isNewSurface);
+}
+
+///
+/// Sets the Radius value of the camera
+///
+extern HRESULT _cdecl SetCameraRadius(float r)
+{
+ if ( NULL == pApplication )
+ {
+ return E_FAIL;
+ }
+
+ pApplication->GetCamera()->SetRadius(r);
+ return 0;
+}
+
+///
+/// Sets the Theta value of the camera
+/// Theta represents the angle (in radians) of the camera around the
+/// center in the x-y plane
+///
+extern HRESULT _cdecl SetCameraTheta(float theta)
+{
+ if ( NULL == pApplication )
+ {
+ return E_FAIL;
+ }
+
+ pApplication->GetCamera()->SetTheta(theta);
+ return 0;
+}
+
+///
+/// Sets the Phi value of the camera
+/// Phi represents angle (in radians) of the camera around the center
+/// in the y-z plane (over the top and below the scene)
+///
+extern HRESULT _cdecl SetCameraPhi(float phi)
+{
+ if ( NULL == pApplication )
+ {
+ return E_FAIL;
+ }
+
+ pApplication->GetCamera()->SetPhi(phi);
+ return 0;
+}
+
+///
+/// Constructor
+///
+CCube::CCube()
+{
+ m_Height = 0;
+ m_Width = 0;
+
+ m_hInst = NULL;
+ m_featureLevel = D3D_FEATURE_LEVEL_11_0;
+ m_pd3dDevice = NULL;
+ m_pImmediateContext = NULL;
+ m_pVertexLayout = NULL;
+ m_pVertexBuffer = NULL;
+ m_pVertexShader = NULL;
+ m_pPixelShader = NULL;
+}
+
+///
+/// Destructor
+///
+CCube::~CCube()
+{
+ if (m_pImmediateContext)
+ {
+ m_pImmediateContext->ClearState();
+ }
+
+ SAFE_RELEASE(m_pIndexBuffer);
+ SAFE_RELEASE(m_pPixelShader);
+ SAFE_RELEASE(m_pVertexBuffer);
+ SAFE_RELEASE(m_pVertexLayout);
+ SAFE_RELEASE(m_pVertexShader);
+ SAFE_RELEASE(m_pImmediateContext);
+ SAFE_RELEASE(m_pd3dDevice);
+}
+
+
+///
+/// Compile and set layout for shaders
+///
+/// S_OK for success, or failure code
+HRESULT CCube::LoadShaders()
+{
+ HRESULT hr = S_OK;
+
+ // Compile the pixel shader
+ ID3DBlob* pPSBlob = NULL;
+ hr = CompileShaderFromFile(L"D3DVisualization.fx", "PS", "ps_4_0", &pPSBlob);
+ if (FAILED(hr))
+ {
+ MessageBox(NULL,
+ L"The FX file cannot be compiled. Please run this executable from the directory that contains the FX file.", L"Error", MB_OK);
+ return hr;
+ }
+
+ // Create the pixel shader
+ hr = m_pd3dDevice->CreatePixelShader(pPSBlob->GetBufferPointer(), pPSBlob->GetBufferSize(), NULL, &m_pPixelShader);
+ pPSBlob->Release();
+ if (FAILED(hr))
+ return hr;
+
+ // Compile the vertex shader
+ ID3DBlob* pVSBlob = NULL;
+ hr = CompileShaderFromFile(L"D3DVisualization.fx", "VS", "vs_4_0", &pVSBlob);
+ if (FAILED(hr))
+ {
+ MessageBox(NULL,
+ L"The FX file cannot be compiled. Please run this executable from the directory that contains the FX file.", L"Error", MB_OK);
+ return hr;
+ }
+
+ // Create the vertex shader
+ hr = m_pd3dDevice->CreateVertexShader(pVSBlob->GetBufferPointer(), pVSBlob->GetBufferSize(), NULL, &m_pVertexShader);
+ if (FAILED(hr))
+ {
+ pVSBlob->Release();
+ return hr;
+ }
+
+ // Define the input layout
+ D3D11_INPUT_ELEMENT_DESC layout[] =
+ {
+ { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
+ { "COLOR", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0 },
+ };
+ UINT numElements = ARRAYSIZE(layout);
+
+ // Create the input layout
+ hr = m_pd3dDevice->CreateInputLayout(layout, numElements, pVSBlob->GetBufferPointer(),
+ pVSBlob->GetBufferSize(), &m_pVertexLayout);
+ pVSBlob->Release();
+ if (FAILED(hr))
+ return hr;
+
+ // Set the input layout
+ m_pImmediateContext->IASetInputLayout(m_pVertexLayout);
+
+ return hr;
+}
+
+///
+/// Create Direct3D device
+///
+/// S_OK for success, or failure code
+HRESULT CCube::InitDevice()
+{
+ HRESULT hr = S_OK;
+
+ UINT createDeviceFlags = D3D11_CREATE_DEVICE_BGRA_SUPPORT;
+
+ D3D_DRIVER_TYPE driverTypes[] =
+ {
+ D3D_DRIVER_TYPE_HARDWARE,
+ D3D_DRIVER_TYPE_WARP,
+ D3D_DRIVER_TYPE_REFERENCE,
+ };
+ UINT numDriverTypes = ARRAYSIZE(driverTypes);
+
+ // DX10 or 11 devices are suitable
+ D3D_FEATURE_LEVEL featureLevels[] =
+ {
+ D3D_FEATURE_LEVEL_11_0,
+ D3D_FEATURE_LEVEL_10_1,
+ D3D_FEATURE_LEVEL_10_0,
+ };
+ UINT numFeatureLevels = ARRAYSIZE(featureLevels);
+
+ for (UINT driverTypeIndex = 0; driverTypeIndex < numDriverTypes; ++driverTypeIndex)
+ {
+ hr = D3D11CreateDevice(NULL, driverTypes[driverTypeIndex], NULL, createDeviceFlags, featureLevels, numFeatureLevels,
+ D3D11_SDK_VERSION, &m_pd3dDevice, &m_featureLevel, &m_pImmediateContext);
+
+ if ( SUCCEEDED(hr) )
+ {
+ m_driverType = driverTypes[driverTypeIndex];
+ break;
+ }
+ }
+
+ if ( FAILED(hr) )
+ {
+ MessageBox(NULL, L"Could not create a Direct3D 10 or 11 device.", L"Error", MB_ICONHAND | MB_OK);
+ return hr;
+ }
+
+ hr = LoadShaders();
+
+ if ( FAILED(hr) )
+ {
+ MessageBox(NULL, L"Could not load shaders.", L"Error", MB_ICONHAND | MB_OK);
+ return hr;
+ }
+
+ // Create vertex buffer
+ SimpleVertex vertices[] =
+ {
+ { XMFLOAT3(-1.0f, 1.0f, -1.0f), XMFLOAT4(0.0f, 0.0f, 1.0f, 0.5f) },
+ { XMFLOAT3(1.0f, 1.0f, -1.0f), XMFLOAT4(0.0f, 1.0f, 0.0f, 0.5f) },
+ { XMFLOAT3(1.0f, 1.0f, 1.0f), XMFLOAT4(0.0f, 1.0f, 1.0f, 0.5f) },
+ { XMFLOAT3(-1.0f, 1.0f, 1.0f), XMFLOAT4(1.0f, 0.0f, 0.0f, 0.5f) },
+ { XMFLOAT3(-1.0f, -1.0f, -1.0f), XMFLOAT4(1.0f, 0.0f, 1.0f, 0.5f) },
+ { XMFLOAT3(1.0f, -1.0f, -1.0f), XMFLOAT4(1.0f, 1.0f, 0.0f, 0.5f) },
+ { XMFLOAT3(1.0f, -1.0f, 1.0f), XMFLOAT4(1.0f, 1.0f, 1.0f, 0.5f) },
+ { XMFLOAT3(-1.0f, -1.0f, 1.0f), XMFLOAT4(0.0f, 0.0f, 0.0f, 0.5f) },
+ };
+ D3D11_BUFFER_DESC bd;
+ ZeroMemory(&bd, sizeof(bd));
+ bd.Usage = D3D11_USAGE_DEFAULT;
+ bd.ByteWidth = sizeof(SimpleVertex)* 8;
+ bd.BindFlags = D3D11_BIND_VERTEX_BUFFER;
+ bd.CPUAccessFlags = 0;
+ D3D11_SUBRESOURCE_DATA InitData;
+ ZeroMemory(&InitData, sizeof(InitData));
+ InitData.pSysMem = vertices;
+ hr = m_pd3dDevice->CreateBuffer(&bd, &InitData, &m_pVertexBuffer);
+ if (FAILED(hr))
+ return hr;
+
+ // Set vertex buffer
+ UINT stride = sizeof(SimpleVertex);
+ UINT offset = 0;
+ m_pImmediateContext->IASetVertexBuffers(0, 1, &m_pVertexBuffer, &stride, &offset);
+
+ // Create index buffer
+ WORD indices[] =
+ {
+ 3, 1, 0,
+ 2, 1, 3,
+
+ 0, 5, 4,
+ 1, 5, 0,
+
+ 3, 4, 7,
+ 0, 4, 3,
+
+ 1, 6, 5,
+ 2, 6, 1,
+
+ 2, 7, 6,
+ 3, 7, 2,
+
+ 6, 4, 5,
+ 7, 4, 6,
+ };
+ bd.Usage = D3D11_USAGE_DEFAULT;
+ bd.ByteWidth = sizeof(WORD)* 36; // 36 vertices needed for 12 triangles in a triangle list
+ bd.BindFlags = D3D11_BIND_INDEX_BUFFER;
+ bd.CPUAccessFlags = 0;
+ InitData.pSysMem = indices;
+ hr = m_pd3dDevice->CreateBuffer(&bd, &InitData, &m_pIndexBuffer);
+ if (FAILED(hr))
+ return hr;
+
+ // Set index buffer
+ m_pImmediateContext->IASetIndexBuffer(m_pIndexBuffer, DXGI_FORMAT_R16_UINT, 0);
+
+ // Set primitive topology
+ m_pImmediateContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
+
+ // Create the constant buffer
+ bd.Usage = D3D11_USAGE_DEFAULT;
+ bd.ByteWidth = sizeof(ConstantBuffer);
+ bd.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
+ bd.CPUAccessFlags = 0;
+ hr = m_pd3dDevice->CreateBuffer(&bd, NULL, &m_pConstantBuffer);
+ if (FAILED(hr))
+ return hr;
+
+ // Initialize the world matrix
+ m_World = XMMatrixIdentity();
+
+ // Initialize the view matrix
+ XMVECTOR Eye = XMVectorSet(0.0f, 1.0f, -5.0f, 0.0f);
+ XMVECTOR At = XMVectorSet(0.0f, 1.0f, 0.0f, 0.0f);
+ XMVECTOR Up = XMVectorSet(0.0f, 1.0f, 0.0f, 0.0f);
+ m_View = XMMatrixLookAtLH(Eye, At, Up);
+
+ return S_OK;
+}
+
+void CCube::SetUpViewport()
+{
+ // Setup the viewport
+ D3D11_VIEWPORT vp;
+ vp.Width = (float)m_Width;
+ vp.Height = (float)m_Height;
+ vp.MinDepth = 0.0f;
+ vp.MaxDepth = 1.0f;
+ vp.TopLeftX = 0;
+ vp.TopLeftY = 0;
+ m_pImmediateContext->RSSetViewports(1, &vp);
+
+ // Initialize the projection matrix
+ m_Projection = XMMatrixPerspectiveFovLH(XM_PIDIV4, m_Width / (FLOAT)m_Height, 0.01f, 100.0f);
+}
+
+///
+/// Initializes RenderTarget
+///
+/// S_OK for success, or failure code
+HRESULT CCube::InitRenderTarget(void * pResource)
+{
+ HRESULT hr = S_OK;
+
+ IUnknown *pUnk = (IUnknown*)pResource;
+
+ IDXGIResource * pDXGIResource;
+ hr = pUnk->QueryInterface(__uuidof(IDXGIResource), (void**)&pDXGIResource);
+ if (FAILED(hr))
+ {
+ return hr;
+ }
+
+ HANDLE sharedHandle;
+ hr = pDXGIResource->GetSharedHandle(&sharedHandle);
+ if (FAILED(hr))
+ {
+ return hr;
+ }
+
+ pDXGIResource->Release();
+
+ IUnknown * tempResource11;
+ hr = m_pd3dDevice->OpenSharedResource(sharedHandle, __uuidof(ID3D11Resource), (void**)(&tempResource11));
+ if (FAILED(hr))
+ {
+ return hr;
+ }
+
+ ID3D11Texture2D * pOutputResource;
+ hr = tempResource11->QueryInterface(__uuidof(ID3D11Texture2D), (void**)(&pOutputResource));
+ if (FAILED(hr))
+ {
+ return hr;
+ }
+ tempResource11->Release();
+
+ D3D11_RENDER_TARGET_VIEW_DESC rtDesc;
+ rtDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM;
+ rtDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D;
+ rtDesc.Texture2D.MipSlice = 0;
+
+ hr = m_pd3dDevice->CreateRenderTargetView(pOutputResource, &rtDesc, &m_pRenderTargetView);
+ if (FAILED(hr))
+ {
+ return hr;
+ }
+
+ D3D11_TEXTURE2D_DESC outputResourceDesc;
+ pOutputResource->GetDesc(&outputResourceDesc);
+ if ( outputResourceDesc.Width != m_Width || outputResourceDesc.Height != m_Height )
+ {
+ m_Width = outputResourceDesc.Width;
+ m_Height = outputResourceDesc.Height;
+
+ SetUpViewport();
+ }
+
+ m_pImmediateContext->OMSetRenderTargets(1, &m_pRenderTargetView, NULL);
+
+ if ( NULL != pOutputResource )
+ {
+ pOutputResource->Release();
+ }
+
+ return hr;
+}
+
+///
+/// Renders a frame
+///
+/// S_OK for success, or failure code
+HRESULT CCube::Render(void * pResource, bool isNewSurface)
+{
+ HRESULT hr = S_OK;
+
+ // If we've gotten a new Surface, need to initialize the renderTarget.
+ // One of the times that this happens is on a resize.
+ if ( isNewSurface )
+ {
+ m_pImmediateContext->OMSetRenderTargets(0, NULL, NULL);
+ hr = InitRenderTarget(pResource);
+ if (FAILED(hr))
+ {
+ return hr;
+ }
+ }
+
+ // Update our time
+ static float t = 0.0f;
+ if (m_driverType == D3D_DRIVER_TYPE_REFERENCE)
+ {
+ t += (float)XM_PI * 0.0125f;
+ }
+ else
+ {
+ static DWORD dwTimeStart = 0;
+ DWORD dwTimeCur = GetTickCount();
+ if (dwTimeStart == 0)
+ dwTimeStart = dwTimeCur;
+ t = (dwTimeCur - dwTimeStart) / 1000.0f;
+ }
+
+ //
+ // Animate the cube
+ //
+ m_World = XMMatrixRotationX(t) * XMMatrixRotationY(t);
+
+ // Clear the back buffer
+ static float ClearColor[4] = { 0.0f, 0.0f, 0.0f, 0.0f };
+ m_pImmediateContext->ClearRenderTargetView(m_pRenderTargetView, ClearColor);
+
+ // Update the view matrix
+ m_camera.Update();
+
+ XMMATRIX viewProjection = XMMatrixMultiply(m_camera.View, m_Projection);
+
+ ConstantBuffer cb;
+ cb.mWorld = XMMatrixTranspose(m_World);
+ cb.mView = XMMatrixTranspose(m_View);
+ cb.mProjection = XMMatrixTranspose(viewProjection);
+ m_pImmediateContext->UpdateSubresource(m_pConstantBuffer, 0, NULL, &cb, 0, 0);
+
+ // Renders a triangle
+ m_pImmediateContext->VSSetShader(m_pVertexShader, NULL, 0);
+ m_pImmediateContext->VSSetConstantBuffers(0, 1, &m_pConstantBuffer);
+ m_pImmediateContext->PSSetShader(m_pPixelShader, NULL, 0);
+ m_pImmediateContext->DrawIndexed(36, 0, 0); // 36 vertices needed for 12 triangles in a triangle list
+
+ if ( NULL != m_pImmediateContext )
+ {
+ m_pImmediateContext->Flush();
+ }
+
+ return 0;
+}
+
+///
+/// Method for retreiving the camera
+///
+/// Pointer to the camera
+CCamera* CCube::GetCamera()
+{
+ return &m_camera;
+}
\ No newline at end of file
diff --git a/samples/D3D11Image net core 3.1/D3D11Visualization/D3DVisualization.fx b/samples/D3D11Image net core 3.1/D3D11Visualization/D3DVisualization.fx
new file mode 100644
index 0000000..b286d8e
--- /dev/null
+++ b/samples/D3D11Image net core 3.1/D3D11Visualization/D3DVisualization.fx
@@ -0,0 +1,44 @@
+//--------------------------------------------------------------------------------------
+// File: D3DVisualization.fx
+// Originally from DirectX SDK - Tutorial 4 sample
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//--------------------------------------------------------------------------------------
+
+//--------------------------------------------------------------------------------------
+// Constant Buffer Variables
+//--------------------------------------------------------------------------------------
+cbuffer ConstantBuffer : register(b0)
+{
+ matrix World;
+ matrix View;
+ matrix Projection;
+}
+
+//--------------------------------------------------------------------------------------
+struct VS_OUTPUT
+{
+ float4 Pos : SV_POSITION;
+ float4 Color : COLOR0;
+};
+
+//--------------------------------------------------------------------------------------
+// Vertex Shader
+//--------------------------------------------------------------------------------------
+VS_OUTPUT VS(float4 Pos : POSITION, float4 Color : COLOR)
+{
+ VS_OUTPUT output = (VS_OUTPUT)0;
+ output.Pos = mul(Pos, World);
+ output.Pos = mul(output.Pos, View);
+ output.Pos = mul(output.Pos, Projection);
+ output.Color = Color;
+ return output;
+}
+
+
+//--------------------------------------------------------------------------------------
+// Pixel Shader
+//--------------------------------------------------------------------------------------
+float4 PS(VS_OUTPUT input) : SV_Target
+{
+ return input.Color;
+}
diff --git a/samples/D3D11Image net core 3.1/D3D11Visualization/D3DVisualization.h b/samples/D3D11Image net core 3.1/D3D11Visualization/D3DVisualization.h
new file mode 100644
index 0000000..3c65925
--- /dev/null
+++ b/samples/D3D11Image net core 3.1/D3D11Visualization/D3DVisualization.h
@@ -0,0 +1,131 @@
+//------------------------------------------------------------------------------
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+//------------------------------------------------------------------------------
+
+#pragma once
+
+#include
+#include
+
+#ifdef DIRECTX_SDK // requires DirectX SDK June 2010
+ #include
+ #define DirectX_NS // DirectX SDK requires a blank namespace for several types
+#else // Windows SDK
+ #include
+ #include
+ #define DirectX_NS DirectX // Windows SDK requires a DirectX namespace for several types
+#endif
+
+#include "OrbitCamera.h"
+#include "DX11Utils.h"
+#include "resource.h"
+
+
+extern "C" {
+ __declspec(dllexport) HRESULT __cdecl Init();
+}
+
+extern "C" {
+ __declspec(dllexport) void __cdecl Cleanup();
+}
+
+extern "C" {
+ __declspec(dllexport) HRESULT __cdecl Render(void * pResource, bool isNewSurface);
+}
+
+extern "C" {
+ __declspec(dllexport) HRESULT __cdecl SetCameraRadius(float r);
+}
+
+extern "C" {
+ __declspec(dllexport) HRESULT __cdecl SetCameraTheta(float theta);
+}
+
+extern "C" {
+ __declspec(dllexport) HRESULT __cdecl SetCameraPhi(float phi);
+}
+
+class CCube
+{
+
+public:
+ ///
+ /// Constructor
+ ///
+ CCube();
+
+ ///
+ /// Destructor
+ ///
+ ~CCube();
+
+ ///
+ /// Create Direct3D device and swap chain
+ ///
+ /// S_OK for success, or failure code
+ HRESULT InitDevice();
+
+ ///
+ /// Renders a frame
+ ///
+ /// S_OK for success, or failure code
+ HRESULT Render(void * pResource, bool isNewSurface);
+
+
+ ///
+ /// Method for retrieving the camera
+ ///
+ /// Pointer to the camera
+ CCamera* GetCamera();
+
+ // Special function definitions to ensure alignment between c# and c++
+ void* operator new(size_t size)
+ {
+ return _aligned_malloc(size, 16);
+ }
+
+ void operator delete(void *p)
+ {
+ _aligned_free(p);
+ }
+
+private:
+
+ HRESULT InitRenderTarget(void * pResource);
+ void SetUpViewport();
+
+ // 3d camera
+ CCamera m_camera;
+
+ HINSTANCE m_hInst;
+ D3D_DRIVER_TYPE m_driverType;
+ D3D_FEATURE_LEVEL m_featureLevel;
+
+ ID3D11Device* m_pd3dDevice;
+ ID3D11DeviceContext* m_pImmediateContext;
+ IDXGISwapChain* m_pSwapChain = NULL;
+ ID3D11RenderTargetView* m_pRenderTargetView = NULL;
+ ID3D11InputLayout* m_pVertexLayout;
+ ID3D11Buffer* m_pVertexBuffer;
+ ID3D11Buffer* m_pIndexBuffer = NULL;
+ ID3D11Buffer* m_pConstantBuffer = NULL;
+
+ DirectX_NS::XMMATRIX m_World;
+ DirectX_NS::XMMATRIX m_View;
+ DirectX_NS::XMMATRIX m_Projection;
+
+ ID3D11VertexShader* m_pVertexShader;
+ ID3D11PixelShader* m_pPixelShader;
+
+ // Initial window resolution
+ UINT m_Width;
+ UINT m_Height;
+
+ ///
+ /// Compile and set layout for shaders
+ ///
+ /// S_OK for success, or failure code
+ HRESULT LoadShaders();
+};
\ No newline at end of file
diff --git a/samples/D3D11Image net core 3.1/D3D11Visualization/D3DVisualization.rc b/samples/D3D11Image net core 3.1/D3D11Visualization/D3DVisualization.rc
new file mode 100644
index 0000000..de6c708
--- /dev/null
+++ b/samples/D3D11Image net core 3.1/D3D11Visualization/D3DVisualization.rc
@@ -0,0 +1,71 @@
+//------------------------------------------------------------------------------
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+//------------------------------------------------------------------------------
+
+//Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#define APSTUDIO_HIDDEN_SYMBOLS
+#include "windows.h"
+#undef APSTUDIO_HIDDEN_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+LANGUAGE 9, 1
+#pragma code_page(1252)
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+1 TEXTINCLUDE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#define APSTUDIO_HIDDEN_SYMBOLS\r\n"
+ "#include ""windows.h""\r\n"
+ "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+#endif
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
diff --git a/samples/D3D11Image net core 3.1/D3D11Visualization/D3DVisualization.vcxproj b/samples/D3D11Image net core 3.1/D3D11Visualization/D3DVisualization.vcxproj
new file mode 100644
index 0000000..6bb16e5
--- /dev/null
+++ b/samples/D3D11Image net core 3.1/D3D11Visualization/D3DVisualization.vcxproj
@@ -0,0 +1,195 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ Win32
+
+
+ Release
+ x64
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Document
+ true
+
+
+
+ {3FEB553A-62BD-42E1-9A70-0CD3E45929D0}
+ D3DVisualization
+ D3DVisualization
+ .dll
+
+
+
+ DynamicLibrary
+ true
+ Unicode
+ v120
+
+
+ DynamicLibrary
+ true
+ Unicode
+ v120
+
+
+ DynamicLibrary
+ false
+ true
+ Unicode
+ v120
+
+
+ DynamicLibrary
+ false
+ true
+ Unicode
+ v120
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ .dll
+ $(DXSDK_DIR)Utilities\bin\x86;$(ExecutablePath)
+ $(IncludePath);$(DXSDK_DIR)Include
+ $(LibraryPath);$(DXSDK_DIR)Lib\x86
+ false
+ $(SolutionDir)x86\$(Configuration)\
+
+
+ .dll
+ $(DXSDK_DIR)Utilities\bin\x64;$(DXSDK_DIR)Utilities\bin\x86;$(ExecutablePath)
+ $(IncludePath);$(DXSDK_DIR)Include
+ $(LibraryPath);$(DXSDK_DIR)Lib\x64
+ false
+ $(SolutionDir)x64\$(Configuration)\
+
+
+ .dll
+ $(DXSDK_DIR)Utilities\bin\x86;$(ExecutablePath)
+ $(IncludePath);$(DXSDK_DIR)Include
+ $(LibraryPath);$(DXSDK_DIR)Lib\x86
+ false
+ $(SolutionDir)x86\$(Configuration)\
+
+
+ .dll
+ $(DXSDK_DIR)Utilities\bin\x64;$(DXSDK_DIR)Utilities\bin\x86;$(ExecutablePath)
+ $(IncludePath);$(DXSDK_DIR)Include
+ $(LibraryPath);$(DXSDK_DIR)Lib\x64
+ false
+ $(SolutionDir)x64\$(Configuration)\
+
+
+
+ Level3
+ Disabled
+ WIN32;_DEBUG;DEBUG;PROFILE;_WINDOWS;D3DXFX_LARGEADDRESS_HANDLE;%(PreprocessorDefinitions)
+ MultiThreadedDLL
+
+
+ true
+ d3d11.lib;d3dcompiler.lib;d3dx11d.lib;d3dx9d.lib;dxerr.lib;dxguid.lib;winmm.lib;comctl32.lib;%(AdditionalDependencies)
+
+
+ copy d3dvisualization.fx "$(SolutionDir)x86\$(Configuration)\"
+
+
+
+
+ Level3
+ Disabled
+ WIN32;_DEBUG;DEBUG;PROFILE;_WINDOWS;D3DXFX_LARGEADDRESS_HANDLE;%(PreprocessorDefinitions)
+ MultiThreadedDLL
+
+
+ true
+ d3d11.lib;d3dcompiler.lib;d3dx11d.lib;d3dx9d.lib;dxerr.lib;dxguid.lib;winmm.lib;comctl32.lib;%(AdditionalDependencies)
+
+
+ copy d3dvisualization.fx "$(SolutionDir)x64\$(Configuration)\"
+
+
+
+
+ Level3
+ MaxSpeed
+ true
+ true
+ WIN32;NDEBUG;_WINDOWS;D3DXFX_LARGEADDRESS_HANDLE;%(PreprocessorDefinitions)
+ MultiThreadedDLL
+
+
+ true
+ true
+ true
+ d3d11.lib;d3dcompiler.lib;d3dx11d.lib;d3dx9d.lib;dxerr.lib;dxguid.lib;winmm.lib;comctl32.lib;%(AdditionalDependencies)
+
+
+ copy d3dvisualization.fx "$(SolutionDir)x86\$(Configuration)\"
+
+
+
+
+ Level3
+ MaxSpeed
+ true
+ true
+ WIN32;NDEBUG;_WINDOWS;D3DXFX_LARGEADDRESS_HANDLE;%(PreprocessorDefinitions)
+ MultiThreadedDLL
+
+
+ true
+ true
+ true
+ d3d11.lib;d3dcompiler.lib;d3dx11d.lib;d3dx9d.lib;dxerr.lib;dxguid.lib;winmm.lib;comctl32.lib;%(AdditionalDependencies)
+
+
+ copy d3dvisualization.fx "$(SolutionDir)x64\$(Configuration)\""
+
+
+
+
+
+
\ No newline at end of file
diff --git a/samples/D3D11Image net core 3.1/D3D11Visualization/D3DVisualization.vcxproj.filters b/samples/D3D11Image net core 3.1/D3D11Visualization/D3DVisualization.vcxproj.filters
new file mode 100644
index 0000000..a08240e
--- /dev/null
+++ b/samples/D3D11Image net core 3.1/D3D11Visualization/D3DVisualization.vcxproj.filters
@@ -0,0 +1,50 @@
+
+
+
+
+ {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
+ cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
+
+
+ {93995380-89BD-4b04-88EB-625FBE52EBFB}
+ h;hpp;hxx;hm;inl;inc;xsd
+
+
+ {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
+ rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
+
+
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+
+
+ Resource Files
+
+
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+
+
+
+
\ No newline at end of file
diff --git a/samples/D3D11Image net core 3.1/D3D11Visualization/D3DVisualization_winsdk.vcxproj b/samples/D3D11Image net core 3.1/D3D11Visualization/D3DVisualization_winsdk.vcxproj
new file mode 100644
index 0000000..6154dde
--- /dev/null
+++ b/samples/D3D11Image net core 3.1/D3D11Visualization/D3DVisualization_winsdk.vcxproj
@@ -0,0 +1,200 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ Win32
+
+
+ Release
+ x64
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Document
+
+
+
+ {D73DCE48-0DBC-40FE-AC89-2C06AF01060B}
+ D3DVisualization
+ D3DVisualization
+ .dll
+ 10.0
+
+
+
+ DynamicLibrary
+ true
+ Unicode
+ v142
+
+
+ DynamicLibrary
+ true
+ Unicode
+ v142
+
+
+ DynamicLibrary
+ false
+ true
+ Unicode
+ v142
+
+
+ DynamicLibrary
+ false
+ true
+ Unicode
+ v142
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ .dll
+ $(DXSDK_DIR)Utilities\bin\x86;$(ExecutablePath)
+ $(IncludePath);$(DXSDK_DIR)Include
+ $(LibraryPath);$(DXSDK_DIR)Lib\x86
+ false
+ $(SolutionDir)bin\D3DVisualization_$(Platform)_$(Configuration)\
+ obj\D3DVisualization_$(Platform)_$(Configuration)\
+
+
+ .dll
+ $(ExecutablePath)
+ $(IncludePath)
+ $(LibraryPath)
+ false
+ $(SolutionDir)bin\D3DVisualization_$(Platform)_$(Configuration)\
+ obj\D3DVisualization_$(Platform)_$(Configuration)\
+
+
+ .dll
+ $(DXSDK_DIR)Utilities\bin\x86;$(ExecutablePath)
+ $(IncludePath);$(DXSDK_DIR)Include
+ $(LibraryPath);$(DXSDK_DIR)Lib\x86
+ false
+ $(SolutionDir)bin\D3DVisualization_$(Platform)_$(Configuration)\
+ obj\D3DVisualization_$(Platform)_$(Configuration)\
+
+
+ .dll
+ $(DXSDK_DIR)Utilities\bin\x64;$(DXSDK_DIR)Utilities\bin\x86;$(ExecutablePath)
+ $(IncludePath);$(DXSDK_DIR)Include
+ $(LibraryPath);$(DXSDK_DIR)Lib\x64
+ false
+ $(SolutionDir)bin\D3DVisualization_$(Platform)_$(Configuration)\
+ obj\D3DVisualization_$(Platform)_$(Configuration)\
+
+
+
+ Level3
+ Disabled
+ WIN32;_DEBUG;DEBUG;PROFILE;_WINDOWS;D3DXFX_LARGEADDRESS_HANDLE;%(PreprocessorDefinitions)
+ MultiThreadedDLL
+
+
+ true
+ d3d11.lib;d3dcompiler.lib;dxguid.lib;winmm.lib;comctl32.lib;%(AdditionalDependencies)
+
+
+ copy d3dvisualization.fx "$(SolutionDir)bin\D3DVisualization_$(Platform)_$(Configuration)\""
+
+
+
+
+ Level3
+ Disabled
+ WIN32;_DEBUG;DEBUG;PROFILE;_WINDOWS;D3DXFX_LARGEADDRESS_HANDLE;%(PreprocessorDefinitions)
+ MultiThreadedDLL
+
+
+ true
+ d3d11.lib;d3dcompiler.lib;dxguid.lib;winmm.lib;comctl32.lib;%(AdditionalDependencies)
+
+
+ copy d3dvisualization.fx "$(SolutionDir)bin\D3DVisualization_$(Platform)_$(Configuration)\""
+
+
+
+
+ Level3
+ MaxSpeed
+ true
+ true
+ WIN32;NDEBUG;_WINDOWS;D3DXFX_LARGEADDRESS_HANDLE;%(PreprocessorDefinitions)
+ MultiThreadedDLL
+
+
+ true
+ true
+ true
+ d3d11.lib;d3dcompiler.lib;d3dx11d.lib;d3dx9d.lib;dxerr.lib;dxguid.lib;winmm.lib;comctl32.lib;%(AdditionalDependencies)
+
+
+ copy d3dvisualization.fx "$(SolutionDir)bin\D3DVisualization_$(Platform)_$(Configuration)\""
+
+
+
+
+ Level3
+ MaxSpeed
+ true
+ true
+ WIN32;NDEBUG;_WINDOWS;D3DXFX_LARGEADDRESS_HANDLE;%(PreprocessorDefinitions)
+ MultiThreadedDLL
+
+
+ true
+ true
+ true
+ d3d11.lib;d3dcompiler.lib;dxguid.lib;winmm.lib;comctl32.lib;%(AdditionalDependencies)
+ false
+
+
+ copy d3dvisualization.fx "$(SolutionDir)bin\D3DVisualization_$(Platform)_$(Configuration)\""
+
+
+
+
+
+
\ No newline at end of file
diff --git a/samples/D3D11Image net core 3.1/D3D11Visualization/D3DVisualization_winsdk.vcxproj.filters b/samples/D3D11Image net core 3.1/D3D11Visualization/D3DVisualization_winsdk.vcxproj.filters
new file mode 100644
index 0000000..a08240e
--- /dev/null
+++ b/samples/D3D11Image net core 3.1/D3D11Visualization/D3DVisualization_winsdk.vcxproj.filters
@@ -0,0 +1,50 @@
+
+
+
+
+ {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
+ cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
+
+
+ {93995380-89BD-4b04-88EB-625FBE52EBFB}
+ h;hpp;hxx;hm;inl;inc;xsd
+
+
+ {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
+ rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
+
+
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+
+
+ Resource Files
+
+
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+
+
+
+
\ No newline at end of file
diff --git a/samples/D3D11Image net core 3.1/D3D11Visualization/DX11Utils.cpp b/samples/D3D11Image net core 3.1/D3D11Visualization/DX11Utils.cpp
new file mode 100644
index 0000000..3a9bbb7
--- /dev/null
+++ b/samples/D3D11Image net core 3.1/D3D11Visualization/DX11Utils.cpp
@@ -0,0 +1,50 @@
+//------------------------------------------------------------------------------
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+//------------------------------------------------------------------------------
+
+#include "DX11Utils.h"
+
+#ifdef DIRECTX_SDK // requires DirectX SDK June 2010
+ #include
+#else // Windows SDK
+ #include
+ #include
+#endif
+
+///
+/// Helper for compiling shaders with D3DX11
+///
+/// full path to shader to compile
+/// entry point of shader
+/// shader model to compile for
+/// holds result of compilation
+/// S_OK for success, or failure code
+HRESULT CompileShaderFromFile(WCHAR* szFileName, LPCSTR szEntryPoint, LPCSTR szShaderModel, ID3D10Blob** ppBlobOut)
+{
+ HRESULT hr = S_OK;
+
+ ID3D10Blob* pErrorBlob = NULL;
+
+#ifdef DIRECTX_SDK // requires DirectX SDK June 2010
+ hr = D3DX11CompileFromFileW( szFileName, NULL, NULL, szEntryPoint, szShaderModel,
+ 0, 0, NULL, ppBlobOut, &pErrorBlob, NULL );
+#else // Windows SDK
+ hr = D3DCompileFromFile(szFileName, NULL, NULL, szEntryPoint, szShaderModel,
+ 0, 0, ppBlobOut, &pErrorBlob);
+#endif
+
+
+ if ( FAILED(hr) )
+ {
+ if (NULL != pErrorBlob)
+ {
+ OutputDebugStringA( (char*)pErrorBlob->GetBufferPointer() );
+ }
+ }
+
+ SAFE_RELEASE(pErrorBlob);
+
+ return hr;
+}
\ No newline at end of file
diff --git a/samples/D3D11Image net core 3.1/D3D11Visualization/DX11Utils.h b/samples/D3D11Image net core 3.1/D3D11Visualization/DX11Utils.h
new file mode 100644
index 0000000..247fdc0
--- /dev/null
+++ b/samples/D3D11Image net core 3.1/D3D11Visualization/DX11Utils.h
@@ -0,0 +1,30 @@
+//------------------------------------------------------------------------------
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+//------------------------------------------------------------------------------
+
+#pragma once
+
+#include
+#include
+
+#ifndef SAFE_DELETE
+#define SAFE_DELETE(p) { if (p) { delete (p); (p)=NULL; } }
+#endif
+#ifndef SAFE_DELETE_ARRAY
+#define SAFE_DELETE_ARRAY(p) { if (p) { delete[] (p); (p)=NULL; } }
+#endif
+#ifndef SAFE_RELEASE
+#define SAFE_RELEASE(p) { if (p) { (p)->Release(); (p)=NULL; } }
+#endif
+
+///
+/// Helper for compiling shaders with D3DX11
+///
+/// full path to shader to compile
+/// entry point of shader
+/// shader model to compile for
+/// holds result of compilation
+/// S_OK for success, or failure code
+HRESULT CompileShaderFromFile( WCHAR* szFileName, LPCSTR szEntryPoint, LPCSTR szShaderModel, ID3D10Blob** ppBlobOut );
\ No newline at end of file
diff --git a/samples/D3D11Image net core 3.1/D3D11Visualization/OrbitCamera.cpp b/samples/D3D11Image net core 3.1/D3D11Visualization/OrbitCamera.cpp
new file mode 100644
index 0000000..2d8ab6a
--- /dev/null
+++ b/samples/D3D11Image net core 3.1/D3D11Visualization/OrbitCamera.cpp
@@ -0,0 +1,90 @@
+//------------------------------------------------------------------------------
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+//------------------------------------------------------------------------------
+
+#include "OrbitCamera.h"
+
+#ifndef DIRECTX_SDK // Windows SDK
+ using namespace DirectX;
+ using namespace DirectX::PackedVector;
+#endif
+
+///
+/// Constructor
+///
+CCamera::CCamera()
+{
+ Reset();
+}
+
+///
+/// Move camera into position
+///
+int CCamera::UpdatePosition()
+{
+ m_eye = XMVectorSet(r * sinf(theta) * cosf(phi), r * sinf(phi), -r * cosf(theta) * cosf(phi), 0.0F);
+
+ return 0;
+}
+
+///
+/// Reset the camera state to initial values
+///
+void CCamera::Reset()
+{
+ View = XMMatrixIdentity();
+
+ m_eye = XMVectorSet(0.f, 0.f, -0.3f, 0.f);
+ m_at = XMVectorSet(0.f, 0.f, 1.0f, 0.f);
+ m_up = XMVectorSet(0.f, 1.f, 0.f, 0.f);
+}
+
+///
+/// Update the view matrix
+///
+void CCamera::Update()
+{
+ View = XMMatrixLookAtLH(m_eye + m_at, m_at, m_up);
+}
+
+///
+/// Sets the center depth of the rendered image
+///
+void CCamera::SetCenterDepth(float depth)
+{
+ m_at = XMVectorSet(0.0f, 0.0f, depth, 0.0f);
+}
+
+///
+/// Sets the R value of the camera from the depth center
+/// R value represents the distance of the camera from the players
+///
+void CCamera::SetRadius(float r)
+{
+ this->r = r;
+ UpdatePosition();
+}
+
+///
+/// Sets the Theta value of the camera from around the depth center
+/// Theta represents the angle (in radians) of the camera around the
+/// center in the x-y plane (circling around players)
+///
+void CCamera::SetTheta(float theta)
+{
+ this->theta = theta;
+ UpdatePosition();
+}
+
+///
+/// Sets the Phi value of the camera
+/// Phi represents angle (in radians) of the camera around the center
+/// in the y-z plane (over the top and below players)
+///
+void CCamera::SetPhi(float phi)
+{
+ this->phi = phi;
+ UpdatePosition();
+}
\ No newline at end of file
diff --git a/samples/D3D11Image net core 3.1/D3D11Visualization/OrbitCamera.h b/samples/D3D11Image net core 3.1/D3D11Visualization/OrbitCamera.h
new file mode 100644
index 0000000..c11af56
--- /dev/null
+++ b/samples/D3D11Image net core 3.1/D3D11Visualization/OrbitCamera.h
@@ -0,0 +1,91 @@
+//------------------------------------------------------------------------------
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+//------------------------------------------------------------------------------
+
+#pragma once
+
+#include
+
+#ifdef DIRECTX_SDK // requires DirectX SDK June 2010
+ #include
+ #define DirectX_NS // DirectX SDK requires a blank namespace for several types
+#else // Windows SDK
+ #include
+ #include
+ #define DirectX_NS DirectX // Windows SDK requires a DirectX namespace for several types
+#endif
+
+
+class CCamera
+{
+public:
+ DirectX_NS::XMMATRIX View;
+
+ ///
+ /// Constructor
+ ///
+ CCamera();
+
+ ///
+ /// Reset the camera state to initial values
+ ///
+ void Reset();
+
+ ///
+ /// Update the view matrix
+ ///
+ void Update();
+
+ ///
+ /// Move camera into position
+ ///
+ int UpdatePosition();
+
+ ///
+ /// Sets the R value of the camera.
+ /// R value represents the distance of the camera from the center
+ ///
+ void SetRadius(float r);
+
+ ///
+ /// Sets the Theta value of the camera from around the depth center
+ /// Theta represents the angle (in radians) of the camera around the
+ /// center in the x-y plane (circling around players)
+ ///
+ void SetTheta(float theta);
+
+ ///
+ /// Sets the Phi value of the camera
+ /// Phi represents angle (in radians) of the camera around the center
+ /// in the y-z plane (over the top and below players)
+ ///
+ void SetPhi(float phi);
+
+ ///
+ /// Get the camera's up vector
+ ///
+ /// camera's up vector
+ DirectX_NS::XMVECTOR GetUp() { return m_up; }
+
+ ///
+ /// Get the camera's position vector
+ ///
+ /// camera's position vector
+ DirectX_NS::XMVECTOR GetEye() { return m_eye; }
+
+ ///
+ /// Sets the center depth of the rendered image
+ ///
+ void SetCenterDepth(float depth);
+
+private:
+ float r;
+ float theta;
+ float phi;
+
+ DirectX_NS::XMVECTOR m_eye;
+ DirectX_NS::XMVECTOR m_at;
+ DirectX_NS::XMVECTOR m_up;
+};
\ No newline at end of file
diff --git a/samples/D3D11Image net core 3.1/D3D11Visualization/Resource.h b/samples/D3D11Image net core 3.1/D3D11Visualization/Resource.h
new file mode 100644
index 0000000..3c3aeb6
--- /dev/null
+++ b/samples/D3D11Image net core 3.1/D3D11Visualization/Resource.h
@@ -0,0 +1,27 @@
+//------------------------------------------------------------------------------
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+//------------------------------------------------------------------------------
+
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by Depth-D3D.rc
+//
+
+#define IDS_APP_TITLE 103
+
+#define IDI_APP 107
+#define IDC_STATIC -1
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+
+#define _APS_NO_MFC 130
+#define _APS_NEXT_RESOURCE_VALUE 129
+#define _APS_NEXT_COMMAND_VALUE 32771
+#define _APS_NEXT_CONTROL_VALUE 1000
+#define _APS_NEXT_SYMED_VALUE 110
+#endif
+#endif
diff --git a/samples/D3D11Image net core 3.1/WpfD3D11Interop_core.sln b/samples/D3D11Image net core 3.1/WpfD3D11Interop_core.sln
new file mode 100644
index 0000000..c369b76
--- /dev/null
+++ b/samples/D3D11Image net core 3.1/WpfD3D11Interop_core.sln
@@ -0,0 +1,53 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.29721.120
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "D3DVisualization_winsdk", "D3D11Visualization\D3DVisualization_winsdk.vcxproj", "{D73DCE48-0DBC-40FE-AC89-2C06AF01060B}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WpfD3D11Interop_core", "WpfD3D11Interop_core\WpfD3D11Interop_core.csproj", "{6E5627CF-48BB-4A7A-BFC9-A4209985E0F9}"
+ ProjectSection(ProjectDependencies) = postProject
+ {D73DCE48-0DBC-40FE-AC89-2C06AF01060B} = {D73DCE48-0DBC-40FE-AC89-2C06AF01060B}
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Debug|x64 = Debug|x64
+ Debug|x86 = Debug|x86
+ Release|Any CPU = Release|Any CPU
+ Release|x64 = Release|x64
+ Release|x86 = Release|x86
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {D73DCE48-0DBC-40FE-AC89-2C06AF01060B}.Debug|Any CPU.ActiveCfg = Debug|Win32
+ {D73DCE48-0DBC-40FE-AC89-2C06AF01060B}.Debug|Any CPU.Build.0 = Debug|Win32
+ {D73DCE48-0DBC-40FE-AC89-2C06AF01060B}.Debug|x64.ActiveCfg = Debug|x64
+ {D73DCE48-0DBC-40FE-AC89-2C06AF01060B}.Debug|x64.Build.0 = Debug|x64
+ {D73DCE48-0DBC-40FE-AC89-2C06AF01060B}.Debug|x86.ActiveCfg = Debug|Win32
+ {D73DCE48-0DBC-40FE-AC89-2C06AF01060B}.Debug|x86.Build.0 = Debug|Win32
+ {D73DCE48-0DBC-40FE-AC89-2C06AF01060B}.Release|Any CPU.ActiveCfg = Release|Win32
+ {D73DCE48-0DBC-40FE-AC89-2C06AF01060B}.Release|x64.ActiveCfg = Release|x64
+ {D73DCE48-0DBC-40FE-AC89-2C06AF01060B}.Release|x64.Build.0 = Release|x64
+ {D73DCE48-0DBC-40FE-AC89-2C06AF01060B}.Release|x86.ActiveCfg = Release|Win32
+ {D73DCE48-0DBC-40FE-AC89-2C06AF01060B}.Release|x86.Build.0 = Release|Win32
+ {6E5627CF-48BB-4A7A-BFC9-A4209985E0F9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {6E5627CF-48BB-4A7A-BFC9-A4209985E0F9}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {6E5627CF-48BB-4A7A-BFC9-A4209985E0F9}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {6E5627CF-48BB-4A7A-BFC9-A4209985E0F9}.Debug|x64.Build.0 = Debug|Any CPU
+ {6E5627CF-48BB-4A7A-BFC9-A4209985E0F9}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {6E5627CF-48BB-4A7A-BFC9-A4209985E0F9}.Debug|x86.Build.0 = Debug|Any CPU
+ {6E5627CF-48BB-4A7A-BFC9-A4209985E0F9}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {6E5627CF-48BB-4A7A-BFC9-A4209985E0F9}.Release|Any CPU.Build.0 = Release|Any CPU
+ {6E5627CF-48BB-4A7A-BFC9-A4209985E0F9}.Release|x64.ActiveCfg = Release|Any CPU
+ {6E5627CF-48BB-4A7A-BFC9-A4209985E0F9}.Release|x64.Build.0 = Release|Any CPU
+ {6E5627CF-48BB-4A7A-BFC9-A4209985E0F9}.Release|x86.ActiveCfg = Release|Any CPU
+ {6E5627CF-48BB-4A7A-BFC9-A4209985E0F9}.Release|x86.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {D61C8E9C-92BF-46E7-87D4-9982010367D6}
+ EndGlobalSection
+EndGlobal
diff --git a/samples/D3D11Image net core 3.1/WpfD3D11Interop_core/App.xaml b/samples/D3D11Image net core 3.1/WpfD3D11Interop_core/App.xaml
new file mode 100644
index 0000000..d5b5b64
--- /dev/null
+++ b/samples/D3D11Image net core 3.1/WpfD3D11Interop_core/App.xaml
@@ -0,0 +1,9 @@
+
+
+
+
+
diff --git a/samples/D3D11Image net core 3.1/WpfD3D11Interop_core/App.xaml.cs b/samples/D3D11Image net core 3.1/WpfD3D11Interop_core/App.xaml.cs
new file mode 100644
index 0000000..8713224
--- /dev/null
+++ b/samples/D3D11Image net core 3.1/WpfD3D11Interop_core/App.xaml.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Configuration;
+using System.Data;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Windows;
+
+namespace coreWpfD3D11Interop
+{
+ ///
+ /// Interaction logic for App.xaml
+ ///
+ public partial class App : Application
+ {
+ }
+}
diff --git a/samples/D3D11Image net core 3.1/WpfD3D11Interop_core/AssemblyInfo.cs b/samples/D3D11Image net core 3.1/WpfD3D11Interop_core/AssemblyInfo.cs
new file mode 100644
index 0000000..8b5504e
--- /dev/null
+++ b/samples/D3D11Image net core 3.1/WpfD3D11Interop_core/AssemblyInfo.cs
@@ -0,0 +1,10 @@
+using System.Windows;
+
+[assembly: ThemeInfo(
+ ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
+ //(used if a resource is not found in the page,
+ // or application resource dictionaries)
+ ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
+ //(used if a resource is not found in the page,
+ // app, or any theme specific resource dictionaries)
+)]
diff --git a/samples/D3D11Image net core 3.1/WpfD3D11Interop_core/Images/Background.jpg b/samples/D3D11Image net core 3.1/WpfD3D11Interop_core/Images/Background.jpg
new file mode 100644
index 0000000..cbbffc8
Binary files /dev/null and b/samples/D3D11Image net core 3.1/WpfD3D11Interop_core/Images/Background.jpg differ
diff --git a/samples/D3D11Image net core 3.1/WpfD3D11Interop_core/Images/Checkbox_checked.png b/samples/D3D11Image net core 3.1/WpfD3D11Interop_core/Images/Checkbox_checked.png
new file mode 100644
index 0000000..3e937a4
Binary files /dev/null and b/samples/D3D11Image net core 3.1/WpfD3D11Interop_core/Images/Checkbox_checked.png differ
diff --git a/samples/D3D11Image net core 3.1/WpfD3D11Interop_core/Images/Checkbox_unchecked.png b/samples/D3D11Image net core 3.1/WpfD3D11Interop_core/Images/Checkbox_unchecked.png
new file mode 100644
index 0000000..d62c7d0
Binary files /dev/null and b/samples/D3D11Image net core 3.1/WpfD3D11Interop_core/Images/Checkbox_unchecked.png differ
diff --git a/samples/D3D11Image net core 3.1/WpfD3D11Interop_core/Images/MagnifyingGlass.PNG b/samples/D3D11Image net core 3.1/WpfD3D11Interop_core/Images/MagnifyingGlass.PNG
new file mode 100644
index 0000000..4e11b47
Binary files /dev/null and b/samples/D3D11Image net core 3.1/WpfD3D11Interop_core/Images/MagnifyingGlass.PNG differ
diff --git a/samples/D3D11Image net core 3.1/WpfD3D11Interop_core/Images/Slider.png b/samples/D3D11Image net core 3.1/WpfD3D11Interop_core/Images/Slider.png
new file mode 100644
index 0000000..3d49abb
Binary files /dev/null and b/samples/D3D11Image net core 3.1/WpfD3D11Interop_core/Images/Slider.png differ
diff --git a/samples/D3D11Image net core 3.1/WpfD3D11Interop_core/Images/radiobutton_off.png b/samples/D3D11Image net core 3.1/WpfD3D11Interop_core/Images/radiobutton_off.png
new file mode 100644
index 0000000..0eaf258
Binary files /dev/null and b/samples/D3D11Image net core 3.1/WpfD3D11Interop_core/Images/radiobutton_off.png differ
diff --git a/samples/D3D11Image net core 3.1/WpfD3D11Interop_core/Images/radiobutton_on.png b/samples/D3D11Image net core 3.1/WpfD3D11Interop_core/Images/radiobutton_on.png
new file mode 100644
index 0000000..07ad0f8
Binary files /dev/null and b/samples/D3D11Image net core 3.1/WpfD3D11Interop_core/Images/radiobutton_on.png differ
diff --git a/samples/D3D11Image net core 3.1/WpfD3D11Interop_core/MainWindow.xaml b/samples/D3D11Image net core 3.1/WpfD3D11Interop_core/MainWindow.xaml
new file mode 100644
index 0000000..9abdab6
--- /dev/null
+++ b/samples/D3D11Image net core 3.1/WpfD3D11Interop_core/MainWindow.xaml
@@ -0,0 +1,170 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/samples/D3D11Image net core 3.1/WpfD3D11Interop_core/MainWindow.xaml.cs b/samples/D3D11Image net core 3.1/WpfD3D11Interop_core/MainWindow.xaml.cs
new file mode 100644
index 0000000..632aff8
--- /dev/null
+++ b/samples/D3D11Image net core 3.1/WpfD3D11Interop_core/MainWindow.xaml.cs
@@ -0,0 +1,370 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Runtime.InteropServices;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Interop;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace coreWpfD3D11Interop
+{
+ ///
+ /// Interaction logic for MainWindow.xaml
+ ///
+ public partial class MainWindow : Window
+ {
+ // Magnifier Image Settings
+ private const double MagImageScale = 1.25; // Scale of image to magnified ellipse
+ private const double MagImageOffset = 0.12; // Offset of magnified ellipse within image
+
+ // Unit conversion
+ private const float DegreesToRadians = (float)Math.PI / 180;
+
+ // State Management
+ private bool magnify = true;
+ TimeSpan lastRender;
+ bool lastVisible;
+
+ // Magnifier Settings (filled by default slider vlaues)
+ private double magSize;
+ private double magScale;
+
+ public MainWindow()
+ {
+ this.InitializeComponent();
+ this.host.Loaded += new RoutedEventHandler(this.Host_Loaded);
+ this.host.SizeChanged += new SizeChangedEventHandler(this.Host_SizeChanged);
+ }
+
+ private static bool Init()
+ {
+
+ bool initSucceeded = NativeMethods.InvokeWithDllProtection(() => NativeMethods.Init()) >= 0;
+
+ if (!initSucceeded)
+ {
+ MessageBox.Show("Failed to initialize.", "WPF D3D Interop", MessageBoxButton.OK, MessageBoxImage.Error);
+
+ if (Application.Current != null)
+ {
+ Application.Current.Shutdown();
+ }
+ }
+
+ return initSucceeded;
+ }
+
+ private static void Cleanup()
+ {
+ NativeMethods.InvokeWithDllProtection(NativeMethods.Cleanup);
+ }
+
+ private static int Render(IntPtr resourcePointer, bool isNewSurface)
+ {
+ return NativeMethods.InvokeWithDllProtection(() => NativeMethods.Render(resourcePointer, isNewSurface));
+ }
+
+ private static int SetCameraRadius(float radius)
+ {
+ return NativeMethods.InvokeWithDllProtection(() => NativeMethods.SetCameraRadius(radius));
+ }
+
+ private static int SetCameraTheta(float theta)
+ {
+ return NativeMethods.InvokeWithDllProtection(() => NativeMethods.SetCameraTheta(theta));
+ }
+
+ private static int SetCameraPhi(float phi)
+ {
+ return NativeMethods.InvokeWithDllProtection(() => NativeMethods.SetCameraPhi(phi));
+ }
+
+ #region Callbacks
+ private void Host_Loaded(object sender, RoutedEventArgs e)
+ {
+ Init();
+ this.InitializeRendering();
+
+ // Setup the Magnifier Size
+ MagEllipse.Height = this.magSize;
+ MagEllipse.Width = this.magSize;
+ Scale.Value = this.magScale;
+
+ // Add mouse over event
+ host.MouseMove += this.MagElement_MouseMove;
+ ImageHost.MouseMove += this.MagElement_MouseMove;
+ MagEllipse.MouseMove += this.MagElement_MouseMove;
+ MagImage.MouseMove += this.MagElement_MouseMove;
+
+ host.MouseLeave += this.MagElement_MouseLeave;
+ MagEllipse.MouseLeave += this.MagElement_MouseLeave;
+ ImageHost.MouseLeave += this.MagElement_MouseLeave;
+ MagImage.MouseLeave += this.MagElement_MouseLeave;
+
+ MagBox.Checked += this.MagBox_Checked;
+ MagBox.Unchecked += this.MagBox_Unchecked;
+ }
+
+ private void Host_SizeChanged(object sender, SizeChangedEventArgs e)
+ {
+ double dpiScale = 1.0; // default value for 96 dpi
+
+ // determine DPI
+ // (as of .NET 4.6.1, this returns the DPI of the primary monitor, if you have several different DPIs)
+ var hwndTarget = PresentationSource.FromVisual(this).CompositionTarget as HwndTarget;
+ if (hwndTarget != null)
+ {
+ dpiScale = hwndTarget.TransformToDevice.M11;
+ }
+
+ int surfWidth = (int)(host.ActualWidth < 0 ? 0 : Math.Ceiling(host.ActualWidth * dpiScale));
+ int surfHeight = (int)(host.ActualHeight < 0 ? 0 : Math.Ceiling(host.ActualHeight * dpiScale));
+
+ // Notify the D3D11Image of the pixel size desired for the DirectX rendering.
+ // The D3DRendering component will determine the size of the new surface it is given, at that point.
+ InteropImage.SetPixelSize(surfWidth, surfHeight);
+
+ // Stop rendering if the D3DImage isn't visible - currently just if width or height is 0
+ // TODO: more optimizations possible (scrolled off screen, etc...)
+ bool isVisible = (surfWidth != 0 && surfHeight != 0);
+ if (lastVisible != isVisible)
+ {
+ lastVisible = isVisible;
+ if (lastVisible)
+ {
+ CompositionTarget.Rendering += CompositionTarget_Rendering;
+ }
+ else
+ {
+ CompositionTarget.Rendering -= CompositionTarget_Rendering;
+ }
+ }
+ }
+
+ private void Scale_ValueChanged(object sender, RoutedPropertyChangedEventArgs e)
+ {
+ this.magScale = e.NewValue;
+ }
+
+ private void Size_ValueChanged(object sender, RoutedPropertyChangedEventArgs e)
+ {
+ this.magSize = e.NewValue;
+
+ // Setup the Magnifier Size
+ this.MagEllipse.Height = this.magSize;
+ this.MagEllipse.Width = this.magSize;
+ }
+
+ private void MagBox_Checked(object sender, RoutedEventArgs e)
+ {
+ this.magnify = true;
+
+ MagCurserToggle1.Cursor = System.Windows.Input.Cursors.None;
+ MagCurserToggle2.Cursor = System.Windows.Input.Cursors.None;
+ host.Cursor = System.Windows.Input.Cursors.None;
+ }
+
+ private void MagBox_Unchecked(object sender, RoutedEventArgs e)
+ {
+ this.magnify = false;
+
+ MagCurserToggle1.Cursor = System.Windows.Input.Cursors.Arrow;
+ MagCurserToggle2.Cursor = System.Windows.Input.Cursors.Arrow;
+ host.Cursor = System.Windows.Input.Cursors.Arrow;
+ }
+
+ private void MagElement_MouseMove(object sender, MouseEventArgs e)
+ {
+ if (this.magnify)
+ {
+ Point point = Mouse.GetPosition(host);
+
+ if (!(point.X < 0 || point.Y < 0 || point.X > host.ActualWidth || point.Y > host.ActualHeight))
+ {
+ // Draw the Magnified ellipse on top of image
+ System.Windows.Controls.Canvas.SetTop(this.MagEllipse, point.Y - (this.magSize / 2));
+ System.Windows.Controls.Canvas.SetLeft(this.MagEllipse, point.X - (this.magSize / 2));
+
+ // Set the magnifier image on top of magnified ellipse
+ System.Windows.Controls.Canvas.SetTop(this.MagImage, point.Y - (this.magSize * (.5 + MagImageOffset)));
+ System.Windows.Controls.Canvas.SetLeft(this.MagImage, point.X - (this.magSize * (.5 + MagImageOffset)));
+ MagImage.Width = this.magSize * MagImageScale;
+
+ MagEllipse.Visibility = System.Windows.Visibility.Visible;
+ MagImage.Visibility = System.Windows.Visibility.Visible;
+
+ double magViewboxSize = this.magSize / this.magScale;
+ MagBrush.Viewbox = new Rect(point.X - (.5 * magViewboxSize), point.Y - (.5 * magViewboxSize), magViewboxSize, magViewboxSize);
+ }
+ else
+ {
+ MagEllipse.Visibility = Visibility.Hidden;
+ MagImage.Visibility = Visibility.Hidden;
+ }
+ }
+ }
+
+ private void MagElement_MouseLeave(object sender, MouseEventArgs e)
+ {
+ MagEllipse.Visibility = Visibility.Hidden;
+ MagImage.Visibility = Visibility.Hidden;
+ }
+
+ private void Radius_ValueChanged(object sender, RoutedPropertyChangedEventArgs e)
+ {
+ SetCameraRadius((float)e.NewValue);
+ }
+
+ private void Theta_ValueChanged(object sender, RoutedPropertyChangedEventArgs e)
+ {
+ SetCameraTheta((float)e.NewValue * DegreesToRadians);
+ }
+
+ private void Phi_ValueChanged(object sender, RoutedPropertyChangedEventArgs e)
+ {
+ SetCameraPhi((float)e.NewValue * DegreesToRadians);
+ }
+ #endregion Callbacks
+
+ #region Helpers
+ private void InitializeRendering()
+ {
+ InteropImage.WindowOwner = (new System.Windows.Interop.WindowInteropHelper(this)).Handle;
+ InteropImage.OnRender = this.DoRender;
+
+ // Set up camera
+ SetCameraRadius((float)RadiusSlider.Value);
+ SetCameraPhi((float)PhiSlider.Value * DegreesToRadians);
+ SetCameraTheta((float)ThetaSlider.Value * DegreesToRadians);
+
+ // Start rendering now!
+ InteropImage.RequestRender();
+ }
+
+ void CompositionTarget_Rendering(object sender, EventArgs e)
+ {
+ RenderingEventArgs args = (RenderingEventArgs)e;
+
+ // It's possible for Rendering to call back twice in the same frame
+ // so only render when we haven't already rendered in this frame.
+ if (this.lastRender != args.RenderingTime)
+ {
+ InteropImage.RequestRender();
+ this.lastRender = args.RenderingTime;
+ }
+ }
+
+ private void UninitializeRendering()
+ {
+ Cleanup();
+
+ CompositionTarget.Rendering -= this.CompositionTarget_Rendering;
+ }
+ #endregion Helpers
+
+ private void DoRender(IntPtr surface, bool isNewSurface)
+ {
+ Render(surface, isNewSurface);
+ }
+
+ private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
+ {
+ this.UninitializeRendering();
+
+ host.MouseMove -= this.MagElement_MouseMove;
+ ImageHost.MouseMove -= this.MagElement_MouseMove;
+ MagEllipse.MouseMove -= this.MagElement_MouseMove;
+ MagImage.MouseMove -= this.MagElement_MouseMove;
+
+ host.MouseLeave -= this.MagElement_MouseLeave;
+ MagEllipse.MouseLeave -= this.MagElement_MouseLeave;
+ ImageHost.MouseLeave -= this.MagElement_MouseLeave;
+ MagImage.MouseLeave -= this.MagElement_MouseLeave;
+
+ MagBox.Checked -= this.MagBox_Checked;
+ MagBox.Unchecked -= this.MagBox_Unchecked;
+ }
+
+ private static class NativeMethods
+ {
+ ///
+ /// Variable used to track whether the missing dependency dialog has been displayed,
+ /// used to prevent multiple notifications of the same failure.
+ ///
+ private static bool errorHasDisplayed;
+
+ [DllImport("D3DVisualization.dll", CallingConvention = CallingConvention.Cdecl)]
+ public static extern int Init();
+
+ [DllImport("D3DVisualization.dll", CallingConvention = CallingConvention.Cdecl)]
+ public static extern void Cleanup();
+
+ [DllImport("D3DVisualization.dll", CallingConvention = CallingConvention.Cdecl)]
+ public static extern int Render(IntPtr resourcePointer, bool isNewSurface);
+
+ [DllImport("D3DVisualization.dll", CallingConvention = CallingConvention.Cdecl)]
+ public static extern int SetCameraRadius(float radius);
+
+ [DllImport("D3DVisualization.dll", CallingConvention = CallingConvention.Cdecl)]
+ public static extern int SetCameraTheta(float theta);
+
+ [DllImport("D3DVisualization.dll", CallingConvention = CallingConvention.Cdecl)]
+ public static extern int SetCameraPhi(float phi);
+
+ ///
+ /// Method used to invoke an Action that will catch DllNotFoundExceptions and display a warning dialog.
+ ///
+ /// The Action to invoke.
+ public static void InvokeWithDllProtection(Action action)
+ {
+ InvokeWithDllProtection(
+ () =>
+ {
+ action.Invoke();
+ return 0;
+ });
+ }
+
+ ///
+ /// Method used to invoke A Func that will catch DllNotFoundExceptions and display a warning dialog.
+ ///
+ /// The Func to invoke.
+ /// The return value of func, or default(T) if a DllNotFoundException was caught.
+ /// The return type of the func.
+ public static T InvokeWithDllProtection(Func func)
+ {
+ try
+ {
+ return func.Invoke();
+ }
+ catch (DllNotFoundException e)
+ {
+ if (!errorHasDisplayed)
+ {
+ MessageBox.Show("This sample requires:\nManual build of the D3DVisualization project, which requires installation of Windows 10 SDK or DirectX SDK.\n" +
+ "Installation of the DirectX runtime on non-build machines.\n\n"+
+ "Detailed exception message: " + e.Message, "WPF D3D11 Interop",
+ MessageBoxButton.OK, MessageBoxImage.Error);
+ errorHasDisplayed = true;
+
+ if (Application.Current != null)
+ {
+ Application.Current.Shutdown();
+ }
+ }
+ }
+
+ return default(T);
+ }
+ }
+ }
+}
diff --git a/samples/D3D11Image net core 3.1/WpfD3D11Interop_core/WpfD3D11Interop_core.csproj b/samples/D3D11Image net core 3.1/WpfD3D11Interop_core/WpfD3D11Interop_core.csproj
new file mode 100644
index 0000000..0f294aa
--- /dev/null
+++ b/samples/D3D11Image net core 3.1/WpfD3D11Interop_core/WpfD3D11Interop_core.csproj
@@ -0,0 +1,53 @@
+
+
+
+ WinExe
+ netcoreapp3.1
+ true
+
+
+
+ ..\bin\core31_x64_Debug\
+ x64
+
+
+
+ ..\bin\core31_x64_Release\
+ x64
+
+
+
+
+ Always
+
+
+ Always
+
+
+ Always
+
+
+ Always
+
+
+ Always
+
+
+ Always
+
+
+ Always
+
+
+
+
+
+ ..\..\..\src\x64\Release\Microsoft.Wpf.Interop.DirectX.dll
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/samples/D3D11Image/D3D11Visualization/D3DVisualization_winsdk.vcxproj b/samples/D3D11Image/D3D11Visualization/D3DVisualization_winsdk.vcxproj
index 5adac90..840a7cb 100644
--- a/samples/D3D11Image/D3D11Visualization/D3DVisualization_winsdk.vcxproj
+++ b/samples/D3D11Image/D3D11Visualization/D3DVisualization_winsdk.vcxproj
@@ -45,34 +45,34 @@
D3DVisualization
D3DVisualization
.dll
- 10.0.10240.0
+ 10.0
DynamicLibrary
true
Unicode
- v140
+ v142
DynamicLibrary
true
Unicode
- v140
+ v142
DynamicLibrary
false
true
Unicode
- v140
+ v142
DynamicLibrary
false
true
Unicode
- v140
+ v142
diff --git a/samples/SharpDx2D/App.config b/samples/SharpDx2D/App.config
new file mode 100644
index 0000000..d1428ad
--- /dev/null
+++ b/samples/SharpDx2D/App.config
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/samples/SharpDx2D/App.xaml b/samples/SharpDx2D/App.xaml
new file mode 100644
index 0000000..b026861
--- /dev/null
+++ b/samples/SharpDx2D/App.xaml
@@ -0,0 +1,9 @@
+
+
+
+
+
diff --git a/samples/SharpDx2D/App.xaml.cs b/samples/SharpDx2D/App.xaml.cs
new file mode 100644
index 0000000..5cc7568
--- /dev/null
+++ b/samples/SharpDx2D/App.xaml.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Configuration;
+using System.Data;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Windows;
+
+namespace SharpDx2D
+{
+ ///
+ /// Interaction logic for App.xaml
+ ///
+ public partial class App : Application
+ {
+ }
+}
diff --git a/samples/SharpDx2D/MainWindow.xaml b/samples/SharpDx2D/MainWindow.xaml
new file mode 100644
index 0000000..b43a36c
--- /dev/null
+++ b/samples/SharpDx2D/MainWindow.xaml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
diff --git a/samples/SharpDx2D/MainWindow.xaml.cs b/samples/SharpDx2D/MainWindow.xaml.cs
new file mode 100644
index 0000000..e21b32d
--- /dev/null
+++ b/samples/SharpDx2D/MainWindow.xaml.cs
@@ -0,0 +1,106 @@
+using System;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Media;
+using SharpDX.Direct2D1;
+
+namespace SharpDx2D
+{
+ ///
+ /// Interaction logic for MainWindow.xaml
+ ///
+ public partial class MainWindow : Window
+ {
+ private TimeSpan lastRenderTime;
+ private RenderTarget renderTarget = null;
+ private SharpDX.DirectWrite.TextLayout textLayout;
+ private SharpDX.Direct2D1.Brush brush;
+
+ public MainWindow()
+ {
+ InitializeComponent();
+ Loaded += MainWindow_Loaded;
+ SizeChanged += MainWindow_SizeChanged;
+ }
+
+ private void MainWindow_SizeChanged(object sender, SizeChangedEventArgs e)
+ {
+ Grid g = (Grid)Content;
+ if (g.ActualWidth > 0 && g.ActualHeight > 0)
+ {
+ InteropImage.SetPixelSize((int)g.ActualWidth, (int)g.ActualHeight);
+ }
+ else
+ {
+ Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Background, (Action