src/video/windowsrt/Direct3DBase.h
author David Ludwig <dludwig@pobox.com>
Sun, 28 Oct 2012 20:47:33 -0400
changeset 8332 ea83d191cc17
parent 8322 839cd578a474
child 8350 ecc8c88ed82e
permissions -rw-r--r--
WinRT: added mouse button event support
dludwig@8322
     1
#pragma once
dludwig@8322
     2
dludwig@8322
     3
#include "DirectXHelper.h"
dludwig@8322
     4
dludwig@8322
     5
// Helper class that initializes DirectX APIs for 3D rendering.
dludwig@8322
     6
ref class Direct3DBase abstract
dludwig@8322
     7
{
dludwig@8322
     8
internal:
dludwig@8322
     9
	Direct3DBase();
dludwig@8322
    10
dludwig@8322
    11
public:
dludwig@8322
    12
	virtual void Initialize(Windows::UI::Core::CoreWindow^ window);
dludwig@8322
    13
	virtual void HandleDeviceLost();
dludwig@8322
    14
	virtual void CreateDeviceResources();
dludwig@8322
    15
	virtual void CreateWindowSizeDependentResources();
dludwig@8322
    16
	virtual void UpdateForWindowSizeChange();
dludwig@8322
    17
	virtual void Render() = 0;
dludwig@8322
    18
	virtual void Present();
dludwig@8322
    19
	virtual float ConvertDipsToPixels(float dips);
dludwig@8322
    20
dludwig@8322
    21
protected private:
dludwig@8322
    22
	// Direct3D Objects.
dludwig@8322
    23
	Microsoft::WRL::ComPtr<ID3D11Device1> m_d3dDevice;
dludwig@8322
    24
	Microsoft::WRL::ComPtr<ID3D11DeviceContext1> m_d3dContext;
dludwig@8322
    25
	Microsoft::WRL::ComPtr<IDXGISwapChain1> m_swapChain;
dludwig@8322
    26
	Microsoft::WRL::ComPtr<ID3D11RenderTargetView> m_renderTargetView;
dludwig@8322
    27
	Microsoft::WRL::ComPtr<ID3D11DepthStencilView> m_depthStencilView;
dludwig@8322
    28
dludwig@8322
    29
	// Cached renderer properties.
dludwig@8322
    30
	D3D_FEATURE_LEVEL m_featureLevel;
dludwig@8322
    31
	Windows::Foundation::Size m_renderTargetSize;
dludwig@8322
    32
	Windows::Foundation::Rect m_windowBounds;
dludwig@8322
    33
	Platform::Agile<Windows::UI::Core::CoreWindow> m_window;
dludwig@8322
    34
	Windows::Graphics::Display::DisplayOrientations m_orientation;
dludwig@8322
    35
dludwig@8322
    36
	// Transform used for display orientation.
dludwig@8322
    37
	DirectX::XMFLOAT4X4 m_orientationTransform3D;
dludwig@8322
    38
};