]> icculus.org git repositories - divverent/darkplaces.git/blob - r_shadow.h
Added automatic unloading of unused sounds. The "silentlymissing" boolean is now...
[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 extern cvar_t r_shadow_worldshadows;
15 extern cvar_t r_shadow_dlightshadows;
16
17 void R_Shadow_Init(void);
18 void R_Shadow_Volume(int numverts, int numtris, const float *invertex3f, int *elements, int *neighbors, vec3_t relativelightorigin, float lightradius, float projectdistance);
19 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);
20 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);
21 void R_Shadow_ClearStencil(void);
22
23 void R_Shadow_RenderShadowMeshVolume(shadowmesh_t *mesh);
24 void R_Shadow_Stage_Begin(void);
25 void R_Shadow_LoadWorldLightsIfNeeded(void);
26 void R_Shadow_Stage_ShadowVolumes(void);
27 void R_Shadow_Stage_LightWithShadows(void);
28 void R_Shadow_Stage_LightWithoutShadows(void);
29 void R_Shadow_Stage_End(void);
30 int R_Shadow_ScissorForBBox(const float *mins, const float *maxs);
31
32 typedef struct worldlight_s
33 {
34         // saved properties
35         vec3_t origin;
36         vec_t lightradius;
37         vec3_t light;
38         vec3_t angles;
39         int castshadows;
40         char *cubemapname;
41
42         // shadow volumes are done entirely in model space, so there are no matrices for dealing with them...
43
44         // note that the world to light matrices are inversely scaled (divided) by lightradius
45
46         // matrix for transforming world coordinates to light filter coordinates
47         //matrix4x4_t matrix_worldtofilter;
48         // based on worldtofilter this transforms -1 to +1 to 0 to 1 for purposes
49         // of attenuation texturing in full 3D (z result often ignored)
50         //matrix4x4_t matrix_worldtoattenuationxyz;
51         // this transforms only the Z to S, and T is always 0.5
52         //matrix4x4_t matrix_worldtoattenuationz;
53
54         // generated properties
55         vec3_t mins;
56         vec3_t maxs;
57         vec_t cullradius;
58         struct worldlight_s *next;
59         rtexture_t *cubemap;
60         int style;
61         int selected;
62
63         // premade shadow volumes and lit surfaces to render
64         shadowmesh_t *meshchain_shadow;
65         shadowmesh_t *meshchain_light;
66 }
67 worldlight_t;
68
69 extern worldlight_t *r_shadow_worldlightchain;
70
71 void R_Shadow_UpdateWorldLightSelection(void);
72
73 void R_Shadow_DrawStaticWorldLight_Shadow(worldlight_t *light, matrix4x4_t *matrix);
74 void R_Shadow_DrawStaticWorldLight_Light(worldlight_t *light, matrix4x4_t *matrix, vec3_t relativelightorigin, vec3_t relativeeyeorigin, float lightradius, float *lightcolor, const matrix4x4_t *matrix_modeltofilter, const matrix4x4_t *matrix_modeltoattenuationxyz, const matrix4x4_t *matrix_modeltoattenuationz);
75
76 #endif