[vlc-commits] viewpoint: add reverse viewpoint function

Alexandre Janniaux git at videolan.org
Mon Mar 11 10:04:10 CET 2019


vlc | branch: master | Alexandre Janniaux <ajanni at videolabs.io> | Fri Mar  8 10:35:38 2019 +0100| [5701c7fbcaf5989f392fe16112ab257d27733737] | committer: Steve Lhomme

viewpoint: add reverse viewpoint function

It reverses the transformation (here rotation only) which is helpful to
convert the viewpoint rotation into a world rotation for video outputs.

Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5701c7fbcaf5989f392fe16112ab257d27733737
---

 include/vlc_viewpoint.h | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/include/vlc_viewpoint.h b/include/vlc_viewpoint.h
index b9e162b02e..f88ac16ce3 100644
--- a/include/vlc_viewpoint.h
+++ b/include/vlc_viewpoint.h
@@ -59,4 +59,23 @@ static inline void vlc_viewpoint_clip( vlc_viewpoint_t *p_vp )
                           FIELD_OF_VIEW_DEGREES_MAX );
 }
 
+/**
+ * Reverse the viewpoint rotation.
+ *
+ * It can be used to convert a camera view into a world transformation.
+ * It will also copy non-rotation related data from \p src to \p dst.
+ *
+ * \param dst the viewpoint with the final reversed rotation
+ * \param src the viewpoint for which the rotation need to be reversed
+ */
+static inline void vlc_viewpoint_reverse( vlc_viewpoint_t *dst,
+                                          const vlc_viewpoint_t *src )
+{
+    dst->yaw   = -src->yaw;
+    dst->pitch = -src->pitch;
+    dst->roll  = -src->roll;
+
+    dst->fov   = src->fov;
+}
+
 #endif /* VLC_VIEWPOINT_H_ */



More information about the vlc-commits mailing list