File tree Expand file tree Collapse file tree 5 files changed +404
-101
lines changed Expand file tree Collapse file tree 5 files changed +404
-101
lines changed Original file line number Diff line number Diff line change 11#include " Direct3DBase.h"
22
3+
34using namespace DirectX ;
45using namespace Microsoft ::WRL;
56using namespace Windows ::UI::Core;
@@ -226,6 +227,8 @@ void Direct3DBase::CreateWindowSizeDependentResources()
226227m_swapChain->SetRotation (rotation)
227228);
228229
230+ // 0
231+ //
229232// Create a render target view of the swap chain back buffer.
230233ComPtr<ID3D11Texture2D> backBuffer;
231234DX::ThrowIfFailed (
Original file line number Diff line number Diff line change 11#pragma once
2-
2+ # include " DirectXHelper.h "
33#include < wrl/client.h>
44#include < d3d11_1.h>
55#include < DirectXMath.h>
66#include < memory>
77#include < agile.h>
88
9- #include " DirectXHelper.h"
10-
119// Helper class that initializes DirectX APIs for 3D rendering.
1210class Direct3DBase
1311{
1412public:
15- Direct3DBase ();
13+ Direct3DBase ();
1614
1715virtual void Initialize (Windows::UI::Core::CoreWindow^ window);
1816virtual void HandleDeviceLost ();
@@ -23,7 +21,6 @@ class Direct3DBase
2321virtual void Present ();
2422virtual float ConvertDipsToPixels (float dips);
2523
26- protected:
2724// Direct3D Objects.
2825Microsoft::WRL::ComPtr<ID3D11Device1> m_d3dDevice;
2926Microsoft::WRL::ComPtr<ID3D11DeviceContext1> m_d3dContext;
Original file line number Diff line number Diff line change 1+ struct PixelShaderInput
2+ {
3+ float4 pos : SV_POSITION ;
4+ float3 color : COLOR0 ;
5+ };
6+
7+ float4 main (PixelShaderInput input) : SV_TARGET
8+ {
9+ return float4 (input.color,1.0f );
10+ }
Original file line number Diff line number Diff line change 1+ cbuffer ModelViewProjectionConstantBuffer : register (b0)
2+ {
3+ matrix model;
4+ matrix view;
5+ matrix projection;
6+ };
7+
8+ struct VertexShaderInput
9+ {
10+ float3 pos : POSITION ;
11+ float3 color : COLOR0 ;
12+ };
13+
14+ struct VertexShaderOutput
15+ {
16+ float4 pos : SV_POSITION ;
17+ float3 color : COLOR0 ;
18+ };
19+
20+ VertexShaderOutput main (VertexShaderInput input)
21+ {
22+ VertexShaderOutput output;
23+ float4 pos = float4 (input.pos, 1.0f );
24+
25+ // Transform the vertex position into projected space.
26+ pos = mul (pos, model);
27+ pos = mul (pos, view);
28+ pos = mul (pos, projection);
29+ output.pos = pos;
30+
31+ // Pass through the color without modification.
32+ output.color = input.color;
33+
34+ return output;
35+ }
You can’t perform that action at this time.
0 commit comments