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
15 changes: 7 additions & 8 deletions lib/shaders/pick-vertex.glsl
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
precision mediump float;
precision highp float;

attribute vec2 position;
attribute vec2 positionHi, positionLo;
attribute vec2 offset;
attribute vec4 id;

uniform mat3 viewTransform;
uniform vec2 pixelScale;
uniform vec2 scaleHi, scaleLo, translateHi, translateLo, pixelScale;
uniform vec4 pickOffset;

varying vec4 fragColor;
Expand All @@ -27,8 +26,8 @@ void main() {
fragColor = fragId / 255.0;

gl_Position = computePosition(
position,
offset,
viewTransform,
pixelScale);
positionHi, positionLo,
scaleHi, scaleLo,
translateHi, translateLo,
pixelScale, offset);
}
15 changes: 7 additions & 8 deletions lib/shaders/vertex.glsl
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
precision mediump float;
precision highp float;

attribute vec2 position;
attribute vec2 positionHi, positionLo;
attribute vec2 offset;
attribute vec4 color;

uniform mat3 viewTransform;
uniform vec2 pixelScale;
uniform vec2 scaleHi, scaleLo, translateHi, translateLo, pixelScale;

varying vec4 fragColor;

Expand All @@ -15,8 +14,8 @@ void main() {
fragColor = color;

gl_Position = computePosition(
position,
offset,
viewTransform,
pixelScale);
positionHi, positionLo,
scaleHi, scaleLo,
translateHi, translateLo,
pixelScale, offset);
}
15 changes: 7 additions & 8 deletions lib/shaders/xform.glsl
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
vec4 computePosition(vec2 position, vec2 offset, mat3 view, vec2 scale) {
vec3 xposition = view * vec3(position, 1.0);
return vec4(
xposition.xy + scale * offset * xposition.z,
0,
xposition.z);
}

#pragma glslify: export(computePosition)
vec4 computePosition(vec2 posHi, vec2 posLo, vec2 scHi, vec2 scLo, vec2 trHi, vec2 trLo, vec2 screenScale, vec2 screenOffset) {
return vec4(scHi * posHi + trHi
+ scLo * posHi + trLo
+ scHi * posLo
+ scLo * posLo
+ screenScale * screenOffset, 0, 1);
}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gl-scatter2d-fancy",
"version": "1.1.3",
"version": "1.2.0",
"description": "Fancy and slow scatter plots",
"main": "scatter-fancy.js",
"scripts": {
Expand All @@ -15,6 +15,7 @@
"plot"
],
"author": "Mikola Lysenko",
"contributors": ["Étienne Tétreault-Pinard", "Robert Monfera"],
"license": "MIT",
"bugs": {
"url": "https://github.com/gl-vis/gl-scatter2d-fancy/issues"
Expand Down
Loading