VLC  3.0.15
vlc_viewpoint.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * vlc_viewpoint.h: viewpoint struct and helpers
3  *****************************************************************************
4  * Copyright (C) 2017 VLC authors and VideoLAN
5  *
6  * This program is free software; you can redistribute it and/or modify it
7  * under the terms of the GNU Lesser General Public License as published by
8  * the Free Software Foundation; either version 2.1 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this program; if not, write to the Free Software Foundation,
18  * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
19  *****************************************************************************/
20 
21 #ifndef VLC_VIEWPOINT_H_
22 #define VLC_VIEWPOINT_H_ 1
23 
24 #include <vlc_common.h>
25 
26 #include <math.h>
27 
28 /**
29  * \defgroup output Output
30  * \ingroup output
31  *
32  * @{
33  * \file
34  * Video and audio viewpoint struct and helpers
35  */
36 
37 #define FIELD_OF_VIEW_DEGREES_DEFAULT 80.f
38 #define FIELD_OF_VIEW_DEGREES_MAX 150.f
39 #define FIELD_OF_VIEW_DEGREES_MIN 20.f
40 
41 /**
42  * Viewpoints
43  */
45  float yaw; /* yaw in degrees */
46  float pitch; /* pitch in degrees */
47  float roll; /* roll in degrees */
48  float fov; /* field of view in degrees */
49 };
50 
51 static inline void vlc_viewpoint_init( vlc_viewpoint_t *p_vp )
52 {
53  p_vp->yaw = p_vp->pitch = p_vp->roll = 0.0f;
55 }
56 
57 static inline void vlc_viewpoint_clip( vlc_viewpoint_t *p_vp )
58 {
59  p_vp->yaw = fmodf( p_vp->yaw, 360.f );
60  p_vp->pitch = fmodf( p_vp->pitch, 360.f );
61  p_vp->roll = fmodf( p_vp->roll, 360.f );
62  p_vp->fov = VLC_CLIP( p_vp->fov, FIELD_OF_VIEW_DEGREES_MIN,
64 }
65 
66 /**@}*/
67 
68 #endif /* VLC_VIEWPOINT_H_ */
vlc_common.h
FIELD_OF_VIEW_DEGREES_DEFAULT
#define FIELD_OF_VIEW_DEGREES_DEFAULT
Definition: vlc_viewpoint.h:37
vlc_viewpoint_t
Viewpoints.
Definition: vlc_viewpoint.h:44
vlc_viewpoint_t::yaw
float yaw
Definition: vlc_viewpoint.h:45
VLC_CLIP
#define VLC_CLIP(v, min, max)
Definition: vlc_common.h:485
vlc_viewpoint_t::roll
float roll
Definition: vlc_viewpoint.h:47
vlc_viewpoint_clip
static void vlc_viewpoint_clip(vlc_viewpoint_t *p_vp)
Definition: vlc_viewpoint.h:57
FIELD_OF_VIEW_DEGREES_MIN
#define FIELD_OF_VIEW_DEGREES_MIN
Definition: vlc_viewpoint.h:39
FIELD_OF_VIEW_DEGREES_MAX
#define FIELD_OF_VIEW_DEGREES_MAX
Definition: vlc_viewpoint.h:38
vlc_viewpoint_init
static void vlc_viewpoint_init(vlc_viewpoint_t *p_vp)
Definition: vlc_viewpoint.h:51
vlc_viewpoint_t::pitch
float pitch
Definition: vlc_viewpoint.h:46
vlc_viewpoint_t::fov
float fov
Definition: vlc_viewpoint.h:48