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
26df15dc
Verified
Commit
26df15dc
authored
3 years ago
by
Josch Morgenstern
Browse files
Options
Downloads
Patches
Plain Diff
[
#42
] changes to invocation of cameraManager
parent
63a9167f
No related branches found
No related tags found
1 merge request
!35
Resolve "Kamera - Trackballkamera"
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
projects/cmd_sync_test/src/main.cpp
+5
-12
5 additions, 12 deletions
projects/cmd_sync_test/src/main.cpp
projects/first_mesh/src/main.cpp
+3
-6
3 additions, 6 deletions
projects/first_mesh/src/main.cpp
projects/first_triangle/src/main.cpp
+3
-11
3 additions, 11 deletions
projects/first_triangle/src/main.cpp
with
11 additions
and
29 deletions
projects/cmd_sync_test/src/main.cpp
+
5
−
12
View file @
26df15dc
...
...
@@ -18,16 +18,8 @@ int main(int argc, const char** argv) {
true
);
vkcv
::
CameraManager
cameraManager
(
window
,
windowWidth
,
windowHeight
);
uint32_t
camIndex
=
cameraManager
.
addCamera
();
uint32_t
controllerIndex
=
cameraManager
.
addController
(
vkcv
::
ControllerType
::
PILOT
,
camIndex
);
cameraManager
.
getCamera
(
camIndex
).
setPosition
(
glm
::
vec3
(
0.
f
,
0.
f
,
3.
f
));
cameraManager
.
getCamera
(
camIndex
).
setNearFar
(
0.1
,
30
);
uint32_t
camIndex2
=
cameraManager
.
addCamera
();
uint32_t
controllerIndex2
=
cameraManager
.
addController
(
vkcv
::
ControllerType
::
TRACKBALL
,
camIndex2
);
cameraManager
.
getCamera
(
camIndex2
).
setPosition
(
glm
::
vec3
(
0.
f
,
0.
f
,
3.
f
));
cameraManager
.
getCamera
(
camIndex2
).
setNearFar
(
0.1
,
30
);
vkcv
::
CameraManager
cameraManager
(
window
,
windowWidth
,
windowHeight
);
uint32_t
camIndex
=
cameraManager
.
addCamera
(
vkcv
::
ControllerType
::
PILOT
);
window
.
initEvents
();
...
...
@@ -236,7 +228,8 @@ int main(int argc, const char** argv) {
auto
end
=
std
::
chrono
::
system_clock
::
now
();
auto
deltatime
=
std
::
chrono
::
duration_cast
<
std
::
chrono
::
microseconds
>
(
end
-
start
);
start
=
end
;
cameraManager
.
update
(
deltatime
.
count
()
*
0.000001
);
cameraManager
.
update
(
std
::
chrono
::
duration
<
double
>
(
deltatime
).
count
());
const
float
sunTheta
=
std
::
chrono
::
duration_cast
<
std
::
chrono
::
milliseconds
>
(
end
-
appStartTime
).
count
()
*
0.001
f
;
lightInfo
.
direction
=
glm
::
normalize
(
glm
::
vec3
(
std
::
cos
(
sunTheta
),
1
,
std
::
sin
(
sunTheta
)));
...
...
@@ -260,7 +253,7 @@ int main(int argc, const char** argv) {
lightInfo
.
lightMatrix
=
projectionLight
*
viewLight
;
lightBuffer
.
fill
({
lightInfo
});
const
glm
::
mat4
viewProjectionCamera
=
cameraManager
.
getActiveC
ontroller
().
getC
amera
().
getMVP
();
const
glm
::
mat4
viewProjectionCamera
=
cameraManager
.
getActiveCamera
().
getMVP
();
mainPassMatrices
.
clear
();
mvpLight
.
clear
();
...
...
This diff is collapsed.
Click to expand it.
projects/first_mesh/src/main.cpp
+
3
−
6
View file @
26df15dc
...
...
@@ -142,11 +142,8 @@ int main(int argc, const char** argv) {
vkcv
::
DrawcallInfo
drawcall
(
renderMesh
,
{
descriptorUsage
});
vkcv
::
CameraManager
cameraManager
(
window
,
windowWidth
,
windowHeight
);
uint32_t
camIndex
=
cameraManager
.
addCamera
();
uint32_t
controllerIndex
=
cameraManager
.
addController
(
vkcv
::
ControllerType
::
PILOT
,
camIndex
);
uint32_t
camIndex2
=
cameraManager
.
addCamera
();
uint32_t
controllerIndex2
=
cameraManager
.
addController
(
vkcv
::
ControllerType
::
TRACKBALL
,
camIndex2
);
uint32_t
camIndex0
=
cameraManager
.
addCamera
(
vkcv
::
ControllerType
::
PILOT
);
uint32_t
camIndex1
=
cameraManager
.
addCamera
(
vkcv
::
ControllerType
::
TRACKBALL
);
auto
start
=
std
::
chrono
::
system_clock
::
now
();
...
...
@@ -172,7 +169,7 @@ int main(int argc, const char** argv) {
auto
deltatime
=
end
-
start
;
start
=
end
;
cameraManager
.
update
(
std
::
chrono
::
duration
<
double
>
(
deltatime
).
count
());
glm
::
mat4
mvp
=
cameraManager
.
getActiveC
ontroller
().
getC
amera
().
getMVP
();
glm
::
mat4
mvp
=
cameraManager
.
getActiveCamera
().
getMVP
();
vkcv
::
PushConstantData
pushConstantData
((
void
*
)
&
mvp
,
sizeof
(
glm
::
mat4
));
...
...
This diff is collapsed.
Click to expand it.
projects/first_triangle/src/main.cpp
+
3
−
11
View file @
26df15dc
...
...
@@ -163,15 +163,7 @@ int main(int argc, const char** argv) {
const
vkcv
::
ImageHandle
swapchainInput
=
vkcv
::
ImageHandle
::
createSwapchainImageHandle
();
vkcv
::
CameraManager
cameraManager
(
window
,
windowWidth
,
windowHeight
);
uint32_t
camIndex
=
cameraManager
.
addCamera
();
cameraManager
.
getCamera
(
camIndex
).
setPosition
(
glm
::
vec3
(
0.0
f
,
0.0
f
,
0.0
f
));
cameraManager
.
getCamera
(
camIndex
).
setCenter
(
glm
::
vec3
(
0.0
f
,
0.0
f
,
-
1.0
f
));
uint32_t
controllerIndex
=
cameraManager
.
addController
(
vkcv
::
ControllerType
::
PILOT
,
camIndex
);
uint32_t
camIndex2
=
cameraManager
.
addCamera
();
cameraManager
.
getCamera
(
camIndex2
).
setPosition
(
glm
::
vec3
(
0.0
f
,
0.0
f
,
0.0
f
));
cameraManager
.
getCamera
(
camIndex2
).
setCenter
(
glm
::
vec3
(
0.0
f
,
0.0
f
,
-
1.0
f
));
uint32_t
controllerIndex2
=
cameraManager
.
addController
(
vkcv
::
ControllerType
::
TRACKBALL
,
camIndex2
);
uint32_t
camIndex
=
cameraManager
.
addCamera
(
vkcv
::
ControllerType
::
PILOT
);
while
(
window
.
isWindowOpen
())
{
...
...
@@ -185,8 +177,8 @@ int main(int argc, const char** argv) {
auto
end
=
std
::
chrono
::
system_clock
::
now
();
auto
deltatime
=
end
-
start
;
start
=
end
;
cameraManager
.
update
(
std
::
chrono
::
duration
<
double
>
(
deltatime
).
count
());
glm
::
mat4
mvp
=
cameraManager
.
getActiveC
ontroller
().
getC
amera
().
getMVP
();
cameraManager
.
update
(
std
::
chrono
::
duration
<
double
>
(
deltatime
).
count
());
glm
::
mat4
mvp
=
cameraManager
.
getActiveCamera
().
getMVP
();
vkcv
::
PushConstantData
pushConstantData
((
void
*
)
&
mvp
,
sizeof
(
glm
::
mat4
));
auto
cmdStream
=
core
.
createCommandStream
(
vkcv
::
QueueType
::
Graphics
);
...
...
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