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
659d366e
Verified
Commit
659d366e
authored
3 years ago
by
Josch Morgenstern
Browse files
Options
Downloads
Patches
Plain Diff
[
#54
] add simple example for linear camera interpolation
parent
f2bbd45a
No related branches found
No related tags found
1 merge request
!53
Resolve "Kamera - Kamerafahrt mit Interpolation"
Pipeline
#26087
failed
3 years ago
Stage: build
Stage: deploy
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
projects/first_mesh/src/main.cpp
+14
-2
14 additions, 2 deletions
projects/first_mesh/src/main.cpp
with
14 additions
and
2 deletions
projects/first_mesh/src/main.cpp
+
14
−
2
View file @
659d366e
...
...
@@ -2,6 +2,7 @@
#include
<vkcv/Core.hpp>
#include
<GLFW/glfw3.h>
#include
<vkcv/camera/CameraManager.hpp>
#include
<vkcv/camera/InterpolationLinear.hpp>
#include
<chrono>
#include
<vkcv/asset/asset_loader.hpp>
...
...
@@ -152,11 +153,21 @@ int main(int argc, const char** argv) {
vkcv
::
DrawcallInfo
drawcall
(
renderMesh
,
{
descriptorUsage
});
vkcv
::
camera
::
CameraManager
cameraManager
(
window
);
uint32_t
camIndex0
=
cameraManager
.
addCamera
(
vkcv
::
camera
::
ControllerType
::
PILOT
);
uint32_t
camIndex1
=
cameraManager
.
addCamera
(
vkcv
::
camera
::
ControllerType
::
TRACKBALL
);
uint32_t
camIndex0
=
cameraManager
.
addCamera
(
vkcv
::
camera
::
ControllerType
::
NONE
);
uint32_t
camIndex1
=
cameraManager
.
addCamera
(
vkcv
::
camera
::
ControllerType
::
PILOT
);
uint32_t
camIndex2
=
cameraManager
.
addCamera
(
vkcv
::
camera
::
ControllerType
::
TRACKBALL
);
cameraManager
.
getCamera
(
camIndex0
).
setPosition
(
glm
::
vec3
(
0
,
0
,
-
3
));
vkcv
::
camera
::
InterpolationLinear
interp
(
cameraManager
.
getCamera
(
camIndex0
));
interp
.
addPosition
(
glm
::
vec3
(
5
,
5
,
-
5
));
interp
.
addPosition
(
glm
::
vec3
(
0
,
5
,
-
5
));
interp
.
addPosition
(
glm
::
vec3
(
0
,
-
3
,
-
3
));
interp
.
addPosition
(
glm
::
vec3
(
3
,
0
,
-
6
));
interp
.
addPosition
(
glm
::
vec3
(
5
,
5
,
5
));
interp
.
addPosition
(
glm
::
vec3
(
5
,
5
,
-
5
));
auto
start
=
std
::
chrono
::
system_clock
::
now
();
while
(
window
.
isWindowOpen
())
{
...
...
@@ -182,6 +193,7 @@ int main(int argc, const char** argv) {
start
=
end
;
cameraManager
.
update
(
0.000001
*
static_cast
<
double
>
(
deltatime
.
count
()));
interp
.
updateCamera
();
glm
::
mat4
mvp
=
cameraManager
.
getActiveCamera
().
getMVP
();
vkcv
::
PushConstantData
pushConstantData
((
void
*
)
&
mvp
,
sizeof
(
glm
::
mat4
));
...
...
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