+ else if (t->currentmaterialflags & MATERIALFLAG_LIGHTGRID)
+ {
+ if (r_glsl_offsetmapping.integer && ((R_TextureFlags(t->nmaptexture) & TEXF_ALPHA) || t->offsetbias != 0.0f))
+ {
+ switch(t->offsetmapping)
+ {
+ case OFFSETMAPPING_LINEAR: permutation |= SHADERPERMUTATION_OFFSETMAPPING;break;
+ case OFFSETMAPPING_RELIEF: permutation |= SHADERPERMUTATION_OFFSETMAPPING | SHADERPERMUTATION_OFFSETMAPPING_RELIEFMAPPING;break;
+ case OFFSETMAPPING_DEFAULT: permutation |= SHADERPERMUTATION_OFFSETMAPPING;if (r_glsl_offsetmapping_reliefmapping.integer) permutation |= SHADERPERMUTATION_OFFSETMAPPING_RELIEFMAPPING;break;
+ case OFFSETMAPPING_OFF: break;
+ }
+ }
+ if (t->currentmaterialflags & MATERIALFLAG_VERTEXTEXTUREBLEND)
+ permutation |= SHADERPERMUTATION_VERTEXTEXTUREBLEND;
+ if (t->currentmaterialflags & MATERIALFLAG_ALPHAGEN_VERTEX)
+ permutation |= SHADERPERMUTATION_ALPHAGEN_VERTEX;
+ // directional model lighting
+ mode = SHADERMODE_LIGHTGRID;
+ if ((t->glowtexture || t->backgroundglowtexture) && r_hdr_glowintensity.value > 0 && !gl_lightmaps.integer)
+ permutation |= SHADERPERMUTATION_GLOW;
+ permutation |= SHADERPERMUTATION_DIFFUSE;
+ if (t->glosstexture || t->backgroundglosstexture)
+ permutation |= SHADERPERMUTATION_SPECULAR;
+ if (r_refdef.fogenabled)
+ permutation |= r_texture_fogheighttexture ? SHADERPERMUTATION_FOGHEIGHTTEXTURE : (r_refdef.fogplaneviewabove ? SHADERPERMUTATION_FOGOUTSIDE : SHADERPERMUTATION_FOGINSIDE);
+ if (t->colormapping)
+ permutation |= SHADERPERMUTATION_COLORMAPPING;
+ if (r_shadow_usingshadowmaportho && !(rsurface.ent_flags & RENDER_NOSELFSHADOW))
+ {
+ permutation |= SHADERPERMUTATION_SHADOWMAPORTHO;
+ permutation |= SHADERPERMUTATION_SHADOWMAP2D;
+
+ if (r_shadow_shadowmap2ddepthbuffer)
+ permutation |= SHADERPERMUTATION_DEPTHRGB;
+ }
+ if (t->currentmaterialflags & MATERIALFLAG_REFLECTION)
+ permutation |= SHADERPERMUTATION_REFLECTION;
+ if (r_shadow_usingdeferredprepass && !(t->currentmaterialflags & MATERIALFLAG_BLENDED))
+ permutation |= SHADERPERMUTATION_DEFERREDLIGHTMAP;
+ if (t->reflectmasktexture)
+ permutation |= SHADERPERMUTATION_REFLECTCUBE;
+ if (r_shadow_bouncegrid_state.texture && cl.csqc_vidvars.drawworld && !notrippy)
+ {
+ permutation |= SHADERPERMUTATION_BOUNCEGRID;
+ if (r_shadow_bouncegrid_state.directional)
+ permutation |= SHADERPERMUTATION_BOUNCEGRIDDIRECTIONAL;
+ }
+ GL_BlendFunc(t->currentblendfunc[0], t->currentblendfunc[1]);
+ blendfuncflags = R_BlendFuncFlags(t->currentblendfunc[0], t->currentblendfunc[1]);
+ // when using alphatocoverage, we don't need alphakill
+ if (vid.allowalphatocoverage)
+ {
+ if (r_transparent_alphatocoverage.integer)
+ {
+ GL_AlphaToCoverage((t->currentmaterialflags & MATERIALFLAG_ALPHATEST) != 0);
+ permutation &= ~SHADERPERMUTATION_ALPHAKILL;
+ }
+ else
+ GL_AlphaToCoverage(false);
+ }
+ }