Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Clark Lin
hw3d
Commits
13abbb1e
Commit
13abbb1e
authored
Mar 03, 2019
by
chili
Browse files
use camera/view matrix
parent
98fa77f0
Changes
9
Show whitespace changes
Inline
Side-by-side
hw3d/App.cpp
View file @
13abbb1e
...
@@ -11,6 +11,8 @@
...
@@ -11,6 +11,8 @@
#include "GDIPlusManager.h"
#include "GDIPlusManager.h"
#include "imgui/imgui.h"
#include "imgui/imgui.h"
namespace
dx
=
DirectX
;
GDIPlusManager
gdipm
;
GDIPlusManager
gdipm
;
App
::
App
()
App
::
App
()
...
@@ -74,7 +76,8 @@ App::App()
...
@@ -74,7 +76,8 @@ App::App()
drawables
.
reserve
(
nDrawables
);
drawables
.
reserve
(
nDrawables
);
std
::
generate_n
(
std
::
back_inserter
(
drawables
),
nDrawables
,
Factory
{
wnd
.
Gfx
()
}
);
std
::
generate_n
(
std
::
back_inserter
(
drawables
),
nDrawables
,
Factory
{
wnd
.
Gfx
()
}
);
wnd
.
Gfx
().
SetProjection
(
DirectX
::
XMMatrixPerspectiveLH
(
1.0
f
,
3.0
f
/
4.0
f
,
0.5
f
,
40.0
f
)
);
wnd
.
Gfx
().
SetProjection
(
dx
::
XMMatrixPerspectiveLH
(
1.0
f
,
3.0
f
/
4.0
f
,
0.5
f
,
40.0
f
)
);
wnd
.
Gfx
().
SetCamera
(
dx
::
XMMatrixTranslation
(
0.0
f
,
0.0
f
,
20.0
f
)
);
}
}
void
App
::
DoFrame
()
void
App
::
DoFrame
()
...
...
hw3d/Box.cpp
View file @
13abbb1e
...
@@ -106,6 +106,5 @@ DirectX::XMMATRIX Box::GetTransformXM() const noexcept
...
@@ -106,6 +106,5 @@ DirectX::XMMATRIX Box::GetTransformXM() const noexcept
return
dx
::
XMLoadFloat3x3
(
&
mt
)
*
return
dx
::
XMLoadFloat3x3
(
&
mt
)
*
dx
::
XMMatrixRotationRollPitchYaw
(
pitch
,
yaw
,
roll
)
*
dx
::
XMMatrixRotationRollPitchYaw
(
pitch
,
yaw
,
roll
)
*
dx
::
XMMatrixTranslation
(
r
,
0.0
f
,
0.0
f
)
*
dx
::
XMMatrixTranslation
(
r
,
0.0
f
,
0.0
f
)
*
dx
::
XMMatrixRotationRollPitchYaw
(
theta
,
phi
,
chi
)
*
dx
::
XMMatrixRotationRollPitchYaw
(
theta
,
phi
,
chi
);
dx
::
XMMatrixTranslation
(
0.0
f
,
0.0
f
,
20.0
f
);
}
}
hw3d/Graphics.cpp
View file @
13abbb1e
...
@@ -170,6 +170,16 @@ DirectX::XMMATRIX Graphics::GetProjection() const noexcept
...
@@ -170,6 +170,16 @@ DirectX::XMMATRIX Graphics::GetProjection() const noexcept
return
projection
;
return
projection
;
}
}
void
Graphics
::
SetCamera
(
DirectX
::
FXMMATRIX
cam
)
noexcept
{
camera
=
cam
;
}
DirectX
::
XMMATRIX
Graphics
::
GetCamera
()
const
noexcept
{
return
camera
;
}
void
Graphics
::
EnableImgui
()
noexcept
void
Graphics
::
EnableImgui
()
noexcept
{
{
imguiEnabled
=
true
;
imguiEnabled
=
true
;
...
...
hw3d/Graphics.h
View file @
13abbb1e
...
@@ -60,12 +60,15 @@ public:
...
@@ -60,12 +60,15 @@ public:
void
DrawIndexed
(
UINT
count
)
noexcept
(
!
IS_DEBUG
);
void
DrawIndexed
(
UINT
count
)
noexcept
(
!
IS_DEBUG
);
void
SetProjection
(
DirectX
::
FXMMATRIX
proj
)
noexcept
;
void
SetProjection
(
DirectX
::
FXMMATRIX
proj
)
noexcept
;
DirectX
::
XMMATRIX
GetProjection
()
const
noexcept
;
DirectX
::
XMMATRIX
GetProjection
()
const
noexcept
;
void
SetCamera
(
DirectX
::
FXMMATRIX
cam
)
noexcept
;
DirectX
::
XMMATRIX
GetCamera
()
const
noexcept
;
void
EnableImgui
()
noexcept
;
void
EnableImgui
()
noexcept
;
void
DisableImgui
()
noexcept
;
void
DisableImgui
()
noexcept
;
bool
IsImguiEnabled
()
const
noexcept
;
bool
IsImguiEnabled
()
const
noexcept
;
private:
private:
bool
imguiEnabled
=
true
;
DirectX
::
XMMATRIX
projection
;
DirectX
::
XMMATRIX
projection
;
DirectX
::
XMMATRIX
camera
;
bool
imguiEnabled
=
true
;
#ifndef NDEBUG
#ifndef NDEBUG
DxgiInfoManager
infoManager
;
DxgiInfoManager
infoManager
;
#endif
#endif
...
...
hw3d/Melon.cpp
View file @
13abbb1e
...
@@ -98,6 +98,5 @@ DirectX::XMMATRIX Melon::GetTransformXM() const noexcept
...
@@ -98,6 +98,5 @@ DirectX::XMMATRIX Melon::GetTransformXM() const noexcept
namespace
dx
=
DirectX
;
namespace
dx
=
DirectX
;
return
dx
::
XMMatrixRotationRollPitchYaw
(
pitch
,
yaw
,
roll
)
*
return
dx
::
XMMatrixRotationRollPitchYaw
(
pitch
,
yaw
,
roll
)
*
dx
::
XMMatrixTranslation
(
r
,
0.0
f
,
0.0
f
)
*
dx
::
XMMatrixTranslation
(
r
,
0.0
f
,
0.0
f
)
*
dx
::
XMMatrixRotationRollPitchYaw
(
theta
,
phi
,
chi
)
*
dx
::
XMMatrixRotationRollPitchYaw
(
theta
,
phi
,
chi
);
dx
::
XMMatrixTranslation
(
0.0
f
,
0.0
f
,
20.0
f
);
}
}
hw3d/Pyramid.cpp
View file @
13abbb1e
...
@@ -90,6 +90,5 @@ DirectX::XMMATRIX Pyramid::GetTransformXM() const noexcept
...
@@ -90,6 +90,5 @@ DirectX::XMMATRIX Pyramid::GetTransformXM() const noexcept
namespace
dx
=
DirectX
;
namespace
dx
=
DirectX
;
return
dx
::
XMMatrixRotationRollPitchYaw
(
pitch
,
yaw
,
roll
)
*
return
dx
::
XMMatrixRotationRollPitchYaw
(
pitch
,
yaw
,
roll
)
*
dx
::
XMMatrixTranslation
(
r
,
0.0
f
,
0.0
f
)
*
dx
::
XMMatrixTranslation
(
r
,
0.0
f
,
0.0
f
)
*
dx
::
XMMatrixRotationRollPitchYaw
(
theta
,
phi
,
chi
)
*
dx
::
XMMatrixRotationRollPitchYaw
(
theta
,
phi
,
chi
);
dx
::
XMMatrixTranslation
(
0.0
f
,
0.0
f
,
20.0
f
);
}
}
hw3d/Sheet.cpp
View file @
13abbb1e
...
@@ -90,6 +90,5 @@ DirectX::XMMATRIX Sheet::GetTransformXM() const noexcept
...
@@ -90,6 +90,5 @@ DirectX::XMMATRIX Sheet::GetTransformXM() const noexcept
namespace
dx
=
DirectX
;
namespace
dx
=
DirectX
;
return
dx
::
XMMatrixRotationRollPitchYaw
(
pitch
,
yaw
,
roll
)
*
return
dx
::
XMMatrixRotationRollPitchYaw
(
pitch
,
yaw
,
roll
)
*
dx
::
XMMatrixTranslation
(
r
,
0.0
f
,
0.0
f
)
*
dx
::
XMMatrixTranslation
(
r
,
0.0
f
,
0.0
f
)
*
dx
::
XMMatrixRotationRollPitchYaw
(
theta
,
phi
,
chi
)
*
dx
::
XMMatrixRotationRollPitchYaw
(
theta
,
phi
,
chi
);
dx
::
XMMatrixTranslation
(
0.0
f
,
0.0
f
,
20.0
f
);
}
}
hw3d/SkinnedBox.cpp
View file @
13abbb1e
...
@@ -83,6 +83,5 @@ DirectX::XMMATRIX SkinnedBox::GetTransformXM() const noexcept
...
@@ -83,6 +83,5 @@ DirectX::XMMATRIX SkinnedBox::GetTransformXM() const noexcept
namespace
dx
=
DirectX
;
namespace
dx
=
DirectX
;
return
dx
::
XMMatrixRotationRollPitchYaw
(
pitch
,
yaw
,
roll
)
*
return
dx
::
XMMatrixRotationRollPitchYaw
(
pitch
,
yaw
,
roll
)
*
dx
::
XMMatrixTranslation
(
r
,
0.0
f
,
0.0
f
)
*
dx
::
XMMatrixTranslation
(
r
,
0.0
f
,
0.0
f
)
*
dx
::
XMMatrixRotationRollPitchYaw
(
theta
,
phi
,
chi
)
*
dx
::
XMMatrixRotationRollPitchYaw
(
theta
,
phi
,
chi
);
dx
::
XMMatrixTranslation
(
0.0
f
,
0.0
f
,
20.0
f
);
}
}
hw3d/TransformCbuf.cpp
View file @
13abbb1e
...
@@ -14,7 +14,9 @@ void TransformCbuf::Bind( Graphics& gfx ) noexcept
...
@@ -14,7 +14,9 @@ void TransformCbuf::Bind( Graphics& gfx ) noexcept
{
{
pVcbuf
->
Update
(
gfx
,
pVcbuf
->
Update
(
gfx
,
DirectX
::
XMMatrixTranspose
(
DirectX
::
XMMatrixTranspose
(
parent
.
GetTransformXM
()
*
gfx
.
GetProjection
()
parent
.
GetTransformXM
()
*
gfx
.
GetCamera
()
*
gfx
.
GetProjection
()
)
)
);
);
pVcbuf
->
Bind
(
gfx
);
pVcbuf
->
Bind
(
gfx
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment