/* "esclight.h" */ #ifndef __ESCLIGHTHEADER #define __ESCLIGHTHEADER #include typedef struct{ long int x, y, z; int length; }long_vector; typedef struct{ int xPos, yPos, zPos; long_vector normal; unsigned char inherentRed, inherentGreen, inherentBlue; unsigned char screenRed, screenGreen, screenBlue; }gouraud_vertex; typedef struct{ long int r, g, b; }colour_vector; typedef struct{ long influence[3]; }light_influence_vector; struct f_lights{ GsF_LIGHT flatLight[3]; long_vector invDirection[3]; int active[3]; }worldFlatLights; struct a_light{ short red, green, blue; }worldAmbientLight; /**************** MACRO Functions *****************/ #define SetLongVector(v, _x, _y, _z) ((v)->x = (_x), \ (v)->y = (_y), \ (v)->z = (_z)) #define SetVertexColour(v, _r, _g, _b) ((v)->inherentRed = (_r), \ (v)->inherentGreen = (_g), \ (v)->inherentBlue = (_b)) /************* End of MACRO Functions *************/ /************** Function Declarations *************/ void InitFlatLights(); void InitAmbientLight(); void SetFlatLight(int id, long int vx, long int vy, long int vz, unsigned char r, unsigned char g, unsigned char b); void SetAmbientLight(short int red, short int green, short int blue); void NormaliseLongVector(long_vector* vector); long CalculateDotProduct(long_vector* vector1, long_vector* vector2); light_influence_vector* CalculateLightInfluence(long_vector* vector); colour_vector* CalculateInfluenceColour(light_influence_vector* influence); void AddAmbientLightToColourVector(colour_vector* vector); colour_vector* CalculateScreenColours(gouraud_vertex* vertex, colour_vector* influenceColour); void DoLightCalculation(gouraud_vertex* vertex); /********** End of Function Declararions *********/ #endif