numpoints = min(portal->numpoints, POLYGONELEMENTS_MAXPOINTS);
+ R_Mesh_VertexPointer(vertex3f, 0, 0);
+ R_Mesh_ColorPointer(NULL, 0, 0);
R_Mesh_ResetTextureState();
+ R_SetupShader_Generic(NULL, NULL, GL_MODULATE, 1);
isvis = (portal->here->clusterindex >= 0 && portal->past->clusterindex >= 0 && portal->here->clusterindex != portal->past->clusterindex);
isvis ? 0.125f : 0.03125f);
for (i = 0, v = vertex3f;i < numpoints;i++, v += 3)
VectorCopy(portal->points[i].position, v);
- R_Mesh_PrepareVertices_Generic_Arrays(numpoints, vertex3f, NULL, NULL);
- R_SetupShader_Generic(NULL, NULL, GL_MODULATE, 1);
- R_Mesh_Draw(0, numpoints, 0, numpoints - 2, polygonelement3i, NULL, 0, polygonelement3s, NULL, 0);
+ R_Mesh_Draw(0, numpoints, 0, numpoints - 2, polygonelement3i, polygonelement3s, 0, 0);
}
// LordHavoc: this is just a nice debugging tool, very slow
GL_BlendFunc(GL_ONE, GL_ZERO);
GL_DepthMask(true);
GL_AlphaTest(false);
+ R_Mesh_ColorPointer(NULL, 0, 0);
R_Mesh_ResetTextureState();
R_SetupShader_DepthOrShadow();
if (ent == r_refdef.scene.worldentity)
if (SVBSP_AddPolygon(&r_svbsp, portal->numpoints, points[0], false, NULL, NULL, 0) & 2)
break;
}
- if (portal == NULL)
+ if (leaf->portals && portal == NULL)
return; // no portals of this leaf visible
}
if (info->svbsp_insertoccluder)
rsurface.texture = R_GetCurrentTexture(surface->texture);
if (rsurface.texture->currentmaterialflags & MATERIALFLAG_NOSHADOW)
continue;
- R_Shadow_MarkVolumeFromBox(surface->num_firsttriangle, surface->num_triangles, rsurface.modelvertex3f, rsurface.modelelement3i, relativelightorigin, relativelightdirection, lightmins, lightmaxs, surface->mins, surface->maxs);
+ RSurf_PrepareVerticesForBatch(false, false, 1, &surface);
+ R_Shadow_MarkVolumeFromBox(surface->num_firsttriangle, surface->num_triangles, rsurface.vertex3f, rsurface.modelelement3i, relativelightorigin, relativelightdirection, lightmins, lightmaxs, surface->mins, surface->maxs);
}
- R_Shadow_VolumeFromList(model->surfmesh.num_vertices, model->surfmesh.num_triangles, rsurface.modelvertex3f, model->surfmesh.data_element3i, model->surfmesh.data_neighbor3i, relativelightorigin, relativelightdirection, projectdistance, numshadowmark, shadowmarklist, ent->mins, ent->maxs);
+ R_Shadow_VolumeFromList(model->surfmesh.num_vertices, model->surfmesh.num_triangles, rsurface.vertex3f, model->surfmesh.data_element3i, model->surfmesh.data_neighbor3i, relativelightorigin, relativelightdirection, projectdistance, numshadowmark, shadowmarklist, ent->mins, ent->maxs);
}
if (ent->model->brush.submodel)
GL_PolygonOffset(r_refdef.shadowpolygonfactor, r_refdef.shadowpolygonoffset);
}
--modelsurfacelistindex;
GL_CullFace(rsurface.texture->currentmaterialflags & MATERIALFLAG_NOCULLFACE ? GL_NONE : r_refdef.view.cullface_back);
- RSurf_PrepareVerticesForBatch(BATCHNEED_VERTEXPOSITION, batchnumsurfaces, batchsurfacelist);
- R_Mesh_PrepareVertices_Position(rsurface.batchnumvertices, rsurface.batchvertexposition, rsurface.batchvertexpositionbuffer);
- RSurf_DrawBatch();
+ RSurf_PrepareVerticesForBatch(false, false, batchnumsurfaces, batchsurfacelist);
+ RSurf_DrawBatch_Simple(batchnumsurfaces, batchsurfacelist);
}
}
int i, j, endsurface;
texture_t *t;
const msurface_t *surface;
- // note: in practice this never actually receives batches
+ // note: in practice this never actually receives batches), oh well
R_Shadow_RenderMode_Begin();
R_Shadow_RenderMode_ActiveLight(rtlight);
R_Shadow_RenderMode_Lighting(false, true, false);
surface = rsurface.modelsurfaces + surfacelist[j];
if (t != surface->texture)
break;
- R_Shadow_RenderLighting(1, &surface);
+ RSurf_PrepareVerticesForBatch(true, true, 1, &surface);
+ R_Shadow_RenderLighting(surface->num_firstvertex, surface->num_vertices, surface->num_firsttriangle, surface->num_triangles, ent->model->surfmesh.data_element3i, ent->model->surfmesh.data_element3s, ent->model->surfmesh.ebo3i, ent->model->surfmesh.ebo3s);
}
}
R_Shadow_RenderMode_End();
{
dp_model_t *model = ent->model;
const msurface_t *surface;
- int i, k, kend, l, endsurface, batchnumsurfaces, texturenumsurfaces;
- const msurface_t **texturesurfacelist;
+ int i, k, kend, l, m, mend, endsurface, batchnumsurfaces, batchnumtriangles, batchfirstvertex, batchlastvertex, batchfirsttriangle;
const int *element3i;
+ static int batchelements[BATCHSIZE*3];
texture_t *tex;
CHECKGLERROR
element3i = rsurface.modelelement3i;
}
if (r_shadow_usingdeferredprepass)
continue;
- texturenumsurfaces = kend - k;
- texturesurfacelist = batchsurfacelist + k;
- R_Shadow_RenderLighting(texturenumsurfaces, texturesurfacelist);
+ batchnumtriangles = 0;
+ batchfirsttriangle = surface->num_firsttriangle;
+ m = 0; // hush warning
+ for (l = k;l < kend;l++)
+ {
+ surface = batchsurfacelist[l];
+ RSurf_PrepareVerticesForBatch(true, true, 1, &surface);
+ for (m = surface->num_firsttriangle, mend = m + surface->num_triangles;m < mend;m++)
+ {
+ if (lighttrispvs && r_test.integer && !CHECKPVSBIT(lighttrispvs, m))
+ continue;
+ if (batchnumtriangles >= BATCHSIZE)
+ {
+ r_refdef.stats.lights_lighttriangles += batchnumtriangles;
+ Mod_VertexRangeFromElements(batchnumtriangles*3, batchelements, &batchfirstvertex, &batchlastvertex);
+ // use the element buffer if all triangles are consecutive
+ if (m == batchfirsttriangle + batchnumtriangles)
+ R_Shadow_RenderLighting(batchfirstvertex, batchlastvertex + 1 - batchfirstvertex, batchfirsttriangle, batchnumtriangles, ent->model->surfmesh.data_element3i, ent->model->surfmesh.data_element3s, ent->model->surfmesh.ebo3i, ent->model->surfmesh.ebo3s);
+ else
+ R_Shadow_RenderLighting(batchfirstvertex, batchlastvertex + 1 - batchfirstvertex, 0, batchnumtriangles, batchelements, NULL, 0, 0);
+ batchnumtriangles = 0;
+ batchfirsttriangle = m;
+ }
+ batchelements[batchnumtriangles*3+0] = element3i[m*3+0];
+ batchelements[batchnumtriangles*3+1] = element3i[m*3+1];
+ batchelements[batchnumtriangles*3+2] = element3i[m*3+2];
+ batchnumtriangles++;
+ }
+ }
+ if (batchnumtriangles > 0)
+ {
+ r_refdef.stats.lights_lighttriangles += batchnumtriangles;
+ Mod_VertexRangeFromElements(batchnumtriangles*3, batchelements, &batchfirstvertex, &batchlastvertex);
+ // use the element buffer if all triangles are consecutive
+ if (m == batchfirsttriangle + batchnumtriangles)
+ R_Shadow_RenderLighting(batchfirstvertex, batchlastvertex + 1 - batchfirstvertex, batchfirsttriangle, batchnumtriangles, ent->model->surfmesh.data_element3i, ent->model->surfmesh.data_element3s, ent->model->surfmesh.ebo3i, ent->model->surfmesh.ebo3s);
+ else
+ R_Shadow_RenderLighting(batchfirstvertex, batchlastvertex + 1 - batchfirstvertex, 0, batchnumtriangles, batchelements, NULL, 0, 0);
+ }
}
}
}
skinframe_t *skinframe;
if (!r_refdef.scene.worldmodel)
{
- if (gamemode != GAME_BLOODOMNICIDE)
- Con_Printf("There is no worldmodel\n");
+ Con_Printf("There is no worldmodel\n");
return;
}
m = r_refdef.scene.worldmodel;
}
if(!cl.islocalgame || !cl.worldmodel)
{
- if (gamemode != GAME_BLOODOMNICIDE)
- Con_Print("This command works only in singleplayer\n");
+ Con_Print("This command works only in singleplayer\n");
return;
}
r = Cmd_Argv(1);
// t->skinframes[0] = skinframe;
t->currentskinframe = skinframe;
t->currentskinframe = skinframe;
- if (gamemode != GAME_BLOODOMNICIDE)
- Con_Printf("%s replaced with %s\n", r, newt);
+ Con_Printf("%s replaced with %s\n", r, newt);
}
else
{
- if (gamemode != GAME_BLOODOMNICIDE)
- Con_Printf("%s was not found\n", newt);
+ Con_Printf("%s was not found\n", newt);
return;
}
}