Skip to content

Commit

Permalink
Pass options into renderers and fix antialiased depth
Browse files Browse the repository at this point in the history
  • Loading branch information
davepagurek committed Jan 22, 2023
1 parent d357542 commit 03bc94f
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions BlurRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ class BlurRenderer extends Renderer {
}
}

p5.prototype.createBlurRenderer = function() {
return new BlurRenderer(this)
p5.prototype.createBlurRenderer = function(options) {
return new BlurRenderer(this, options)
}

BlurRenderer.vert = `
Expand Down
4 changes: 2 additions & 2 deletions ContactShadowRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ class ContactShadowRenderer extends Renderer {
}
}

p5.prototype.createContactShadowRenderer = function() {
return new ContactShadowRenderer(this)
p5.prototype.createContactShadowRenderer = function(options) {
return new ContactShadowRenderer(this, options)
}

ContactShadowRenderer.vert = `
Expand Down
4 changes: 2 additions & 2 deletions GaussianBlurRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ class GaussianBlurRenderer extends BlurRenderer {
}
}

p5.prototype.createGaussianBlurRenderer = function() {
return new GaussianBlurRenderer(this)
p5.prototype.createGaussianBlurRenderer = function(options) {
return new GaussianBlurRenderer(this, options)
}

GaussianBlurRenderer.frag = `
Expand Down
2 changes: 1 addition & 1 deletion examples/shadows/sketch.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ let contactShadowRenderer

function setup() {
createCanvas(600, 600, WEBGL)
contactShadowRenderer = createContactShadowRenderer()
contactShadowRenderer = createContactShadowRenderer({ antialias: true })
contactShadowRenderer.setIntensity(0.9)
contactShadowRenderer.setExponent(500)
contactShadowRenderer.setSearchRadius(100)
Expand Down
2 changes: 1 addition & 1 deletion examples/simple/sketch.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ let fbo

function setup() {
createCanvas(400, 400, WEBGL)
fbo = createFramebuffer()
fbo = createFramebuffer({ antialias: true })
}

function draw() {
Expand Down
2 changes: 1 addition & 1 deletion p5.Framebuffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ class Framebuffer {
if (this.antialias && this._renderer.hasWebGL2) {
gl.bindFramebuffer(gl.READ_FRAMEBUFFER, this.aaFramebuffer)
gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, this.framebuffer)
for (const [flag, filter] of [[gl.COLOR_BUFFER_BIT, gl.LINEAR, gl.DEPTH_BUFFER_BIT, gl.NEAREST]]) {
for (const [flag, filter] of [[gl.COLOR_BUFFER_BIT, gl.LINEAR], [gl.DEPTH_BUFFER_BIT, gl.NEAREST]]) {
gl.blitFramebuffer(
0, 0,
this.width * this.density * this.aaDensity, this.height * this.density * this.aaDensity,
Expand Down

0 comments on commit 03bc94f

Please sign in to comment.