SHADERSTATICPARM_SHADOWSAMPLER = 10, ///< sampler
SHADERSTATICPARM_CELSHADING = 11, ///< celshading (alternative diffuse and specular math)
SHADERSTATICPARM_CELOUTLINES = 12, ///< celoutline (depth buffer analysis to produce outlines)
- SHADERSTATICPARM_FXAA = 13 ///< fast approximate anti aliasing
+ SHADERSTATICPARM_FXAA = 13, ///< fast approximate anti aliasing
+ SHADERSTATICPARM_COLORFRINGE = 14 ///< colorfringe (chromatic aberration)
};
-#define SHADERSTATICPARMS_COUNT 14
+#define SHADERSTATICPARMS_COUNT 15
static const char *shaderstaticparmstrings_list[SHADERSTATICPARMS_COUNT];
static int shaderstaticparms_count = 0;
R_COMPILESHADER_STATICPARM_ENABLE(SHADERSTATICPARM_CELSHADING);
if (r_celoutlines.integer)
R_COMPILESHADER_STATICPARM_ENABLE(SHADERSTATICPARM_CELOUTLINES);
+ if (r_colorfringe.value)
+ R_COMPILESHADER_STATICPARM_ENABLE(SHADERSTATICPARM_COLORFRINGE);
return memcmp(r_compileshader_staticparms, r_compileshader_staticparms_save, sizeof(r_compileshader_staticparms)) != 0;
}
R_COMPILESHADER_STATICPARM_EMIT(SHADERSTATICPARM_CELSHADING, "USECELSHADING");
R_COMPILESHADER_STATICPARM_EMIT(SHADERSTATICPARM_CELOUTLINES, "USECELOUTLINES");
R_COMPILESHADER_STATICPARM_EMIT(SHADERSTATICPARM_FXAA, "USEFXAA");
+ R_COMPILESHADER_STATICPARM_EMIT(SHADERSTATICPARM_COLORFRINGE, "USECOLORFRINGE");
}
/// information about each possible shader permutation
r_texture_numcubemaps = 0;
//r_texture_fogintensity = NULL;
memset(&r_fb, 0, sizeof(r_fb));
- R_GLSL_Restart_f(&cmd_client);
+ R_GLSL_Restart_f(cmd_client);
r_glsl_permutation = NULL;
memset(r_glsl_permutationhash, 0, sizeof(r_glsl_permutationhash));
rsurface.entity = NULL; // used only by R_GetCurrentTexture and RSurf_ActiveModelEntity
if(R_CompileShader_CheckStaticParms())
- R_GLSL_Restart_f(&cmd_client);
+ R_GLSL_Restart_f(cmd_client);
if (!r_drawentities.integer)
r_refdef.scene.numentities = 0;
model_t *model;
const msurface_t *surface;
const msurface_t *surfaces;
- const int *surfacelist;
const texture_t *texture;
int numtriangles;
- int numsurfacelist;
- int surfacelistindex;
int surfaceindex;
int triangleindex;
float localorigin[3];
#endif
dynamic = model->surfmesh.isanimated;
- numsurfacelist = model->nummodelsurfaces;
- surfacelist = model->sortedmodelsurfaces;
surfaces = model->data_surfaces;
bih = NULL;
}
else
{
- for (surfacelistindex = 0;surfacelistindex < numsurfacelist;surfacelistindex++)
+ for (surfaceindex = model->submodelsurfaces_start;surfaceindex < model->submodelsurfaces_end;surfaceindex++)
{
- surfaceindex = surfacelist[surfacelistindex];
surface = surfaces + surfaceindex;
// check cull box first because it rejects more than any other check
if (!dynamic && !BoxesOverlap(surface->mins, surface->maxs, localmins, localmaxs))
static void R_DrawDebugModel(void)
{
entity_render_t *ent = rsurface.entity;
- int i, j, flagsmask;
+ int j, flagsmask;
const msurface_t *surface;
model_t *model = ent->model;
GL_DepthMask(false);
GL_DepthRange(0, 1);
GL_BlendFunc(GL_ONE, GL_ONE);
- for (i = 0, j = model->firstmodelsurface, surface = model->data_surfaces + j;i < model->nummodelsurfaces;i++, j++, surface++)
+ for (j = model->submodelsurfaces_start;j < model->submodelsurfaces_end;j++)
{
if (ent == r_refdef.scene.worldentity && !r_refdef.viewcache.world_surfacevisible[j])
continue;
+ surface = model->data_surfaces + j;
rsurface.texture = R_GetCurrentTexture(surface->texture);
if ((rsurface.texture->currentmaterialflags & flagsmask) && surface->num_triangles)
{
GL_DepthMask(true);
}
qglPolygonMode(GL_FRONT_AND_BACK, GL_LINE);CHECKGLERROR
- for (i = 0, j = model->firstmodelsurface, surface = model->data_surfaces + j;i < model->nummodelsurfaces;i++, j++, surface++)
+ for (j = model->submodelsurfaces_start; j < model->submodelsurfaces_end; j++)
{
if (ent == r_refdef.scene.worldentity && !r_refdef.viewcache.world_surfacevisible[j])
continue;
+ surface = model->data_surfaces + j;
rsurface.texture = R_GetCurrentTexture(surface->texture);
if ((rsurface.texture->currentmaterialflags & flagsmask) && surface->num_triangles)
{
GL_BlendFunc(GL_ONE, GL_ZERO);
GL_DepthMask(true);
}
- for (i = 0, j = model->firstmodelsurface, surface = model->data_surfaces + j;i < model->nummodelsurfaces;i++, j++, surface++)
+ for (j = model->submodelsurfaces_start; j < model->submodelsurfaces_end; j++)
{
if (ent == r_refdef.scene.worldentity && !r_refdef.viewcache.world_surfacevisible[j])
continue;
+ surface = model->data_surfaces + j;
rsurface.texture = R_GetCurrentTexture(surface->texture);
if ((rsurface.texture->currentmaterialflags & flagsmask) && surface->num_triangles)
{
}
// check if this is an empty model
- if (model->nummodelsurfaces == 0)
+ if (model->submodelsurfaces_start >= model->submodelsurfaces_end)
return;
rsurface.lightmaptexture = NULL;
if (ent == r_refdef.scene.worldentity)
{
// for the world entity, check surfacevisible
- for (i = 0;i < model->nummodelsurfaces;i++)
+ for (i = model->submodelsurfaces_start;i < model->submodelsurfaces_end;i++)
{
- j = model->sortedmodelsurfaces[i];
+ j = model->modelsurfaces_sorted[i];
if (r_refdef.viewcache.world_surfacevisible[j])
r_surfacelist[numsurfacelist++] = surfaces + j;
}
}
else if (ui)
{
- // for ui we have to preserve the order of surfaces (not using sortedmodelsurfaces)
- for (i = 0; i < model->nummodelsurfaces; i++)
- r_surfacelist[numsurfacelist++] = surfaces + model->firstmodelsurface + i;
+ // for ui we have to preserve the order of surfaces (not using modelsurfaces_sorted)
+ for (i = model->submodelsurfaces_start; i < model->submodelsurfaces_end; i++)
+ r_surfacelist[numsurfacelist++] = surfaces + i;
}
else
{
// add all surfaces
- for (i = 0; i < model->nummodelsurfaces; i++)
- r_surfacelist[numsurfacelist++] = surfaces + model->sortedmodelsurfaces[i];
+ for (i = model->submodelsurfaces_start; i < model->submodelsurfaces_end; i++)
+ r_surfacelist[numsurfacelist++] = surfaces + model->modelsurfaces_sorted[i];
}
/*