]> de.git.xonotic.org Git - xonotic/darkplaces.git/blob - r_shadow.h
changed gloss behavior, now darkens light intensity (to 25% of normal) instead of...
[xonotic/darkplaces.git] / r_shadow.h
1
2 #ifndef R_SHADOW_H
3 #define R_SHADOW_H
4
5 extern cvar_t r_shadow_lightattenuationscale;
6 extern cvar_t r_shadow_lightintensityscale;
7 extern cvar_t r_shadow_realtime;
8 extern cvar_t r_shadow_gloss;
9 extern cvar_t r_shadow_debuglight;
10 extern cvar_t r_shadow_bumpscale_bumpmap;
11 extern cvar_t r_shadow_bumpscale_basetexture;
12
13 void R_Shadow_Init(void);
14 void R_Shadow_Volume(int numverts, int numtris, int *elements, int *neighbors, vec3_t relativelightorigin, float lightradius, float projectdistance);
15 void R_Shadow_DiffuseLighting(int numverts, int numtriangles, const int *elements, const float *svectors, const float *tvectors, const float *normals, const float *texcoords, const float *relativelightorigin, float lightradius, const float *lightcolor, const matrix4x4_t *matrix_worldtofilter, const matrix4x4_t *matrix_worldtoattenuationxyz, const matrix4x4_t *matrix_worldtoattenuationz, rtexture_t *basetexture, rtexture_t *bumptexture, rtexture_t *lightcubemap);
16 void R_Shadow_SpecularLighting(int numverts, int numtriangles, const int *elements, const float *svectors, const float *tvectors, const float *normals, const float *texcoords, const float *relativelightorigin, const float *relativeeyeorigin, float lightradius, const float *lightcolor, const matrix4x4_t *matrix_worldtofilter, const matrix4x4_t *matrix_worldtoattenuationxyz, const matrix4x4_t *matrix_worldtoattenuationz, rtexture_t *glosstexture, rtexture_t *bumptexture, rtexture_t *lightcubemap);
17 void R_Shadow_ClearStencil(void);
18
19 void R_Shadow_RenderVolume(int numverts, int numtris, int *elements);
20 void R_Shadow_RenderShadowMeshVolume(shadowmesh_t *mesh);
21 void R_Shadow_Stage_Begin(void);
22 void R_Shadow_Stage_ShadowVolumes(void);
23 void R_Shadow_Stage_LightWithShadows(void);
24 void R_Shadow_Stage_LightWithoutShadows(void);
25 void R_Shadow_Stage_End(void);
26 //int R_Shadow_ScissorForBBoxAndSphere(const float *mins, const float *maxs, const float *origin, float radius);
27 int R_Shadow_ScissorForBBox(const float *mins, const float *maxs);
28
29 typedef struct worldlight_s
30 {
31         // saved properties
32         vec3_t origin;
33         vec_t lightradius;
34         vec3_t light;
35         vec3_t angles;
36         int castshadows;
37         char *cubemapname;
38
39         // shadow volumes are done entirely in model space, so there are no matrices for dealing with them...
40
41         // note that the world to light matrices are inversely scaled (divided) by lightradius
42
43         // matrix for transforming world coordinates to light filter coordinates
44         //matrix4x4_t matrix_worldtofilter;
45         // based on worldtofilter this transforms -1 to +1 to 0 to 1 for purposes
46         // of attenuation texturing in full 3D (z result often ignored)
47         //matrix4x4_t matrix_worldtoattenuationxyz;
48         // this transforms only the Z to S, and T is always 0.5
49         //matrix4x4_t matrix_worldtoattenuationz;
50
51         // generated properties
52         vec3_t mins;
53         vec3_t maxs;
54         vec_t cullradius;
55         struct worldlight_s *next;
56         msurface_t **surfaces;
57         int numsurfaces;
58         mleaf_t **leafs;
59         int numleafs;
60         rtexture_t *cubemap;
61         int style;
62         shadowmesh_t *shadowvolume;
63         int selected;
64 }
65 worldlight_t;
66
67 extern worldlight_t *r_shadow_worldlightchain;
68
69 // 0 = normal, 1 = dynamic light shadows, 2 = world and dynamic light shadows
70 extern int r_shadow_lightingmode;
71 void R_Shadow_UpdateLightingMode(void);
72
73 void R_Shadow_UpdateWorldLightSelection(void);
74
75 #endif