00001 00005 /* 00006 Copyright (C) 1997-2001 Id Software, Inc. 00007 00008 This program is free software; you can redistribute it and/or 00009 modify it under the terms of the GNU General Public License 00010 as published by the Free Software Foundation; either version 2 00011 of the License, or (at your option) any later version. 00012 00013 This program is distributed in the hope that it will be useful, 00014 but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00016 00017 See the GNU General Public License for more details. 00018 00019 You should have received a copy of the GNU General Public License 00020 along with this program; if not, write to the Free Software 00021 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00022 00023 */ 00024 00025 #ifndef R_LIGHT_H 00026 #define R_LIGHT_H 00027 00028 struct entity_s; 00029 00030 #include "r_entity.h" 00031 00032 /* cap on number of light sources that can be in a scene; feel free 00033 * to increase if necessary, but be aware that doing so will increase 00034 * the time it takes for each entity to sort the light list at each 00035 * frame (this is based on the number of lights actually used, not 00036 * the max number allowed) */ 00037 #define MAX_DYNAMIC_LIGHTS 64 00038 00039 typedef struct r_light_s { 00040 vec4_t loc; 00041 vec4_t ambientColor; 00042 vec4_t diffuseColor; 00043 vec4_t specularColor; 00044 00045 float constantAttenuation; 00046 float linearAttenuation; 00047 float quadraticAttenuation; 00048 00049 qboolean enabled; 00050 } r_light_t; 00051 00053 void R_AddLight(const vec3_t origin, float radius, const vec3_t color); 00054 void R_AddSustainedLight(const vec3_t org, float radius, const vec3_t color, float sustain); 00055 void R_EnableLights(void); 00056 void R_ShiftLights(const vec3_t offset); 00057 00058 void R_AddLightsource(const r_light_t *source); 00059 void R_ClearActiveLights(void); 00060 void R_UpdateLightList(struct entity_s *ent); 00061 00062 #endif