Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
TheFakeMontyOnTheRun committed Aug 11, 2023
1 parent c217a2a commit 4ece0cc
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions mx_frontend/base3d/src/CRenderer_Rasterization.c
Original file line number Diff line number Diff line change
Expand Up @@ -338,10 +338,15 @@ void drawWall(FixP_t x0,
}

if (iy < 0) {
FixP_t diff = intToFix((-iy));
v += Mul(diff, dv);
destinationLine += -iy * (XRES_FRAMEBUFFER);
iy = 0;
FixP_t diff = -y0;
int32_t iv = fixToInt(v);
lastV = iv;
v += Mul(diff, dv);
iv = fixToInt(v);
destinationLine += -iy * (XRES_FRAMEBUFFER);
iy = 0;
pixel = *(lineOffset);
lineOffset = ((iv & (NATIVE_TEXTURE_SIZE - 1)) + sourceLineStart);
}

stipple = (((ix + iy) & 1)) ? 0xFFFFFFFF : 0;
Expand All @@ -353,7 +358,6 @@ void drawWall(FixP_t x0,
stipple = ~stipple;

if (iv != lastV && !(stipple && farForStipple)) {

pixel = *(lineOffset);
lineOffset = ((iv & (NATIVE_TEXTURE_SIZE - 1)) + sourceLineStart);
lastV = iv;
Expand Down Expand Up @@ -852,14 +856,20 @@ void drawFloor(FixP_t y0,
lastDiffX = diffX;
}

sourceLineStart = texture + (fixToInt(v) * NATIVE_TEXTURE_SIZE);

if (ix < 0) {
FixP_t diff = intToFix((-ix + 0));
FixP_t diff = -iX0;
lastU = fixToInt(u);
u += Mul(diff, du);
ix = 0;
const int32_t iu = fixToInt(u);
sourceLineStart += (iu - lastU);
pixel = *(sourceLineStart);
}

destinationLine = bufferData + (XRES_FRAMEBUFFER * iy) + ix;
sourceLineStart = texture + (fixToInt(v) * NATIVE_TEXTURE_SIZE);

pixel = *(sourceLineStart);
stipple = ((iX0 + iy) & 1) ? 0xFFFFFFFF : 0;

Expand Down

0 comments on commit 4ece0cc

Please sign in to comment.