00001
00002 #ifndef LIGHT_H
00003 #define LIGHT_H
00004
00005 #include "model.h"
00006 #include "world.h"
00007 #include "instance.h"
00008
00009
00010
00011 #define LIGHT_MAX 120
00012
00013 #define LIGHT_FIXED 1
00014 #define LIGHT_MOVING 2
00015 #define LIGHT_FILE 4
00016 #define LIGHT_OFF 8
00017 #define LIGHT_FLICKER 16
00018
00019 enum {
00020 LIGHT_OMNI,
00021 LIGHT_OMNINORMAL,
00022 LIGHT_SPOT,
00023 LIGHT_SPOTNORMAL,
00024 };
00025
00026 enum {
00027 LIGHT_AXIS_XY,
00028 LIGHT_AXIS_XZ,
00029 LIGHT_AXIS_ZY,
00030 LIGHT_AXIS_X,
00031 LIGHT_AXIS_Y,
00032 LIGHT_AXIS_Z,
00033 };
00034
00035 typedef struct {
00036 float x, y, z, Reach, SquareReach;
00037 float Xmin, Xmax, Ymin, Ymax, Zmin, Zmax;
00038 MAT DirMatrix;
00039 float Cone, ConeMul;
00040 long r, g, b;
00041 unsigned char Flag, Type, Speed, pad2;
00042 } LIGHT;
00043
00044 typedef struct {
00045 float x, y, z, Reach;
00046 MAT DirMatrix;
00047 float Cone;
00048 float r, g, b;
00049 unsigned char Flag, Type, Speed, pad2;
00050 } FILELIGHT;
00051
00052
00053
00054 extern void InitLights(void);
00055 extern LIGHT *AllocLight(void);
00056 extern void FreeLight(LIGHT *light);
00057 extern void ProcessLights(void);
00058 extern void ProcessOneLight(LIGHT *l);
00059 extern void AddPermLight(LIGHT *light);
00060 extern char CheckCubeLight(CUBE_HEADER *cube);
00061 extern void AddCubeLightPermOmni(CUBE_HEADER *cube, LIGHT *light);
00062 extern void AddCubeLightPermOmniNormal(CUBE_HEADER *cube, LIGHT *light);
00063 extern void AddCubeLightPermSpot(CUBE_HEADER *cube, LIGHT *light);
00064 extern void AddCubeLightPermSpotNormal(CUBE_HEADER *cube, LIGHT *light);
00065 extern void SetCubeLightOmni(CUBE_HEADER *cube, LIGHT *light);
00066 extern void AddCubeLightOmni(CUBE_HEADER *cube, LIGHT *light);
00067 extern void SetCubeLightOmniNormal(CUBE_HEADER *cube, LIGHT *light);
00068 extern void AddCubeLightOmniNormal(CUBE_HEADER *cube, LIGHT *light);
00069 extern void SetCubeLightSpot(CUBE_HEADER *cube, LIGHT *light);
00070 extern void AddCubeLightSpot(CUBE_HEADER *cube, LIGHT *light);
00071 extern void SetCubeLightSpotNormal(CUBE_HEADER *cube, LIGHT *light);
00072 extern void AddCubeLightSpotNormal(CUBE_HEADER *cube, LIGHT *light);
00073 extern short CheckObjectLight(VEC *pos, BOUNDING_BOX *box, float rad);
00074 extern short CheckInstanceLight(INSTANCE *inst, float rad);
00075 extern short CheckInstanceLightEdit(INSTANCE *inst, float rad);
00076 extern void AddModelLightPermOmni(MODEL *model, LIGHT *light, VEC *pos);
00077 extern void AddModelLightPermOmniNormal(MODEL *model, LIGHT *light, VEC *pos);
00078 extern void AddModelLightPermSpot(MODEL *model, LIGHT *light, VEC *pos, VEC *dir);
00079 extern void AddModelLightPermSpotNormal(MODEL *model, LIGHT *light, VEC *pos, VEC *dir);
00080 extern void AddModelLight(MODEL *model, VEC *pos, MAT *mat);
00081 extern void SetModelLightOmni(MODEL *model, LIGHT *light, VEC *pos);
00082 extern void AddModelLightOmni(MODEL *model, LIGHT *light, VEC *pos);
00083 extern void SetModelLightOmniNormal(MODEL *model, LIGHT *light, VEC *pos);
00084 extern void AddModelLightOmniNormal(MODEL *model, LIGHT *light, VEC *pos);
00085 extern void SetModelLightSpot(MODEL *model, LIGHT *light, VEC *pos, VEC *dir);
00086 extern void AddModelLightSpot(MODEL *model, LIGHT *light, VEC *pos, VEC *dir);
00087 extern void SetModelLightSpotNormal(MODEL *model, LIGHT *light, VEC *pos, VEC *dir);
00088 extern void AddModelLightSpotNormal(MODEL *model, LIGHT *light, VEC *pos, VEC *dir);
00089 extern void AddModelLightSimple(MODEL *model, VEC *pos);
00090 extern void AddPermLightInstance(LIGHT *light);
00091 extern void LoadLights(char *file);
00092 extern void SaveLights(char *file);
00093 extern void DrawFileLights(void);
00094 extern void EditFileLights(void);
00095 extern void DisplayLightInfo(LIGHT *light);
00096 extern void LoadEditLightModels(void);
00097 extern void FreeEditLightModels(void);
00098 extern char LightVertexVisible(LIGHT *light, float *v);
00099
00100
00101
00102 extern LIGHT Light[];
00103 extern LIGHT *CurrentEditLight;
00104 extern short TotalLightCount;
00105
00106 #endif