#define gl_alpha_format 4
int R_CullBox(const vec3_t mins, const vec3_t maxs);
#define gl_alpha_format 4
int R_CullBox(const vec3_t mins, const vec3_t maxs);
// r_stain
void R_Stain(const vec3_t origin, float radius, int cr1, int cg1, int cb1, int ca1, int cr2, int cg2, int cb2, int ca2);
// r_stain
void R_Stain(const vec3_t origin, float radius, int cr1, int cg1, int cb1, int ca1, int cr2, int cg2, int cb2, int ca2);
void R_CalcBeam_Vertex3f(float *vert, const vec3_t org1, const vec3_t org2, float width);
void R_DrawSprite(int blendfunc1, int blendfunc2, rtexture_t *texture, rtexture_t *fogtexture, int depthdisable, const vec3_t origin, const vec3_t left, const vec3_t up, float scalex1, float scalex2, float scaley1, float scaley2, float cr, float cg, float cb, float ca);
void R_CalcBeam_Vertex3f(float *vert, const vec3_t org1, const vec3_t org2, float width);
void R_DrawSprite(int blendfunc1, int blendfunc2, rtexture_t *texture, rtexture_t *fogtexture, int depthdisable, const vec3_t origin, const vec3_t left, const vec3_t up, float scalex1, float scalex2, float scaley1, float scaley2, float cr, float cg, float cb, float ca);
extern const entity_render_t *rsurface_entity;
extern const model_t *rsurface_model;
extern texture_t *rsurface_texture;
extern const entity_render_t *rsurface_entity;
extern const model_t *rsurface_model;
extern texture_t *rsurface_texture;
-void RSurf_ActiveEntity(const entity_render_t *ent, qboolean wantnormals, qboolean wanttangents);
+void RSurf_ActiveWorldEntity(void);
+void RSurf_ActiveModelEntity(const entity_render_t *ent, qboolean wantnormals, qboolean wanttangents);
void R_UpdateTextureInfo(const entity_render_t *ent, texture_t *t);
void R_UpdateAllTextureInfo(entity_render_t *ent);
void R_QueueTextureSurfaceList(int texturenumsurfaces, msurface_t **texturesurfacelist);
void R_UpdateTextureInfo(const entity_render_t *ent, texture_t *t);
void R_UpdateAllTextureInfo(entity_render_t *ent);
void R_QueueTextureSurfaceList(int texturenumsurfaces, msurface_t **texturesurfacelist);
void RSurf_PrepareVerticesForBatch(qboolean generatenormals, qboolean generatetangents, int texturenumsurfaces, msurface_t **texturesurfacelist);
void RSurf_DrawBatch_Simple(int texturenumsurfaces, msurface_t **texturesurfacelist);
void RSurf_PrepareVerticesForBatch(qboolean generatenormals, qboolean generatetangents, int texturenumsurfaces, msurface_t **texturesurfacelist);
void RSurf_DrawBatch_Simple(int texturenumsurfaces, msurface_t **texturesurfacelist);
#define SHADERPERMUTATION_CUBEFILTER (1<<8) // (lightsource) use cubemap light filter
#define SHADERPERMUTATION_OFFSETMAPPING (1<<9) // adjust texcoords to roughly simulate a displacement mapped surface
#define SHADERPERMUTATION_OFFSETMAPPING_RELIEFMAPPING (1<<10) // adjust texcoords to accurately simulate a displacement mapped surface (requires OFFSETMAPPING to also be set!)
#define SHADERPERMUTATION_CUBEFILTER (1<<8) // (lightsource) use cubemap light filter
#define SHADERPERMUTATION_OFFSETMAPPING (1<<9) // adjust texcoords to roughly simulate a displacement mapped surface
#define SHADERPERMUTATION_OFFSETMAPPING_RELIEFMAPPING (1<<10) // adjust texcoords to accurately simulate a displacement mapped surface (requires OFFSETMAPPING to also be set!)
+#define SHADERPERMUTATION_COUNTMASK (SHADERPERMUTATION_COUNT - 1) // mask of valid indexing bits for r_glsl_permutations[] array
+
+// these are additional flags used only by R_GLSL_CompilePermutation
+#define SHADERPERMUTATION_USES_VERTEXSHADER (1<<29)
+#define SHADERPERMUTATION_USES_GEOMETRYSHADER (1<<30)
+#define SHADERPERMUTATION_USES_FRAGMENTSHADER (1<<31)
int R_SetupSurfaceShader(const vec3_t lightcolorbase, qboolean modellighting);
void R_SwitchSurfaceShader(int permutation);
int R_SetupSurfaceShader(const vec3_t lightcolorbase, qboolean modellighting);
void R_SwitchSurfaceShader(int permutation);