[vlc-devel] [PATCH 16/17] opengl: handle the little planet projection mode
Steve Lhomme
robux4 at videolabs.io
Mon Nov 14 15:16:25 CET 2016
---
include/vlc_vout.h | 1 +
modules/video_output/opengl.c | 11 +++++++++++
src/libvlc-module.c | 3 ++-
src/video_output/vout_intf.c | 1 +
4 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/include/vlc_vout.h b/include/vlc_vout.h
index 6d51f60..dec4f9b 100644
--- a/include/vlc_vout.h
+++ b/include/vlc_vout.h
@@ -87,6 +87,7 @@ typedef enum {
VOUT_PROJECTION_FLAT,
VOUT_PROJECTION_SPHERE,
VOUT_PROJECTION_CUBEMAP,
+ VOUT_PROJECTION_LITTLE_PLANET,
} vout_projection_mode_t;
diff --git a/modules/video_output/opengl.c b/modules/video_output/opengl.c
index 7bfeaef..941921e 100644
--- a/modules/video_output/opengl.c
+++ b/modules/video_output/opengl.c
@@ -823,6 +823,7 @@ int vout_display_opengl_SetProjection( vout_display_t *vd,
case VOUT_PROJECTION_FLAT:
case VOUT_PROJECTION_SPHERE:
case VOUT_PROJECTION_CUBEMAP:
+ case VOUT_PROJECTION_LITTLE_PLANET:
if (proj_mode != VOUT_PROJECTION_AUTO)
vgl->projection = proj_mode;
else
@@ -1600,6 +1601,7 @@ static void DrawWithShaders(vout_display_opengl_t *vgl,
&indices, &nbIndices,
left, top, right, bottom);
break;
+ case VOUT_PROJECTION_LITTLE_PLANET:
case VOUT_PROJECTION_SPHERE:
i_ret = BuildSphere(vgl->chroma->plane_count,
&vertexCoord, &textureCoord, &nbVertices,
@@ -1638,6 +1640,15 @@ static void DrawWithShaders(vout_display_opengl_t *vgl,
getZRotMatrix(vgl->f_roll, zRotMatrix);
getZoomMatrix(vgl->f_zoom, zoomMatrix);
}
+ else if (vgl->projection == VOUT_PROJECTION_LITTLE_PLANET)
+ {
+ float sar = (float) vgl->fmt.i_visible_width / vgl->fmt.i_visible_height;
+ getProjectionMatrix(sar, 2.14, projectionMatrix);
+ getYRotMatrix(vgl->f_teta, yRotMatrix);
+ getXRotMatrix(1.57, xRotMatrix);
+ getZRotMatrix(vgl->f_roll, zRotMatrix);
+ memcpy(zoomMatrix, identity, sizeof(identity));
+ }
else
{
memcpy(projectionMatrix, identity, sizeof(identity));
diff --git a/src/libvlc-module.c b/src/libvlc-module.c
index afe07d9..b9a970d 100644
--- a/src/libvlc-module.c
+++ b/src/libvlc-module.c
@@ -460,12 +460,13 @@ static const char *const ppsz_pos_descriptions[] =
#define PROJECTION_TEXT N_("Projection")
#define PROJECTION_LONGTEXT N_( \
"Change the way the video is displayed.")
-static const int pi_projection_values[] = { 0, 1, 2, 3 };
+static const int pi_projection_values[] = { 0, 1, 2, 3, 4 };
static const char *const ppsz_projection_descriptions[] =
{ N_("Automatic"),
N_("Flat/2D"),
N_("360° Sphere"),
N_("360° Cubemap"),
+ N_("Little Planet"),
};
#define AUTOSCALE_TEXT N_("Video Auto Scaling")
diff --git a/src/video_output/vout_intf.c b/src/video_output/vout_intf.c
index 3b831fe..e964d6e 100644
--- a/src/video_output/vout_intf.c
+++ b/src/video_output/vout_intf.c
@@ -131,6 +131,7 @@ static const struct
{ VOUT_PROJECTION_FLAT, N_("Flat/2D") },
{ VOUT_PROJECTION_SPHERE, N_("360° Sphere") },
{ VOUT_PROJECTION_CUBEMAP, N_("360° Cubemap") },
+ { VOUT_PROJECTION_LITTLE_PLANET, N_("Little Planet") },
};
static void AddCustomRatios( vout_thread_t *p_vout, const char *psz_var,
--
2.10.1
More information about the vlc-devel
mailing list