rt: fix polylights facing the wrong direction

This commit is contained in:
Ivan Avdeev 2022-01-15 19:54:35 -08:00
parent 90bf0bc262
commit 6853ad51ea

View File

@ -440,7 +440,6 @@ static model_sizes_t computeSizes( const model_t *mod ) {
static void loadEmissiveSurface(const model_t *mod, const int surface_index, const msurface_t *surf, const vec3_t emissive) {
rt_light_add_polygon_t lpoly;
const qboolean flip = !!FBitSet( surf->flags, SURF_PLANEBACK );
lpoly.num_vertices = Q_min(7, surf->numedges);
// TODO split, don't clip
@ -450,8 +449,7 @@ static void loadEmissiveSurface(const model_t *mod, const int surface_index, con
VectorCopy(emissive, lpoly.emissive);
for (int i = 0; i < lpoly.num_vertices; ++i) {
const int index = flip ? lpoly.num_vertices - i - 1 : i;
const int iedge = mod->surfedges[surf->firstedge + index];
const int iedge = mod->surfedges[surf->firstedge + i];
const medge_t *edge = mod->edges + (iedge >= 0 ? iedge : -iedge);
const mvertex_t *vertex = mod->vertexes + (iedge >= 0 ? edge->v[0] : edge->v[1]);
VectorCopy(vertex->position, lpoly.vertices[i]);