www.pudn.com > LightTrack.rar > Colour.cpp
/** 3DGPL *************************************************\
* () *
* Handling of colour and lighting. *
* *
* Ifdefs: *
* _CI_ Colour/Intensity model; *
* _RGB_ RGB model; *
* *
* Defines: *
* CL_init_colours Initialization; *
* CL_colour Composing a colour; *
* CL_light Lighting a colour. *
* *
* (c) 1995-98 Sergei Savchenko, (savs@cs.mcgill.ca) *
\**********************************************************/
//Color.cpp
#include "Colour.h" /* colour models. */
int CL_div[CL_COLOUR_LEVELS][CL_LIGHT_LEVELS];
HW_pixel *CL_intensities; /* intensity table */
#if defined(_CI_)
struct CL_palette *CL_colours; /* saved for hardware access */
#endif
/**********************************************************\
* Initializing internal lookup tables. *
* *
* SETS: CL_intensity (when _CI_) CL_div (when _RGB_) *
* ----- *
\**********************************************************/
#if defined(_CI_)
void CL_init_colour(struct CL_palette *palette)
{
CL_colours=palette;
CL_intensities=palette->cl_intensity_table;/* for palette based models */
}
#endif
//初始化内部查找表,具体不是特别清楚
#if defined(_RGB_)
void CL_init_colour(void)
{
int i,j; /* for RGB modes */
for(i=0;i