Skip to content

Commit

Permalink
Fix rectMode() in 3D
Browse files Browse the repository at this point in the history
  • Loading branch information
jbuck committed Sep 15, 2011
1 parent 558d58b commit c1855dd
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 0 deletions.
13 changes: 13 additions & 0 deletions processing.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -13748,6 +13748,19 @@
throw "rect() with rounded corners is not supported in 3D mode"; throw "rect() with rounded corners is not supported in 3D mode";
} }


if (curRectMode === PConstants.CORNERS) {
width -= x;
height -= y;
}
if (curRectMode === PConstants.RADIUS) {
width *= 2;
height *= 2;
}
if (curRectMode === PConstants.CENTER || curRectMode === PConstants.RADIUS) {
x -= width / 2;
y -= height / 2;
}

// Modeling transformation // Modeling transformation
var model = new PMatrix3D(); var model = new PMatrix3D();
model.translate(x, y, 0); model.translate(x, y, 0);
Expand Down
51 changes: 51 additions & 0 deletions test/ref/rectMode-3d.pde

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions test/ref/tests.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ var tests = [
{ path: "continuous-curve.pde", tags: ["2D"], epsilonOverride: 0.09 }, { path: "continuous-curve.pde", tags: ["2D"], epsilonOverride: 0.09 },
{ path: "points-lines.pde", tags: ["2D", "Crisp"] }, { path: "points-lines.pde", tags: ["2D", "Crisp"] },
{ path: "rectMode.pde", tags: ["2D", "Crisp"] }, { path: "rectMode.pde", tags: ["2D", "Crisp"] },
{ path: "rectMode-3d.pde", tags: ["3D"] },
{ path: "rect-quad.pde", tags: ["2D"] }, { path: "rect-quad.pde", tags: ["2D"] },
{ path: "size-fill-rect.pde", tags: ["2D"] }, { path: "size-fill-rect.pde", tags: ["2D"] },
{ path: "triangle.pde", tags: ["2D"] }, { path: "triangle.pde", tags: ["2D"] },
Expand Down

0 comments on commit c1855dd

Please sign in to comment.