Fixes 3d planet lighting map calculations, bug #1151, from Louis Delacroix

Relative lighting factor in GenerateLightMap() should now be reexamined to determine what algorithm works best.

git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@3753 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
avolkov
2012-01-28 19:08:30 +00:00
parent 8abe057e2a
commit 18a399eea7
+3 -3
View File
@@ -1572,8 +1572,8 @@ get_vblock_avg (elev_block_t *pblk, SBYTE *pTopo, int x, int y)
if (y1 > MAP_HEIGHT)
y1 = MAP_HEIGHT;
elev = pTopo + y0 * MAP_HEIGHT + x;
for (i = y0; i < y1; ++i, elev += MAP_HEIGHT)
elev = pTopo + y0 * MAP_WIDTH + x;
for (i = y0; i < y1; ++i, elev += MAP_WIDTH)
{
int delta = abs (i - y);
int weight = 255; // full weight
@@ -1589,7 +1589,7 @@ get_vblock_avg (elev_block_t *pblk, SBYTE *pTopo, int x, int y)
max = v;
if (v < min)
min = v;
avg += pblk->avg * weight;
avg += v * weight;
total_weight += weight;
}
avg /= total_weight;