From: <av...@us...> - 2012-01-28 19:08:36
|
Revision: 3753 http://sc2.svn.sourceforge.net/sc2/?rev=3753&view=rev Author: avolkov Date: 2012-01-28 19:08:30 +0000 (Sat, 28 Jan 2012) Log Message: ----------- 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. Modified Paths: -------------- trunk/sc2/src/uqm/planets/plangen.c Modified: trunk/sc2/src/uqm/planets/plangen.c =================================================================== --- trunk/sc2/src/uqm/planets/plangen.c 2012-01-28 19:02:33 UTC (rev 3752) +++ trunk/sc2/src/uqm/planets/plangen.c 2012-01-28 19:08:30 UTC (rev 3753) @@ -1572,8 +1572,8 @@ 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 @@ max = v; if (v < min) min = v; - avg += pblk->avg * weight; + avg += v * weight; total_weight += weight; } avg /= total_weight; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |