X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=gl_rmain.c;h=5976c1cddf1facf6f3bd1640c7370184f6572619;hb=32ad538b7b2fb3349717631863dfdfe61358fe6c;hp=3bc4326a33af3e14500b30836ef179335108146c;hpb=76285e846057dd44284deb36b7b4a21a7768594c;p=xonotic%2Fdarkplaces.git diff --git a/gl_rmain.c b/gl_rmain.c index 3bc4326a..5976c1cd 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -112,6 +112,10 @@ cvar_t gl_lightmaps = {0, "gl_lightmaps", "0", "draws only lightmaps, no texture cvar_t r_test = {0, "r_test", "0", "internal development use only, leave it alone (usually does nothing anyway)"}; cvar_t r_batchmode = {0, "r_batchmode", "1", "selects method of rendering multiple surfaces with one driver call (values are 0, 1, 2, etc...)"}; +cvar_t r_track_sprites = {CVAR_SAVE, "r_track_sprites", "1", "track SPR_LABEL* sprites by putting them as indicator at the screen border to rotate to"}; +cvar_t r_track_sprites_flags = {CVAR_SAVE, "r_track_sprites_flags", "1", "1: Rotate sprites accodringly, 2: Make it a continuous rotation"}; +cvar_t r_track_sprites_scalew = {CVAR_SAVE, "r_track_sprites_scalew", "1", "width scaling of tracked sprites"}; +cvar_t r_track_sprites_scaleh = {CVAR_SAVE, "r_track_sprites_scaleh", "1", "height scaling of tracked sprites"}; extern qboolean v_flipped_state; @@ -444,10 +448,10 @@ static const char *builtinshaderstring = "varying vec3 VectorT; // direction of T texcoord (sometimes crudely called binormal)\n" "varying vec3 VectorR; // direction of R texcoord (surface normal)\n" "\n" -"//#ifdef USEWATER\n" +"//#ifdef MODE_WATER\n" "varying vec4 ModelViewProjectionPosition;\n" "//#else\n" -"//# ifdef USEREFRACTION\n" +"//# ifdef MODE_REFRACTION\n" "//varying vec4 ModelViewProjectionPosition;\n" "//# else\n" "//# ifdef USEREFLECTION\n" @@ -515,7 +519,7 @@ static const char *builtinshaderstring = " VectorR = gl_MultiTexCoord3.xyz;\n" "#endif\n" "\n" -"//#if defined(USEWATER) || defined(USEREFRACTION) || defined(USEREFLECTION)\n" +"//#if defined(MODE_WATER) || defined(MODE_REFRACTION) || defined(USEREFLECTION)\n" "// ModelViewProjectionPosition = gl_Vertex * gl_ModelViewProjectionMatrix;\n" "// //ModelViewProjectionPosition_svector = (gl_Vertex + vec4(gl_MultiTexCoord1.xyz, 0)) * gl_ModelViewProjectionMatrix - ModelViewProjectionPosition;\n" "// //ModelViewProjectionPosition_tvector = (gl_Vertex + vec4(gl_MultiTexCoord2.xyz, 0)) * gl_ModelViewProjectionMatrix - ModelViewProjectionPosition;\n" @@ -531,12 +535,6 @@ static const char *builtinshaderstring = "#ifdef MODE_REFRACTION\n" " ModelViewProjectionPosition = gl_Position;\n" "#endif\n" -"#ifdef USEWATER\n" -" ModelViewProjectionPosition = gl_Position;\n" -"#endif\n" -"#ifdef USEREFRACTION\n" -" ModelViewProjectionPosition = gl_Position;\n" -"#endif\n" "#ifdef USEREFLECTION\n" " ModelViewProjectionPosition = gl_Position;\n" "#endif\n" @@ -573,7 +571,7 @@ static const char *builtinshaderstring = "uniform myhvec3 Color_Shirt;\n" "uniform myhvec3 FogColor;\n" "\n" -"//#ifdef USEWATER\n" +"//#ifdef MODE_WATER\n" "uniform vec4 DistortScaleRefractReflect;\n" "uniform vec4 ScreenScaleRefractReflect;\n" "uniform vec4 ScreenCenterRefractReflect;\n" @@ -582,11 +580,14 @@ static const char *builtinshaderstring = "uniform myhalf ReflectFactor;\n" "uniform myhalf ReflectOffset;\n" "//#else\n" -"//# ifdef USEREFRACTION\n" +"//# ifdef MODE_REFRACTION\n" "//uniform vec4 DistortScaleRefractReflect;\n" "//uniform vec4 ScreenScaleRefractReflect;\n" "//uniform vec4 ScreenCenterRefractReflect;\n" "//uniform myhvec4 RefractColor;\n" +"//# ifdef USEREFLECTION\n" +"//uniform myhvec4 ReflectColor;\n" +"//# endif\n" "//# else\n" "//# ifdef USEREFLECTION\n" "//uniform vec4 DistortScaleRefractReflect;\n" @@ -827,27 +828,13 @@ static const char *builtinshaderstring = " color.rgb += myhvec3(texture2D(Texture_Glow, TexCoord)) * GlowScale;\n" "#endif\n" "\n" -"#ifdef MODE_LIGHTSOURCE\n" -"# ifdef USEWATER\n" -" color.rgb *= color.a;\n" -"# endif\n" -"# ifdef USEREFRACTION\n" -" color.rgb *= color.a;\n" -"# endif\n" -"#else\n" -"# ifdef USEWATER\n" -" vec4 ScreenScaleRefractReflectIW = ScreenScaleRefractReflect * (1.0 / ModelViewProjectionPosition.w);\n" -" //vec4 ScreenTexCoord = (ModelViewProjectionPosition.xyxy + normalize(myhvec3(texture2D(Texture_Normal, TexCoord)) - myhvec3(0.5)).xyxy * DistortScaleRefractReflect * 100) * ScreenScaleRefractReflectIW + ScreenCenterRefractReflect;\n" -" vec4 ScreenTexCoord = ModelViewProjectionPosition.xyxy * ScreenScaleRefractReflectIW + ScreenCenterRefractReflect + vec3(normalize(myhvec3(texture2D(Texture_Normal, TexCoord)) - myhvec3(0.5))).xyxy * DistortScaleRefractReflect;\n" -" myhalf Fresnel = myhalf(pow(min(1.0, 1.0 - float(normalize(EyeVector).z)), 5.0)) * ReflectFactor + ReflectOffset;\n" -" color.rgb = mix(mix(myhvec3(texture2D(Texture_Refraction, ScreenTexCoord.xy)) * RefractColor.rgb, myhvec3(texture2D(Texture_Reflection, ScreenTexCoord.zw)) * ReflectColor.rgb, Fresnel), color.rgb, color.a);\n" -"# endif\n" -"# ifdef USEREFRACTION\n" -" vec4 ScreenScaleRefractReflectIW = ScreenScaleRefractReflect * (1.0 / ModelViewProjectionPosition.w);\n" -" //vec4 ScreenTexCoord = (ModelViewProjectionPosition.xyxy + normalize(myhvec3(texture2D(Texture_Normal, TexCoord)) - myhvec3(0.5)).xyxy * DistortScaleRefractReflect * 100) * ScreenScaleRefractReflectIW + ScreenCenterRefractReflect;\n" -" vec4 ScreenTexCoord = ModelViewProjectionPosition.xyxy * ScreenScaleRefractReflectIW + ScreenCenterRefractReflect + vec3(normalize(myhvec3(texture2D(Texture_Normal, TexCoord)) - myhvec3(0.5))).xyxy * DistortScaleRefractReflect;\n" -" color.rgb = mix(myhvec3(texture2D(Texture_Refraction, ScreenTexCoord.xy)) * RefractColor.rgb, color.rgb, color.a);\n" -"# endif\n" +"#ifdef USECONTRASTBOOST\n" +" color.rgb = color.rgb / (ContrastBoostCoeff * color.rgb + myhvec3(1, 1, 1));\n" +"#endif\n" +"\n" +" color.rgb *= SceneBrightness;\n" +"\n" +"#ifndef MODE_LIGHTSOURCE\n" "# ifdef USEREFLECTION\n" " vec4 ScreenScaleRefractReflectIW = ScreenScaleRefractReflect * (1.0 / ModelViewProjectionPosition.w);\n" " //vec4 ScreenTexCoord = (ModelViewProjectionPosition.xyxy + normalize(myhvec3(texture2D(Texture_Normal, TexCoord)) - myhvec3(0.5)).xyxy * DistortScaleRefractReflect * 100) * ScreenScaleRefractReflectIW + ScreenCenterRefractReflect;\n" @@ -861,12 +848,6 @@ static const char *builtinshaderstring = " color.rgb = mix(FogColor, color.rgb, myhalf(texture2D(Texture_FogMask, myhvec2(length(EyeVectorModelSpace)*FogRangeRecip, 0.0))));\n" "#endif\n" "\n" -"#ifdef USECONTRASTBOOST\n" -" color.rgb = color.rgb / (ContrastBoostCoeff * color.rgb + myhvec3(1, 1, 1));\n" -"#endif\n" -"\n" -" color.rgb *= SceneBrightness;\n" -"\n" " gl_FragColor = vec4(color);\n" "}\n" "#endif // MODE_REFRACTION\n" @@ -885,9 +866,7 @@ static const char *builtinshaderstring = #define SHADERPERMUTATION_REFLECTION (1<<7) // normalmap-perturbed reflection of the scene infront of the surface, preformed as an overlay on the surface #define SHADERPERMUTATION_OFFSETMAPPING (1<<8) // adjust texcoords to roughly simulate a displacement mapped surface #define SHADERPERMUTATION_OFFSETMAPPING_RELIEFMAPPING (1<<9) // adjust texcoords to accurately simulate a displacement mapped surface (requires OFFSETMAPPING to also be set!) -#define SHADERPERMUTATION_WATER (1<<10) // normalmap-perturbed refraction of the background, performed behind the surface (the texture or material must be transparent to see it) -#define SHADERPERMUTATION_REFRACTION (1<<11) // normalmap-perturbed reflection of the scene infront of the surface, preformed as an overlay on the surface -#define SHADERPERMUTATION_MODEBASE (1<<12) // multiplier for the SHADERMODE_ values to get a valid index +#define SHADERPERMUTATION_MODEBASE (1<<10) // multiplier for the SHADERMODE_ values to get a valid index // NOTE: MUST MATCH ORDER OF SHADERPERMUTATION_* DEFINES! const char *shaderpermutationinfo[][2] = @@ -902,8 +881,6 @@ const char *shaderpermutationinfo[][2] = {"#define USEREFLECTION\n", " reflection"}, {"#define USEOFFSETMAPPING\n", " offsetmapping"}, {"#define USEOFFSETMAPPING_RELIEFMAPPING\n", " reliefmapping"}, - {"#define USEWATER\n", " water"}, - {"#define USEREFRACTION\n", " refraction"}, {NULL, NULL} }; @@ -1223,10 +1200,6 @@ int R_SetupSurfaceShader(const vec3_t lightcolorbase, qboolean modellighting, fl permutation |= SHADERPERMUTATION_COLORMAPPING; if(r_glsl_contrastboost.value > 1 || r_glsl_contrastboost.value < 0) permutation |= SHADERPERMUTATION_CONTRASTBOOST; - //if (rsurface.texture->currentmaterialflags & MATERIALFLAG_WATERSHADER) - // permutation |= SHADERPERMUTATION_WATER; - //if (rsurface.texture->currentmaterialflags & MATERIALFLAG_REFRACTION) - // permutation |= SHADERPERMUTATION_REFRACTION; if (rsurface.texture->currentmaterialflags & MATERIALFLAG_REFLECTION) permutation |= SHADERPERMUTATION_REFLECTION; } @@ -1248,10 +1221,6 @@ int R_SetupSurfaceShader(const vec3_t lightcolorbase, qboolean modellighting, fl } if(r_glsl_contrastboost.value > 1 || r_glsl_contrastboost.value < 0) permutation |= SHADERPERMUTATION_CONTRASTBOOST; - //if (rsurface.texture->currentmaterialflags & MATERIALFLAG_WATERSHADER) - // permutation |= SHADERPERMUTATION_WATER; - //if (rsurface.texture->currentmaterialflags & MATERIALFLAG_REFRACTION) - // permutation |= SHADERPERMUTATION_REFRACTION; if (rsurface.texture->currentmaterialflags & MATERIALFLAG_REFLECTION) permutation |= SHADERPERMUTATION_REFLECTION; } @@ -1269,10 +1238,6 @@ int R_SetupSurfaceShader(const vec3_t lightcolorbase, qboolean modellighting, fl permutation |= SHADERPERMUTATION_COLORMAPPING; if(r_glsl_contrastboost.value > 1 || r_glsl_contrastboost.value < 0) permutation |= SHADERPERMUTATION_CONTRASTBOOST; - //if (rsurface.texture->currentmaterialflags & MATERIALFLAG_WATERSHADER) - // permutation |= SHADERPERMUTATION_WATER; - //if (rsurface.texture->currentmaterialflags & MATERIALFLAG_REFRACTION) - // permutation |= SHADERPERMUTATION_REFRACTION; if (rsurface.texture->currentmaterialflags & MATERIALFLAG_REFLECTION) permutation |= SHADERPERMUTATION_REFLECTION; } @@ -1309,10 +1274,6 @@ int R_SetupSurfaceShader(const vec3_t lightcolorbase, qboolean modellighting, fl permutation |= SHADERPERMUTATION_COLORMAPPING; if(r_glsl_contrastboost.value > 1 || r_glsl_contrastboost.value < 0) permutation |= SHADERPERMUTATION_CONTRASTBOOST; - //if (rsurface.texture->currentmaterialflags & MATERIALFLAG_WATERSHADER) - // permutation |= SHADERPERMUTATION_WATER; - //if (rsurface.texture->currentmaterialflags & MATERIALFLAG_REFRACTION) - // permutation |= SHADERPERMUTATION_REFRACTION; if (rsurface.texture->currentmaterialflags & MATERIALFLAG_REFLECTION) permutation |= SHADERPERMUTATION_REFLECTION; } @@ -1393,7 +1354,7 @@ int R_SetupSurfaceShader(const vec3_t lightcolorbase, qboolean modellighting, fl // color.rgb *= [[SceneBrightness * ContrastBoost]]; // color.rgb /= [[(ContrastBoost - 1) / ContrastBoost]] * color.rgb + 1; // and Black: - // color.rgb = [[SceneBrightness * ContrastBoost]] / ([[(ContrastBoost - 1) * SceneBrightness]] + 1 / color.rgb); + // color.rgb = [[SceneBrightness * ContrastBoost]] * color.rgb / ([[(ContrastBoost - 1) * SceneBrightness]] * color.rgb + 1); // and do [[calculations]] here in the engine qglUniform1fARB(r_glsl_permutation->loc_ContrastBoostCoeff, (r_glsl_contrastboost.value - 1) * r_view.colorscale); if (r_glsl_permutation->loc_SceneBrightness >= 0) qglUniform1fARB(r_glsl_permutation->loc_SceneBrightness, r_view.colorscale * r_glsl_contrastboost.value); @@ -1406,6 +1367,21 @@ int R_SetupSurfaceShader(const vec3_t lightcolorbase, qboolean modellighting, fl if (rsurface.rtlight || (rsurface.texture->currentmaterialflags & MATERIALFLAG_ADD)) qglUniform3fARB(r_glsl_permutation->loc_FogColor, 0, 0, 0); else + /* + { + vec3_t fogvec; + // color.rgb *= SceneBrightness; + VectorScale(r_refdef.fogcolor, r_view.colorscale, fogvec); + if(r_glsl_permutation->loc_ContrastBoostCoeff >= 0) // need to support contrast boost + { + // color.rgb *= ContrastBoost / ((ContrastBoost - 1) * color.rgb + 1); + fogvec[0] *= r_glsl_contrastboost.value / ((r_glsl_contrastboost.value - 1) * fogvec[0] + 1); + fogvec[1] *= r_glsl_contrastboost.value / ((r_glsl_contrastboost.value - 1) * fogvec[1] + 1); + fogvec[2] *= r_glsl_contrastboost.value / ((r_glsl_contrastboost.value - 1) * fogvec[2] + 1); + } + qglUniform3fARB(r_glsl_permutation->loc_FogColor, fogvec[0], fogvec[1], fogvec[2]); + } + */ qglUniform3fARB(r_glsl_permutation->loc_FogColor, r_refdef.fogcolor[0], r_refdef.fogcolor[1], r_refdef.fogcolor[2]); } if (r_glsl_permutation->loc_EyePosition >= 0) qglUniform3fARB(r_glsl_permutation->loc_EyePosition, rsurface.modelorg[0], rsurface.modelorg[1], rsurface.modelorg[2]); @@ -1929,6 +1905,11 @@ void GL_Main_Init(void) if (gamemode == GAME_NEHAHRA || gamemode == GAME_TENEBRAE) Cvar_SetValue("r_fullbrights", 0); R_RegisterModule("GL_Main", gl_main_start, gl_main_shutdown, gl_main_newmap); + + Cvar_RegisterVariable(&r_track_sprites); + Cvar_RegisterVariable(&r_track_sprites_flags); + Cvar_RegisterVariable(&r_track_sprites_scalew); + Cvar_RegisterVariable(&r_track_sprites_scaleh); } extern void R_Textures_Init(void); @@ -2132,7 +2113,8 @@ static void R_View_UpdateEntityVisible (void) for (i = 0;i < r_refdef.numentities;i++) { ent = r_refdef.entities[i]; - r_viewcache.entityvisible[i] = !(ent->flags & renderimask) && !R_CullBox(ent->mins, ent->maxs) && ((ent->effects & EF_NODEPTHTEST) || (ent->flags & RENDER_VIEWMODEL) || r_refdef.worldmodel->brush.BoxTouchingVisibleLeafs(r_refdef.worldmodel, r_viewcache.world_leafvisible, ent->mins, ent->maxs)); + r_viewcache.entityvisible[i] = !(ent->flags & renderimask) && ((ent->model->type == mod_sprite && (ent->model->sprite.sprnum_type == SPR_LABEL || ent->model->sprite.sprnum_type == SPR_LABEL_SCALE)) || !R_CullBox(ent->mins, ent->maxs)) && ((ent->effects & EF_NODEPTHTEST) || (ent->flags & RENDER_VIEWMODEL) || r_refdef.worldmodel->brush.BoxTouchingVisibleLeafs(r_refdef.worldmodel, r_viewcache.world_leafvisible, ent->mins, ent->maxs)); + } if(r_cullentities_trace.integer) { @@ -2155,7 +2137,7 @@ static void R_View_UpdateEntityVisible (void) for (i = 0;i < r_refdef.numentities;i++) { ent = r_refdef.entities[i]; - r_viewcache.entityvisible[i] = !(ent->flags & renderimask) && !R_CullBox(ent->mins, ent->maxs); + r_viewcache.entityvisible[i] = !(ent->flags & renderimask) && ((ent->model->type == mod_sprite && (ent->model->sprite.sprnum_type == SPR_LABEL || ent->model->sprite.sprnum_type == SPR_LABEL_SCALE)) || !R_CullBox(ent->mins, ent->maxs)); } } @@ -2337,8 +2319,6 @@ static void R_View_SetFrustum(void) r_view.frustum[5].dist = m[15] + m[14]; #endif - - if (r_view.useperspective) { slopex = 1.0 / r_view.frustum_x; @@ -2348,6 +2328,14 @@ static void R_View_SetFrustum(void) VectorMA(r_view.forward, -slopey, r_view.up , r_view.frustum[2].normal); VectorMA(r_view.forward, slopey, r_view.up , r_view.frustum[3].normal); VectorCopy(r_view.forward, r_view.frustum[4].normal); + + // Leaving those out was a mistake, those were in the old code, and they + // fix a reproducable bug in this one: frustum culling got fucked up when viewmatrix was an identity matrix + // I couldn't reproduce it after adding those normalizations. --blub + VectorNormalize(r_view.frustum[0].normal); + VectorNormalize(r_view.frustum[1].normal); + VectorNormalize(r_view.frustum[2].normal); + VectorNormalize(r_view.frustum[3].normal); // calculate frustum corners, which are used to calculate deformed frustum planes for shadow caster culling VectorMAMAMAM(1, r_view.origin, 1024, r_view.forward, -1024 * slopex, r_view.left, -1024 * slopey, r_view.up, r_view.frustumcorner[0]); @@ -2586,7 +2574,7 @@ static void R_Water_StartFrame(void) // calculate desired texture sizes // can't use water if the card does not support the texture size - if (!r_water.integer || waterwidth > gl_max_texture_size || waterheight > gl_max_texture_size) + if (!r_water.integer || !r_glsl.integer || !gl_support_fragment_shader || waterwidth > gl_max_texture_size || waterheight > gl_max_texture_size) texturewidth = textureheight = waterwidth = waterheight = 0; else if (gl_support_arb_texture_non_power_of_two) { @@ -3283,7 +3271,7 @@ void R_RenderScene(qboolean addwaterplanes) R_View_Update(); if (r_timereport_active) - R_TimeReport("watervisibility"); + R_TimeReport("watervis"); if (cl.csqc_vidvars.drawworld && r_refdef.worldmodel && r_refdef.worldmodel->DrawAddWaterPlanes) { @@ -5299,105 +5287,6 @@ static void RSurf_DrawBatch_GL11_VertexShade(int texturenumsurfaces, msurface_t RSurf_DrawBatch_Simple(texturenumsurfaces, texturesurfacelist); } -#if 0 -static void RSurf_GL11_WaterTexCoords(int texturenumsurfaces, msurface_t **texturesurfacelist) -{ - int texturesurfaceindex; - const msurface_t *surface; - // compute texcoords for vertices (yes, these swim around the screen a bit unintentionally) - // compute vertex alpha to fade between reflection and refraction if this is water - for (texturesurfaceindex = 0;texturesurfaceindex < texturenumsurfaces;texturesurfaceindex++) - { - surface = texturesurfacelist[texturesurfaceindex]; - GL_TransformToScreenTexCoords(surface->num_vertices, rsurface.vertex3f + 3 * surface->num_firstvertex, rsurface.array_generatedtexcoordtexture2f + 2 * surface->num_firstvertex, r_waterstate.screenscale[0], r_waterstate.screenscale[1], r_waterstate.screencenter[0], r_waterstate.screencenter[1]); - } -} - -static void RSurf_GL11_WaterFresnelAlpha(int texturenumsurfaces, msurface_t **texturesurfacelist) -{ - int texturesurfaceindex; - int i; - const msurface_t *surface; - int numverts; - const float *v; - const float *n; - float *c2; - vec3_t dir; - float Fresnel; - // compute texcoords for vertices (yes, these swim around the screen a bit unintentionally) - // compute vertex alpha to fade between reflection and refraction if this is water - for (texturesurfaceindex = 0;texturesurfaceindex < texturenumsurfaces;texturesurfaceindex++) - { - surface = texturesurfacelist[texturesurfaceindex]; - numverts = surface->num_vertices; - v = rsurface.vertex3f + 3 * surface->num_firstvertex; - n = rsurface.normal3f + 3 * surface->num_firstvertex; - c2 = rsurface.array_color4f + 4 * surface->num_firstvertex; - for (i = 0;i < numverts;i++, v += 3, n += 3, c2 += 4) - { - VectorSubtract(rsurface.modelorg, v, dir); - VectorNormalize(dir); - Fresnel = pow(min(1.0f, 1.0f - DotProduct(dir, n)), 2.0f) * (rsurface.texture->reflectmax - rsurface.texture->reflectmin) + rsurface.texture->reflectmin; - Vector4Set(c2, 1, 1, 1, Fresnel); - } - } -} - -static void R_DrawTextureSurfaceList_GL11_Water(int texturenumsurfaces, msurface_t **texturesurfacelist) -{ - // OpenGL 1.1 path - crusty old voodoo path - rmeshstate_t m; - qboolean water; - if (rsurface.mode != RSURFMODE_MULTIPASS) - rsurface.mode = RSURFMODE_MULTIPASS; - RSurf_PrepareVerticesForBatch(true, false, texturenumsurfaces, texturesurfacelist); - R_Mesh_ColorPointer(NULL, 0, 0); - water = (rsurface.texture->currentmaterialflags & MATERIALFLAG_WATERSHADER) != 0; - RSurf_GL11_WaterTexCoords(texturenumsurfaces, texturesurfacelist); - if (water) - RSurf_GL11_WaterFresnelAlpha(texturenumsurfaces, texturesurfacelist); - // now draw the surfaces as refraction texture - memset(&m, 0, sizeof(m)); - m.tex[0] = R_GetTexture(r_texture_white); - m.pointer_texcoord[0] = rsurface.array_generatedtexcoordtexture2f; - R_Mesh_TextureState(&m); - RSurf_DrawBatch_WithLightmapSwitching_WithWaterTextureSwitching(texturenumsurfaces, texturesurfacelist, -1, -1, 0, -1); - if (water) - { - // water also reflects before the normal render occurs, and uses a - // vertex-controlled alpha blend between refraction and reflection - GL_LockArrays(0, 0); - R_Mesh_ColorPointer(rsurface.array_color4f, 0, 0); - GL_BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - GL_DepthMask(false); - RSurf_DrawBatch_WithLightmapSwitching_WithWaterTextureSwitching(texturenumsurfaces, texturesurfacelist, -1, -1, -1, 0); - } - GL_LockArrays(0, 0); - CHECKGLERROR -} - -static void R_DrawTextureSurfaceList_GL11_Reflection(int texturenumsurfaces, msurface_t **texturesurfacelist) -{ - // OpenGL 1.1 path - crusty old voodoo path - rmeshstate_t m; - qboolean water; - if (rsurface.mode != RSURFMODE_MULTIPASS) - rsurface.mode = RSURFMODE_MULTIPASS; - RSurf_PrepareVerticesForBatch(true, false, texturenumsurfaces, texturesurfacelist); - R_Mesh_ColorPointer(NULL, 0, 0); - water = (rsurface.texture->currentmaterialflags & MATERIALFLAG_WATERSHADER) != 0; - RSurf_GL11_WaterTexCoords(texturenumsurfaces, texturesurfacelist); - // now draw the surfaces as refraction texture - memset(&m, 0, sizeof(m)); - m.tex[0] = R_GetTexture(r_texture_white); - m.pointer_texcoord[0] = rsurface.array_generatedtexcoordtexture2f; - R_Mesh_TextureState(&m); - RSurf_DrawBatch_WithLightmapSwitching_WithWaterTextureSwitching(texturenumsurfaces, texturesurfacelist, -1, -1, -1, 0); - GL_LockArrays(0, 0); - CHECKGLERROR -} -#endif - static void R_DrawTextureSurfaceList_ShowSurfaces(int texturenumsurfaces, msurface_t **texturesurfacelist) { GL_DepthRange(0, (rsurface.texture->currentmaterialflags & MATERIALFLAG_SHORTDEPTHRANGE) ? 0.0625 : 1); @@ -5613,17 +5502,6 @@ static void R_DrawTextureSurfaceList_GL13(int texturenumsurfaces, msurface_t **t rsurface.mode = RSURFMODE_MULTIPASS; RSurf_PrepareVerticesForBatch(true, false, texturenumsurfaces, texturesurfacelist); -#if 0 - if (rsurface.texture->currentmaterialflags & (MATERIALFLAG_WATERSHADER | MATERIALFLAG_REFRACTION)) - { - // render background - GL_BlendFunc(GL_ONE, GL_ZERO); - GL_DepthMask(true); - GL_AlphaTest(false); - R_DrawTextureSurfaceList_GL11_Water(texturenumsurfaces, texturesurfacelist); - } -#endif - for (layerindex = 0, layer = rsurface.texture->currentlayers;layerindex < rsurface.texture->currentnumlayers;layerindex++, layer++) { vec4_t layercolor; @@ -5733,15 +5611,6 @@ static void R_DrawTextureSurfaceList_GL13(int texturenumsurfaces, msurface_t **t qglDepthFunc(GL_LEQUAL);CHECKGLERROR GL_AlphaTest(false); } - -#if 0 - if (rsurface.texture->currentmaterialflags & MATERIALFLAG_REFLECTION) - { - GL_BlendFunc(GL_ONE, GL_ONE); - GL_DepthMask(false); - R_DrawTextureSurfaceList_GL11_Reflection(texturenumsurfaces, texturesurfacelist); - } -#endif } static void R_DrawTextureSurfaceList_GL11(int texturenumsurfaces, msurface_t **texturesurfacelist) @@ -5756,17 +5625,6 @@ static void R_DrawTextureSurfaceList_GL11(int texturenumsurfaces, msurface_t **t rsurface.mode = RSURFMODE_MULTIPASS; RSurf_PrepareVerticesForBatch(true, false, texturenumsurfaces, texturesurfacelist); -#if 0 - if (rsurface.texture->currentmaterialflags & (MATERIALFLAG_WATERSHADER | MATERIALFLAG_REFRACTION)) - { - // render background - GL_BlendFunc(GL_ONE, GL_ZERO); - GL_DepthMask(true); - GL_AlphaTest(false); - R_DrawTextureSurfaceList_GL11_Water(texturenumsurfaces, texturesurfacelist); - } -#endif - for (layerindex = 0, layer = rsurface.texture->currentlayers;layerindex < rsurface.texture->currentnumlayers;layerindex++, layer++) { if (rsurface.texture->currentmaterialflags & MATERIALFLAG_ALPHATEST) @@ -5884,15 +5742,6 @@ static void R_DrawTextureSurfaceList_GL11(int texturenumsurfaces, msurface_t **t qglDepthFunc(GL_LEQUAL);CHECKGLERROR GL_AlphaTest(false); } - -#if 0 - if (rsurface.texture->currentmaterialflags & MATERIALFLAG_REFLECTION) - { - GL_BlendFunc(GL_ONE, GL_ONE); - GL_DepthMask(false); - R_DrawTextureSurfaceList_GL11_Reflection(texturenumsurfaces, texturesurfacelist); - } -#endif } static void R_DrawTextureSurfaceList(int texturenumsurfaces, msurface_t **texturesurfacelist, qboolean writedepth, qboolean depthonly)