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)MainWindow_SizeChanged, null, null); + } + } + + private void MainWindow_Loaded(object sender, RoutedEventArgs e) + { + SharpDX.DirectWrite.Factory factory = new SharpDX.DirectWrite.Factory(SharpDX.DirectWrite.FactoryType.Isolated); + SharpDX.DirectWrite.TextFormat textFormat = new SharpDX.DirectWrite.TextFormat(factory, "Arial", 60); + textLayout = new SharpDX.DirectWrite.TextLayout(factory, "Test", textFormat, 0, 0); + MainWindow_SizeChanged(null, null); + InteropImage.WindowOwner = (new System.Windows.Interop.WindowInteropHelper(this)).Handle; + InteropImage.OnRender = OnRender; + CompositionTarget.Rendering += CompositionTarget_Rendering; + } + + private void OnRender(IntPtr handle, bool isNewSurface) + { + if (isNewSurface) + { + if (brush != null) + { + brush.Dispose(); + brush = null; + } + + if (renderTarget != null) + { + renderTarget.Dispose(); + renderTarget = null; + } + + SharpDX.ComObject comObject = new SharpDX.ComObject(handle); + SharpDX.DXGI.Resource resource = comObject.QueryInterface(); + SharpDX.Direct3D10.Texture2D texture = resource.QueryInterface(); + using (var surface = texture.QueryInterface()) + { + var properties = new RenderTargetProperties(); + properties.DpiX = 96; + properties.DpiY = 96; + properties.MinLevel = FeatureLevel.Level_DEFAULT; + properties.PixelFormat = new SharpDX.Direct2D1.PixelFormat(SharpDX.DXGI.Format.Unknown, AlphaMode.Premultiplied); + properties.Type = RenderTargetType.Default; + properties.Usage = RenderTargetUsage.None; + + renderTarget = new RenderTarget(new Factory(), surface, properties); + } + } + + if (brush == null) + { + brush = new SharpDX.Direct2D1.SolidColorBrush(renderTarget, new SharpDX.Color4(0.2f, 0.2f, 0.2f, 0.5f)); + } + + renderTarget.BeginDraw(); + renderTarget.DrawTextLayout(new SharpDX.Vector2(50, 50), textLayout, brush); + renderTarget.EndDraw(); + } + + private 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 (lastRenderTime != args.RenderingTime) + { + InteropImage.RequestRender(); + lastRenderTime = args.RenderingTime; + } + } + } +} diff --git a/samples/SharpDx2D/Properties/AssemblyInfo.cs b/samples/SharpDx2D/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..7a63c43 --- /dev/null +++ b/samples/SharpDx2D/Properties/AssemblyInfo.cs @@ -0,0 +1,55 @@ +using System.Reflection; +using System.Resources; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Windows; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("SharpDx2D")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("SharpDx2D")] +[assembly: AssemblyCopyright("Copyright © 2015")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +//In order to begin building localizable applications, set +//CultureYouAreCodingWith in your .csproj file +//inside a . For example, if you are using US english +//in your source files, set the to en-US. Then uncomment +//the NeutralResourceLanguage attribute below. Update the "en-US" in +//the line below to match the UICulture setting in the project file. + +//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] + + +[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) +)] + + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/samples/SharpDx2D/Properties/Resources.Designer.cs b/samples/SharpDx2D/Properties/Resources.Designer.cs new file mode 100644 index 0000000..7c5525c --- /dev/null +++ b/samples/SharpDx2D/Properties/Resources.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace SharpDx2D.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SharpDx2D.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/samples/SharpDx2D/Properties/Resources.resx b/samples/SharpDx2D/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/samples/SharpDx2D/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/samples/SharpDx2D/Properties/Settings.Designer.cs b/samples/SharpDx2D/Properties/Settings.Designer.cs new file mode 100644 index 0000000..450d0fd --- /dev/null +++ b/samples/SharpDx2D/Properties/Settings.Designer.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace SharpDx2D.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default { + get { + return defaultInstance; + } + } + } +} diff --git a/samples/SharpDx2D/Properties/Settings.settings b/samples/SharpDx2D/Properties/Settings.settings new file mode 100644 index 0000000..033d7a5 --- /dev/null +++ b/samples/SharpDx2D/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/samples/SharpDx2D/README.md b/samples/SharpDx2D/README.md new file mode 100644 index 0000000..4f9c41f --- /dev/null +++ b/samples/SharpDx2D/README.md @@ -0,0 +1,10 @@ +A Direct2D SharpDX Sample + +Requires following NuGet packages + +* Microsoft.Wpf.Interop.DirectX-x86 +* SharpDX +* SharpDX.D3DCompiler +* SharpDX.Direct2D1 +* SharpDX.Direct3D10 +* SharpDX.DXGI \ No newline at end of file diff --git a/samples/SharpDx2D/SharpDx2D.csproj b/samples/SharpDx2D/SharpDx2D.csproj new file mode 100644 index 0000000..1d2c3c3 --- /dev/null +++ b/samples/SharpDx2D/SharpDx2D.csproj @@ -0,0 +1,143 @@ + + + + + Debug + AnyCPU + {64669039-1540-4220-964C-CE9B68EDDCD3} + WinExe + Properties + SharpDx2D + SharpDx2D + v4.5 + 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4 + true + + + + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + packages\Microsoft.Wpf.Interop.DirectX-x86.0.9.0-beta-22856\lib\net45\Microsoft.Wpf.Interop.DirectX.dll + True + + + False + $(SharpDXPackageBinDir)\SharpDX.dll + + + False + $(SharpDXPackageBinDir)\SharpDX.D3DCompiler.dll + + + $(SharpDXPackageBinDir)\SharpDX.Direct2D1.dll + + + False + $(SharpDXPackageBinDir)\SharpDX.Direct3D10.dll + + + False + $(SharpDXPackageBinDir)\SharpDX.DXGI.dll + + + + + + + + + + + + + 4.0 + + + + + + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + App.xaml + Code + + + MainWindow.xaml + Code + + + + + Code + + + True + True + Resources.resx + + + True + Settings.settings + True + + + ResXFileCodeGenerator + Resources.Designer.cs + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + \ No newline at end of file diff --git a/samples/SharpDx2D/SharpDx2D.sln b/samples/SharpDx2D/SharpDx2D.sln new file mode 100644 index 0000000..9fe7d5e --- /dev/null +++ b/samples/SharpDx2D/SharpDx2D.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.23107.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpDx2D", "SharpDx2D.csproj", "{64669039-1540-4220-964C-CE9B68EDDCD3}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {64669039-1540-4220-964C-CE9B68EDDCD3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {64669039-1540-4220-964C-CE9B68EDDCD3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {64669039-1540-4220-964C-CE9B68EDDCD3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {64669039-1540-4220-964C-CE9B68EDDCD3}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/samples/SharpDx2D/packages.config b/samples/SharpDx2D/packages.config new file mode 100644 index 0000000..2475409 --- /dev/null +++ b/samples/SharpDx2D/packages.config @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/scripts/BuildNuGetPackage.cmd b/scripts/BuildNuGetPackage.cmd index af1119e..3f66807 100644 --- a/scripts/BuildNuGetPackage.cmd +++ b/scripts/BuildNuGetPackage.cmd @@ -1,2 +1,2 @@ -nuget.exe pack Microsoft.Wpf.Interop.DirectX.nuspec -Version 0.9.0-beta-99999 -Properties ArchitecturePublicName=x64;NuGetBinaries=..\src\x64\release -symbols -nuget.exe pack Microsoft.Wpf.Interop.DirectX.nuspec -Version 0.9.0-beta-99999 -Properties ArchitecturePublicName=x86;NuGetBinaries=..\src\release -symbols \ No newline at end of file +nuget.exe pack Microsoft.Wpf.Interop.DirectX.nuspec -Version 0.9.31 -Properties ArchitecturePublicName=x64;NuGetBinaries=..\src\x64\release -symbols +nuget.exe pack Microsoft.Wpf.Interop.DirectX.nuspec -Version 0.9.31 -Properties ArchitecturePublicName=x86;NuGetBinaries=..\src\release -symbols \ No newline at end of file diff --git a/scripts/Microsoft.Wpf.Interop.DirectX.nuspec b/scripts/Microsoft.Wpf.Interop.DirectX.nuspec index e620ad1..bb86a5c 100644 --- a/scripts/Microsoft.Wpf.Interop.DirectX.nuspec +++ b/scripts/Microsoft.Wpf.Interop.DirectX.nuspec @@ -18,7 +18,7 @@ - - + + diff --git a/scripts/nuget.exe b/scripts/nuget.exe new file mode 100644 index 0000000..4cbab24 Binary files /dev/null and b/scripts/nuget.exe differ diff --git a/src/Microsoft.Wpf.Interop.DirectX/Microsoft.Wpf.Interop.DirectX_core.vcxproj b/src/Microsoft.Wpf.Interop.DirectX/Microsoft.Wpf.Interop.DirectX_core.vcxproj new file mode 100644 index 0000000..2f4e3f9 --- /dev/null +++ b/src/Microsoft.Wpf.Interop.DirectX/Microsoft.Wpf.Interop.DirectX_core.vcxproj @@ -0,0 +1,219 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + Create + Create + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {9BB2478D-F4A2-4EB2-BD1B-8CF35A1C04AB} + Win32Proj + Microsoft.Wpf.Interop.DirectX + Microsoft.Wpf.Interop.DirectX + 10.0 + Microsoft.Wpf.Interop.DirectX_core + netcoreapp3.1;netstandard2.1;net45;net48 + + + + DynamicLibrary + true + Unicode + true + v142 + + + DynamicLibrary + true + Unicode + true + v142 + + + DynamicLibrary + false + true + Unicode + true + v142 + + + DynamicLibrary + false + true + Unicode + true + v142 + + + + + + + + + + + + + + + + + + + true + $(LibraryPath) + $(IncludePath) + + + false + $(LibraryPath) + $(IncludePath) + + + true + $(IncludePath) + $(LibraryPath) + + + false + $(IncludePath) + $(LibraryPath) + + + + NotUsing + Level3 + Disabled + CORE;WIN32;_DEBUG;QUEUE_USE_CONFORMANT_NEW;%(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + MultiThreadedDLL + + + + + true + + dxgi.lib;d3d9.lib;d3d10_1.lib;%(AdditionalDependencies) + + ..\Debug;%(AdditionalLibraryDirectories) + + + + + NotUsing + Level3 + Disabled + CORE;_DEBUG;QUEUE_USE_CONFORMANT_NEW;%(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + MultiThreadedDLL + + + true + + + true + + dxgi.lib;d3d9.lib;d3d10_1.lib;%(AdditionalDependencies) + + ..\x64\Debug;%(AdditionalLibraryDirectories) + + + + + Level3 + NotUsing + MaxSpeed + true + CORE;WIN32;NDEBUG;QUEUE_USE_CONFORMANT_NEW;%(PreprocessorDefinitions) + MultiThreadedDLL + %(AdditionalIncludeDirectories) + Async + + + + + true + + dxgi.lib;d3d9.lib;d3d10_1.lib;%(AdditionalDependencies) + + ..\Release;%(AdditionalLibraryDirectories) + false + + + + + Level3 + NotUsing + MaxSpeed + true + CORE;NDEBUG;QUEUE_USE_CONFORMANT_NEW;%(PreprocessorDefinitions) + MultiThreadedDLL + %(AdditionalIncludeDirectories) + Async + + + + + true + + dxgi.lib;d3d9.lib;d3d10_1.lib;%(AdditionalDependencies) + + ..\x64\Release;%(AdditionalLibraryDirectories) + false + + + + + + \ No newline at end of file diff --git a/src/Microsoft.Wpf.Interop.DirectX/Microsoft.Wpf.Interop.DirectX_dxsdk.vcxproj b/src/Microsoft.Wpf.Interop.DirectX/Microsoft.Wpf.Interop.DirectX_dxsdk.vcxproj index 9802bdd..7a4a566 100644 --- a/src/Microsoft.Wpf.Interop.DirectX/Microsoft.Wpf.Interop.DirectX_dxsdk.vcxproj +++ b/src/Microsoft.Wpf.Interop.DirectX/Microsoft.Wpf.Interop.DirectX_dxsdk.vcxproj @@ -53,7 +53,7 @@ - {157A478D-FE02-4EB2-BD7C-8CF3BF1CB9A2} + {51880B2F-A2DD-4669-B7F2-D5315B03C06D} Win32Proj Microsoft.Wpf.Interop.DirectX Microsoft.Wpf.Interop.DirectX diff --git a/src/Microsoft.Wpf.Interop.DirectX/Microsoft.Wpf.Interop.DirectX_winsdk.vcxproj b/src/Microsoft.Wpf.Interop.DirectX/Microsoft.Wpf.Interop.DirectX_winsdk.vcxproj index f94ba44..e34b8a8 100644 --- a/src/Microsoft.Wpf.Interop.DirectX/Microsoft.Wpf.Interop.DirectX_winsdk.vcxproj +++ b/src/Microsoft.Wpf.Interop.DirectX/Microsoft.Wpf.Interop.DirectX_winsdk.vcxproj @@ -59,8 +59,8 @@ Win32Proj Microsoft.Wpf.Interop.DirectX Microsoft.Wpf.Interop.DirectX - v4.5 - 8.1 + v4.7.2 + 10.0 Microsoft.Wpf.Interop.DirectX_winsdk @@ -69,14 +69,14 @@ true Unicode true - v140 + v142 DynamicLibrary true Unicode true - v140 + v142 DynamicLibrary @@ -84,7 +84,7 @@ true Unicode true - v140 + v142 DynamicLibrary @@ -92,7 +92,7 @@ true Unicode true - v140 + v142 diff --git a/src/Microsoft.Wpf.Interop.DirectX/SurfaceQueueInteropHelper.cpp b/src/Microsoft.Wpf.Interop.DirectX/SurfaceQueueInteropHelper.cpp index 5d53d8d..0544e1b 100644 --- a/src/Microsoft.Wpf.Interop.DirectX/SurfaceQueueInteropHelper.cpp +++ b/src/Microsoft.Wpf.Interop.DirectX/SurfaceQueueInteropHelper.cpp @@ -345,11 +345,14 @@ namespace Microsoft { IFC(pTexture9->GetSurfaceLevel(0, &pSurface9)); m_d3dImage->SetBackBuffer(System::Windows::Interop::D3DResourceType::IDirect3DSurface9, - (IntPtr)(void*)pSurface9, + (IntPtr)(void*)pSurface9 +#ifndef CORE + , true // enableSoftwareFallback // Supports fallback to software rendering for Remote Desktop, etc... // Was added in WPF 4.5 - ); +#endif + ); // Produce Surface m_ABProducer->Enqueue(pTexture9, &count, sizeof(int), SURFACE_QUEUE_FLAG_DO_NOT_WAIT); diff --git a/src/Microsoft.Wpf.Interop.DirectX_core.sln b/src/Microsoft.Wpf.Interop.DirectX_core.sln new file mode 100644 index 0000000..3b4349b --- /dev/null +++ b/src/Microsoft.Wpf.Interop.DirectX_core.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29728.190 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{A759CEB8-4B4A-14D0-4D11-6EA0C090A9CF}") = "Microsoft.Wpf.Interop.DirectX_core", "Microsoft.Wpf.Interop.DirectX\Microsoft.Wpf.Interop.DirectX_core.vcxproj", "{9BB2478D-F4A2-4EB2-BD1B-8CF35A1C04AB}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {9BB2478D-F4A2-4EB2-BD1B-8CF35A1C04AB}.Debug|x64.ActiveCfg = Debug|x64 + {9BB2478D-F4A2-4EB2-BD1B-8CF35A1C04AB}.Debug|x64.Build.0 = Debug|x64 + {9BB2478D-F4A2-4EB2-BD1B-8CF35A1C04AB}.Debug|x86.ActiveCfg = Debug|Win32 + {9BB2478D-F4A2-4EB2-BD1B-8CF35A1C04AB}.Debug|x86.Build.0 = Debug|Win32 + {9BB2478D-F4A2-4EB2-BD1B-8CF35A1C04AB}.Release|x64.ActiveCfg = Release|x64 + {9BB2478D-F4A2-4EB2-BD1B-8CF35A1C04AB}.Release|x64.Build.0 = Release|x64 + {9BB2478D-F4A2-4EB2-BD1B-8CF35A1C04AB}.Release|x86.ActiveCfg = Release|Win32 + {9BB2478D-F4A2-4EB2-BD1B-8CF35A1C04AB}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {D8F0E52E-F030-4A94-BADD-8913F4AD6961} + EndGlobalSection +EndGlobal diff --git a/src/Microsoft.Wpf.Interop.DirectX_dxsdk.sln b/src/Microsoft.Wpf.Interop.DirectX_dxsdk.sln index 225e1d4..5305b2c 100644 --- a/src/Microsoft.Wpf.Interop.DirectX_dxsdk.sln +++ b/src/Microsoft.Wpf.Interop.DirectX_dxsdk.sln @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 14 VisualStudioVersion = 14.0.23107.0 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Wpf.Interop.DirectX_dxsdk", "Microsoft.Wpf.Interop.DirectX\Microsoft.Wpf.Interop.DirectX.csproj", "{51880B2F-A2DD-4669-B7F2-D5315B03C06D}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Wpf.Interop.DirectX_dxsdk", "Microsoft.Wpf.Interop.DirectX\Microsoft.Wpf.Interop.DirectX_dxsdk.csproj", "{51880B2F-A2DD-4669-B7F2-D5315B03C06D}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -13,14 +13,6 @@ Global Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {157A478D-FE02-4EB2-BD7C-8CF3BF1CB9A2}.Debug|x64.ActiveCfg = Debug|x64 - {157A478D-FE02-4EB2-BD7C-8CF3BF1CB9A2}.Debug|x64.Build.0 = Debug|x64 - {157A478D-FE02-4EB2-BD7C-8CF3BF1CB9A2}.Debug|x86.ActiveCfg = Debug|Win32 - {157A478D-FE02-4EB2-BD7C-8CF3BF1CB9A2}.Debug|x86.Build.0 = Debug|Win32 - {157A478D-FE02-4EB2-BD7C-8CF3BF1CB9A2}.Release|x64.ActiveCfg = Release|x64 - {157A478D-FE02-4EB2-BD7C-8CF3BF1CB9A2}.Release|x64.Build.0 = Release|x64 - {157A478D-FE02-4EB2-BD7C-8CF3BF1CB9A2}.Release|x86.ActiveCfg = Release|Win32 - {157A478D-FE02-4EB2-BD7C-8CF3BF1CB9A2}.Release|x86.Build.0 = Release|Win32 {51880B2F-A2DD-4669-B7F2-D5315B03C06D}.Debug|x64.ActiveCfg = Debug|x64 {51880B2F-A2DD-4669-B7F2-D5315B03C06D}.Debug|x64.Build.0 = Debug|x64 {51880B2F-A2DD-4669-B7F2-D5315B03C06D}.Debug|x86.ActiveCfg = Debug|Win32