Browse Source

Swap texture window only when the texture changes between faces.

Saves a bit on performance, though could be even better if we checked for texture window changes instead of texture ID.
master
Nico de Poel 3 years ago
parent
commit
7c0c15019c
  1. 16
      world.c

16
world.c

@ -193,12 +193,6 @@ static void world_drawface_textured(const world_t *world, const ps1bsp_face_t *f
}
}
}
// Texture window commands needs to be placed *after* the draw commands, because the commands are executed in reverse order
DR_TWIN *twin = (DR_TWIN*)mem_prim(sizeof(DR_TWIN));
setlen(twin, 1);
twin->code[0] = texture->twin;
addPrim(ot, twin);
}
static void (*world_drawface)(const world_t*, const ps1bsp_face_t*, u_long *ot) = &world_drawface_fast;
@ -215,6 +209,16 @@ static void world_drawFaces(const world_t *world, const ps1bsp_face_t *firstFace
break;
world_drawface(world, face, curOT);
// Texture window commands needs to be placed *after* the draw commands, because the commands are executed in reverse order
if (face->nextFace == NULL || face->textureId != face->nextFace->textureId)
{
const ps1bsp_texture_t *texture = &world->textures[face->textureId];
DR_TWIN *twin = (DR_TWIN*)mem_prim(sizeof(DR_TWIN));
setlen(twin, 1);
twin->code[0] = texture->twin;
addPrim(curOT, twin);
}
}
}

Loading…
Cancel
Save