Hard Light Productions Forums
Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: Valathil on July 01, 2011, 04:31:23 am
-
Little enhancement for the rendering loop there was a funtion implemented to sort lights by priority but it never got executed so this should clear up the light flickering a bit till i get the 8 light limit a little higher with the pipeline rewrite.
Index: code/graphics/gropengllight.cpp
===================================================================
--- code/graphics/gropengllight.cpp (Revision 7291)
+++ code/graphics/gropengllight.cpp (Arbeitskopie)
@@ -293,6 +293,8 @@
glTranslated(-eyex, -eyey, -eyez);
glScalef(1.0f, 1.0f, -1.0f);
+ //Valathil: Sort lights by priority
+ opengl_pre_render_init_lights();
for (i = 0; i < GL_max_lights; i++) {
if ( (offset + i) >= Num_active_gl_lights ) {
-
Thank you very much. Has been committed to trunk.
-
you know the thing with this patch is that the intention was good and fine but now i see i did the biggest troll on you guys. the function that i called in the patch did the sorting alright, only it did it in the worst way possible it did it exactly backwards. i only found out now after looking at it again. im so sry guys
Index: code/graphics/gropengllight.cpp
===================================================================
--- code/graphics/gropengllight.cpp (Revision 7331)
+++ code/graphics/gropengllight.cpp (Arbeitskopie)
@@ -169,22 +169,22 @@
// directional lights always go first
if ( (la->type != LT_DIRECTIONAL) && (lb->type == LT_DIRECTIONAL) )
+ return -1;
+ else if ( (la->type == LT_DIRECTIONAL) && (lb->type != LT_DIRECTIONAL) )
return 1;
- else if ( (la->type == LT_DIRECTIONAL) && (lb->type != LT_DIRECTIONAL) )
- return -1;
// tube lights go next, they are generally large and intense
if ( (la->type != LT_TUBE) && (lb->type == LT_TUBE) )
+ return -1;
+ else if ( (la->type == LT_TUBE) && (lb->type != LT_TUBE) )
return 1;
- else if ( (la->type == LT_TUBE) && (lb->type != LT_TUBE) )
- return -1;
// everything else is sorted by linear atten (light size)
// NOTE: smaller atten is larger light radius!
if ( la->LinearAtten > lb->LinearAtten )
+ return -1;
+ else if ( la->LinearAtten < lb->LinearAtten )
return 1;
- else if ( la->LinearAtten < lb->LinearAtten )
- return -1;
// as one extra check, if we're still here, go with overall brightness of light
-
Haha, that's fine. I'm more surprised no one noticed after it hit the nightlies.
-
Thats cause It was right the first time and i am just a bumbling moron.