Fix off by one error in the path color buffer

This commit is contained in:
Patrick Walton 2017-08-24 16:23:02 -07:00
parent 1213eaa3d7
commit 77db92bc42
1 changed files with 3 additions and 3 deletions

View File

@ -677,11 +677,11 @@ class PathfinderView {
}
uploadPathData(pathCount: number) {
const pathColors = new Uint8Array(4 * pathCount);
const pathColors = new Uint8Array(4 * (pathCount + 1));
for (let pathIndex = 0; pathIndex < pathCount; pathIndex++) {
for (let channel = 0; channel < 3; channel++)
pathColors[pathIndex * 4 + channel] = 0x00; // RGB
pathColors[pathIndex * 4 + 3] = 0xff; // alpha
pathColors[(pathIndex + 1) * 4 + channel] = 0x00; // RGB
pathColors[(pathIndex + 1) * 4 + 3] = 0xff; // alpha
}
this.pathColorsBufferTexture.upload(this.gl, pathColors);