diff options
author | Michal Krol <[email protected]> | 2006-03-21 10:37:40 +0000 |
---|---|---|
committer | Michal Krol <[email protected]> | 2006-03-21 10:37:40 +0000 |
commit | 071357096e682e9af59ad45ea5abc444ab431837 (patch) | |
tree | 99fba2183fe97981f7c309d99b206b39e43f5bec /src/mesa/main/fog.c | |
parent | 519b23b21f9cd6945fd17cdb26e7a6f531cdeec0 (diff) |
GLSL fixes:
- generate error on NULL pointers in glShaderSourceARB;
- reinstall program object, if current, in glLinkProgramARB;
- vertex and fragment shaders are optional in program object;
- floor asm was wrongly computed for x86 back-end;
- allow for (void) idiom in function prototypes;
- all fixed-state uniforms are updated;
- local variable initializers are working;
- implement texture* and shadow* functions for vertex processor;
- generate error if too many arguments in general constructor;
- trim unused data in general constructor;
- struct r-value field select was badly relocated;
Changes:
- add derived state gl_fog_attrib::_Scale;
- add derived state gl_light::_CosCutoffNeg;
Diffstat (limited to 'src/mesa/main/fog.c')
-rw-r--r-- | src/mesa/main/fog.c | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/src/mesa/main/fog.c b/src/mesa/main/fog.c index d3b8a923aae..df99c6519f6 100644 --- a/src/mesa/main/fog.c +++ b/src/mesa/main/fog.c @@ -70,7 +70,15 @@ _mesa_Fogiv(GLenum pname, const GLint *params ) ; } _mesa_Fogfv(pname, p); -} +}
+
+
+#define UPDATE_FOG_SCALE(ctx) do {\
+ if (ctx->Fog.End == ctx->Fog.Start)\
+ ctx->Fog._Scale = 1.0f;\
+ else\
+ ctx->Fog._Scale = 1.0f / (ctx->Fog.End - ctx->Fog.Start);\
+ } while(0) void GLAPIENTRY @@ -108,17 +116,19 @@ _mesa_Fogfv( GLenum pname, const GLfloat *params ) ctx->Fog.Density = *params; break; case GL_FOG_START: - if (ctx->Fog.Start == *params) - return; - FLUSH_VERTICES(ctx, _NEW_FOG); - ctx->Fog.Start = *params; - break; + if (ctx->Fog.Start == *params) + return; + FLUSH_VERTICES(ctx, _NEW_FOG); + ctx->Fog.Start = *params;
+ UPDATE_FOG_SCALE(ctx); + break; case GL_FOG_END: - if (ctx->Fog.End == *params) - return; - FLUSH_VERTICES(ctx, _NEW_FOG); - ctx->Fog.End = *params; - break; + if (ctx->Fog.End == *params) + return; + FLUSH_VERTICES(ctx, _NEW_FOG);
+ ctx->Fog.End = *params;
+ UPDATE_FOG_SCALE(ctx); + break; case GL_FOG_INDEX: if (ctx->Fog.Index == *params) return; @@ -173,5 +183,6 @@ void _mesa_init_fog( GLcontext * ctx ) ctx->Fog.Start = 0.0; ctx->Fog.End = 1.0; ctx->Fog.ColorSumEnabled = GL_FALSE; - ctx->Fog.FogCoordinateSource = GL_FRAGMENT_DEPTH_EXT; + ctx->Fog.FogCoordinateSource = GL_FRAGMENT_DEPTH_EXT;
+ ctx->Fog._Scale = 1.0f; } |