diff options
author | Mathias Froehlich <[email protected]> | 2015-03-29 18:57:45 +0200 |
---|---|---|
committer | Mathias Froehlich <[email protected]> | 2015-04-05 08:01:47 +0200 |
commit | 29e6c7dbc5bacf4f2b741333ac56469a00164e65 (patch) | |
tree | dce4396bf2dd349906b3c5120d11db4426b98695 /src/mesa/tnl/t_rasterpos.c | |
parent | 472913ea7563e136b9ad3d33111925147a044a39 (diff) |
tnl: Maintain the _WindowMap matrix in TNLcontext v2.
This is the only real user of _WindowMap which has the depth
buffer scaling multiplied in. Maintain the _WindowMap of the
one and only viewport inside TNLcontext.
v2:
Remove unneeded parentheses.
Reviewed-by: Brian Paul <[email protected]>
Signed-off-by: Mathias Froehlich <[email protected]>
Diffstat (limited to 'src/mesa/tnl/t_rasterpos.c')
-rw-r--r-- | src/mesa/tnl/t_rasterpos.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/mesa/tnl/t_rasterpos.c b/src/mesa/tnl/t_rasterpos.c index 1cd398108f1..d4b45bac9ac 100644 --- a/src/mesa/tnl/t_rasterpos.c +++ b/src/mesa/tnl/t_rasterpos.c @@ -30,6 +30,7 @@ #include "main/macros.h" #include "util/simple_list.h" #include "main/mtypes.h" +#include "main/viewport.h" #include "math/m_matrix.h" #include "tnl/tnl.h" @@ -377,6 +378,7 @@ _tnl_RasterPos(struct gl_context *ctx, const GLfloat vObj[4]) GLfloat eye[4], clip[4], ndc[3], d; GLfloat *norm, eyenorm[3]; GLfloat *objnorm = ctx->Current.Attrib[VERT_ATTRIB_NORMAL]; + double scale[3], translate[3]; /* apply modelview matrix: eye = MV * obj */ TRANSFORM_POINT( eye, ctx->ModelviewMatrixStack.Top->m, vObj ); @@ -409,13 +411,10 @@ _tnl_RasterPos(struct gl_context *ctx, const GLfloat vObj[4]) ndc[1] = clip[1] * d; ndc[2] = clip[2] * d; /* wincoord = viewport_mapping(ndc) */ - ctx->Current.RasterPos[0] = (ndc[0] * ctx->ViewportArray[0]._WindowMap.m[MAT_SX] - + ctx->ViewportArray[0]._WindowMap.m[MAT_TX]); - ctx->Current.RasterPos[1] = (ndc[1] * ctx->ViewportArray[0]._WindowMap.m[MAT_SY] - + ctx->ViewportArray[0]._WindowMap.m[MAT_TY]); - ctx->Current.RasterPos[2] = (ndc[2] * ctx->ViewportArray[0]._WindowMap.m[MAT_SZ] - + ctx->ViewportArray[0]._WindowMap.m[MAT_TZ]) - / ctx->DrawBuffer->_DepthMaxF; + _mesa_get_viewport_xform(ctx, 0, scale, translate); + ctx->Current.RasterPos[0] = ndc[0] * scale[0] + translate[0]; + ctx->Current.RasterPos[1] = ndc[1] * scale[1] + translate[1]; + ctx->Current.RasterPos[2] = ndc[2] * scale[2] + translate[2]; ctx->Current.RasterPos[3] = clip[3]; if (ctx->Transform.DepthClamp) { |