Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
masterarbeit-kai
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Philipp Adolf
masterarbeit-kai
Commits
642265e6
Commit
642265e6
authored
Jul 09, 2017
by
Kai Westerkamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
camera smooth
parent
8cad1c31
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
46 additions
and
7 deletions
+46
-7
Camera.cpp
3_PointCloud/Camera.cpp
+3
-0
glut.cpp
3_PointCloud/glut.cpp
+5
-0
main.cpp
3_PointCloud/main.cpp
+37
-7
main.h
3_PointCloud/main.h
+1
-0
No files found.
3_PointCloud/Camera.cpp
View file @
642265e6
...
...
@@ -35,6 +35,9 @@ Camera::~Camera()
void
Camera
::
move
(
glm
::
vec3
relative
)
{
if
(
length
(
relative
)
<
0.001
f
)
return
;
relative
=
normalize
(
relative
);
glm
::
vec3
right
=
cross
(
direction
,
up
);
vec3
uplocal
=
cross
(
right
,
direction
);
...
...
3_PointCloud/glut.cpp
View file @
642265e6
...
...
@@ -15,9 +15,14 @@ bool init(int argc, char* argv[]) {
glutInitDisplayMode
(
GLUT_DEPTH
|
GLUT_DOUBLE
|
GLUT_RGBA
);
glutInitWindowSize
(
width
,
height
);
glutCreateWindow
(
"Kinect VR Point Cloud"
);
glutKeyboardFunc
(
keyPressed
);
glutIgnoreKeyRepeat
(
1
);
glutKeyboardUpFunc
(
keyReleased
);
glutMouseFunc
(
mouseButton
);
glutMotionFunc
(
mouseMove
);
glutDisplayFunc
(
draw
);
glutIdleFunc
(
draw
);
glewInit
();
...
...
3_PointCloud/main.cpp
View file @
642265e6
...
...
@@ -56,7 +56,7 @@ ICoordinateMapper* mapper; // Converts between depth, color, and 3d coor
SteamTracking
*
steamTracking
=
nullptr
;
glm
::
mat4x4
*
currentControlerPos
=
nullptr
;
Camera
mainCam
;
glm
::
vec3
cameraMove
;
static
bool
writeFile
=
false
;
static
bool
captureFrame
=
false
;
...
...
@@ -277,6 +277,9 @@ void drawElementArray(drawData data, GLenum mode) {
void
mainRenderLoop
()
{
steamTracking
->
processEvents
();
mainCam
.
move
(
cameraMove
);
//get controler pos
delete
currentControlerPos
;
currentControlerPos
=
steamTracking
->
getTransformationForDevice
(
1
);
...
...
@@ -351,22 +354,22 @@ void keyPressed(unsigned char key, int x, int y)
writeFile
=
true
;
break
;
case
'w'
:
mainCam
.
move
(
glm
::
vec3
(
1.0
f
,
0.0
f
,
0.0
f
));
cameraMove
+=
(
glm
::
vec3
(
1.0
f
,
0.0
f
,
0.0
f
));
break
;
case
's'
:
mainCam
.
move
(
glm
::
vec3
(
-
1.0
f
,
0.0
f
,
0.0
f
));
cameraMove
+=
(
glm
::
vec3
(
-
1.0
f
,
0.0
f
,
0.0
f
));
break
;
case
'a'
:
mainCam
.
move
(
glm
::
vec3
(
0.0
f
,
0.0
f
,
-
1.0
f
));
cameraMove
+=
(
glm
::
vec3
(
0.0
f
,
0.0
f
,
-
1.0
f
));
break
;
case
'd'
:
mainCam
.
move
(
glm
::
vec3
(
0.0
f
,
0.0
f
,
1.0
f
));
cameraMove
+=
(
glm
::
vec3
(
0.0
f
,
0.0
f
,
1.0
f
));
break
;
case
'q'
:
mainCam
.
move
(
glm
::
vec3
(
0.0
f
,
1.0
f
,
0.0
f
));
cameraMove
+=
(
glm
::
vec3
(
0.0
f
,
1.0
f
,
0.0
f
));
break
;
case
'e'
:
mainCam
.
move
(
glm
::
vec3
(
0.0
f
,
-
1.0
f
,
0.0
f
));
cameraMove
+=
(
glm
::
vec3
(
0.0
f
,
-
1.0
f
,
0.0
f
));
break
;
case
27
:
// Escape key
exit
(
0
);
...
...
@@ -379,6 +382,32 @@ void keyPressed(unsigned char key, int x, int y)
instantly */
}
void
keyReleased
(
unsigned
char
key
,
int
x
,
int
y
)
{
switch
(
key
)
{
case
'w'
:
cameraMove
-=
(
glm
::
vec3
(
1.0
f
,
0.0
f
,
0.0
f
));
break
;
case
's'
:
cameraMove
-=
(
glm
::
vec3
(
-
1.0
f
,
0.0
f
,
0.0
f
));
break
;
case
'a'
:
cameraMove
-=
(
glm
::
vec3
(
0.0
f
,
0.0
f
,
-
1.0
f
));
break
;
case
'd'
:
cameraMove
-=
(
glm
::
vec3
(
0.0
f
,
0.0
f
,
1.0
f
));
break
;
case
'q'
:
cameraMove
-=
(
glm
::
vec3
(
0.0
f
,
1.0
f
,
0.0
f
));
break
;
case
'e'
:
cameraMove
-=
(
glm
::
vec3
(
0.0
f
,
-
1.0
f
,
0.0
f
));
break
;
default:
break
;
}
}
void
mouseButton
(
int
button
,
int
state
,
int
x
,
int
y
)
{
lastX
=
x
;
lastY
=
y
;
...
...
@@ -402,6 +431,7 @@ void captureNextFrame(vr::VREvent_t event)
int
main
(
int
argc
,
char
*
argv
[])
{
cameraMove
=
glm
::
vec3
(
0.0
f
,
0.0
f
,
0.0
f
);
std
::
cout
<<
"Starting Kinect VR Point Cloud creator
\n
"
;
if
(
!
init
(
argc
,
argv
))
return
1
;
if
(
!
initKinect
())
return
1
;
...
...
3_PointCloud/main.h
View file @
642265e6
...
...
@@ -8,6 +8,7 @@ const int colorheight = 1080;
void
mainRenderLoop
();
void
keyPressed
(
unsigned
char
key
,
int
x
,
int
y
);
void
keyReleased
(
unsigned
char
key
,
int
x
,
int
y
);
void
mouseButton
(
int
button
,
int
state
,
int
x
,
int
y
);
void
mouseMove
(
int
x
,
int
y
);
...
...
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