MCPcopy Create free account
hub / github.com/assaultcube/AC / textureslotusagegeometry

Function textureslotusagegeometry

source/src/texture.cpp:931–980  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

929}
930
931void textureslotusagegeometry(int *used, int *visible = NULL, int *mostvisible = NULL)
932{
933 sqr *s = world;
934 int *mostw = mostvisible ? new int[1024] : NULL, *mostc = mostvisible ? mostw + 256 : NULL, *mostf = mostvisible ? mostw + 512 : NULL, *mostu = mostvisible ? mostw + 768 : NULL;
935 if(mostvisible) loopi(1024) mostw[i] = 0;
936 if(visible) calcworldvisibility();
937 loopirev(cubicsize)
938 {
939 used[s->wtex]++;
940 if(s->type != SOLID)
941 {
942 used[s->ctex]++;
943 used[s->ftex]++;
944 used[s->utex]++;
945 }
946 if(visible && !(s->visible & INVISIBLE))
947 { // cube not invisible
948 if(!(s->visible & INVISWTEX))
949 { // lower wall visible
950 visible[s->wtex]++;
951 if(mostw) mostw[s->wtex]++;
952 }
953 if(s->type != SOLID)
954 {
955 if(!(s->visible & INVISUTEX))
956 { // upper wall visible
957 visible[s->utex]++;
958 if(mostu) mostu[s->utex]++;
959 }
960 visible[s->ctex]++;
961 if(mostc) mostc[s->ctex]++;
962 visible[s->ftex]++;
963 if(mostf) mostf[s->ftex]++;
964 }
965 }
966 s++;
967 }
968 if(visible) clearworldvisibility();
969 if(mostvisible) loopk(4)
970 { // find most visible texures (for all four geometry uses)
971 int *mx[4] = { mostw, mostf, mostc, mostu }, *m = mx[k], maxval = 0;
972 mostvisible[k] = -1;
973 loopi(256) if(m[i] > maxval)
974 {
975 maxval = m[i];
976 mostvisible[k] = i;
977 }
978 }
979 if(mostw) delete[] mostw;
980}
981
982void textureslotusagelist(char *what)
983{

Callers 2

textureslotusagelistFunction · 0.85
sorttextureslotsFunction · 0.85

Calls 4

calcworldvisibilityFunction · 0.85
clearworldvisibilityFunction · 0.85
loopiFunction · 0.70
loopkFunction · 0.70

Tested by

no test coverage detected