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
9c50145e
Commit
9c50145e
authored
Apr 14, 2019
by
chili
Browse files
put lightpos in camera ref frame > fixed spec but check diffuse...
parent
f0ac931f
Changes
3
Show whitespace changes
Inline
Side-by-side
hw3d/App.cpp
View file @
9c50145e
...
...
@@ -53,7 +53,7 @@ void App::DoFrame()
const
auto
dt
=
timer
.
Mark
()
*
speed_factor
;
wnd
.
Gfx
().
BeginFrame
(
0.07
f
,
0.0
f
,
0.12
f
);
wnd
.
Gfx
().
SetCamera
(
cam
.
GetMatrix
()
);
light
.
Bind
(
wnd
.
Gfx
()
);
light
.
Bind
(
wnd
.
Gfx
()
,
cam
.
GetMatrix
()
);
for
(
auto
&
d
:
drawables
)
{
...
...
@@ -65,7 +65,7 @@ void App::DoFrame()
// imgui window to control simulation speed
if
(
ImGui
::
Begin
(
"Simulation Speed"
)
)
{
ImGui
::
SliderFloat
(
"Speed Factor"
,
&
speed_factor
,
0.0
f
,
4
.0
f
);
ImGui
::
SliderFloat
(
"Speed Factor"
,
&
speed_factor
,
0.0
f
,
6
.0
f
,
"%.4f"
,
3.2
f
);
ImGui
::
Text
(
"%.3f ms/frame (%.1f FPS)"
,
1000.0
f
/
ImGui
::
GetIO
().
Framerate
,
ImGui
::
GetIO
().
Framerate
);
ImGui
::
Text
(
"Status: %s"
,
wnd
.
kbd
.
KeyIsPressed
(
VK_SPACE
)
?
"PAUSED"
:
"RUNNING (hold spacebar to pause)"
);
}
...
...
hw3d/PointLight.cpp
View file @
9c50145e
...
...
@@ -55,8 +55,11 @@ void PointLight::Draw( Graphics& gfx ) const noexcept(!IS_DEBUG)
mesh
.
Draw
(
gfx
);
}
void
PointLight
::
Bind
(
Graphics
&
gfx
)
const
noexcept
void
PointLight
::
Bind
(
Graphics
&
gfx
,
DirectX
::
FXMMATRIX
view
)
const
noexcept
{
cbuf
.
Update
(
gfx
,
cbData
);
auto
dataCopy
=
cbData
;
const
auto
pos
=
DirectX
::
XMLoadFloat3
(
&
cbData
.
pos
);
DirectX
::
XMStoreFloat3
(
&
dataCopy
.
pos
,
DirectX
::
XMVector3Transform
(
pos
,
view
)
);
cbuf
.
Update
(
gfx
,
dataCopy
);
cbuf
.
Bind
(
gfx
);
}
hw3d/PointLight.h
View file @
9c50145e
...
...
@@ -10,7 +10,7 @@ public:
void
SpawnControlWindow
()
noexcept
;
void
Reset
()
noexcept
;
void
Draw
(
Graphics
&
gfx
)
const
noexcept
(
!
IS_DEBUG
);
void
Bind
(
Graphics
&
gfx
)
const
noexcept
;
void
Bind
(
Graphics
&
gfx
,
DirectX
::
FXMMATRIX
view
)
const
noexcept
;
private:
struct
PointLightCBuf
{
...
...
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