void renderLinePET() { for (x = xL; x < xR; x++) { pos = x + offset; if (z < zBuffer[pos]) { lutID = ((nx >> 16) & 255) + (((ny >> 16) & 255) << 8); bkgrd = screen.p[pos]; c = texture.pixel[((tx >> 16) & tw) + (((ty >> 16) & th) << tbitW)]; c = ColorUtility.multiply(c, diffuse[lutID]); s = ColorUtility.add(specular[lutID], envmap[lutID]); s = ColorUtility.scale(s, reflectivity); c = ColorUtility.transparency(bkgrd, c, transparency); c = ColorUtility.add(c, s); screen.p[pos] = 0xFF000000 | c; zBuffer[pos] = (uint)z; if (useIdBuffer) { idBuffer[pos] = currentId; } } z += dz; nx += dnx; ny += dny; tx += dtx; ty += dty; } }
void renderLineE() { for (x = xL; x < xR; x++) { pos = x + offset; if (z < zBuffer[pos]) { lutID = ((nx >> 16) & 255) + (((ny >> 16) & 255) << 8); bkgrd = screen.p[pos]; s = ColorUtility.add(specular[lutID], envmap[lutID]); s = ColorUtility.scale(s, reflectivity); c = ColorUtility.transparency(bkgrd, s, transparency); screen.p[pos] = 0xFF000000 | c; zBuffer[pos] = (uint)z; if (useIdBuffer) { idBuffer[pos] = currentId; } } z += dz; nx += dnx; ny += dny; } }
public static Texture blendTopDown(Texture top, Texture down) { down.resize(top.width, top.height); var t = new Texture(top.width, top.height); var pos = 0; uint alpha; for (var y = 0; y < top.height; y++) { alpha = (uint)(255 * y / (top.height - 1)); for (var x = 0; x < top.width; x++) { t.pixel[pos] = ColorUtility.transparency(down.pixel[pos], top.pixel[pos], alpha); pos++; } } return(t); }
// Fast scanline rendering void renderLineF() { for (x = xL; x < xR; x++) { pos = x + offset; if (z < zBuffer[pos]) { bkgrd = screen.p[pos]; c = ColorUtility.transparency(bkgrd, currentColor, transparency); screen.p[pos] = 0xFF000000 | c; zBuffer[pos] = (uint)z; if (useIdBuffer) { idBuffer[pos] = currentId; } } z += dz; } }
void renderLineT() { for (x = xL; x < xR; x++) { pos = x + offset; if (z < zBuffer[pos]) { bkgrd = screen.p[pos]; c = texture.pixel[((tx >> 16) & tw) + (((ty >> 16) & th) << tbitW)]; c = ColorUtility.transparency(bkgrd, c, transparency); screen.p[pos] = 0xFF000000 | c; zBuffer[pos] = (uint)z; if (useIdBuffer) { idBuffer[pos] = currentId; } } z += dz; tx += dtx; ty += dty; } }