Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
VkCV Framework
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Vulkan2021
VkCV Framework
Commits
598c348c
Commit
598c348c
authored
3 years ago
by
Alexander Gauggel
Browse files
Options
Downloads
Patches
Plain Diff
[
#106
] Add option to freeze frame for motion blur inspection
parent
9d0c4b86
No related branches found
No related tags found
1 merge request
!89
Resolve "Indirect Dispatch"
Pipeline
#26825
passed
3 years ago
Stage: build
Stage: deploy
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
projects/indirect_dispatch/src/App.cpp
+24
-12
24 additions, 12 deletions
projects/indirect_dispatch/src/App.cpp
with
24 additions
and
12 deletions
projects/indirect_dispatch/src/App.cpp
+
24
−
12
View file @
598c348c
...
...
@@ -96,6 +96,7 @@ void App::run() {
eMotionVectorVisualisationMode
motionVectorVisualisationMode
=
eMotionVectorVisualisationMode
::
None
;
eMotionVectorMode
motionBlurMotionMode
=
eMotionVectorMode
::
MaxTileNeighbourhood
;
bool
freezeFrame
=
false
;
float
objectVerticalSpeed
=
5
;
float
objectAmplitude
=
0
;
float
objectMeanHeight
=
1
;
...
...
@@ -104,10 +105,9 @@ void App::run() {
int
cameraShutterSpeedInverse
=
24
;
float
motionVectorVisualisationRange
=
0.008
;
glm
::
mat4
viewProjection
=
m_cameraManager
.
getActiveCamera
().
getMVP
();
glm
::
mat4
viewProjectionPrevious
=
m_cameraManager
.
getActiveCamera
().
getMVP
();
struct
Object
{
MeshResources
meshResources
;
glm
::
mat4
modelMatrix
=
glm
::
mat4
(
1.
f
);
...
...
@@ -132,6 +132,8 @@ void App::run() {
};
sceneObjects
.
push_back
(
sphere
);
auto
frameEndTime
=
std
::
chrono
::
system_clock
::
now
();
while
(
m_window
.
isWindowOpen
())
{
vkcv
::
Window
::
pollEvents
();
...
...
@@ -151,21 +153,27 @@ void App::run() {
m_motionBlur
.
setResolution
(
m_windowWidth
,
m_windowHeight
);
}
auto
frameEndTime
=
std
::
chrono
::
system_clock
::
now
();
if
(
!
freezeFrame
)
{
frameEndTime
=
std
::
chrono
::
system_clock
::
now
();
}
auto
deltatime
=
std
::
chrono
::
duration_cast
<
std
::
chrono
::
microseconds
>
(
frameEndTime
-
frameStartTime
);
m_cameraManager
.
update
(
0.000001
*
static_cast
<
double
>
(
deltatime
.
count
()));
const
glm
::
mat4
viewProjection
=
m_cameraManager
.
getActiveCamera
().
getMVP
();
const
auto
time
=
frameEndTime
-
appStartTime
;
const
float
fCurrentTime
=
std
::
chrono
::
duration_cast
<
std
::
chrono
::
milliseconds
>
(
time
).
count
()
*
0.001
f
;
// update matrices
for
(
Object
&
obj
:
sceneObjects
)
{
if
(
obj
.
modelMatrixUpdate
)
{
obj
.
modelMatrixUpdate
(
fCurrentTime
,
obj
);
if
(
!
freezeFrame
)
{
viewProjection
=
m_cameraManager
.
getActiveCamera
().
getMVP
();
for
(
Object
&
obj
:
sceneObjects
)
{
if
(
obj
.
modelMatrixUpdate
)
{
obj
.
modelMatrixUpdate
(
fCurrentTime
,
obj
);
}
obj
.
mvp
=
viewProjection
*
obj
.
modelMatrix
;
}
obj
.
mvp
=
viewProjection
*
obj
.
modelMatrix
;
}
const
vkcv
::
CommandStreamHandle
cmdStream
=
m_core
.
createCommandStream
(
vkcv
::
QueueType
::
Graphics
);
...
...
@@ -322,6 +330,8 @@ void App::run() {
gui
.
beginGUI
();
ImGui
::
Begin
(
"Settings"
);
ImGui
::
Checkbox
(
"Freeze frame"
,
&
freezeFrame
);
ImGui
::
Combo
(
"Debug view"
,
reinterpret_cast
<
int
*>
(
&
motionVectorVisualisationMode
),
...
...
@@ -350,11 +360,13 @@ void App::run() {
m_core
.
endFrame
();
viewProjectionPrevious
=
viewProjection
;
frameStartTime
=
frameEndTime
;
if
(
!
freezeFrame
)
{
viewProjectionPrevious
=
viewProjection
;
frameStartTime
=
frameEndTime
;
for
(
Object
&
obj
:
sceneObjects
)
{
obj
.
mvpPrevious
=
obj
.
mvp
;
for
(
Object
&
obj
:
sceneObjects
)
{
obj
.
mvpPrevious
=
obj
.
mvp
;
}
}
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment