5 #define R_SHADOW_SHADOWMAP_NUMCUBEMAPS 8
7 extern cvar_t r_shadow_bumpscale_basetexture;
8 extern cvar_t r_shadow_bumpscale_bumpmap;
9 extern cvar_t r_shadow_debuglight;
10 extern cvar_t r_shadow_gloss;
11 extern cvar_t r_shadow_gloss2intensity;
12 extern cvar_t r_shadow_glossintensity;
13 extern cvar_t r_shadow_glossexponent;
14 extern cvar_t r_shadow_gloss2exponent;
15 extern cvar_t r_shadow_glossexact;
16 extern cvar_t r_shadow_lightattenuationpower;
17 extern cvar_t r_shadow_lightattenuationscale;
18 extern cvar_t r_shadow_lightintensityscale;
19 extern cvar_t r_shadow_lightradiusscale;
20 extern cvar_t r_shadow_projectdistance;
21 extern cvar_t r_shadow_frontsidecasting;
22 extern cvar_t r_shadow_realtime_dlight;
23 extern cvar_t r_shadow_realtime_dlight_shadows;
24 extern cvar_t r_shadow_realtime_dlight_svbspculling;
25 extern cvar_t r_shadow_realtime_dlight_portalculling;
26 extern cvar_t r_shadow_realtime_world;
27 extern cvar_t r_shadow_realtime_world_lightmaps;
28 extern cvar_t r_shadow_realtime_world_shadows;
29 extern cvar_t r_shadow_realtime_world_compile;
30 extern cvar_t r_shadow_realtime_world_compileshadow;
31 extern cvar_t r_shadow_realtime_world_compilesvbsp;
32 extern cvar_t r_shadow_realtime_world_compileportalculling;
33 extern cvar_t r_shadow_scissor;
34 extern cvar_t r_shadow_polygonfactor;
35 extern cvar_t r_shadow_polygonoffset;
36 extern cvar_t r_shadow_texture3d;
37 extern cvar_t gl_ext_separatestencil;
38 extern cvar_t gl_ext_stenciltwoside;
40 void R_Shadow_Init(void);
41 qboolean R_Shadow_ShadowMappingEnabled(void);
42 void R_Shadow_VolumeFromList(int numverts, int numtris, const float *invertex3f, const int *elements, const int *neighbors, const vec3_t projectorigin, const vec3_t projectdirection, float projectdistance, int nummarktris, const int *marktris, vec3_t trismins, vec3_t trismaxs);
43 void R_Shadow_ShadowMapFromList(int numverts, int numtris, const float *vertex3f, const int *elements, int numsidetris, const int *sidetotals, const unsigned char *sides, const int *sidetris);
44 void R_Shadow_MarkVolumeFromBox(int firsttriangle, int numtris, const float *invertex3f, const int *elements, const vec3_t projectorigin, const vec3_t projectdirection, const vec3_t lightmins, const vec3_t lightmaxs, const vec3_t surfacemins, const vec3_t surfacemaxs);
45 int R_Shadow_CalcTriangleSideMask(const vec3_t p1, const vec3_t p2, const vec3_t p3, float bias);
46 int R_Shadow_CalcSphereSideMask(const vec3_t p1, float radius, float bias);
47 int R_Shadow_ChooseSidesFromBox(int firsttriangle, int numtris, const float *invertex3f, const int *elements, const matrix4x4_t *worldtolight, const vec3_t projectorigin, const vec3_t projectdirection, const vec3_t lightmins, const vec3_t lightmaxs, const vec3_t surfacemins, const vec3_t surfacemaxs, int *totals);
48 void R_Shadow_RenderLighting(int firstvertex, int numvertices, int firsttriangle, int numtriangles, const int *element3i, const unsigned short *element3s, int element3i_bufferobject, int element3s_bufferobject);
49 void R_Shadow_RenderMode_Begin(void);
50 void R_Shadow_RenderMode_ActiveLight(const rtlight_t *rtlight);
51 void R_Shadow_RenderMode_Reset(void);
52 void R_Shadow_RenderMode_StencilShadowVolumes(qboolean zpass);
53 void R_Shadow_RenderMode_Lighting(qboolean stenciltest, qboolean transparent, qboolean shadowmapping);
54 void R_Shadow_RenderMode_DrawDeferredLight(qboolean stenciltest, qboolean shadowmapping);
55 void R_Shadow_RenderMode_VisibleShadowVolumes(void);
56 void R_Shadow_RenderMode_VisibleLighting(qboolean stenciltest, qboolean transparent);
57 void R_Shadow_RenderMode_End(void);
58 void R_Shadow_ClearStencil(void);
59 void R_Shadow_SetupEntityLight(const entity_render_t *ent);
61 qboolean R_Shadow_ScissorForBBox(const float *mins, const float *maxs);
63 // these never change, they are used to create attenuation matrices
64 extern matrix4x4_t matrix_attenuationxyz;
65 extern matrix4x4_t matrix_attenuationz;
67 void R_Shadow_UpdateWorldLightSelection(void);
69 extern rtlight_t *r_shadow_compilingrtlight;
71 void R_RTLight_Update(rtlight_t *rtlight, int isstatic, matrix4x4_t *matrix, vec3_t color, int style, const char *cubemapname, int shadow, vec_t corona, vec_t coronasizescale, vec_t ambientscale, vec_t diffusescale, vec_t specularscale, int flags);
72 void R_RTLight_Compile(rtlight_t *rtlight);
73 void R_RTLight_Uncompile(rtlight_t *rtlight);
75 void R_Shadow_PrepareLights(void);
76 void R_Shadow_DrawPrepass(void);
77 void R_Shadow_DrawLights(void);
78 void R_Shadow_DrawCoronas(void);
80 extern int maxshadowmark;
81 extern int numshadowmark;
82 extern int *shadowmark;
83 extern int *shadowmarklist;
84 extern int shadowmarkcount;
85 void R_Shadow_PrepareShadowMark(int numtris);
87 extern int maxshadowsides;
88 extern int numshadowsides;
89 extern unsigned char *shadowsides;
90 extern int *shadowsideslist;
91 void R_Shadow_PrepareShadowSides(int numtris);
93 void R_CompleteLightPoint(vec3_t ambientcolor, vec3_t diffusecolor, vec3_t diffusenormal, const vec3_t p, int dynamic);