Skip to content

Commit

Permalink
fix(glsl): fix bilinear texture call in sim
Browse files Browse the repository at this point in the history
  • Loading branch information
MrTelanie committed Jul 3, 2021
1 parent de9106c commit 89fc7eb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/glsl/builtin-texture.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ export class Texture2D {

get(builtIn, pos) {
const { w, h, bilinear } = this;
let x = pos.x * w;
let y = pos.y * h;
let x = pos.x * w - 0.5;
let y = pos.y * h - 0.5;

x = (x + w) % w;
y = (y + h) % h;
Expand Down
2 changes: 1 addition & 1 deletion test/glsl/sim.js
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ float action(vec2 one, vec2 two) {

const shader = ({ texture, vec2, vec4, sampler2D }) => {
let bar = vec4((image = sampler2D()) => {
return texture(image, vec2(0.0, 0.0));
return texture(image, vec2(0.5, 0.5));
});
return { bar };
};
Expand Down

0 comments on commit 89fc7eb

Please sign in to comment.