[vlc-devel] [PATCH v2 4/8] opengl: use vlc_viewpoint_to_4x4 to compute view matrix
Rémi Denis-Courmont
remi at remlab.net
Wed Mar 6 16:44:28 CET 2019
Le keskiviikkona 6. maaliskuuta 2019, 17.31.34 EET Alexandre Janniaux a écrit
:
> ---
> modules/video_output/opengl/vout_helper.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/modules/video_output/opengl/vout_helper.c
> b/modules/video_output/opengl/vout_helper.c index 30283419a3..0964a2fd22
> 100644
> --- a/modules/video_output/opengl/vout_helper.c
> +++ b/modules/video_output/opengl/vout_helper.c
> @@ -104,6 +104,7 @@ struct prgm
> GLfloat YRotMatrix[16];
> GLfloat XRotMatrix[16];
> GLfloat ZoomMatrix[16];
> + GLfloat ViewMatrix[16];
> } var;
>
> struct { /* UniformLocation */
> @@ -162,6 +163,7 @@ struct vout_display_opengl_t {
> bool supports_npot;
>
> /* View point */
> + vlc_viewpoint_t vp;
> float f_teta;
> float f_phi;
> float f_roll;
> @@ -279,6 +281,10 @@ static void getViewpointMatrixes(vout_display_opengl_t
> *vgl, getXRotMatrix(vgl->f_phi, prgm->var.XRotMatrix);
> getZRotMatrix(vgl->f_roll, prgm->var.ZRotMatrix);
> getZoomMatrix(vgl->f_z, prgm->var.ZoomMatrix);
> +
> + vlc_viewpoint_t vp = vgl->vp;
> + vlc_viewpoint_reverse(&vp);
AFAICT, this could use a non-destructive function and save one useless copy.
> + vlc_viewpoint_to_4x4(&vp, prgm->var.ViewMatrix);
> }
> else
> {
> @@ -288,6 +294,7 @@ static void getViewpointMatrixes(vout_display_opengl_t
> *vgl, memcpy(prgm->var.XRotMatrix, identity, sizeof(identity));
> memcpy(prgm->var.ZoomMatrix, identity, sizeof(identity)); }
> +
> }
>
> static void getOrientationTransformMatrix(video_orientation_t orientation,
> @@ -1053,6 +1060,7 @@ int
> vout_display_opengl_SetViewpoint(vout_display_opengl_t *vgl, vgl->f_phi =
> RAD(p_vp->pitch);
> vgl->f_roll = RAD(p_vp->roll);
>
> + vgl->vp = *p_vp;
>
> if (fabsf(f_fovx - vgl->f_fovx) >= 0.001f)
> {
--
Rémi Denis-Courmont
http://www.remlab.net/
More information about the vlc-devel
mailing list