vertex lighting option for mapmodels

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@2656 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
Lee Salzman
2008-09-17 03:34:58 +00:00
parent b2811e4893
commit b76491d06e
10 changed files with 154 additions and 13 deletions
+11
View File
@@ -137,6 +137,14 @@ void postlightarea(block &a) // median filter, smooths out random noise in li
remip(a);
}
int lastcalclight = 0;
void fullbrightlight(int level)
{
loopi(mipsize) world[i].r = world[i].g = world[i].b = level;
lastcalclight = totalmillis;
}
void calclight()
{
loop(x,ssize) loop(y,ssize)
@@ -154,6 +162,7 @@ void calclight()
block b = { 1, 1, ssize-2, ssize-2 };
postlightarea(b);
setvar("fullbright", 0);
lastcalclight = totalmillis;
}
VARP(dynlight, 0, 16, 32);
@@ -167,6 +176,7 @@ void cleardlights()
block *backup = dlights.pop();
blockpaste(*backup);
freeblock(backup);
lastcalclight = totalmillis;
}
}
@@ -187,6 +197,7 @@ void dodynlight(vec &vold, vec &v, int reach, int strength, dynent *owner)
persistent_entity l((int)v.x, (int)v.y, (int)v.z, LIGHT, reach, strength, 0, 0);
calclightsource(l);
postlightarea(b);
lastcalclight = totalmillis;
}
// utility functions also used by editing code