Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

## v0.7.4

- Increase floating point precision (#5)
- Fix a rare glitch in the lasso selection where the lasso would be drawn with a far away point
- Smoothify lasso by lowering the min delay and min dist
- Update 2D camera and many dev packages
Expand Down
8 changes: 4 additions & 4 deletions src/point.vs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const VERTEX_SHADER = `
precision mediump float;
precision highp float;

uniform sampler2D colorTex;
uniform float colorTexRes;
Expand Down Expand Up @@ -29,7 +29,7 @@ void main() {
float stateRowIndex = floor((stateIndex + eps) / stateTexRes);
vec2 stateTexIndex = vec2(
(stateIndex / stateTexRes) - stateRowIndex + eps,
stateRowIndex / stateTexRes
stateRowIndex / stateTexRes + eps
);

vec4 state = texture2D(stateTex, stateTexIndex);
Expand All @@ -47,13 +47,13 @@ void main() {
eps = 0.5 / colorTexRes;
float colorLinearIndex = colorIndex + globalState;
// Need to add cEps here to avoid floating point issue that can lead to
// dramatic changes in which color is loaded as floor(3/2.9) = 1 but
// dramatic changes in which color is loaded as floor(3/2.9999) = 1 but
// floor(3/3.0001) = 0!
float colorRowIndex = floor((colorLinearIndex + eps) / colorTexRes);

vec2 colorTexIndex = vec2(
(colorLinearIndex / colorTexRes) - colorRowIndex + eps,
colorRowIndex / colorTexRes
colorRowIndex / colorTexRes + eps
);

color = texture2D(colorTex, colorTexIndex);
Expand Down