Saturate colored dynamic light just like normal one - makes the hwole thing a bit less colorful but makes for better balanced color mixing (theoretically) and does not reduce static light

This commit is contained in:
zicodxx 2011-06-09 10:28:55 +02:00
parent 425eef904d
commit 24b8426dd5
3 changed files with 14 additions and 16 deletions

View file

@ -1,5 +1,9 @@
D1X-Rebirth Changelog
20110609
--------
main/render.c: Saturate colored dynamic light just like normal one - makes the hwole thing a bit less colorful but makes for better balanced color mixing (theoretically) and does not reduce static light
20110607
--------
main/render.c: Definition of dynlight_time should have been static to archive timed light calculations

View file

@ -144,7 +144,7 @@ void apply_light(g3s_lrgb obj_light_emission, int obj_seg, vms_vector *obj_pos,
fix dist;
vertnum = vp[vv];
if ((vertnum ^ light_frame_count) & 1) {
if (/*(vertnum ^ light_frame_count) & */1) {
vertpos = &Vertices[vertnum];
dist = vm_vec_dist_quick(obj_pos, vertpos);
dist = fixmul(dist/4, dist/4);
@ -170,7 +170,7 @@ void apply_light(g3s_lrgb obj_light_emission, int obj_seg, vms_vector *obj_pos,
int apply_light;
vertnum = render_vertices[vv];
if ((vertnum ^ light_frame_count) & 1) {
if (/*(vertnum ^ light_frame_count) & */1) {
vertpos = &Vertices[vertnum];
dist = vm_vec_dist_quick(obj_pos, vertpos);
apply_light = 0;
@ -501,7 +501,7 @@ void set_dynamic_light(void)
vertnum = render_vertices[vv];
Assert(vertnum >= 0 && vertnum <= Highest_vertex_index);
if ((vertnum ^ light_frame_count) & 1)
if (/*(vertnum ^ light_frame_count) & */1)
Dynamic_light[vertnum].r = Dynamic_light[vertnum].g = Dynamic_light[vertnum].b = 0;
}

View file

@ -247,7 +247,6 @@ void render_face(int segnum, int sidenum, int nv, short *vp, int tmap1, int tmap
for (i=0;i<nv;i++)
{
float highval = 1.0;
//the uvl struct has static light already in it
//scale static light for destruction effect
@ -272,23 +271,18 @@ void render_face(int segnum, int sidenum, int nv, short *vp, int tmap1, int tmap
else
dyn_light[i].r = dyn_light[i].g = dyn_light[i].b = fixmul(flash_scale,uvl_copy[i].l);
}
// add light color
dyn_light[i].r += Dynamic_light[vp[i]].r;
dyn_light[i].g += Dynamic_light[vp[i]].g;
dyn_light[i].b += Dynamic_light[vp[i]].b;
// saturate at max value
if (dyn_light[i].r/MAX_LIGHT > highval)
highval = dyn_light[i].r/MAX_LIGHT;
if (dyn_light[i].g/MAX_LIGHT > highval)
highval = dyn_light[i].g/MAX_LIGHT;
if (dyn_light[i].b/MAX_LIGHT > highval)
highval = dyn_light[i].b/MAX_LIGHT;
if (highval > 1.0)
{
dyn_light[i].r /= highval;
dyn_light[i].g /= highval;
dyn_light[i].b /= highval;
}
if (dyn_light[i].r > MAX_LIGHT)
dyn_light[i].r = MAX_LIGHT;
if (dyn_light[i].g > MAX_LIGHT)
dyn_light[i].g = MAX_LIGHT;
if (dyn_light[i].b > MAX_LIGHT)
dyn_light[i].b = MAX_LIGHT;
}
}