TruLite v1.0 for ExoticaX v1.711
for the Euphoria programming language
By Liquid-Nitrogen Software 2005
Assembly coding by Mic

TruLite is a 24/32 bit real time lighting library for use with
the ExoticaX DirectX game library for euphoria.

It allows you to blit all of your graphics to a bitmap, and then
apply lighting to that bitmap, and finaly blit the bitmap to the
DirectX surface.

You can use multiple lights of any color values, with a radius
of up to 255 pixels.

Currently your program must run in 640x480 24/32bit mode only.
Support for higher resolutions will probably NOT be added.

*****************************************************
*************Variables and Procedures********************
*****************************************************
global atom shade_buffer

global procedure setup_light_map()

global procedure apply_light()
global procedure mix_light()
global procedure shade_surface()

global procedure shade_surface_back_buffer()

---------------------------------------------------------
<shade_buffer>
the atom shade_buffer holds the BMP_ID of the bitmap which
you should blit all of your graphics to. The reason for using this
bitmap instead of the back buffer is because shading the back
buffer is much slower than shading a bitmap.

---------------------------------------------------------
<setup_light_map()>
this procedure sets up all the buffers for the lighting to work properly,
you should call setup_light_map() immediately after calling exotica_initX()
in your programs init section.

---------------------------------------------------------
<apply_light(s1, i, s2)>
this procedure applies a light to the light map without mixing with
any other lights. you can position it anywhere on or off screen since
the light will be clipped to the screen boundary.
	s1 is the position of the light: {x,y}
	i is the radius in pixels: 1-255
	s2 is the color of the light: {r,g,b}
		color values are real numbers from 0 to 1

---------------------------------------------------------
<mix_light(s1, i, s2)>
this is the same as apply_light(), except that it mixes the light with
any other lights that you have already applied to the light map. It is
slightly slower than apply_light() but you need it if you have multiple
lights which will overlap eachother.

---------------------------------------------------------
<shade_surface()>
this procedure applies all of the lights that you have drawn to the
graphics that are on your shade_buffer bitmap. It then clears all of the
lights that you have applied so you are free to apply new ones.

---------------------------------------------------------
<shade_surface_back_buffer()>
this is the same as shade_surface() except that it shades the DirectX back
buffer surface, instead of the shade_buffer bitmap. it is much slower and is
for testing purposes

*****************************************************
For an example of how to use Trulite, see the included demo program.


http://www.freewebtown.com/liquidnitrogen
email Liquid nitrogen: m.honnor@slingshot.co.nz


Euphoria: www.rapideuphoria.com

24-02-05