c_bmodels++;
- VectorSubtract (r_refdef.vieworg, e->render.origin, modelorg);
+ VectorSubtract (r_origin, e->render.origin, modelorg);
if (rotated)
{
vec3_t temp;
modelorg[2] = DotProduct (temp, up);
}
- s = &clmodel->surfaces[clmodel->firstmodelsurface];
+ for (i = 0, s = &clmodel->surfaces[clmodel->firstmodelsurface];i < clmodel->nummodelsurfaces;i++, s++)
+ {
+ if (((s->flags & SURF_PLANEBACK) == 0) == (PlaneDiff(modelorg, s->plane) >= 0))
+ s->visframe = r_framecount;
+ else
+ s->visframe = -1;
+ }
// calculate dynamic lighting for bmodel if it's not an
// instanced model
e->render.angles[0] = -e->render.angles[0]; // stupid quake bug
// draw texture
- for (i = 0;i < clmodel->nummodelsurfaces;i++, s++)
+ for (i = 0, s = &clmodel->surfaces[clmodel->firstmodelsurface];i < clmodel->nummodelsurfaces;i++, s++)
{
- if (((s->flags & SURF_PLANEBACK) == 0) == (PlaneDiff(modelorg, s->plane) >= 0))
+ if (s->visframe == r_framecount)
{
// R_DrawSurf(s, true, vertexlit || s->texinfo->texture->transparent);
if (s->flags & (SURF_DRAWSKY | SURF_DRAWTURB))
for (l = 0, leaf = cl.worldmodel->leafs;l < cl.worldmodel->numleafs;l++, leaf++)
{
- if (/*leaf->efrags || */leaf->nummarksurfaces)
+ if (leaf->nummarksurfaces)
{
if (R_CullBox(leaf->mins, leaf->maxs))
continue;
leaf->visframe = r_framecount;
- // deal with model fragments in this leaf
-// if (leaf->efrags)
-// R_StoreEfrags (&leaf->efrags);
-
if (leaf->nummarksurfaces)
{
mark = leaf->firstmarksurface;
leaf->visframe = r_framecount;
- // deal with model fragments in this leaf
- // if (leaf->efrags)
- // R_StoreEfrags (&leaf->efrags);
-
if (leaf->nummarksurfaces)
{
mark = leaf->firstmarksurface;
leaf->visframe = r_framecount;
- // deal with model fragments in this leaf
-// if (leaf->efrags)
-// R_StoreEfrags (&leaf->efrags);
-
if (leaf->nummarksurfaces)
{
mark = leaf->firstmarksurface;
modelalpha = ent.render.alpha = 1;
ent.render.scale = 1;
- VectorCopy (r_refdef.vieworg, modelorg);
+ VectorCopy (r_origin, modelorg);
currententity = &ent;