diff options
Diffstat (limited to 'src/mesa/tnl/t_rasterpos.c')
-rw-r--r-- | src/mesa/tnl/t_rasterpos.c | 64 |
1 files changed, 37 insertions, 27 deletions
diff --git a/src/mesa/tnl/t_rasterpos.c b/src/mesa/tnl/t_rasterpos.c index dfbe0f1806..a8cf86060f 100644 --- a/src/mesa/tnl/t_rasterpos.c +++ b/src/mesa/tnl/t_rasterpos.c @@ -26,17 +26,19 @@ #include "main/glheader.h" #include "main/colormac.h" #include "main/context.h" -#include "feedback.h" -#include "light.h" +#include "main/feedback.h" +#include "main/light.h" #include "main/macros.h" -#include "rastpos.h" -#include "simple_list.h" +#include "main/rastpos.h" +#include "main/simple_list.h" #include "main/mtypes.h" #include "math/m_matrix.h" #include "tnl/tnl.h" +#if FEATURE_rastpos + /** * Clip a point against the view volume. @@ -46,11 +48,10 @@ * \return zero if outside view volume, or one if inside. */ static GLuint -viewclip_point( const GLfloat v[] ) +viewclip_point_xy( const GLfloat v[] ) { if ( v[0] > v[3] || v[0] < -v[3] - || v[1] > v[3] || v[1] < -v[3] - || v[2] > v[3] || v[2] < -v[3] ) { + || v[1] > v[3] || v[1] < -v[3] ) { return 0; } else { @@ -167,7 +168,7 @@ shade_rastpos(GLcontext *ctx, light->QuadraticAttenuation)); if (light->_Flags & LIGHT_SPOT) { - GLfloat PV_dot_dir = - DOT3(VP, light->_NormDirection); + GLfloat PV_dot_dir = - DOT3(VP, light->_NormSpotDirection); if (PV_dot_dir<light->_CosCutoff) { continue; @@ -301,12 +302,12 @@ compute_texgen(GLcontext *ctx, const GLfloat vObj[4], const GLfloat vEye[4], mInv = 0.0F; if (texUnit->TexGenEnabled & S_BIT) { - switch (texUnit->GenModeS) { + switch (texUnit->GenS.Mode) { case GL_OBJECT_LINEAR: - texcoord[0] = DOT4(vObj, texUnit->ObjectPlaneS); + texcoord[0] = DOT4(vObj, texUnit->GenS.ObjectPlane); break; case GL_EYE_LINEAR: - texcoord[0] = DOT4(vEye, texUnit->EyePlaneS); + texcoord[0] = DOT4(vEye, texUnit->GenS.EyePlane); break; case GL_SPHERE_MAP: texcoord[0] = rx * mInv + 0.5F; @@ -324,12 +325,12 @@ compute_texgen(GLcontext *ctx, const GLfloat vObj[4], const GLfloat vEye[4], } if (texUnit->TexGenEnabled & T_BIT) { - switch (texUnit->GenModeT) { + switch (texUnit->GenT.Mode) { case GL_OBJECT_LINEAR: - texcoord[1] = DOT4(vObj, texUnit->ObjectPlaneT); + texcoord[1] = DOT4(vObj, texUnit->GenT.ObjectPlane); break; case GL_EYE_LINEAR: - texcoord[1] = DOT4(vEye, texUnit->EyePlaneT); + texcoord[1] = DOT4(vEye, texUnit->GenT.EyePlane); break; case GL_SPHERE_MAP: texcoord[1] = ry * mInv + 0.5F; @@ -347,12 +348,12 @@ compute_texgen(GLcontext *ctx, const GLfloat vObj[4], const GLfloat vEye[4], } if (texUnit->TexGenEnabled & R_BIT) { - switch (texUnit->GenModeR) { + switch (texUnit->GenR.Mode) { case GL_OBJECT_LINEAR: - texcoord[2] = DOT4(vObj, texUnit->ObjectPlaneR); + texcoord[2] = DOT4(vObj, texUnit->GenR.ObjectPlane); break; case GL_EYE_LINEAR: - texcoord[2] = DOT4(vEye, texUnit->EyePlaneR); + texcoord[2] = DOT4(vEye, texUnit->GenR.EyePlane); break; case GL_REFLECTION_MAP: texcoord[2] = rz; @@ -367,12 +368,12 @@ compute_texgen(GLcontext *ctx, const GLfloat vObj[4], const GLfloat vEye[4], } if (texUnit->TexGenEnabled & Q_BIT) { - switch (texUnit->GenModeQ) { + switch (texUnit->GenQ.Mode) { case GL_OBJECT_LINEAR: - texcoord[3] = DOT4(vObj, texUnit->ObjectPlaneQ); + texcoord[3] = DOT4(vObj, texUnit->GenQ.ObjectPlane); break; case GL_EYE_LINEAR: - texcoord[3] = DOT4(vEye, texUnit->EyePlaneQ); + texcoord[3] = DOT4(vEye, texUnit->GenQ.EyePlane); break; default: _mesa_problem(ctx, "Bad Q texgen in compute_texgen()"); @@ -408,18 +409,18 @@ _tnl_RasterPos(GLcontext *ctx, const GLfloat vObj[4]) /* apply projection matrix: clip = Proj * eye */ TRANSFORM_POINT( clip, ctx->ProjectionMatrixStack.Top->m, eye ); - /* clip to view volume */ - if (ctx->Transform.RasterPositionUnclipped) { - /* GL_IBM_rasterpos_clip: only clip against Z */ + /* clip to view volume. */ + if (!ctx->Transform.DepthClamp) { if (viewclip_point_z(clip) == 0) { ctx->Current.RasterPosValid = GL_FALSE; return; } } - else if (viewclip_point(clip) == 0) { - /* Normal OpenGL behaviour */ - ctx->Current.RasterPosValid = GL_FALSE; - return; + if (!ctx->Transform.RasterPositionUnclipped) { + if (viewclip_point_xy(clip) == 0) { + ctx->Current.RasterPosValid = GL_FALSE; + return; + } } /* clip to user clipping planes */ @@ -443,6 +444,12 @@ _tnl_RasterPos(GLcontext *ctx, const GLfloat vObj[4]) / ctx->DrawBuffer->_DepthMaxF; ctx->Current.RasterPos[3] = clip[3]; + if (ctx->Transform.DepthClamp) { + ctx->Current.RasterPos[3] = CLAMP(ctx->Current.RasterPos[3], + ctx->Viewport.Near, + ctx->Viewport.Far); + } + /* compute raster distance */ if (ctx->Fog.FogCoordinateSource == GL_FOG_COORDINATE_EXT) ctx->Current.RasterDistance = ctx->Current.Attrib[VERT_ATTRIB_FOG][0]; @@ -503,3 +510,6 @@ _tnl_RasterPos(GLcontext *ctx, const GLfloat vObj[4]) _mesa_update_hitflag( ctx, ctx->Current.RasterPos[2] ); } } + + +#endif /* FEATURE_rastpos */ |