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;
" color.rgb += myhvec3(texture2D(Texture_Glow, TexCoord)) * GlowScale;\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"
"#ifndef MODE_LIGHTSOURCE\n"
"# ifdef USEREFLECTION\n"
" vec4 ScreenScaleRefractReflectIW = ScreenScaleRefractReflect * (1.0 / ModelViewProjectionPosition.w);\n"
" 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"
// 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);
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]);
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);
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)
{
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));
}
}
r_view.frustum[5].dist = m[15] + m[14];
#endif
-
-
if (r_view.useperspective)
{
slopex = 1.0 / r_view.frustum_x;
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]);
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)
{