Skip to content

Commit 3ef17b5

Browse files
committed
Use round instead of floor for texel get
1 parent e609114 commit 3ef17b5

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/backend/mode_gpu.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@
280280
'}',
281281
'',
282282
'float get(sampler2D tex, vec2 texSize, vec3 texDim, float z, float y, float x) {',
283-
' vec3 xyz = vec3(floor(x), floor(y), floor(z));',
283+
' vec3 xyz = vec3(floor(x + 0.5), floor(y + 0.5), floor(z + 0.5));',
284284
(opt.wraparound ? ' xyz = mod(xyz, texDim);' : ''),
285285
' float index = (xyz.z * texDim.x * texDim.y) + (xyz.y * texDim.x) + xyz.x;',
286286
' float t = (floor(index / texSize.x) + 0.5) / texSize.y;',

0 commit comments

Comments
 (0)