-/* $Id: attrib.c,v 1.61 2002/03/28 22:42:41 brianp Exp $ */
+/* $Id: attrib.c,v 1.62 2002/03/29 17:27:59 brianp Exp $ */
/*
* Mesa 3-D graphics library
attr->AlphaTest = ctx->Color.AlphaEnabled;
attr->AutoNormal = ctx->Eval.AutoNormal;
attr->Blend = ctx->Color.BlendEnabled;
- for (i=0;i<MAX_CLIP_PLANES;i++) {
- attr->ClipPlane[i] = ctx->Transform.ClipEnabled[i];
- }
+ attr->ClipPlanes = ctx->Transform.ClipPlanesEnabled;
attr->ColorMaterial = ctx->Light.ColorMaterialEnabled;
attr->Convolution1D = ctx->Pixel.Convolution1DEnabled;
attr->Convolution2D = ctx->Pixel.Convolution2DEnabled;
TEST_AND_UPDATE(ctx->Color.BlendEnabled, enable->Blend, GL_BLEND);
for (i=0;i<MAX_CLIP_PLANES;i++) {
- if (ctx->Transform.ClipEnabled[i] != enable->ClipPlane[i])
+ const GLuint mask = 1 << i;
+ if ((ctx->Transform.ClipPlanesEnabled & mask) != (enable->ClipPlanes & mask))
_mesa_set_enable(ctx, (GLenum) (GL_CLIP_PLANE0 + i),
- enable->ClipPlane[i]);
+ (enable->ClipPlanes & mask) ? GL_TRUE : GL_FALSE);
}
TEST_AND_UPDATE(ctx->Light.ColorMaterialEnabled, enable->ColorMaterial,
/* restore clip planes */
for (i = 0; i < MAX_CLIP_PLANES; i++) {
+ const GLuint mask = 1 << 1;
const GLfloat *eyePlane = xform->EyeUserPlane[i];
COPY_4V(ctx->Transform.EyeUserPlane[i], eyePlane);
- if (xform->ClipEnabled[i]) {
- _mesa_transform_vector( ctx->Transform._ClipUserPlane[i],
- eyePlane,
- ctx->ProjectionMatrixStack.Top->inv );
+ if (xform->ClipPlanesEnabled & mask) {
_mesa_set_enable(ctx, GL_CLIP_PLANE0 + i, GL_TRUE);
}
else {
-/* $Id: clip.c,v 1.24 2001/12/18 04:06:44 brianp Exp $ */
+/* $Id: clip.c,v 1.25 2002/03/29 17:29:12 brianp Exp $ */
/*
* Mesa 3-D graphics library
* matrix, and is recalculated on changes to the projection matrix by
* code in _mesa_update_state().
*/
- if (ctx->Transform.ClipEnabled[p]) {
+ if (ctx->Transform.ClipPlanesEnabled & (1 << p)) {
if (ctx->ProjectionMatrixStack.Top->flags & MAT_DIRTY)
- _math_matrix_analyse( ctx->ProjectionMatrixStack.Top );
+ _math_matrix_analyse( ctx->ProjectionMatrixStack.Top );
_mesa_transform_vector( ctx->Transform._ClipUserPlane[p],
ctx->Transform.EyeUserPlane[p],
-/* $Id: context.c,v 1.157 2002/03/19 16:47:04 brianp Exp $ */
+/* $Id: context.c,v 1.158 2002/03/29 17:27:59 brianp Exp $ */
/*
* Mesa 3-D graphics library
ctx->Transform.RescaleNormals = GL_FALSE;
ctx->Transform.RasterPositionUnclipped = GL_FALSE;
for (i=0;i<MAX_CLIP_PLANES;i++) {
- ctx->Transform.ClipEnabled[i] = GL_FALSE;
ASSIGN_4V( ctx->Transform.EyeUserPlane[i], 0.0, 0.0, 0.0, 0.0 );
}
- ctx->Transform._AnyClip = GL_FALSE;
+ ctx->Transform.ClipPlanesEnabled = 0;
/* Viewport group */
ctx->Viewport.X = 0;
-/* $Id: enable.c,v 1.58 2002/03/28 22:45:45 brianp Exp $ */
+/* $Id: enable.c,v 1.59 2002/03/29 17:27:59 brianp Exp $ */
/*
* Mesa 3-D graphics library
case GL_CLIP_PLANE4:
case GL_CLIP_PLANE5:
{
- GLuint p = cap - GL_CLIP_PLANE0;
+ const GLuint p = cap - GL_CLIP_PLANE0;
- if (ctx->Transform.ClipEnabled[p] == state)
+ if ((ctx->Transform.ClipPlanesEnabled & (1 << p)) == (state << p))
return;
FLUSH_VERTICES(ctx, _NEW_TRANSFORM);
- ctx->Transform.ClipEnabled[p] = state;
if (state) {
- ctx->Transform._AnyClip++;
+ ctx->Transform.ClipPlanesEnabled |= (1 << p);
- if (ctx->ProjectionMatrixStack.Top->flags & MAT_DIRTY) {
+ if (ctx->ProjectionMatrixStack.Top->flags & MAT_DIRTY)
_math_matrix_analyse( ctx->ProjectionMatrixStack.Top );
- }
/* This derived state also calculated in clip.c and
* from _mesa_update_state() on changes to EyeUserPlane
ctx->ProjectionMatrixStack.Top->inv );
}
else {
- ctx->Transform._AnyClip--;
+ ctx->Transform.ClipPlanesEnabled &= ~(1 << p);
}
}
break;
case GL_CLIP_PLANE3:
case GL_CLIP_PLANE4:
case GL_CLIP_PLANE5:
- return ctx->Transform.ClipEnabled[cap-GL_CLIP_PLANE0];
+ return (ctx->Transform.ClipPlanesEnabled >> (cap - GL_CLIP_PLANE0)) & 1;
case GL_COLOR_MATERIAL:
return ctx->Light.ColorMaterialEnabled;
case GL_CULL_FACE:
-/* $Id: get.c,v 1.75 2001/12/18 04:06:45 brianp Exp $ */
+/* $Id: get.c,v 1.76 2002/03/29 17:27:59 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 4.1
*
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
case GL_CLIP_PLANE3:
case GL_CLIP_PLANE4:
case GL_CLIP_PLANE5:
- *params = ctx->Transform.ClipEnabled[pname-GL_CLIP_PLANE0];
+ if (ctx->Transform.ClipPlanesEnabled & (1 << (pname - GL_CLIP_PLANE0)))
+ *params = GL_TRUE;
+ else
+ *params = GL_FALSE;
break;
case GL_COLOR_CLEAR_VALUE:
params[0] = ctx->Color.ClearColor[0] ? GL_TRUE : GL_FALSE;
case GL_CLIP_PLANE3:
case GL_CLIP_PLANE4:
case GL_CLIP_PLANE5:
- *params = (GLdouble) ctx->Transform.ClipEnabled[pname-GL_CLIP_PLANE0];
+ if (ctx->Transform.ClipPlanesEnabled & (1 << (pname - GL_CLIP_PLANE0)))
+ *params = 1.0;
+ else
+ *params = 0.0;
break;
case GL_COLOR_CLEAR_VALUE:
params[0] = (GLdouble) CHAN_TO_FLOAT(ctx->Color.ClearColor[0]);
case GL_CLIP_PLANE3:
case GL_CLIP_PLANE4:
case GL_CLIP_PLANE5:
- *params = (GLfloat) ctx->Transform.ClipEnabled[pname-GL_CLIP_PLANE0];
+ if (ctx->Transform.ClipPlanesEnabled & (1 << (pname - GL_CLIP_PLANE0)))
+ *params = 1.0;
+ else
+ *params = 0.0;
break;
case GL_COLOR_CLEAR_VALUE:
params[0] = CHAN_TO_FLOAT(ctx->Color.ClearColor[0]);
case GL_CLIP_PLANE3:
case GL_CLIP_PLANE4:
case GL_CLIP_PLANE5:
- i = (GLint) (pname - GL_CLIP_PLANE0);
- *params = (GLint) ctx->Transform.ClipEnabled[i];
+ if (ctx->Transform.ClipPlanesEnabled & (1 << (pname - GL_CLIP_PLANE0)))
+ *params = 1;
+ else
+ *params = 0;
break;
case GL_COLOR_CLEAR_VALUE:
params[0] = FLOAT_TO_INT( (ctx->Color.ClearColor[0]) );
-/* $Id: mtypes.h,v 1.68 2002/03/23 16:33:53 brianp Exp $ */
+/* $Id: mtypes.h,v 1.69 2002/03/29 17:27:59 brianp Exp $ */
/*
* Mesa 3-D graphics library
GLboolean AlphaTest;
GLboolean AutoNormal;
GLboolean Blend;
- GLboolean ClipPlane[MAX_CLIP_PLANES];
+ GLuint ClipPlanes;
GLboolean ColorMaterial;
GLboolean Convolution1D;
GLboolean Convolution2D;
GLenum MatrixMode; /* Matrix mode */
GLfloat EyeUserPlane[MAX_CLIP_PLANES][4];
GLfloat _ClipUserPlane[MAX_CLIP_PLANES][4]; /* derived */
- GLboolean ClipEnabled[MAX_CLIP_PLANES];
- GLubyte _AnyClip; /* How many ClipEnabled? */
+ GLuint ClipPlanesEnabled; /* on/off bitmask */
GLboolean Normalize; /* Normalize all normals? */
GLboolean RescaleNormals; /* GL_EXT_rescale_normal */
GLboolean RasterPositionUnclipped; /* GL_IBM_rasterpos_clip */
-/* $Id: rastpos.c,v 1.35 2002/02/15 16:26:08 brianp Exp $ */
+/* $Id: rastpos.c,v 1.36 2002/03/29 17:27:59 brianp Exp $ */
/*
* Mesa 3-D graphics library
GLuint p;
for (p = 0; p < ctx->Const.MaxClipPlanes; p++) {
- if (ctx->Transform.ClipEnabled[p]) {
+ if (ctx->Transform.ClipPlanesEnabled & (1 << p)) {
GLfloat dot = v[0] * ctx->Transform._ClipUserPlane[p][0]
+ v[1] * ctx->Transform._ClipUserPlane[p][1]
+ v[2] * ctx->Transform._ClipUserPlane[p][2]
}
/* clip to user clipping planes */
- if (ctx->Transform._AnyClip &&
- userclip_point(ctx, clip) == 0) {
+ if (ctx->Transform.ClipPlanesEnabled && !userclip_point(ctx, clip)) {
ctx->Current.RasterPosValid = GL_FALSE;
return;
}
-/* $Id: state.c,v 1.78 2002/03/16 18:07:39 brianp Exp $ */
+/* $Id: state.c,v 1.79 2002/03/29 17:27:59 brianp Exp $ */
/*
* Mesa 3-D graphics library
/* Recompute clip plane positions in clipspace. This is also done
* in _mesa_ClipPlane().
*/
- if (ctx->Transform._AnyClip) {
+ if (ctx->Transform.ClipPlanesEnabled) {
GLuint p;
for (p = 0; p < ctx->Const.MaxClipPlanes; p++) {
- if (ctx->Transform.ClipEnabled[p]) {
+ if (ctx->Transform.ClipPlanesEnabled & (1 << p)) {
_mesa_transform_vector( ctx->Transform._ClipUserPlane[p],
ctx->Transform.EyeUserPlane[p],
ctx->ProjectionMatrixStack.Top->inv );
-/* $Id: t_vb_cliptmp.h,v 1.14 2001/07/13 17:26:39 brianp Exp $ */
+/* $Id: t_vb_cliptmp.h,v 1.15 2002/03/29 17:27:59 brianp Exp $ */
/*
* Mesa 3-D graphics library
if (mask & CLIP_USER_BIT) {
for (p=0;p<MAX_CLIP_PLANES;p++) {
- if (ctx->Transform.ClipEnabled[p]) {
- GLfloat a = ctx->Transform._ClipUserPlane[p][0];
- GLfloat b = ctx->Transform._ClipUserPlane[p][1];
- GLfloat c = ctx->Transform._ClipUserPlane[p][2];
- GLfloat d = ctx->Transform._ClipUserPlane[p][3];
+ if (ctx->Transform.ClipPlanesEnabled & (1 << p)) {
+ const GLfloat a = ctx->Transform._ClipUserPlane[p][0];
+ const GLfloat b = ctx->Transform._ClipUserPlane[p][1];
+ const GLfloat c = ctx->Transform._ClipUserPlane[p][2];
+ const GLfloat d = ctx->Transform._ClipUserPlane[p][3];
LINE_CLIP( CLIP_USER_BIT, a, b, c, d );
}
}
if (mask & CLIP_USER_BIT) {
for (p=0;p<MAX_CLIP_PLANES;p++) {
- if (ctx->Transform.ClipEnabled[p]) {
- GLfloat a = ctx->Transform._ClipUserPlane[p][0];
- GLfloat b = ctx->Transform._ClipUserPlane[p][1];
- GLfloat c = ctx->Transform._ClipUserPlane[p][2];
- GLfloat d = ctx->Transform._ClipUserPlane[p][3];
- POLY_CLIP( CLIP_USER_BIT, a, b, c, d );
- }
+ if (ctx->Transform.ClipPlanesEnabled & (1 << p)) {
+ const GLfloat a = ctx->Transform._ClipUserPlane[p][0];
+ const GLfloat b = ctx->Transform._ClipUserPlane[p][1];
+ const GLfloat c = ctx->Transform._ClipUserPlane[p][2];
+ const GLfloat d = ctx->Transform._ClipUserPlane[p][3];
+ POLY_CLIP( CLIP_USER_BIT, a, b, c, d );
+ }
}
}
if (mask & CLIP_USER_BIT) {
for (p=0;p<MAX_CLIP_PLANES;p++) {
- if (ctx->Transform.ClipEnabled[p]) {
- GLfloat a = ctx->Transform._ClipUserPlane[p][0];
- GLfloat b = ctx->Transform._ClipUserPlane[p][1];
- GLfloat c = ctx->Transform._ClipUserPlane[p][2];
- GLfloat d = ctx->Transform._ClipUserPlane[p][3];
+ if (ctx->Transform.ClipPlanesEnabled & (1 << p)) {
+ const GLfloat a = ctx->Transform._ClipUserPlane[p][0];
+ const GLfloat b = ctx->Transform._ClipUserPlane[p][1];
+ const GLfloat c = ctx->Transform._ClipUserPlane[p][2];
+ const GLfloat d = ctx->Transform._ClipUserPlane[p][3];
POLY_CLIP( CLIP_USER_BIT, a, b, c, d );
}
}
-/* $Id: t_vb_vertex.c,v 1.12 2002/01/22 14:35:17 brianp Exp $ */
+/* $Id: t_vb_vertex.c,v 1.13 2002/03/29 17:27:59 brianp Exp $ */
/*
* Mesa 3-D graphics library
GLuint p; \
\
for (p = 0; p < ctx->Const.MaxClipPlanes; p++) \
- if (ctx->Transform.ClipEnabled[p]) { \
+ if (ctx->Transform.ClipPlanesEnabled & (1 << p)) { \
GLuint nr, i; \
const GLfloat a = ctx->Transform._ClipUserPlane[p][0]; \
const GLfloat b = ctx->Transform._ClipUserPlane[p][1]; \
/* Test userclip planes. This contributes to VB->ClipMask, so
* is essentially required to be in this stage.
*/
- if (ctx->Transform._AnyClip) {
+ if (ctx->Transform.ClipPlanesEnabled) {
usercliptab[VB->ClipPtr->size]( ctx,
VB->ClipPtr,
store->clipmask,