]> icculus.org git repositories - divverent/darkplaces.git/blob - r_shadow.h
fixed a bug with Host_Startdemos_f that caused it to never shorten the list of demos...
[divverent/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_world;
8 extern cvar_t r_shadow_realtime_dlight;
9 extern cvar_t r_shadow_visiblevolumes;
10 extern cvar_t r_shadow_gloss;
11 extern cvar_t r_shadow_debuglight;
12 extern cvar_t r_shadow_bumpscale_bumpmap;
13 extern cvar_t r_shadow_bumpscale_basetexture;
14
15 void R_Shadow_Init(void);
16 void R_Shadow_Volume(int numverts, int numtris, int *elements, int *neighbors, vec3_t relativelightorigin, float lightradius, float projectdistance);
17 void R_Shadow_DiffuseLighting(int numverts, int numtriangles, const int *elements, const float *vertices, 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);
18 void R_Shadow_SpecularLighting(int numverts, int numtriangles, const int *elements, const float *vertices, 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);
19 void R_Shadow_ClearStencil(void);
20
21 // buffer space for the requested number of vertices, for processing
22 float *R_Shadow_VertexBuffer(int numvertices);
23
24 void R_Shadow_RenderShadowMeshVolume(shadowmesh_t *mesh);
25 void R_Shadow_Stage_Begin(void);
26 void R_Shadow_LoadWorldLightsIfNeeded(void);
27 void R_Shadow_Stage_ShadowVolumes(void);
28 void R_Shadow_Stage_LightWithShadows(void);
29 void R_Shadow_Stage_LightWithoutShadows(void);
30 void R_Shadow_Stage_End(void);
31 //int R_Shadow_ScissorForBBoxAndSphere(const float *mins, const float *maxs, const float *origin, float radius);
32 int R_Shadow_ScissorForBBox(const float *mins, const float *maxs);
33
34 typedef struct worldlight_s
35 {
36         // saved properties
37         vec3_t origin;
38         vec_t lightradius;
39         vec3_t light;
40         vec3_t angles;
41         int castshadows;
42         char *cubemapname;
43
44         // shadow volumes are done entirely in model space, so there are no matrices for dealing with them...
45
46         // note that the world to light matrices are inversely scaled (divided) by lightradius
47
48         // matrix for transforming world coordinates to light filter coordinates
49         //matrix4x4_t matrix_worldtofilter;
50         // based on worldtofilter this transforms -1 to +1 to 0 to 1 for purposes
51         // of attenuation texturing in full 3D (z result often ignored)
52         //matrix4x4_t matrix_worldtoattenuationxyz;
53         // this transforms only the Z to S, and T is always 0.5
54         //matrix4x4_t matrix_worldtoattenuationz;
55
56         // generated properties
57         vec3_t mins;
58         vec3_t maxs;
59         vec_t cullradius;
60         struct worldlight_s *next;
61         msurface_t **surfaces;
62         int numsurfaces;
63         mleaf_t **leafs;
64         int numleafs;
65         rtexture_t *cubemap;
66         int style;
67         shadowmesh_t *shadowvolume;
68         int selected;
69 }
70 worldlight_t;
71
72 extern worldlight_t *r_shadow_worldlightchain;
73
74 void R_Shadow_UpdateWorldLightSelection(void);
75
76 #endif