Skip to content

Commit

Permalink
renderer: fix texture not being freed properly
Browse files Browse the repository at this point in the history
  • Loading branch information
Helco committed Nov 27, 2018
1 parent 8c9657d commit a258d3c
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions renderer/renderer.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ void renderer_project(const Renderer* me, const Sector* sector, const lineSeg_t*
void renderer_renderWall(Renderer* me, GColor* framebuffer, const Sector* sector, int wallIndex)
{
const Wall* wall = &sector->walls[wallIndex];
const Texture* texture = texture_load(me->textureManager, wall->texture);

lineSeg_t wallSeg;
renderer_transformWall(me, sector, wallIndex, &wallSeg);
Expand All @@ -164,9 +163,9 @@ void renderer_renderWall(Renderer* me, GColor* framebuffer, const Sector* sector
return;

// render wall
const Texture* texture = texture_load(me->textureManager, wall->texture);
const int renderLeft = max(0, p.left.x);
const int renderRight = min(RENDERER_WIDTH - 1, p.right.x);
const real_t renderAmpl = real_from_int(renderRight - renderLeft + 1);
for (int x = renderLeft; x <= renderRight; x++) {
GColor* curPixel = framebuffer + x * RENDERER_HEIGHT;
int yCurStart = lerpi(x, p.left.x, p.right.x, p.left.yStart, p.right.yStart);
Expand Down

0 comments on commit a258d3c

Please sign in to comment.