Skip to content

Commit

Permalink
renderer: Support legacy option 'perspectiveCorrectTexturing'
Browse files Browse the repository at this point in the history
  • Loading branch information
leikareipa committed Jun 13, 2020
1 parent 74fadc3 commit 3dcb028
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
9 changes: 5 additions & 4 deletions distributable/rngon.cat.js
@@ -1,6 +1,6 @@
// WHAT: Concatenated JavaScript source files
// PROGRAM: Retro n-gon renderer
// VERSION: beta live (13 June 2020 17:57:09 UTC)
// VERSION: beta live (13 June 2020 18:54:39 UTC)
// AUTHOR: Tarpeeksi Hyvae Soft and others
// LINK: https://www.github.com/leikareipa/retro-ngon/
// FILES:
Expand Down Expand Up @@ -1104,7 +1104,7 @@ Rngon.ngon_filler = function(auxiliaryBuffers = [])
const [startV, deltaV] = interpolants(v1, v2, interpolatePerspective);

// (1 / W), for perspective-correct mapping.
const [startInvW, deltaInvW] = interpolatePerspective? interpolants(1, 1, true) : [1, 0];
const [startInvW, deltaInvW] = (interpolatePerspective? interpolants(1, 1, true) : [1, 0]);

(isLeftEdge? leftEdges : rightEdges).push({
startY, endY,
Expand Down Expand Up @@ -1135,7 +1135,7 @@ Rngon.ngon_filler = function(auxiliaryBuffers = [])
{
return [
(start / vert1.w),
(((end / vert2.w) - (start / vert1.w)) / edgeHeight)
(((end / vert2.w) - (start / vert1.w)) / edgeHeight)
];
}
else
Expand Down Expand Up @@ -1556,7 +1556,8 @@ Rngon.render = function(canvasElementId,
Rngon.internalState.useDepthBuffer = (options.useDepthBuffer == true);
Rngon.internalState.showGlobalWireframe = (options.globalWireframe == true);
Rngon.internalState.applyViewportClipping = (options.clipToViewport == true);
Rngon.internalState.usePerspectiveCorrectInterpolation = (options.perspectiveCorrectInterpolation == true);
Rngon.internalState.usePerspectiveCorrectInterpolation = ((options.perspectiveCorrectTexturing || // <- Name in pre-beta.2.
options.perspectiveCorrectInterpolation) == true);
Rngon.internalState.lights = options.lights;
Rngon.internalState.farPlaneDistance = options.farPlane;

Expand Down
3 changes: 2 additions & 1 deletion js/retro-ngon/render.js
Expand Up @@ -39,7 +39,8 @@ Rngon.render = function(canvasElementId,
Rngon.internalState.useDepthBuffer = (options.useDepthBuffer == true);
Rngon.internalState.showGlobalWireframe = (options.globalWireframe == true);
Rngon.internalState.applyViewportClipping = (options.clipToViewport == true);
Rngon.internalState.usePerspectiveCorrectInterpolation = (options.perspectiveCorrectInterpolation == true);
Rngon.internalState.usePerspectiveCorrectInterpolation = ((options.perspectiveCorrectTexturing || // <- Name in pre-beta.2.
options.perspectiveCorrectInterpolation) == true);
Rngon.internalState.lights = options.lights;
Rngon.internalState.farPlaneDistance = options.farPlane;

Expand Down

0 comments on commit 3dcb028

Please sign in to comment.