Xonotic
slider_picmip.qc File Reference
#include "slider_picmip.qh"
+ Include dependency graph for slider_picmip.qc:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

entity makeXonoticPicmipSlider ()
 
float texmemsize (float s3tc)
 
void XonoticPicmipSlider_autofix (entity me)
 
void XonoticPicmipSlider_configureXonoticPicmipSlider (entity me)
 
void XonoticPicmipSlider_draw (entity me)
 

Function Documentation

◆ makeXonoticPicmipSlider()

entity makeXonoticPicmipSlider ( )

Definition at line 3 of file slider_picmip.qc.

References entity(), and NEW.

4 {
5  entity me;
7  me.configureXonoticPicmipSlider(me);
8  return me;
9 }
#define NEW(cname,...)
Definition: oo.qh:105
entity() spawn
+ Here is the call graph for this function:

◆ texmemsize()

float texmemsize ( float  s3tc)

Definition at line 17 of file slider_picmip.qc.

References cvar(), and max().

Referenced by XonoticPicmipSlider_autofix().

18 {
19  return
20  (
21  2500 * (0.25 ** max(0, cvar("gl_picmip") + cvar("gl_picmip_other")))
22  + 1500 * (0.25 ** max(0, cvar("gl_picmip") + cvar("gl_picmip_world")))
23  ) * ((s3tc && (cvar("r_texture_dds_load") || cvar("gl_texturecompression"))) ? 0.2 : 1.0); // TC: normalmaps 50%, other 25%, few incompressible, guessing 40% as conservative average
24 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ XonoticPicmipSlider_autofix()

void XonoticPicmipSlider_autofix ( entity  me)

Definition at line 25 of file slider_picmip.qc.

References cvar(), and texmemsize().

26 {
27  float max_hard, max_soft;
28  if(cvar("menu_picmip_bypass"))
29  return;
30  max_hard = cvar("sys_memsize_virtual");
31  max_soft = cvar("sys_memsize_physical");
32  if(max_hard > 0)
33  {
34  while(me.value > 0 && texmemsize(me.have_s3tc) > max_hard)
35  me.setValue(me, me.value - 1);
36  }
37  // TODO also check the soft limit!
38  // TODO better handling than clamping the slider!
39 }
float texmemsize(float s3tc)
+ Here is the call graph for this function:

◆ XonoticPicmipSlider_configureXonoticPicmipSlider()

void XonoticPicmipSlider_configureXonoticPicmipSlider ( entity  me)

Definition at line 10 of file slider_picmip.qc.

11 {
12  me.configureXonoticTextSlider(me, "gl_picmip",
13  _("Change the sharpness of the textures. Lowering it will effectively reduce texture memory usage, but make the textures appear very blurry."));
14  me.autofix(me);
15  me.have_s3tc = GL_Have_TextureCompression();
16 }

◆ XonoticPicmipSlider_draw()

void XonoticPicmipSlider_draw ( entity  me)

Definition at line 40 of file slider_picmip.qc.

References SUPER.

41 {
42  me.autofix(me);
43  SUPER(XonoticPicmipSlider).draw(me);
44 }
#define SUPER(cname)
Definition: oo.qh:219