Skip to content

Commit

Permalink
Fix cpu-render.html coordinate space
Browse files Browse the repository at this point in the history
This should ensure that CPU/GPU diffs are actually useful,
and not improperly shifted.
  • Loading branch information
adroitwhiz committed Jun 30, 2021
1 parent c5b78e5 commit 7f79231
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions test/integration/cpu-render.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,15 @@
return { id, drawable };
}).filter(Boolean);
const color = new Uint8ClampedArray(3);
for (let x = -239; x <= 240; x++) {
for (let y = -180; y< 180; y++) {
render.constructor.sampleColor3b([x, y], drawBits, color);
const offset = (((179-y) * 480) + 239 + x) * 4
const vec = [0, 0];
for (let x = 0; x < 480; x++) {
// leftmost pixel is -240, rightmost is 239
vec[0] = x - 240;
for (let y = 0; y < 360; y++) {
// bottommost pixel is -179, topmost is 180
vec[1] = 180 - y;
render.constructor.sampleColor3b(vec, drawBits, color);
const offset = ((y * 480) + x) * 4;
cpuImageData.data.set(color, offset);
}
}
Expand Down

0 comments on commit 7f79231

Please sign in to comment.