Skip to content

Commit 0022196

Browse files
author
Floyd Huizinga
committed
fix 3d projection
1 parent 405d638 commit 0022196

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

src/Cpp/1-getting-started/1-3-3-SettingUp3DRendering/Assets/Shaders/Main.vs.hlsl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ struct VSOutput
1414

1515
cbuffer PerFrame : register(b0)
1616
{
17-
row_major matrix viewprojection;
17+
matrix viewprojection;
1818
};
1919

2020
cbuffer PerObject : register(b1)
2121
{
22-
row_major matrix modelmatrix;
22+
matrix modelmatrix;
2323
};
2424

2525
VSOutput Main(VSInput input)

src/Cpp/1-getting-started/1-3-3-SettingUp3DRendering/Setting3DApplication.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -446,8 +446,8 @@ void Setting3DApplication::Update()
446446
//This will be our "camera"
447447
XMVECTOR camPos = XMLoadFloat3(&_cameraPosition);
448448

449-
XMMATRIX view = XMMatrixLookAtLH(camPos, g_XMZero, { 0,1,0,1 });
450-
XMMATRIX proj = XMMatrixPerspectiveFovLH(90.0f * 0.0174533f,
449+
XMMATRIX view = XMMatrixLookAtRH(camPos, g_XMZero, { 0,1,0,1 });
450+
XMMATRIX proj = XMMatrixPerspectiveFovRH(90.0f * 0.0174533f,
451451
static_cast<float>(_width) / static_cast<float>(_height),
452452
0.1f,
453453
100.0f);

src/Cpp/1-getting-started/1-3-4-3DRendering/3DRenderingApplication.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ void Rendering3DApplication::Update()
355355

356356
static float _yRotation = 0.0f;
357357
static float _scale = 1.0f;
358-
static XMFLOAT3 _cameraPosition = { 0.0f, 0.0f, -5.0f };
358+
static XMFLOAT3 _cameraPosition = { 0.0f, 0.0f, -2.0f };
359359

360360

361361
_yRotation += _deltaTime;
@@ -364,8 +364,8 @@ void Rendering3DApplication::Update()
364364
//This will be our "camera"
365365
XMVECTOR camPos = XMLoadFloat3(&_cameraPosition);
366366

367-
XMMATRIX view = XMMatrixLookAtLH(camPos, g_XMZero, { 0,1,0,1 });
368-
XMMATRIX proj = XMMatrixPerspectiveFovLH(75.0f * 0.0174533f,
367+
XMMATRIX view = XMMatrixLookAtRH(camPos, g_XMZero, { 0,1,0,1 });
368+
XMMATRIX proj = XMMatrixPerspectiveFovRH(90.0f * 0.0174533f,
369369
static_cast<float>(_width) / static_cast<float>(_height),
370370
0.1f,
371371
100.0f);

src/Cpp/1-getting-started/1-3-4-3DRendering/Assets/Shaders/Main.vs.hlsl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ struct VSOutput
1414

1515
cbuffer PerFrame : register(b0)
1616
{
17-
row_major matrix viewprojection;
17+
matrix viewprojection;
1818
};
1919

2020
cbuffer PerObject : register(b1)
2121
{
22-
row_major matrix modelmatrix;
22+
matrix modelmatrix;
2323
};
2424

2525
VSOutput Main(VSInput input)

0 commit comments

Comments
 (0)