X-Git-Url: https://git.xonotic.org/?a=blobdiff_plain;f=r_light.h;h=a3c7066e26fbe81c9177f3b8d948109f2fc57ca8;hb=093c41bf532834207d8a23df44f5b39fa707815d;hp=509fe6440c4c98be7d2ccec158c0973aa89c2614;hpb=ccf0849cbfe3013a00dff7f37cc68e774b241cb5;p=xonotic%2Fdarkplaces.git diff --git a/r_light.h b/r_light.h index 509fe644..a3c7066e 100644 --- a/r_light.h +++ b/r_light.h @@ -1,21 +1,40 @@ -// LordHavoc: 256 dynamic lights -#define MAX_DLIGHTS 256 +#ifndef R_LIGHT_H +#define R_LIGHT_H + typedef struct { - vec3_t origin; - float radius; - float die; // stop lighting after this time - float decay; // drop this each second - int key; - vec3_t color; // LordHavoc: colored lighting - qboolean dark; // subtracts light instead of adding -} dlight_t; - -// LordHavoc: this affects the lighting scale of the whole game -//#define LIGHTOFFSET 16384.0f -//#define LIGHTSCALE1 2.0f -#define LIGHTOFFSET 4096.0f -#define LIGHTSCALE1 1.0f -#define LIGHTSCALE (LIGHTSCALE1*LIGHTSCALE1) -#define LIGHTSCALE2 LIGHTSCALE + vec3_t origin; + vec_t cullradius2; // only for culling comparisons, squared version + vec3_t light; // the brightness of the light + vec_t cullradius; // only for culling comparisons + vec_t subtract; // to avoid sudden brightness change at cullradius, subtract this + entity_render_t *ent; // owner of this light + + matrix4x4_t matrix_lighttoworld; + matrix4x4_t matrix_worldtolight; + matrix4x4_t matrix_worldtoattenuationxyz; + matrix4x4_t matrix_worldtoattenuationz; + + vec3_t color; + vec_t radius; + int cubemapnum; + int shadow; + vec_t corona; +} +rdlight_t; + +extern int r_numdlights; +extern rdlight_t r_dlight[MAX_DLIGHTS]; + +void R_BuildLightList(void); +void R_AnimateLight(void); +void R_MarkLights(entity_render_t *ent); +void R_DrawCoronas(void); +void R_CompleteLightPoint(vec3_t ambientcolor, vec3_t diffusecolor, vec3_t diffusenormal, const vec3_t p, int dynamic, const mleaf_t *leaf); +int R_LightModel(float *ambient4f, float *diffusecolor, float *diffusenormal, const entity_render_t *ent, float colorr, float colorg, float colorb, float colora, int worldcoords); +void R_LightModel_CalcVertexColors(const float *ambientcolor4f, const float *diffusecolor, const float *diffusenormal, int numverts, const float *vertex3f, const float *normal3f, float *color4f); +void R_UpdateEntLights(entity_render_t *ent); + +#endif +