Index: common.h
===================================================================
--- common.h	(revision 903)
+++ common.h	(revision 904)
@@ -315,6 +315,10 @@
 #define RAYDIUM_HDR_PASS                        8
 #define RAYDIUM_HDR_EYE_SPEED_DEFAULT           0.1f
 
+#define RAYDIUM_MAX_LENSFLARES                  32
+#define RAYDIUM_LENSFLARE_MAX_TEXTURES          6
+#define RAYDIUM_LENSFLARE_MAX_FX                8
+
 #define RAYDIUM_FOG_MODE_LINEAR                 GL_LINEAR
 #define RAYDIUM_FOG_MODE_EXP                    GL_EXP
 #define RAYDIUM_FOG_MODE_EXP2                   GL_EXP2
@@ -739,6 +743,17 @@
 __global unsigned char *raydium_hdr_mem_hdr2;
 __global unsigned char *raydium_hdr_mem_hdr3;
 
+__global signed char raydium_lensflare_enabled_tag;
+__global int         raydium_lensflare_index;
+__global char        raydium_lensflare_name[RAYDIUM_MAX_LENSFLARES][RAYDIUM_MAX_NAME_LEN];
+__global signed char raydium_lensflare_internal_state[RAYDIUM_MAX_LENSFLARES];
+__global int         raydium_lensflare_texture_id[RAYDIUM_MAX_LENSFLARES][RAYDIUM_LENSFLARE_MAX_TEXTURES];
+__global float       raydium_lensflare_position[RAYDIUM_MAX_LENSFLARES][3];
+__global int         raydium_lensflare_fx_internal_state[RAYDIUM_MAX_LENSFLARES][RAYDIUM_LENSFLARE_MAX_FX];
+__global float       raydium_lensflare_fx_size[RAYDIUM_MAX_LENSFLARES][RAYDIUM_LENSFLARE_MAX_FX];
+__global float       raydium_lensflare_fx_color[RAYDIUM_MAX_LENSFLARES][RAYDIUM_LENSFLARE_MAX_FX][4];
+__global float       raydium_lensflare_fx_velocity[RAYDIUM_MAX_LENSFLARES][RAYDIUM_LENSFLARE_MAX_FX];
+
 __global int    raydium_register_variable_index;
 __global int    raydium_register_function_index;
 __global char   raydium_register_variable_name[RAYDIUM_MAX_REG_VARIABLES][RAYDIUM_MAX_NAME_LEN];
wiki"> Green </td></tr>
+<tr class="wiki"><td class="wiki"> 3 </td><td class="wiki"> Cyan </td></tr>
+<tr class="wiki"><td class="wiki"> 4 </td><td class="wiki"> Red </td></tr>
+<tr class="wiki"><td class="wiki"> 5 </td><td class="wiki"> Purple </td></tr>
+<tr class="wiki"><td class="wiki"> 6 </td><td class="wiki"> Brown </td></tr>
+<tr class="wiki"><td class="wiki"> 7 </td><td class="wiki"> White </td></tr>
+<tr class="wiki"><td class="wiki"> 8 </td><td class="wiki"> Grey </td></tr>
+<tr class="wiki"><td class="wiki"> 9 </td><td class="wiki"> Light Blue </td></tr>
+<tr class="wiki"><td class="wiki"> A </td><td class="wiki"> Light Green </td></tr>
+<tr class="wiki"><td class="wiki"> B </td><td class="wiki"> Light Cyan </td></tr>
+<tr class="wiki"><td class="wiki"> C </td><td class="wiki"> Light Red </td></tr>
+<tr class="wiki"><td class="wiki"> D </td><td class="wiki"> Light Purple </td></tr>
+<tr class="wiki"><td class="wiki"> E </td><td class="wiki"> Light Yellow </td></tr>
+<tr class="wiki"><td class="wiki"> F </td><td class="wiki"> Light White </td></tr>
+</table>
+</div>
+""
+**/
+
+extern void raydium_osd_start (void);
+/**
+Mostly for internal uses. (will configure screen for OSD operations)
+**/
+
+extern void raydium_osd_stop (void);
+/**
+Mostly for internal uses. (see above)
+**/
+
+extern void raydium_osd_draw (int tex, GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2);
+/**
+Will draw ##tex## texture using (##x1##,##y1##) and (##x2##,##y2##) points.
+**/
+
+extern void raydium_osd_draw_name (char *tex, GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2);
+/**
+Same as above, but using texture filename.
+**/
+
+extern void raydium_osd_printf (GLfloat x, GLfloat y, GLfloat size, GLfloat spacer, char *texture, unsigned char *format, ...);
+/**
+This function is an OpenGL equivalent to the standard "printf" C function.
+
+- (##x##,##y##) is the position of the text's beginning, as a screen 
+percentage, with origin at lower left.
+
+- ##size## is the font size, using an arbitrary unit. This size is always 
+proportionnal to frame size (font size will grow up with screen size,
+in other words).
+
+- ##spacer## is the factor of spacing between 2 consecutive letters. With 
+standard fonts, 0.5 is a correct value (relatively condensed text).
+
+- ##texture## is obviously the texture filename to use (font*.tga are 
+often provided with Raydium distribution, and by R3S).
+
+- ##format## is the standard printf format string, followed by 
+corresponding arguments: ##"^9Player ^Fname is: %10s", player_name##
+This format can use '^' char to change color text, followed by a color, 
+indicated by a hexadecimal letter (EGA palette). See ##raydium_osd_color_ega##
+function, above.
+
+Here you are a simple example:
+
+%%(c)
+strcpy(version,"^Ctest 0.1^F");
+raydium_osd_printf(2,98,16,0.5,"font2.tga","- %3i FPS - tech demo %s for Raydium %s, CQFD Corp.",
+                   raydium_render_fps,version,raydium_version);
+%%
+**/
+
+extern void raydium_osd_printf_3D (GLfloat x, GLfloat y, GLfloat z, GLfloat size, GLfloat spacer, char *texture, unsigned char *format, ...);
+/**
+Same as above, but you can place your text in your application 3D space, 
+using ##x##, ##y## and ##z## values.
+**/
+
+extern void raydium_osd_logo (char *texture);
+/**
+Will draw a logo for the current frame with texture filename.
+For now, you've no control over rotation speed of the logo.
+**/
+
+extern void raydium_osd_cursor_set (char *texture, GLfloat xsize, GLfloat ysize);
+/**
+This function will set mouse cursor with texture filename and 
+with (##xsize##,##ysize##) size (percent of screen size).
+You should use a RGB**A** texture for better results.
+example:
+%%(c)
+raydium_osd_cursor_set("BOXcursor.tga",4,4);
+%%
+**/
+
+extern void raydium_osd_cursor_draw (void);
+/**
+Internal use.
+**/
+
+extern void raydium_osd_internal_vertex (GLfloat x, GLfloat y, GLfloat top);
+/**
+Internal use.
+**/
+
+extern void raydium_osd_network_stat_draw (GLfloat px, GLfloat py, GLfloat size);
+/**
+Will draw network stats (if available) in a box.
+%%(c) raydium_osd_network_stat_draw(5,30,20); %%
+**/
+
+extern void raydium_osd_mask (GLfloat * color4);
+/**
+Will draw a uniform mask using ##color4## (RGBA color) for this frame.
+**/
+
+extern void raydium_osd_fade_callback (void);
+/**
+Internal use.
+**/
+
+extern void raydium_osd_fade_init (void);
+/**
+Internal use.
+**/
+
+extern void raydium_osd_fade_from (GLfloat * from4, GLfloat * to4, GLfloat time_len, void *OnFadeEnd);
+/**
+This function will configure a fading mask from ##from4## color to ##to4##.
+This fade will last ##time_len## seconds, and will call ##OnFadeEnd## callback
+when finished.
+This callback signature must be ##void callback(void)##.
+
+A standard fade-to-black-and-restore example:
+%%(c)
+// back to normal rendering
+void restorefade(void)
+{
+   GLfloat from[4]={0,0,0,2};
+   GLfloat to[4]={0,0,0,0};
+   raydium_osd_fade_from(from,to,1,NULL);
+   // do things (like moving camera to another place, for example).
+}
+				
+...
+
+// If space key : fade to black
+if(raydium_key_last==1032)
+    {
+    GLfloat from[4]={0,0,0,0};
+    GLfloat to[4]={0,0,0,1};
+    raydium_osd_fade_from(from,to,0.3,restorefade);
+    }
+%%				 
+**/
+
+#endif