Skip to content

Commit 7076d0e

Browse files
committed
Get some graphics on the screen
git-svn-id: https://nekonme.googlecode.com/svn/trunk@2198 1509560c-5e2a-0410-865c-31c25e1cfdef
1 parent c9a9ff1 commit 7076d0e

File tree

5 files changed

+404
-101
lines changed

5 files changed

+404
-101
lines changed

project/winrt/Direct3DBase.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include "Direct3DBase.h"
22

3+
34
using namespace DirectX;
45
using namespace Microsoft::WRL;
56
using namespace Windows::UI::Core;
@@ -226,6 +227,8 @@ void Direct3DBase::CreateWindowSizeDependentResources()
226227
m_swapChain->SetRotation(rotation)
227228
);
228229

230+
//0
231+
//
229232
// Create a render target view of the swap chain back buffer.
230233
ComPtr<ID3D11Texture2D> backBuffer;
231234
DX::ThrowIfFailed(

project/winrt/Direct3DBase.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
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.
1210
class Direct3DBase
1311
{
1412
public:
15-
Direct3DBase();
13+
Direct3DBase();
1614

1715
virtual void Initialize(Windows::UI::Core::CoreWindow^ window);
1816
virtual void HandleDeviceLost();
@@ -23,7 +21,6 @@ class Direct3DBase
2321
virtual void Present();
2422
virtual float ConvertDipsToPixels(float dips);
2523

26-
protected:
2724
// Direct3D Objects.
2825
Microsoft::WRL::ComPtr<ID3D11Device1> m_d3dDevice;
2926
Microsoft::WRL::ComPtr<ID3D11DeviceContext1> m_d3dContext;
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
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+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
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+
}

0 commit comments

Comments
 (0)