From 27a3f3f23ad003e46b5080a9b8339439912402ff Mon Sep 17 00:00:00 2001 From: Jordan Date: Sat, 29 Jun 2024 01:04:46 -0400 Subject: [PATCH] fix: revert Draw3D to fix overlapping model faces? --- src/js/jagex2/graphics/Draw3D.ts | 454 +++++++++++++++---------------- 1 file changed, 227 insertions(+), 227 deletions(-) diff --git a/src/js/jagex2/graphics/Draw3D.ts b/src/js/jagex2/graphics/Draw3D.ts index b32fbc07..c6bab97a 100644 --- a/src/js/jagex2/graphics/Draw3D.ts +++ b/src/js/jagex2/graphics/Draw3D.ts @@ -82,12 +82,12 @@ export default class Draw3D extends Draw2D { }; static init2D = (): void => { - this.lineOffset = new Int32Array(this.height2d); - for (let y: number = 0; y < this.height2d; y++) { - this.lineOffset[y] = this.width2d * y; + this.lineOffset = new Int32Array(Draw2D.height2d); + for (let y: number = 0; y < Draw2D.height2d; y++) { + this.lineOffset[y] = Draw2D.width2d * y; } - this.centerX = (this.width2d / 2) | 0; - this.centerY = (this.height2d / 2) | 0; + this.centerX = (Draw2D.width2d / 2) | 0; + this.centerY = (Draw2D.height2d / 2) | 0; }; static init3D = (width: number, height: number): void => { @@ -283,12 +283,12 @@ export default class Draw3D extends Draw2D { } if (yA <= yB && yA <= yC) { - if (yA < this.bottom) { - if (yB > this.bottom) { - yB = this.bottom; + if (yA < Draw2D.bottom) { + if (yB > Draw2D.bottom) { + yB = Draw2D.bottom; } - if (yC > this.bottom) { - yC = this.bottom; + if (yC > Draw2D.bottom) { + yC = Draw2D.bottom; } if (yB < yC) { xC = xA <<= 0x10; @@ -310,7 +310,7 @@ export default class Draw3D extends Draw2D { if ((yA !== yB && xStepAC < xStepAB) || (yA === yB && xStepAC > xStepBC)) { yC -= yB; yB -= yA; - yA = this.lineOffset[yA]; + yA = Draw3D.lineOffset[yA]; // eslint-disable-next-line no-constant-condition while (true) { yB--; @@ -321,25 +321,25 @@ export default class Draw3D extends Draw2D { if (yC < 0) { return; } - this.drawGouraudScanline(xC >> 16, xB >> 16, colorC >> 7, colorB >> 7, this.pixels, yA, 0); + this.drawGouraudScanline(xC >> 16, xB >> 16, colorC >> 7, colorB >> 7, Draw2D.pixels, yA, 0); xC += xStepAC; xB += xStepBC; colorC += colorStepAC; colorB += colorStepBC; - yA += this.width2d; + yA += Draw2D.width2d; } } - this.drawGouraudScanline(xC >> 16, xA >> 16, colorC >> 7, colorA >> 7, this.pixels, yA, 0); + this.drawGouraudScanline(xC >> 16, xA >> 16, colorC >> 7, colorA >> 7, Draw2D.pixels, yA, 0); xC += xStepAC; xA += xStepAB; colorC += colorStepAC; colorA += colorStepAB; - yA += this.width2d; + yA += Draw2D.width2d; } } else { yC -= yB; yB -= yA; - yA = this.lineOffset[yA]; + yA = Draw3D.lineOffset[yA]; // eslint-disable-next-line no-constant-condition while (true) { yB--; @@ -350,20 +350,20 @@ export default class Draw3D extends Draw2D { if (yC < 0) { return; } - this.drawGouraudScanline(xB >> 16, xC >> 16, colorB >> 7, colorC >> 7, this.pixels, yA, 0); + this.drawGouraudScanline(xB >> 16, xC >> 16, colorB >> 7, colorC >> 7, Draw2D.pixels, yA, 0); xC += xStepAC; xB += xStepBC; colorC += colorStepAC; colorB += colorStepBC; - yA += this.width2d; + yA += Draw2D.width2d; } } - this.drawGouraudScanline(xA >> 16, xC >> 16, colorA >> 7, colorC >> 7, this.pixels, yA, 0); + this.drawGouraudScanline(xA >> 16, xC >> 16, colorA >> 7, colorC >> 7, Draw2D.pixels, yA, 0); xC += xStepAC; xA += xStepAB; colorC += colorStepAC; colorA += colorStepAB; - yA += this.width2d; + yA += Draw2D.width2d; } } } else { @@ -386,7 +386,7 @@ export default class Draw3D extends Draw2D { if ((yA !== yC && xStepAC < xStepAB) || (yA === yC && xStepBC > xStepAB)) { yB -= yC; yC -= yA; - yA = this.lineOffset[yA]; + yA = Draw3D.lineOffset[yA]; // eslint-disable-next-line no-constant-condition while (true) { yC--; @@ -397,25 +397,25 @@ export default class Draw3D extends Draw2D { if (yB < 0) { return; } - this.drawGouraudScanline(xC >> 16, xA >> 16, colorC >> 7, colorA >> 7, this.pixels, yA, 0); + this.drawGouraudScanline(xC >> 16, xA >> 16, colorC >> 7, colorA >> 7, Draw2D.pixels, yA, 0); xC += xStepBC; xA += xStepAB; colorC += colorStepBC; colorA += colorStepAB; - yA += this.width2d; + yA += Draw2D.width2d; } } - this.drawGouraudScanline(xB >> 16, xA >> 16, colorB >> 7, colorA >> 7, this.pixels, yA, 0); + this.drawGouraudScanline(xB >> 16, xA >> 16, colorB >> 7, colorA >> 7, Draw2D.pixels, yA, 0); xB += xStepAC; xA += xStepAB; colorB += colorStepAC; colorA += colorStepAB; - yA += this.width2d; + yA += Draw2D.width2d; } } else { yB -= yC; yC -= yA; - yA = this.lineOffset[yA]; + yA = Draw3D.lineOffset[yA]; // eslint-disable-next-line no-constant-condition while (true) { yC--; @@ -426,31 +426,31 @@ export default class Draw3D extends Draw2D { if (yB < 0) { return; } - this.drawGouraudScanline(xA >> 16, xC >> 16, colorA >> 7, colorC >> 7, this.pixels, yA, 0); + this.drawGouraudScanline(xA >> 16, xC >> 16, colorA >> 7, colorC >> 7, Draw2D.pixels, yA, 0); xC += xStepBC; xA += xStepAB; colorC += colorStepBC; colorA += colorStepAB; - yA += this.width2d; + yA += Draw2D.width2d; } } - this.drawGouraudScanline(xA >> 16, xB >> 16, colorA >> 7, colorB >> 7, this.pixels, yA, 0); + this.drawGouraudScanline(xA >> 16, xB >> 16, colorA >> 7, colorB >> 7, Draw2D.pixels, yA, 0); xB += xStepAC; xA += xStepAB; colorB += colorStepAC; colorA += colorStepAB; - yA += this.width2d; + yA += Draw2D.width2d; } } } } } else if (yB <= yC) { - if (yB < this.bottom) { - if (yC > this.bottom) { - yC = this.bottom; + if (yB < Draw2D.bottom) { + if (yC > Draw2D.bottom) { + yC = Draw2D.bottom; } - if (yA > this.bottom) { - yA = this.bottom; + if (yA > Draw2D.bottom) { + yA = Draw2D.bottom; } if (yC < yA) { xA = xB <<= 0x10; @@ -472,7 +472,7 @@ export default class Draw3D extends Draw2D { if ((yB !== yC && xStepAB < xStepBC) || (yB === yC && xStepAB > xStepAC)) { yA -= yC; yC -= yB; - yB = this.lineOffset[yB]; + yB = Draw3D.lineOffset[yB]; // eslint-disable-next-line no-constant-condition while (true) { yC--; @@ -483,25 +483,25 @@ export default class Draw3D extends Draw2D { if (yA < 0) { return; } - this.drawGouraudScanline(xA >> 16, xC >> 16, colorA >> 7, colorC >> 7, this.pixels, yB, 0); + this.drawGouraudScanline(xA >> 16, xC >> 16, colorA >> 7, colorC >> 7, Draw2D.pixels, yB, 0); xA += xStepAB; xC += xStepAC; colorA += colorStepAB; colorC += colorStepAC; - yB += this.width2d; + yB += Draw2D.width2d; } } - this.drawGouraudScanline(xA >> 16, xB >> 16, colorA >> 7, colorB >> 7, this.pixels, yB, 0); + this.drawGouraudScanline(xA >> 16, xB >> 16, colorA >> 7, colorB >> 7, Draw2D.pixels, yB, 0); xA += xStepAB; xB += xStepBC; colorA += colorStepAB; colorB += colorStepBC; - yB += this.width2d; + yB += Draw2D.width2d; } } else { yA -= yC; yC -= yB; - yB = this.lineOffset[yB]; + yB = Draw3D.lineOffset[yB]; // eslint-disable-next-line no-constant-condition while (true) { yC--; @@ -512,20 +512,20 @@ export default class Draw3D extends Draw2D { if (yA < 0) { return; } - this.drawGouraudScanline(xC >> 16, xA >> 16, colorC >> 7, colorA >> 7, this.pixels, yB, 0); + this.drawGouraudScanline(xC >> 16, xA >> 16, colorC >> 7, colorA >> 7, Draw2D.pixels, yB, 0); xA += xStepAB; xC += xStepAC; colorA += colorStepAB; colorC += colorStepAC; - yB += this.width2d; + yB += Draw2D.width2d; } } - this.drawGouraudScanline(xB >> 16, xA >> 16, colorB >> 7, colorA >> 7, this.pixels, yB, 0); + this.drawGouraudScanline(xB >> 16, xA >> 16, colorB >> 7, colorA >> 7, Draw2D.pixels, yB, 0); xA += xStepAB; xB += xStepBC; colorA += colorStepAB; colorB += colorStepBC; - yB += this.width2d; + yB += Draw2D.width2d; } } } else { @@ -547,7 +547,7 @@ export default class Draw3D extends Draw2D { } yC -= yA; yA -= yB; - yB = this.lineOffset[yB]; + yB = Draw3D.lineOffset[yB]; if (xStepAB < xStepBC) { // eslint-disable-next-line no-constant-condition while (true) { @@ -559,20 +559,20 @@ export default class Draw3D extends Draw2D { if (yC < 0) { return; } - this.drawGouraudScanline(xA >> 16, xB >> 16, colorA >> 7, colorB >> 7, this.pixels, yB, 0); + this.drawGouraudScanline(xA >> 16, xB >> 16, colorA >> 7, colorB >> 7, Draw2D.pixels, yB, 0); xA += xStepAC; xB += xStepBC; colorA += colorStepAC; colorB += colorStepBC; - yB += this.width2d; + yB += Draw2D.width2d; } } - this.drawGouraudScanline(xC >> 16, xB >> 16, colorC >> 7, colorB >> 7, this.pixels, yB, 0); + this.drawGouraudScanline(xC >> 16, xB >> 16, colorC >> 7, colorB >> 7, Draw2D.pixels, yB, 0); xC += xStepAB; xB += xStepBC; colorC += colorStepAB; colorB += colorStepBC; - yB += this.width2d; + yB += Draw2D.width2d; } } else { // eslint-disable-next-line no-constant-condition @@ -585,30 +585,30 @@ export default class Draw3D extends Draw2D { if (yC < 0) { return; } - this.drawGouraudScanline(xB >> 16, xA >> 16, colorB >> 7, colorA >> 7, this.pixels, yB, 0); + this.drawGouraudScanline(xB >> 16, xA >> 16, colorB >> 7, colorA >> 7, Draw2D.pixels, yB, 0); xA += xStepAC; xB += xStepBC; colorA += colorStepAC; colorB += colorStepBC; - yB += this.width2d; + yB += Draw2D.width2d; } } - this.drawGouraudScanline(xB >> 16, xC >> 16, colorB >> 7, colorC >> 7, this.pixels, yB, 0); + this.drawGouraudScanline(xB >> 16, xC >> 16, colorB >> 7, colorC >> 7, Draw2D.pixels, yB, 0); xC += xStepAB; xB += xStepBC; colorC += colorStepAB; colorB += colorStepBC; - yB += this.width2d; + yB += Draw2D.width2d; } } } } - } else if (yC < this.bottom) { - if (yA > this.bottom) { - yA = this.bottom; + } else if (yC < Draw2D.bottom) { + if (yA > Draw2D.bottom) { + yA = Draw2D.bottom; } - if (yB > this.bottom) { - yB = this.bottom; + if (yB > Draw2D.bottom) { + yB = Draw2D.bottom; } if (yA < yB) { xB = xC <<= 0x10; @@ -629,7 +629,7 @@ export default class Draw3D extends Draw2D { } yB -= yA; yA -= yC; - yC = this.lineOffset[yC]; + yC = Draw3D.lineOffset[yC]; if (xStepBC < xStepAC) { // eslint-disable-next-line no-constant-condition while (true) { @@ -641,20 +641,20 @@ export default class Draw3D extends Draw2D { if (yB < 0) { return; } - this.drawGouraudScanline(xB >> 16, xA >> 16, colorB >> 7, colorA >> 7, this.pixels, yC, 0); + this.drawGouraudScanline(xB >> 16, xA >> 16, colorB >> 7, colorA >> 7, Draw2D.pixels, yC, 0); xB += xStepBC; xA += xStepAB; colorB += colorStepBC; colorA += colorStepAB; - yC += this.width2d; + yC += Draw2D.width2d; } } - this.drawGouraudScanline(xB >> 16, xC >> 16, colorB >> 7, colorC >> 7, this.pixels, yC, 0); + this.drawGouraudScanline(xB >> 16, xC >> 16, colorB >> 7, colorC >> 7, Draw2D.pixels, yC, 0); xB += xStepBC; xC += xStepAC; colorB += colorStepBC; colorC += colorStepAC; - yC += this.width2d; + yC += Draw2D.width2d; } } else { // eslint-disable-next-line no-constant-condition @@ -667,20 +667,20 @@ export default class Draw3D extends Draw2D { if (yB < 0) { return; } - this.drawGouraudScanline(xA >> 16, xB >> 16, colorA >> 7, colorB >> 7, this.pixels, yC, 0); + this.drawGouraudScanline(xA >> 16, xB >> 16, colorA >> 7, colorB >> 7, Draw2D.pixels, yC, 0); xB += xStepBC; xA += xStepAB; colorB += colorStepBC; colorA += colorStepAB; - yC += this.width2d; + yC += Draw2D.width2d; } } - this.drawGouraudScanline(xC >> 16, xB >> 16, colorC >> 7, colorB >> 7, this.pixels, yC, 0); + this.drawGouraudScanline(xC >> 16, xB >> 16, colorC >> 7, colorB >> 7, Draw2D.pixels, yC, 0); xB += xStepBC; xC += xStepAC; colorB += colorStepBC; colorC += colorStepAC; - yC += this.width2d; + yC += Draw2D.width2d; } } } else { @@ -702,7 +702,7 @@ export default class Draw3D extends Draw2D { } yA -= yB; yB -= yC; - yC = this.lineOffset[yC]; + yC = Draw3D.lineOffset[yC]; if (xStepBC < xStepAC) { // eslint-disable-next-line no-constant-condition while (true) { @@ -714,20 +714,20 @@ export default class Draw3D extends Draw2D { if (yA < 0) { return; } - this.drawGouraudScanline(xB >> 16, xC >> 16, colorB >> 7, colorC >> 7, this.pixels, yC, 0); + this.drawGouraudScanline(xB >> 16, xC >> 16, colorB >> 7, colorC >> 7, Draw2D.pixels, yC, 0); xB += xStepAB; xC += xStepAC; colorB += colorStepAB; colorC += colorStepAC; - yC += this.width2d; + yC += Draw2D.width2d; } } - this.drawGouraudScanline(xA >> 16, xC >> 16, colorA >> 7, colorC >> 7, this.pixels, yC, 0); + this.drawGouraudScanline(xA >> 16, xC >> 16, colorA >> 7, colorC >> 7, Draw2D.pixels, yC, 0); xA += xStepBC; xC += xStepAC; colorA += colorStepBC; colorC += colorStepAC; - yC += this.width2d; + yC += Draw2D.width2d; } } else { // eslint-disable-next-line no-constant-condition @@ -740,20 +740,20 @@ export default class Draw3D extends Draw2D { if (yA < 0) { return; } - this.drawGouraudScanline(xC >> 16, xB >> 16, colorC >> 7, colorB >> 7, this.pixels, yC, 0); + this.drawGouraudScanline(xC >> 16, xB >> 16, colorC >> 7, colorB >> 7, Draw2D.pixels, yC, 0); xB += xStepAB; xC += xStepAC; colorB += colorStepAB; colorC += colorStepAC; - yC += this.width2d; + yC += Draw2D.width2d; } } - this.drawGouraudScanline(xC >> 16, xA >> 16, colorC >> 7, colorA >> 7, this.pixels, yC, 0); + this.drawGouraudScanline(xC >> 16, xA >> 16, colorC >> 7, colorA >> 7, Draw2D.pixels, yC, 0); xA += xStepBC; xC += xStepAC; colorA += colorStepBC; colorC += colorStepAC; - yC += this.width2d; + yC += Draw2D.width2d; } } } @@ -763,17 +763,17 @@ export default class Draw3D extends Draw2D { private static drawGouraudScanline = (x0: number, x1: number, color0: number, color1: number, dst: Int32Array, offset: number, length: number): void => { let rgb: number; - if (this.jagged) { + if (Draw3D.jagged) { let colorStep: number; - if (this.clipX) { + if (Draw3D.clipX) { if (x1 - x0 > 3) { colorStep = ((color1 - color0) / (x1 - x0)) | 0; } else { colorStep = 0; } - if (x1 > this.boundX) { - x1 = this.boundX; + if (x1 > Draw2D.boundX) { + x1 = Draw2D.boundX; } if (x0 < 0) { color0 -= x0 * colorStep; @@ -789,7 +789,7 @@ export default class Draw3D extends Draw2D { offset += x0; length = (x1 - x0) >> 2; if (length > 0) { - colorStep = ((color1 - color0) * this.reciprocal15[length]) >> 15; + colorStep = ((color1 - color0) * Draw3D.reciprocal15[length]) >> 15; } else { colorStep = 0; } @@ -797,14 +797,14 @@ export default class Draw3D extends Draw2D { return; } - if (this.alpha === 0) { + if (Draw3D.alpha === 0) { // eslint-disable-next-line no-constant-condition while (true) { length--; if (length < 0) { length = (x1 - x0) & 0x3; if (length > 0) { - rgb = this.palette[color0 >> 8]; + rgb = Draw3D.palette[color0 >> 8]; do { dst[offset++] = rgb; length--; @@ -813,7 +813,7 @@ export default class Draw3D extends Draw2D { } break; } - rgb = this.palette[color0 >> 8]; + rgb = Draw3D.palette[color0 >> 8]; color0 += colorStep; dst[offset++] = rgb; dst[offset++] = rgb; @@ -821,15 +821,15 @@ export default class Draw3D extends Draw2D { dst[offset++] = rgb; } } else { - const alpha: number = this.alpha; - const invAlpha: number = 256 - this.alpha; + const alpha: number = Draw3D.alpha; + const invAlpha: number = 256 - Draw3D.alpha; // eslint-disable-next-line no-constant-condition while (true) { length--; if (length < 0) { length = (x1 - x0) & 0x3; if (length > 0) { - rgb = this.palette[color0 >> 8]; + rgb = Draw3D.palette[color0 >> 8]; rgb = ((((rgb & 0xff00ff) * invAlpha) >> 8) & 0xff00ff) + ((((rgb & 0xff00) * invAlpha) >> 8) & 0xff00); do { dst[offset++] = rgb + ((((dst[offset] & 0xff00ff) * alpha) >> 8) & 0xff00ff) + ((((dst[offset] & 0xff00) * alpha) >> 8) & 0xff00); @@ -838,7 +838,7 @@ export default class Draw3D extends Draw2D { } break; } - rgb = this.palette[color0 >> 8]; + rgb = Draw3D.palette[color0 >> 8]; color0 += colorStep; rgb = ((((rgb & 0xff00ff) * invAlpha) >> 8) & 0xff00ff) + ((((rgb & 0xff00) * invAlpha) >> 8) & 0xff00); dst[offset++] = rgb + ((((dst[offset] & 0xff00ff) * alpha) >> 8) & 0xff00ff) + ((((dst[offset] & 0xff00) * alpha) >> 8) & 0xff00); @@ -849,9 +849,9 @@ export default class Draw3D extends Draw2D { } } else if (x0 < x1) { const colorStep: number = ((color1 - color0) / (x1 - x0)) | 0; - if (this.clipX) { - if (x1 > this.boundX) { - x1 = this.boundX; + if (Draw3D.clipX) { + if (x1 > Draw2D.boundX) { + x1 = Draw2D.boundX; } if (x0 < 0) { color0 -= x0 * colorStep; @@ -863,17 +863,17 @@ export default class Draw3D extends Draw2D { } offset += x0; length = x1 - x0; - if (this.alpha === 0) { + if (Draw3D.alpha === 0) { do { - dst[offset++] = this.palette[color0 >> 8]; + dst[offset++] = Draw3D.palette[color0 >> 8]; color0 += colorStep; length--; } while (length > 0); } else { - const alpha: number = this.alpha; - const invAlpha: number = 256 - this.alpha; + const alpha: number = Draw3D.alpha; + const invAlpha: number = 256 - Draw3D.alpha; do { - rgb = this.palette[color0 >> 8]; + rgb = Draw3D.palette[color0 >> 8]; color0 += colorStep; rgb = ((((rgb & 0xff00ff) * invAlpha) >> 8) & 0xff00ff) + ((((rgb & 0xff00) * invAlpha) >> 8) & 0xff00); dst[offset++] = rgb + ((((dst[offset] & 0xff00ff) * alpha) >> 8) & 0xff00ff) + ((((dst[offset] & 0xff00) * alpha) >> 8) & 0xff00); @@ -897,12 +897,12 @@ export default class Draw3D extends Draw2D { xStepAC = (((x0 - x2) << 16) / (y0 - y2)) | 0; } if (y0 <= y1 && y0 <= y2) { - if (y0 < this.bottom) { - if (y1 > this.bottom) { - y1 = this.bottom; + if (y0 < Draw2D.bottom) { + if (y1 > Draw2D.bottom) { + y1 = Draw2D.bottom; } - if (y2 > this.bottom) { - y2 = this.bottom; + if (y2 > Draw2D.bottom) { + y2 = Draw2D.bottom; } if (y1 < y2) { x2 = x0 <<= 0x10; @@ -930,16 +930,16 @@ export default class Draw3D extends Draw2D { if (y2 < 0) { return; } - this.drawScanline(x2 >> 16, x1 >> 16, this.pixels, y0, color); + this.drawScanline(x2 >> 16, x1 >> 16, Draw2D.pixels, y0, color); x2 += xStepAC; x1 += xStepBC; - y0 += this.width2d; + y0 += Draw2D.width2d; } } - this.drawScanline(x2 >> 16, x0 >> 16, this.pixels, y0, color); + this.drawScanline(x2 >> 16, x0 >> 16, Draw2D.pixels, y0, color); x2 += xStepAC; x0 += xStepAB; - y0 += this.width2d; + y0 += Draw2D.width2d; } } else { y2 -= y1; @@ -955,16 +955,16 @@ export default class Draw3D extends Draw2D { if (y2 < 0) { return; } - this.drawScanline(x1 >> 16, x2 >> 16, this.pixels, y0, color); + this.drawScanline(x1 >> 16, x2 >> 16, Draw2D.pixels, y0, color); x2 += xStepAC; x1 += xStepBC; - y0 += this.width2d; + y0 += Draw2D.width2d; } } - this.drawScanline(x0 >> 16, x2 >> 16, this.pixels, y0, color); + this.drawScanline(x0 >> 16, x2 >> 16, Draw2D.pixels, y0, color); x2 += xStepAC; x0 += xStepAB; - y0 += this.width2d; + y0 += Draw2D.width2d; } } } else { @@ -993,16 +993,16 @@ export default class Draw3D extends Draw2D { if (y1 < 0) { return; } - this.drawScanline(x2 >> 16, x0 >> 16, this.pixels, y0, color); + this.drawScanline(x2 >> 16, x0 >> 16, Draw2D.pixels, y0, color); x2 += xStepBC; x0 += xStepAB; - y0 += this.width2d; + y0 += Draw2D.width2d; } } - this.drawScanline(x1 >> 16, x0 >> 16, this.pixels, y0, color); + this.drawScanline(x1 >> 16, x0 >> 16, Draw2D.pixels, y0, color); x1 += xStepAC; x0 += xStepAB; - y0 += this.width2d; + y0 += Draw2D.width2d; } } else { y1 -= y2; @@ -1018,27 +1018,27 @@ export default class Draw3D extends Draw2D { if (y1 < 0) { return; } - this.drawScanline(x0 >> 16, x2 >> 16, this.pixels, y0, color); + this.drawScanline(x0 >> 16, x2 >> 16, Draw2D.pixels, y0, color); x2 += xStepBC; x0 += xStepAB; - y0 += this.width2d; + y0 += Draw2D.width2d; } } - this.drawScanline(x0 >> 16, x1 >> 16, this.pixels, y0, color); + this.drawScanline(x0 >> 16, x1 >> 16, Draw2D.pixels, y0, color); x1 += xStepAC; x0 += xStepAB; - y0 += this.width2d; + y0 += Draw2D.width2d; } } } } } else if (y1 <= y2) { - if (y1 < this.bottom) { - if (y2 > this.bottom) { - y2 = this.bottom; + if (y1 < Draw2D.bottom) { + if (y2 > Draw2D.bottom) { + y2 = Draw2D.bottom; } - if (y0 > this.bottom) { - y0 = this.bottom; + if (y0 > Draw2D.bottom) { + y0 = Draw2D.bottom; } if (y2 < y0) { x0 = x1 <<= 0x10; @@ -1066,16 +1066,16 @@ export default class Draw3D extends Draw2D { if (y0 < 0) { return; } - this.drawScanline(x0 >> 16, x2 >> 16, this.pixels, y1, color); + this.drawScanline(x0 >> 16, x2 >> 16, Draw2D.pixels, y1, color); x0 += xStepAB; x2 += xStepAC; - y1 += this.width2d; + y1 += Draw2D.width2d; } } - this.drawScanline(x0 >> 16, x1 >> 16, this.pixels, y1, color); + this.drawScanline(x0 >> 16, x1 >> 16, Draw2D.pixels, y1, color); x0 += xStepAB; x1 += xStepBC; - y1 += this.width2d; + y1 += Draw2D.width2d; } } else { y0 -= y2; @@ -1091,16 +1091,16 @@ export default class Draw3D extends Draw2D { if (y0 < 0) { return; } - this.drawScanline(x2 >> 16, x0 >> 16, this.pixels, y1, color); + this.drawScanline(x2 >> 16, x0 >> 16, Draw2D.pixels, y1, color); x0 += xStepAB; x2 += xStepAC; - y1 += this.width2d; + y1 += Draw2D.width2d; } } - this.drawScanline(x1 >> 16, x0 >> 16, this.pixels, y1, color); + this.drawScanline(x1 >> 16, x0 >> 16, Draw2D.pixels, y1, color); x0 += xStepAB; x1 += xStepBC; - y1 += this.width2d; + y1 += Draw2D.width2d; } } } else { @@ -1129,16 +1129,16 @@ export default class Draw3D extends Draw2D { if (y2 < 0) { return; } - this.drawScanline(x0 >> 16, x1 >> 16, this.pixels, y1, color); + this.drawScanline(x0 >> 16, x1 >> 16, Draw2D.pixels, y1, color); x0 += xStepAC; x1 += xStepBC; - y1 += this.width2d; + y1 += Draw2D.width2d; } } - this.drawScanline(x2 >> 16, x1 >> 16, this.pixels, y1, color); + this.drawScanline(x2 >> 16, x1 >> 16, Draw2D.pixels, y1, color); x2 += xStepAB; x1 += xStepBC; - y1 += this.width2d; + y1 += Draw2D.width2d; } } else { y2 -= y0; @@ -1154,26 +1154,26 @@ export default class Draw3D extends Draw2D { if (y2 < 0) { return; } - this.drawScanline(x1 >> 16, x0 >> 16, this.pixels, y1, color); + this.drawScanline(x1 >> 16, x0 >> 16, Draw2D.pixels, y1, color); x0 += xStepAC; x1 += xStepBC; - y1 += this.width2d; + y1 += Draw2D.width2d; } } - this.drawScanline(x1 >> 16, x2 >> 16, this.pixels, y1, color); + this.drawScanline(x1 >> 16, x2 >> 16, Draw2D.pixels, y1, color); x2 += xStepAB; x1 += xStepBC; - y1 += this.width2d; + y1 += Draw2D.width2d; } } } } - } else if (y2 < this.bottom) { - if (y0 > this.bottom) { - y0 = this.bottom; + } else if (y2 < Draw2D.bottom) { + if (y0 > Draw2D.bottom) { + y0 = Draw2D.bottom; } - if (y1 > this.bottom) { - y1 = this.bottom; + if (y1 > Draw2D.bottom) { + y1 = Draw2D.bottom; } if (y0 < y1) { x1 = x2 <<= 0x10; @@ -1201,16 +1201,16 @@ export default class Draw3D extends Draw2D { if (y1 < 0) { return; } - this.drawScanline(x1 >> 16, x0 >> 16, this.pixels, y2, color); + this.drawScanline(x1 >> 16, x0 >> 16, Draw2D.pixels, y2, color); x1 += xStepBC; x0 += xStepAB; - y2 += this.width2d; + y2 += Draw2D.width2d; } } - this.drawScanline(x1 >> 16, x2 >> 16, this.pixels, y2, color); + this.drawScanline(x1 >> 16, x2 >> 16, Draw2D.pixels, y2, color); x1 += xStepBC; x2 += xStepAC; - y2 += this.width2d; + y2 += Draw2D.width2d; } } else { y1 -= y0; @@ -1226,16 +1226,16 @@ export default class Draw3D extends Draw2D { if (y1 < 0) { return; } - this.drawScanline(x0 >> 16, x1 >> 16, this.pixels, y2, color); + this.drawScanline(x0 >> 16, x1 >> 16, Draw2D.pixels, y2, color); x1 += xStepBC; x0 += xStepAB; - y2 += this.width2d; + y2 += Draw2D.width2d; } } - this.drawScanline(x2 >> 16, x1 >> 16, this.pixels, y2, color); + this.drawScanline(x2 >> 16, x1 >> 16, Draw2D.pixels, y2, color); x1 += xStepBC; x2 += xStepAC; - y2 += this.width2d; + y2 += Draw2D.width2d; } } } else { @@ -1264,16 +1264,16 @@ export default class Draw3D extends Draw2D { if (y0 < 0) { return; } - this.drawScanline(x1 >> 16, x2 >> 16, this.pixels, y2, color); + this.drawScanline(x1 >> 16, x2 >> 16, Draw2D.pixels, y2, color); x1 += xStepAB; x2 += xStepAC; - y2 += this.width2d; + y2 += Draw2D.width2d; } } - this.drawScanline(x0 >> 16, x2 >> 16, this.pixels, y2, color); + this.drawScanline(x0 >> 16, x2 >> 16, Draw2D.pixels, y2, color); x0 += xStepBC; x2 += xStepAC; - y2 += this.width2d; + y2 += Draw2D.width2d; } } else { y0 -= y1; @@ -1289,16 +1289,16 @@ export default class Draw3D extends Draw2D { if (y0 < 0) { return; } - this.drawScanline(x2 >> 16, x1 >> 16, this.pixels, y2, color); + this.drawScanline(x2 >> 16, x1 >> 16, Draw2D.pixels, y2, color); x1 += xStepAB; x2 += xStepAC; - y2 += this.width2d; + y2 += Draw2D.width2d; } } - this.drawScanline(x2 >> 16, x0 >> 16, this.pixels, y2, color); + this.drawScanline(x2 >> 16, x0 >> 16, Draw2D.pixels, y2, color); x0 += xStepBC; x2 += xStepAC; - y2 += this.width2d; + y2 += Draw2D.width2d; } } } @@ -1371,13 +1371,13 @@ export default class Draw3D extends Draw2D { } if (yA <= yB && yA <= yC) { - if (yA < this.bottom) { - if (yB > this.bottom) { - yB = this.bottom; + if (yA < Draw2D.bottom) { + if (yB > Draw2D.bottom) { + yB = Draw2D.bottom; } - if (yC > this.bottom) { - yC = this.bottom; + if (yC > Draw2D.bottom) { + yC = Draw2D.bottom; } if (yB < yC) { @@ -1418,12 +1418,12 @@ export default class Draw3D extends Draw2D { if (yC < 0) { return; } - this.drawTexturedScanline(xC >> 16, xB >> 16, this.pixels, yA, texels, 0, 0, u, v, w, uStride, vStride, wStride, shadeC >> 8, shadeB >> 8); + this.drawTexturedScanline(xC >> 16, xB >> 16, Draw2D.pixels, yA, texels, 0, 0, u, v, w, uStride, vStride, wStride, shadeC >> 8, shadeB >> 8); xC += xStepAC; xB += xStepBC; shadeC += shadeStepAC; shadeB += shadeStepBC; - yA += this.width2d; + yA += Draw2D.width2d; u += uStepVertical; v += vStepVertical; w += wStepVertical; @@ -1432,12 +1432,12 @@ export default class Draw3D extends Draw2D { w |= 0; } } - this.drawTexturedScanline(xC >> 16, xA >> 16, this.pixels, yA, texels, 0, 0, u, v, w, uStride, vStride, wStride, shadeC >> 8, shadeA >> 8); + this.drawTexturedScanline(xC >> 16, xA >> 16, Draw2D.pixels, yA, texels, 0, 0, u, v, w, uStride, vStride, wStride, shadeC >> 8, shadeA >> 8); xC += xStepAC; xA += xStepAB; shadeC += shadeStepAC; shadeA += shadeStepAB; - yA += this.width2d; + yA += Draw2D.width2d; u += uStepVertical; v += vStepVertical; w += wStepVertical; @@ -1459,12 +1459,12 @@ export default class Draw3D extends Draw2D { if (yC < 0) { return; } - this.drawTexturedScanline(xB >> 16, xC >> 16, this.pixels, yA, texels, 0, 0, u, v, w, uStride, vStride, wStride, shadeB >> 8, shadeC >> 8); + this.drawTexturedScanline(xB >> 16, xC >> 16, Draw2D.pixels, yA, texels, 0, 0, u, v, w, uStride, vStride, wStride, shadeB >> 8, shadeC >> 8); xC += xStepAC; xB += xStepBC; shadeC += shadeStepAC; shadeB += shadeStepBC; - yA += this.width2d; + yA += Draw2D.width2d; u += uStepVertical; v += vStepVertical; w += wStepVertical; @@ -1473,12 +1473,12 @@ export default class Draw3D extends Draw2D { w |= 0; } } - this.drawTexturedScanline(xA >> 16, xC >> 16, this.pixels, yA, texels, 0, 0, u, v, w, uStride, vStride, wStride, shadeA >> 8, shadeC >> 8); + this.drawTexturedScanline(xA >> 16, xC >> 16, Draw2D.pixels, yA, texels, 0, 0, u, v, w, uStride, vStride, wStride, shadeA >> 8, shadeC >> 8); xC += xStepAC; xA += xStepAB; shadeC += shadeStepAC; shadeA += shadeStepAB; - yA += this.width2d; + yA += Draw2D.width2d; u += uStepVertical; v += vStepVertical; w += wStepVertical; @@ -1525,12 +1525,12 @@ export default class Draw3D extends Draw2D { if (yB < 0) { return; } - this.drawTexturedScanline(xA >> 16, xC >> 16, this.pixels, yA, texels, 0, 0, u, v, w, uStride, vStride, wStride, shadeA >> 8, shadeC >> 8); + this.drawTexturedScanline(xA >> 16, xC >> 16, Draw2D.pixels, yA, texels, 0, 0, u, v, w, uStride, vStride, wStride, shadeA >> 8, shadeC >> 8); xC += xStepBC; xA += xStepAB; shadeC += shadeStepBC; shadeA += shadeStepAB; - yA += this.width2d; + yA += Draw2D.width2d; u += uStepVertical; v += vStepVertical; w += wStepVertical; @@ -1539,12 +1539,12 @@ export default class Draw3D extends Draw2D { w |= 0; } } - this.drawTexturedScanline(xA >> 16, xB >> 16, this.pixels, yA, texels, 0, 0, u, v, w, uStride, vStride, wStride, shadeA >> 8, shadeB >> 8); + this.drawTexturedScanline(xA >> 16, xB >> 16, Draw2D.pixels, yA, texels, 0, 0, u, v, w, uStride, vStride, wStride, shadeA >> 8, shadeB >> 8); xB += xStepAC; xA += xStepAB; shadeB += shadeStepAC; shadeA += shadeStepAB; - yA += this.width2d; + yA += Draw2D.width2d; u += uStepVertical; v += vStepVertical; w += wStepVertical; @@ -1566,12 +1566,12 @@ export default class Draw3D extends Draw2D { if (yB < 0) { return; } - this.drawTexturedScanline(xC >> 16, xA >> 16, this.pixels, yA, texels, 0, 0, u, v, w, uStride, vStride, wStride, shadeC >> 8, shadeA >> 8); + this.drawTexturedScanline(xC >> 16, xA >> 16, Draw2D.pixels, yA, texels, 0, 0, u, v, w, uStride, vStride, wStride, shadeC >> 8, shadeA >> 8); xC += xStepBC; xA += xStepAB; shadeC += shadeStepBC; shadeA += shadeStepAB; - yA += this.width2d; + yA += Draw2D.width2d; u += uStepVertical; v += vStepVertical; w += wStepVertical; @@ -1580,12 +1580,12 @@ export default class Draw3D extends Draw2D { w |= 0; } } - this.drawTexturedScanline(xB >> 16, xA >> 16, this.pixels, yA, texels, 0, 0, u, v, w, uStride, vStride, wStride, shadeB >> 8, shadeA >> 8); + this.drawTexturedScanline(xB >> 16, xA >> 16, Draw2D.pixels, yA, texels, 0, 0, u, v, w, uStride, vStride, wStride, shadeB >> 8, shadeA >> 8); xB += xStepAC; xA += xStepAB; shadeB += shadeStepAC; shadeA += shadeStepAB; - yA += this.width2d; + yA += Draw2D.width2d; u += uStepVertical; v += vStepVertical; w += wStepVertical; @@ -1597,12 +1597,12 @@ export default class Draw3D extends Draw2D { } } } else if (yB <= yC) { - if (yB < this.bottom) { - if (yC > this.bottom) { - yC = this.bottom; + if (yB < Draw2D.bottom) { + if (yC > Draw2D.bottom) { + yC = Draw2D.bottom; } - if (yA > this.bottom) { - yA = this.bottom; + if (yA > Draw2D.bottom) { + yA = Draw2D.bottom; } if (yC < yA) { xA = xB <<= 0x10; @@ -1642,12 +1642,12 @@ export default class Draw3D extends Draw2D { if (yA < 0) { return; } - this.drawTexturedScanline(xA >> 16, xC >> 16, this.pixels, yB, texels, 0, 0, u, v, w, uStride, vStride, wStride, shadeA >> 8, shadeC >> 8); + this.drawTexturedScanline(xA >> 16, xC >> 16, Draw2D.pixels, yB, texels, 0, 0, u, v, w, uStride, vStride, wStride, shadeA >> 8, shadeC >> 8); xA += xStepAB; xC += xStepAC; shadeA += shadeStepAB; shadeC += shadeStepAC; - yB += this.width2d; + yB += Draw2D.width2d; u += uStepVertical; v += vStepVertical; w += wStepVertical; @@ -1656,12 +1656,12 @@ export default class Draw3D extends Draw2D { w |= 0; } } - this.drawTexturedScanline(xA >> 16, xB >> 16, this.pixels, yB, texels, 0, 0, u, v, w, uStride, vStride, wStride, shadeA >> 8, shadeB >> 8); + this.drawTexturedScanline(xA >> 16, xB >> 16, Draw2D.pixels, yB, texels, 0, 0, u, v, w, uStride, vStride, wStride, shadeA >> 8, shadeB >> 8); xA += xStepAB; xB += xStepBC; shadeA += shadeStepAB; shadeB += shadeStepBC; - yB += this.width2d; + yB += Draw2D.width2d; u += uStepVertical; v += vStepVertical; w += wStepVertical; @@ -1683,12 +1683,12 @@ export default class Draw3D extends Draw2D { if (yA < 0) { return; } - this.drawTexturedScanline(xC >> 16, xA >> 16, this.pixels, yB, texels, 0, 0, u, v, w, uStride, vStride, wStride, shadeC >> 8, shadeA >> 8); + this.drawTexturedScanline(xC >> 16, xA >> 16, Draw2D.pixels, yB, texels, 0, 0, u, v, w, uStride, vStride, wStride, shadeC >> 8, shadeA >> 8); xA += xStepAB; xC += xStepAC; shadeA += shadeStepAB; shadeC += shadeStepAC; - yB += this.width2d; + yB += Draw2D.width2d; u += uStepVertical; v += vStepVertical; w += wStepVertical; @@ -1697,12 +1697,12 @@ export default class Draw3D extends Draw2D { w |= 0; } } - this.drawTexturedScanline(xB >> 16, xA >> 16, this.pixels, yB, texels, 0, 0, u, v, w, uStride, vStride, wStride, shadeB >> 8, shadeA >> 8); + this.drawTexturedScanline(xB >> 16, xA >> 16, Draw2D.pixels, yB, texels, 0, 0, u, v, w, uStride, vStride, wStride, shadeB >> 8, shadeA >> 8); xA += xStepAB; xB += xStepBC; shadeA += shadeStepAB; shadeB += shadeStepBC; - yB += this.width2d; + yB += Draw2D.width2d; u += uStepVertical; v += vStepVertical; w += wStepVertical; @@ -1749,12 +1749,12 @@ export default class Draw3D extends Draw2D { if (yC < 0) { return; } - this.drawTexturedScanline(xA >> 16, xB >> 16, this.pixels, yB, texels, 0, 0, u, v, w, uStride, vStride, wStride, shadeA >> 8, shadeB >> 8); + this.drawTexturedScanline(xA >> 16, xB >> 16, Draw2D.pixels, yB, texels, 0, 0, u, v, w, uStride, vStride, wStride, shadeA >> 8, shadeB >> 8); xA += xStepAC; xB += xStepBC; shadeA += shadeStepAC; shadeB += shadeStepBC; - yB += this.width2d; + yB += Draw2D.width2d; u += uStepVertical; v += vStepVertical; w += wStepVertical; @@ -1763,12 +1763,12 @@ export default class Draw3D extends Draw2D { w |= 0; } } - this.drawTexturedScanline(xC >> 16, xB >> 16, this.pixels, yB, texels, 0, 0, u, v, w, uStride, vStride, wStride, shadeC >> 8, shadeB >> 8); + this.drawTexturedScanline(xC >> 16, xB >> 16, Draw2D.pixels, yB, texels, 0, 0, u, v, w, uStride, vStride, wStride, shadeC >> 8, shadeB >> 8); xC += xStepAB; xB += xStepBC; shadeC += shadeStepAB; shadeB += shadeStepBC; - yB += this.width2d; + yB += Draw2D.width2d; u += uStepVertical; v += vStepVertical; w += wStepVertical; @@ -1787,12 +1787,12 @@ export default class Draw3D extends Draw2D { if (yC < 0) { return; } - this.drawTexturedScanline(xB >> 16, xA >> 16, this.pixels, yB, texels, 0, 0, u, v, w, uStride, vStride, wStride, shadeB >> 8, shadeA >> 8); + this.drawTexturedScanline(xB >> 16, xA >> 16, Draw2D.pixels, yB, texels, 0, 0, u, v, w, uStride, vStride, wStride, shadeB >> 8, shadeA >> 8); xA += xStepAC; xB += xStepBC; shadeA += shadeStepAC; shadeB += shadeStepBC; - yB += this.width2d; + yB += Draw2D.width2d; u += uStepVertical; v += vStepVertical; w += wStepVertical; @@ -1801,12 +1801,12 @@ export default class Draw3D extends Draw2D { w |= 0; } } - this.drawTexturedScanline(xB >> 16, xC >> 16, this.pixels, yB, texels, 0, 0, u, v, w, uStride, vStride, wStride, shadeB >> 8, shadeC >> 8); + this.drawTexturedScanline(xB >> 16, xC >> 16, Draw2D.pixels, yB, texels, 0, 0, u, v, w, uStride, vStride, wStride, shadeB >> 8, shadeC >> 8); xC += xStepAB; xB += xStepBC; shadeC += shadeStepAB; shadeB += shadeStepBC; - yB += this.width2d; + yB += Draw2D.width2d; u += uStepVertical; v += vStepVertical; w += wStepVertical; @@ -1817,12 +1817,12 @@ export default class Draw3D extends Draw2D { } } } - } else if (yC < this.bottom) { - if (yA > this.bottom) { - yA = this.bottom; + } else if (yC < Draw2D.bottom) { + if (yA > Draw2D.bottom) { + yA = Draw2D.bottom; } - if (yB > this.bottom) { - yB = this.bottom; + if (yB > Draw2D.bottom) { + yB = Draw2D.bottom; } if (yA < yB) { xB = xC <<= 0x10; @@ -1862,12 +1862,12 @@ export default class Draw3D extends Draw2D { if (yB < 0) { return; } - this.drawTexturedScanline(xB >> 16, xA >> 16, this.pixels, yC, texels, 0, 0, u, v, w, uStride, vStride, wStride, shadeB >> 8, shadeA >> 8); + this.drawTexturedScanline(xB >> 16, xA >> 16, Draw2D.pixels, yC, texels, 0, 0, u, v, w, uStride, vStride, wStride, shadeB >> 8, shadeA >> 8); xB += xStepBC; xA += xStepAB; shadeB += shadeStepBC; shadeA += shadeStepAB; - yC += this.width2d; + yC += Draw2D.width2d; u += uStepVertical; v += vStepVertical; w += wStepVertical; @@ -1876,12 +1876,12 @@ export default class Draw3D extends Draw2D { w |= 0; } } - this.drawTexturedScanline(xB >> 16, xC >> 16, this.pixels, yC, texels, 0, 0, u, v, w, uStride, vStride, wStride, shadeB >> 8, shadeC >> 8); + this.drawTexturedScanline(xB >> 16, xC >> 16, Draw2D.pixels, yC, texels, 0, 0, u, v, w, uStride, vStride, wStride, shadeB >> 8, shadeC >> 8); xB += xStepBC; xC += xStepAC; shadeB += shadeStepBC; shadeC += shadeStepAC; - yC += this.width2d; + yC += Draw2D.width2d; u += uStepVertical; v += vStepVertical; w += wStepVertical; @@ -1900,12 +1900,12 @@ export default class Draw3D extends Draw2D { if (yB < 0) { return; } - this.drawTexturedScanline(xA >> 16, xB >> 16, this.pixels, yC, texels, 0, 0, u, v, w, uStride, vStride, wStride, shadeA >> 8, shadeB >> 8); + this.drawTexturedScanline(xA >> 16, xB >> 16, Draw2D.pixels, yC, texels, 0, 0, u, v, w, uStride, vStride, wStride, shadeA >> 8, shadeB >> 8); xB += xStepBC; xA += xStepAB; shadeB += shadeStepBC; shadeA += shadeStepAB; - yC += this.width2d; + yC += Draw2D.width2d; u += uStepVertical; v += vStepVertical; w += wStepVertical; @@ -1914,12 +1914,12 @@ export default class Draw3D extends Draw2D { w |= 0; } } - this.drawTexturedScanline(xC >> 16, xB >> 16, this.pixels, yC, texels, 0, 0, u, v, w, uStride, vStride, wStride, shadeC >> 8, shadeB >> 8); + this.drawTexturedScanline(xC >> 16, xB >> 16, Draw2D.pixels, yC, texels, 0, 0, u, v, w, uStride, vStride, wStride, shadeC >> 8, shadeB >> 8); xB += xStepBC; xC += xStepAC; shadeB += shadeStepBC; shadeC += shadeStepAC; - yC += this.width2d; + yC += Draw2D.width2d; u += uStepVertical; v += vStepVertical; w += wStepVertical; @@ -1966,12 +1966,12 @@ export default class Draw3D extends Draw2D { if (yA < 0) { return; } - this.drawTexturedScanline(xB >> 16, xC >> 16, this.pixels, yC, texels, 0, 0, u, v, w, uStride, vStride, wStride, shadeB >> 8, shadeC >> 8); + this.drawTexturedScanline(xB >> 16, xC >> 16, Draw2D.pixels, yC, texels, 0, 0, u, v, w, uStride, vStride, wStride, shadeB >> 8, shadeC >> 8); xB += xStepAB; xC += xStepAC; shadeB += shadeStepAB; shadeC += shadeStepAC; - yC += this.width2d; + yC += Draw2D.width2d; u += uStepVertical; v += vStepVertical; w += wStepVertical; @@ -1980,12 +1980,12 @@ export default class Draw3D extends Draw2D { w |= 0; } } - this.drawTexturedScanline(xA >> 16, xC >> 16, this.pixels, yC, texels, 0, 0, u, v, w, uStride, vStride, wStride, shadeA >> 8, shadeC >> 8); + this.drawTexturedScanline(xA >> 16, xC >> 16, Draw2D.pixels, yC, texels, 0, 0, u, v, w, uStride, vStride, wStride, shadeA >> 8, shadeC >> 8); xA += xStepBC; xC += xStepAC; shadeA += shadeStepBC; shadeC += shadeStepAC; - yC += this.width2d; + yC += Draw2D.width2d; u += uStepVertical; v += vStepVertical; w += wStepVertical; @@ -2004,12 +2004,12 @@ export default class Draw3D extends Draw2D { if (yA < 0) { return; } - this.drawTexturedScanline(xC >> 16, xB >> 16, this.pixels, yC, texels, 0, 0, u, v, w, uStride, vStride, wStride, shadeC >> 8, shadeB >> 8); + this.drawTexturedScanline(xC >> 16, xB >> 16, Draw2D.pixels, yC, texels, 0, 0, u, v, w, uStride, vStride, wStride, shadeC >> 8, shadeB >> 8); xB += xStepAB; xC += xStepAC; shadeB += shadeStepAB; shadeC += shadeStepAC; - yC += this.width2d; + yC += Draw2D.width2d; u += uStepVertical; v += vStepVertical; w += wStepVertical; @@ -2018,12 +2018,12 @@ export default class Draw3D extends Draw2D { w |= 0; } } - this.drawTexturedScanline(xC >> 16, xA >> 16, this.pixels, yC, texels, 0, 0, u, v, w, uStride, vStride, wStride, shadeC >> 8, shadeA >> 8); + this.drawTexturedScanline(xC >> 16, xA >> 16, Draw2D.pixels, yC, texels, 0, 0, u, v, w, uStride, vStride, wStride, shadeC >> 8, shadeA >> 8); xA += xStepBC; xC += xStepAC; shadeA += shadeStepBC; shadeC += shadeStepAC; - yC += this.width2d; + yC += Draw2D.width2d; u += uStepVertical; v += vStepVertical; w += wStepVertical; @@ -2062,8 +2062,8 @@ export default class Draw3D extends Draw2D { if (this.clipX) { shadeStrides = ((shadeB - shadeA) / (xB - xA)) | 0; - if (xB > this.boundX) { - xB = this.boundX; + if (xB > Draw2D.boundX) { + xB = Draw2D.boundX; } if (xA < 0) { @@ -2456,8 +2456,8 @@ export default class Draw3D extends Draw2D { private static drawScanline = (x0: number, x1: number, dst: Int32Array, offset: number, rgb: number): void => { if (this.clipX) { - if (x1 > this.boundX) { - x1 = this.boundX; + if (x1 > Draw2D.boundX) { + x1 = Draw2D.boundX; } if (x0 < 0) { x0 = 0;