intensity = 1.0f - sqrt(DotProduct(v, v));
if (intensity > 0)
intensity = pow(intensity, r_shadow_attenpower) * r_shadow_attenscale * 256.0f;
- d = bound(0, intensity, 255);
+ d = (int)bound(0, intensity, 255);
data[(y*ATTEN2DSIZE+x)*4+0] = d;
data[(y*ATTEN2DSIZE+x)*4+1] = d;
data[(y*ATTEN2DSIZE+x)*4+2] = d;
intensity = 1.0f - sqrt(DotProduct(v, v));
if (intensity > 0)
intensity = pow(intensity, r_shadow_attenpower) * r_shadow_attenscale * 256.0f;
- d = bound(0, intensity, 255);
+ d = (int)bound(0, intensity, 255);
data[((z*ATTEN3DSIZE+y)*ATTEN3DSIZE+x)*4+0] = d;
data[((z*ATTEN3DSIZE+y)*ATTEN3DSIZE+x)*4+1] = d;
data[((z*ATTEN3DSIZE+y)*ATTEN3DSIZE+x)*4+2] = d;
GL_BlendFunc(GL_ONE, GL_ZERO);
GL_DepthMask(false);
GL_DepthTest(true);
- if (!r_showtrispass)
- qglPolygonOffset(r_shadow_shadow_polygonfactor.value, r_shadow_shadow_polygonoffset.value);
- //if (r_shadow_shadow_polygonoffset.value != 0)
- //{
- // qglPolygonOffset(r_shadow_shadow_polygonfactor.value, r_shadow_shadow_polygonoffset.value);
- // qglEnable(GL_POLYGON_OFFSET_FILL);
- //}
- //else
- // qglDisable(GL_POLYGON_OFFSET_FILL);
+ qglPolygonOffset(r_shadowpolygonfactor, r_shadowpolygonoffset);
qglDepthFunc(GL_LESS);
qglCullFace(GL_FRONT); // quake is backwards, this culls back faces
qglEnable(GL_STENCIL_TEST);
GL_BlendFunc(GL_SRC_ALPHA, GL_ONE);
GL_DepthMask(false);
GL_DepthTest(true);
- if (!r_showtrispass)
- qglPolygonOffset(0, 0);
+ qglPolygonOffset(r_polygonfactor, r_polygonoffset);
//qglDisable(GL_POLYGON_OFFSET_FILL);
GL_Color(1, 1, 1, 1);
GL_ColorMask(r_refdef.colormask[0], r_refdef.colormask[1], r_refdef.colormask[2], 1);
GL_BlendFunc(GL_ONE, GL_ONE);
GL_DepthMask(false);
GL_DepthTest(!r_showdisabledepthtest.integer);
- if (!r_showtrispass)
- qglPolygonOffset(0, 0);
+ qglPolygonOffset(r_polygonfactor, r_polygonoffset);
GL_Color(0.0, 0.0125, 0.1, 1);
GL_ColorMask(r_refdef.colormask[0], r_refdef.colormask[1], r_refdef.colormask[2], 1);
qglDepthFunc(GL_GEQUAL);
GL_BlendFunc(GL_ONE, GL_ONE);
GL_DepthMask(false);
GL_DepthTest(!r_showdisabledepthtest.integer);
- if (!r_showtrispass)
- qglPolygonOffset(0, 0);
+ qglPolygonOffset(r_polygonfactor, r_polygonoffset);
GL_Color(0.1, 0.0125, 0, 1);
GL_ColorMask(r_refdef.colormask[0], r_refdef.colormask[1], r_refdef.colormask[2], 1);
if (transparent)
GL_BlendFunc(GL_ONE, GL_ZERO);
GL_DepthMask(true);
GL_DepthTest(true);
- if (!r_showtrispass)
- qglPolygonOffset(0, 0);
+ qglPolygonOffset(r_polygonfactor, r_polygonoffset);
//qglDisable(GL_POLYGON_OFFSET_FILL);
GL_Color(1, 1, 1, 1);
GL_ColorMask(r_refdef.colormask[0], r_refdef.colormask[1], r_refdef.colormask[2], 1);
}
// now convert the scissor rectangle to integer screen coordinates
- ix1 = x1 - 1.0f;
- iy1 = y1 - 1.0f;
- ix2 = x2 + 1.0f;
- iy2 = y2 + 1.0f;
+ ix1 = (int)(x1 - 1.0f);
+ iy1 = (int)(y1 - 1.0f);
+ ix2 = (int)(x2 + 1.0f);
+ iy2 = (int)(y2 + 1.0f);
//Con_Printf("%f %f %f %f\n", x1, y1, x2, y2);
// clamp it to the screen
return false;
}
-extern float *rsurface_vertex3f;
-extern float *rsurface_svector3f;
-extern float *rsurface_tvector3f;
-extern float *rsurface_normal3f;
-extern void RSurf_SetVertexPointer(const entity_render_t *ent, const texture_t *texture, const msurface_t *surface, const vec3_t modelorg, qboolean generatenormals, qboolean generatetangents);
-
static void R_Shadow_RenderSurfacesLighting_Light_Vertex_Shading(const msurface_t *surface, const float *diffusecolor, const float *ambientcolor)
{
int numverts = surface->num_vertices;
{
// used to display how many times a surface is lit for level design purposes
int surfacelistindex;
+ model_t *model = ent->model;
rmeshstate_t m;
GL_Color(0.1, 0.025, 0, 1);
memset(&m, 0, sizeof(m));
R_Mesh_State(&m);
+ RSurf_PrepareVerticesForBatch(ent, texture, r_shadow_entityeyeorigin, false, false, numsurfaces, surfacelist);
for (surfacelistindex = 0;surfacelistindex < numsurfaces;surfacelistindex++)
{
const msurface_t *surface = surfacelist[surfacelistindex];
- RSurf_SetVertexPointer(ent, texture, surface, r_shadow_entityeyeorigin, false, false);
GL_LockArrays(surface->num_firstvertex, surface->num_vertices);
- R_Mesh_Draw(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, surface->groupmesh->data_element3i + 3 * surface->num_firsttriangle);
+ R_Mesh_Draw(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, model->surfmesh.data_element3i + 3 * surface->num_firsttriangle);
GL_LockArrays(0, 0);
}
}
{
// ARB2 GLSL shader path (GFFX5200, Radeon 9500)
int surfacelistindex;
+ model_t *model = ent->model;
+ RSurf_PrepareVerticesForBatch(ent, texture, r_shadow_entityeyeorigin, true, true, numsurfaces, surfacelist);
R_SetupSurfaceShader(ent, texture, r_shadow_entityeyeorigin, lightcolorbase, false);
for (surfacelistindex = 0;surfacelistindex < numsurfaces;surfacelistindex++)
{
const msurface_t *surface = surfacelist[surfacelistindex];
- const int *elements = surface->groupmesh->data_element3i + surface->num_firsttriangle * 3;
- RSurf_SetVertexPointer(ent, texture, surface, r_shadow_entityeyeorigin, false, true);
- R_Mesh_TexCoordPointer(0, 2, surface->groupmesh->data_texcoordtexture2f);
+ const int *elements = model->surfmesh.data_element3i + surface->num_firsttriangle * 3;
+ R_Mesh_TexCoordPointer(0, 2, model->surfmesh.data_texcoordtexture2f);
R_Mesh_TexCoordPointer(1, 3, rsurface_svector3f);
R_Mesh_TexCoordPointer(2, 3, rsurface_tvector3f);
R_Mesh_TexCoordPointer(3, 3, rsurface_normal3f);
static void R_Shadow_RenderSurfacesLighting_Light_Dot3_AmbientPass(const entity_render_t *ent, const texture_t *texture, const msurface_t *surface, const vec3_t lightcolorbase, rtexture_t *basetexture, float colorscale)
{
int renders;
+ model_t *model = ent->model;
float color2[3];
rmeshstate_t m;
- const int *elements = surface->groupmesh->data_element3i + surface->num_firsttriangle * 3;
+ const int *elements = model->surfmesh.data_element3i + surface->num_firsttriangle * 3;
GL_Color(1,1,1,1);
// colorscale accounts for how much we multiply the brightness
// during combine.
m.pointer_texcoord3f[0] = rsurface_vertex3f;
m.texmatrix[0] = r_shadow_entitytoattenuationxyz;
m.tex[1] = R_GetTexture(basetexture);
- m.pointer_texcoord[1] = surface->groupmesh->data_texcoordtexture2f;
+ m.pointer_texcoord[1] = model->surfmesh.data_texcoordtexture2f;
m.texmatrix[1] = texture->currenttexmatrix;
m.texcubemap[2] = R_GetTexture(r_shadow_rtlight->currentcubemap);
m.pointer_texcoord3f[2] = rsurface_vertex3f;
m.pointer_texcoord3f[0] = rsurface_vertex3f;
m.texmatrix[0] = r_shadow_entitytoattenuationxyz;
m.tex[1] = R_GetTexture(basetexture);
- m.pointer_texcoord[1] = surface->groupmesh->data_texcoordtexture2f;
+ m.pointer_texcoord[1] = model->surfmesh.data_texcoordtexture2f;
m.texmatrix[1] = texture->currenttexmatrix;
GL_BlendFunc(GL_ONE, GL_ONE);
}
m.pointer_texcoord3f[1] = rsurface_vertex3f;
m.texmatrix[1] = r_shadow_entitytoattenuationz;
m.tex[2] = R_GetTexture(basetexture);
- m.pointer_texcoord[2] = surface->groupmesh->data_texcoordtexture2f;
+ m.pointer_texcoord[2] = model->surfmesh.data_texcoordtexture2f;
m.texmatrix[2] = texture->currenttexmatrix;
if (r_shadow_rtlight->currentcubemap != r_texture_whitecube)
{
m.pointer_texcoord3f[1] = rsurface_vertex3f;
m.texmatrix[1] = r_shadow_entitytoattenuationz;
m.tex[2] = R_GetTexture(basetexture);
- m.pointer_texcoord[2] = surface->groupmesh->data_texcoordtexture2f;
+ m.pointer_texcoord[2] = model->surfmesh.data_texcoordtexture2f;
m.texmatrix[2] = texture->currenttexmatrix;
GL_BlendFunc(GL_ONE, GL_ONE);
}
memset(&m, 0, sizeof(m));
m.pointer_vertex = rsurface_vertex3f;
m.tex[0] = R_GetTexture(basetexture);
- m.pointer_texcoord[0] = surface->groupmesh->data_texcoordtexture2f;
+ m.pointer_texcoord[0] = model->surfmesh.data_texcoordtexture2f;
m.texmatrix[0] = texture->currenttexmatrix;
if (r_shadow_rtlight->currentcubemap != r_texture_whitecube)
{
static void R_Shadow_RenderSurfacesLighting_Light_Dot3_DiffusePass(const entity_render_t *ent, const texture_t *texture, const msurface_t *surface, const vec3_t lightcolorbase, rtexture_t *basetexture, rtexture_t *normalmaptexture, float colorscale)
{
int renders;
+ model_t *model = ent->model;
float color2[3];
rmeshstate_t m;
- const int *elements = surface->groupmesh->data_element3i + surface->num_firsttriangle * 3;
+ const int *elements = model->surfmesh.data_element3i + surface->num_firsttriangle * 3;
GL_Color(1,1,1,1);
// colorscale accounts for how much we multiply the brightness
// during combine.
m.pointer_vertex = rsurface_vertex3f;
m.tex[0] = R_GetTexture(normalmaptexture);
m.texcombinergb[0] = GL_REPLACE;
- m.pointer_texcoord[0] = surface->groupmesh->data_texcoordtexture2f;
+ m.pointer_texcoord[0] = model->surfmesh.data_texcoordtexture2f;
m.texmatrix[0] = texture->currenttexmatrix;
m.texcubemap[1] = R_GetTexture(r_texture_normalizationcube);
m.texcombinergb[1] = GL_DOT3_RGBA_ARB;
memset(&m, 0, sizeof(m));
m.pointer_vertex = rsurface_vertex3f;
m.tex[0] = R_GetTexture(basetexture);
- m.pointer_texcoord[0] = surface->groupmesh->data_texcoordtexture2f;
+ m.pointer_texcoord[0] = model->surfmesh.data_texcoordtexture2f;
m.texmatrix[0] = texture->currenttexmatrix;
if (r_shadow_rtlight->currentcubemap != r_texture_whitecube)
{
m.pointer_vertex = rsurface_vertex3f;
m.tex[0] = R_GetTexture(normalmaptexture);
m.texcombinergb[0] = GL_REPLACE;
- m.pointer_texcoord[0] = surface->groupmesh->data_texcoordtexture2f;
+ m.pointer_texcoord[0] = model->surfmesh.data_texcoordtexture2f;
m.texmatrix[0] = texture->currenttexmatrix;
m.texcubemap[1] = R_GetTexture(r_texture_normalizationcube);
m.texcombinergb[1] = GL_DOT3_RGBA_ARB;
memset(&m, 0, sizeof(m));
m.pointer_vertex = rsurface_vertex3f;
m.tex[0] = R_GetTexture(basetexture);
- m.pointer_texcoord[0] = surface->groupmesh->data_texcoordtexture2f;
+ m.pointer_texcoord[0] = model->surfmesh.data_texcoordtexture2f;
m.texmatrix[0] = texture->currenttexmatrix;
if (r_shadow_rtlight->currentcubemap != r_texture_whitecube)
{
m.pointer_vertex = rsurface_vertex3f;
m.tex[0] = R_GetTexture(normalmaptexture);
m.texcombinergb[0] = GL_REPLACE;
- m.pointer_texcoord[0] = surface->groupmesh->data_texcoordtexture2f;
+ m.pointer_texcoord[0] = model->surfmesh.data_texcoordtexture2f;
m.texmatrix[0] = texture->currenttexmatrix;
m.texcubemap[1] = R_GetTexture(r_texture_normalizationcube);
m.texcombinergb[1] = GL_DOT3_RGBA_ARB;
memset(&m, 0, sizeof(m));
m.pointer_vertex = rsurface_vertex3f;
m.tex[0] = R_GetTexture(basetexture);
- m.pointer_texcoord[0] = surface->groupmesh->data_texcoordtexture2f;
+ m.pointer_texcoord[0] = model->surfmesh.data_texcoordtexture2f;
m.texmatrix[0] = texture->currenttexmatrix;
m.tex3d[1] = R_GetTexture(r_shadow_attenuation3dtexture);
m.pointer_texcoord3f[1] = rsurface_vertex3f;
m.pointer_vertex = rsurface_vertex3f;
m.tex[0] = R_GetTexture(normalmaptexture);
m.texcombinergb[0] = GL_REPLACE;
- m.pointer_texcoord[0] = surface->groupmesh->data_texcoordtexture2f;
+ m.pointer_texcoord[0] = model->surfmesh.data_texcoordtexture2f;
m.texmatrix[0] = texture->currenttexmatrix;
m.texcubemap[1] = R_GetTexture(r_texture_normalizationcube);
m.texcombinergb[1] = GL_DOT3_RGBA_ARB;
memset(&m, 0, sizeof(m));
m.pointer_vertex = rsurface_vertex3f;
m.tex[0] = R_GetTexture(basetexture);
- m.pointer_texcoord[0] = surface->groupmesh->data_texcoordtexture2f;
+ m.pointer_texcoord[0] = model->surfmesh.data_texcoordtexture2f;
m.texmatrix[0] = texture->currenttexmatrix;
if (r_shadow_rtlight->currentcubemap != r_texture_whitecube)
{
m.pointer_vertex = rsurface_vertex3f;
m.tex[0] = R_GetTexture(normalmaptexture);
m.texcombinergb[0] = GL_REPLACE;
- m.pointer_texcoord[0] = surface->groupmesh->data_texcoordtexture2f;
+ m.pointer_texcoord[0] = model->surfmesh.data_texcoordtexture2f;
m.texmatrix[0] = texture->currenttexmatrix;
m.texcubemap[1] = R_GetTexture(r_texture_normalizationcube);
m.texcombinergb[1] = GL_DOT3_RGBA_ARB;
memset(&m, 0, sizeof(m));
m.pointer_vertex = rsurface_vertex3f;
m.tex[0] = R_GetTexture(basetexture);
- m.pointer_texcoord[0] = surface->groupmesh->data_texcoordtexture2f;
+ m.pointer_texcoord[0] = model->surfmesh.data_texcoordtexture2f;
m.texmatrix[0] = texture->currenttexmatrix;
if (r_shadow_rtlight->currentcubemap != r_texture_whitecube)
{
static void R_Shadow_RenderSurfacesLighting_Light_Dot3_SpecularPass(const entity_render_t *ent, const texture_t *texture, const msurface_t *surface, const vec3_t lightcolorbase, rtexture_t *glosstexture, rtexture_t *normalmaptexture, float colorscale)
{
int renders;
+ model_t *model = ent->model;
float color2[3];
rmeshstate_t m;
- const int *elements = surface->groupmesh->data_element3i + surface->num_firsttriangle * 3;
+ const int *elements = model->surfmesh.data_element3i + surface->num_firsttriangle * 3;
// FIXME: detect blendsquare!
//if (!gl_support_blendsquare)
// return;
memset(&m, 0, sizeof(m));
m.pointer_vertex = rsurface_vertex3f;
m.tex[0] = R_GetTexture(normalmaptexture);
- m.pointer_texcoord[0] = surface->groupmesh->data_texcoordtexture2f;
+ m.pointer_texcoord[0] = model->surfmesh.data_texcoordtexture2f;
m.texmatrix[0] = texture->currenttexmatrix;
m.texcubemap[1] = R_GetTexture(r_texture_normalizationcube);
m.texcombinergb[1] = GL_DOT3_RGBA_ARB;
memset(&m, 0, sizeof(m));
m.pointer_vertex = rsurface_vertex3f;
m.tex[0] = R_GetTexture(glosstexture);
- m.pointer_texcoord[0] = surface->groupmesh->data_texcoordtexture2f;
+ m.pointer_texcoord[0] = model->surfmesh.data_texcoordtexture2f;
m.texmatrix[0] = texture->currenttexmatrix;
if (r_shadow_rtlight->currentcubemap != r_texture_whitecube)
{
memset(&m, 0, sizeof(m));
m.pointer_vertex = rsurface_vertex3f;
m.tex[0] = R_GetTexture(normalmaptexture);
- m.pointer_texcoord[0] = surface->groupmesh->data_texcoordtexture2f;
+ m.pointer_texcoord[0] = model->surfmesh.data_texcoordtexture2f;
m.texmatrix[0] = texture->currenttexmatrix;
m.texcubemap[1] = R_GetTexture(r_texture_normalizationcube);
m.texcombinergb[1] = GL_DOT3_RGBA_ARB;
memset(&m, 0, sizeof(m));
m.pointer_vertex = rsurface_vertex3f;
m.tex[0] = R_GetTexture(glosstexture);
- m.pointer_texcoord[0] = surface->groupmesh->data_texcoordtexture2f;
+ m.pointer_texcoord[0] = model->surfmesh.data_texcoordtexture2f;
m.texmatrix[0] = texture->currenttexmatrix;
m.tex3d[1] = R_GetTexture(r_shadow_attenuation3dtexture);
m.pointer_texcoord3f[1] = rsurface_vertex3f;
memset(&m, 0, sizeof(m));
m.pointer_vertex = rsurface_vertex3f;
m.tex[0] = R_GetTexture(normalmaptexture);
- m.pointer_texcoord[0] = surface->groupmesh->data_texcoordtexture2f;
+ m.pointer_texcoord[0] = model->surfmesh.data_texcoordtexture2f;
m.texmatrix[0] = texture->currenttexmatrix;
m.texcubemap[1] = R_GetTexture(r_texture_normalizationcube);
m.texcombinergb[1] = GL_DOT3_RGBA_ARB;
memset(&m, 0, sizeof(m));
m.pointer_vertex = rsurface_vertex3f;
m.tex[0] = R_GetTexture(glosstexture);
- m.pointer_texcoord[0] = surface->groupmesh->data_texcoordtexture2f;
+ m.pointer_texcoord[0] = model->surfmesh.data_texcoordtexture2f;
m.texmatrix[0] = texture->currenttexmatrix;
if (r_shadow_rtlight->currentcubemap != r_texture_whitecube)
{
qboolean dospecular = specularscale > 0;
if (!doambient && !dodiffuse && !dospecular)
return;
+ RSurf_PrepareVerticesForBatch(ent, texture, r_shadow_entityeyeorigin, true, true, numsurfaces, surfacelist);
for (surfacelistindex = 0;surfacelistindex < numsurfaces;surfacelistindex++)
{
const msurface_t *surface = surfacelist[surfacelistindex];
- RSurf_SetVertexPointer(ent, texture, surface, r_shadow_entityeyeorigin, false, true);
if (doambient)
R_Shadow_RenderSurfacesLighting_Light_Dot3_AmbientPass(ent, texture, surface, lightcolorbase, basetexture, r_shadow_rtlight->ambientscale);
if (dodiffuse)
}
}
-void R_Shadow_RenderSurfacesLighting_Light_Vertex_Pass(const msurface_t *surface, vec3_t diffusecolor2, vec3_t ambientcolor2)
+void R_Shadow_RenderSurfacesLighting_Light_Vertex_Pass(const model_t *model, const msurface_t *surface, vec3_t diffusecolor2, vec3_t ambientcolor2)
{
int renders;
- const int *elements = surface->groupmesh->data_element3i + surface->num_firsttriangle * 3;
+ const int *elements = model->surfmesh.data_element3i + surface->num_firsttriangle * 3;
R_Shadow_RenderSurfacesLighting_Light_Vertex_Shading(surface, diffusecolor2, ambientcolor2);
for (renders = 0;renders < 64 && (ambientcolor2[0] > renders || ambientcolor2[1] > renders || ambientcolor2[2] > renders || diffusecolor2[0] > renders || diffusecolor2[1] > renders || diffusecolor2[2] > renders);renders++)
{
static void R_Shadow_RenderSurfacesLighting_Light_Vertex(const entity_render_t *ent, const texture_t *texture, int numsurfaces, msurface_t **surfacelist, const vec3_t lightcolorbase, const vec3_t lightcolorpants, const vec3_t lightcolorshirt, rtexture_t *basetexture, rtexture_t *pantstexture, rtexture_t *shirttexture, rtexture_t *normalmaptexture, rtexture_t *glosstexture, float specularscale, qboolean dopants, qboolean doshirt)
{
int surfacelistindex;
+ model_t *model = ent->model;
float ambientcolorbase[3], diffusecolorbase[3];
float ambientcolorpants[3], diffusecolorpants[3];
float ambientcolorshirt[3], diffusecolorshirt[3];
}
m.pointer_color = rsurface_array_color4f;
R_Mesh_State(&m);
+ RSurf_PrepareVerticesForBatch(ent, texture, r_shadow_entityeyeorigin, true, false, numsurfaces, surfacelist);
for (surfacelistindex = 0;surfacelistindex < numsurfaces;surfacelistindex++)
{
const msurface_t *surface = surfacelist[surfacelistindex];
- RSurf_SetVertexPointer(ent, texture, surface, r_shadow_entityeyeorigin, true, false);
// OpenGL 1.1 path (anything)
- R_Mesh_TexCoordPointer(0, 2, surface->groupmesh->data_texcoordtexture2f);
+ R_Mesh_TexCoordPointer(0, 2, model->surfmesh.data_texcoordtexture2f);
R_Mesh_TexMatrix(0, &texture->currenttexmatrix);
if (r_textureunits.integer >= 2)
{
}
}
R_Mesh_TexBind(0, R_GetTexture(basetexture));
- R_Shadow_RenderSurfacesLighting_Light_Vertex_Pass(surface, diffusecolorbase, ambientcolorbase);
+ R_Shadow_RenderSurfacesLighting_Light_Vertex_Pass(model, surface, diffusecolorbase, ambientcolorbase);
if (dopants)
{
R_Mesh_TexBind(0, R_GetTexture(pantstexture));
- R_Shadow_RenderSurfacesLighting_Light_Vertex_Pass(surface, diffusecolorpants, ambientcolorpants);
+ R_Shadow_RenderSurfacesLighting_Light_Vertex_Pass(model, surface, diffusecolorpants, ambientcolorpants);
}
if (doshirt)
{
R_Mesh_TexBind(0, R_GetTexture(shirttexture));
- R_Shadow_RenderSurfacesLighting_Light_Vertex_Pass(surface, diffusecolorshirt, ambientcolorshirt);
+ R_Shadow_RenderSurfacesLighting_Light_Vertex_Pass(model, surface, diffusecolorshirt, ambientcolorshirt);
}
}
}
void R_Shadow_DrawEntityShadow(entity_render_t *ent, int numsurfaces, int *surfacelist)
{
+ model_t *model = ent->model;
vec3_t relativeshadoworigin, relativeshadowmins, relativeshadowmaxs;
vec_t relativeshadowradius;
if (ent == r_refdef.worldentity)
else if (numsurfaces)
{
R_Mesh_Matrix(&ent->matrix);
- ent->model->DrawShadowVolume(ent, r_shadow_rtlight->shadoworigin, r_shadow_rtlight->radius, numsurfaces, surfacelist, r_shadow_rtlight->cullmins, r_shadow_rtlight->cullmaxs);
+ model->DrawShadowVolume(ent, r_shadow_rtlight->shadoworigin, r_shadow_rtlight->radius, numsurfaces, surfacelist, r_shadow_rtlight->cullmins, r_shadow_rtlight->cullmaxs);
}
}
else
relativeshadowmaxs[1] = relativeshadoworigin[1] + relativeshadowradius;
relativeshadowmaxs[2] = relativeshadoworigin[2] + relativeshadowradius;
R_Mesh_Matrix(&ent->matrix);
- ent->model->DrawShadowVolume(ent, relativeshadoworigin, relativeshadowradius, ent->model->nummodelsurfaces, ent->model->surfacelist, relativeshadowmins, relativeshadowmaxs);
+ model->DrawShadowVolume(ent, relativeshadoworigin, relativeshadowradius, model->nummodelsurfaces, model->surfacelist, relativeshadowmins, relativeshadowmaxs);
}
}
void R_Shadow_DrawEntityLight(entity_render_t *ent, int numsurfaces, int *surfacelist)
{
- if (!ent->model->DrawLight)
+ model_t *model = ent->model;
+ if (!model->DrawLight)
return;
R_Shadow_SetupEntityLight(ent);
if (ent == r_refdef.worldentity)
- ent->model->DrawLight(ent, numsurfaces, surfacelist);
+ model->DrawLight(ent, numsurfaces, surfacelist);
else
- ent->model->DrawLight(ent, ent->model->nummodelsurfaces, ent->model->surfacelist);
+ model->DrawLight(ent, model->nummodelsurfaces, model->surfacelist);
}
void R_DrawRTLight(rtlight_t *rtlight, qboolean visible)
{
for (i = 0;i < r_refdef.numentities;i++)
{
+ model_t *model;
entity_render_t *ent = r_refdef.entities[i];
if (BoxesOverlap(ent->mins, ent->maxs, rtlight->cullmins, rtlight->cullmaxs)
- && ent->model
+ && (model = ent->model)
&& !(ent->flags & RENDER_TRANSPARENT)
&& (r_refdef.worldmodel == NULL || r_refdef.worldmodel->brush.BoxTouchingLeafPVS == NULL || r_refdef.worldmodel->brush.BoxTouchingLeafPVS(r_refdef.worldmodel, leafpvs, ent->mins, ent->maxs)))
{
// about the VectorDistance2 - light emitting entities should not cast their own shadow
- if ((ent->flags & RENDER_SHADOW) && ent->model->DrawShadowVolume && VectorDistance2(ent->origin, rtlight->shadoworigin) > 0.1)
+ if ((ent->flags & RENDER_SHADOW) && model->DrawShadowVolume && VectorDistance2(ent->origin, rtlight->shadoworigin) > 0.1)
shadowentities[numshadowentities++] = ent;
- if (ent->visframe == r_framecount && (ent->flags & RENDER_LIGHT) && ent->model->DrawLight)
+ if (ent->visframe == r_framecount && (ent->flags & RENDER_LIGHT) && model->DrawLight)
lightentities[numlightentities++] = ent;
}
}