Skip to content

Commit 6b60fd0

Browse files
committed
adding glslify to plotly.js
1 parent 87cbc9c commit 6b60fd0

File tree

8 files changed

+15
-11
lines changed

8 files changed

+15
-11
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@
103103
"fs-extra": "^1.0.0",
104104
"fuse.js": "^2.2.0",
105105
"glob": "^7.0.0",
106+
"glslify": "^6.0.1",
106107
"gzip-size": "^3.0.0",
107108
"image-size": "^0.5.0",
108109
"jasmine-core": "^2.4.1",

src/traces/parcoords/lineLayer.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@
1010

1111
var utils = require('./utils');
1212
var createREGL = require('regl');
13-
var vertexShaderSource = require('./shaderVertex');
14-
var fragmentShaderSource = require('./shaderFragment');
13+
var glslify = require('glslify');
14+
var vertexShaderSource = glslify('./shaderVertex.glsl');
15+
var fragmentShaderSource = glslify('./shaderFragment.glsl');
1516

1617
var depthLimitEpsilon = 1e-6; // don't change; otherwise near/far plane lines are lost
1718
var filterEpsilon = 1e-3; // don't change; otherwise filter may lose lines on domain boundaries
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
precision lowp float;
2+
3+
varying vec4 fragColor;
4+
5+
void main() {
6+
gl_FragColor = fragColor;
7+
}

src/traces/parcoords/shaderFragment.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/traces/parcoords/shaderVertex.js renamed to src/traces/parcoords/shaderVertex.glsl

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
module.exports = `
2-
31
precision highp float;
42

53
attribute vec4 p0, p1, p2, p3,
@@ -75,6 +73,4 @@ void main() {
7573

7674
float clampedColorIndex = clamp((colorIndex - colorClamp[0]) / (colorClamp[1] - colorClamp[0]), 0.0, 1.0);
7775
fragColor = texture2D(palette, vec2((clampedColorIndex * 255.0 + 0.5) / 256.0, 0.5));
78-
}
79-
80-
`
76+
}

tasks/util/browserify_wrapper.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ module.exports = function _bundle(pathToIndex, pathToBundle, opts) {
3838
var browserifyOpts = {};
3939
browserifyOpts.standalone = opts.standalone;
4040
browserifyOpts.debug = opts.debug;
41-
browserifyOpts.transform = outputMinified ? [compressAttributes] : [];
41+
browserifyOpts.transform = outputMinified ? ['glslify', compressAttributes] : ['glslify'];
4242

4343
var b = browserify(pathToIndex, browserifyOpts),
4444
bundleWriteStream = fs.createWriteStream(pathToBundle);

tasks/util/watchified_bundle.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ module.exports = function makeWatchifiedBundle(onFirstBundleCallback) {
2222
var b = browserify(constants.pathToPlotlyIndex, {
2323
debug: true,
2424
standalone: 'Plotly',
25-
transform: [compressAttributes],
25+
transform: ['glslify', compressAttributes],
2626
cache: {},
2727
packageCache: {},
2828
plugin: [watchify]

test/jasmine/karma.conf.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ func.defaultConfig = {
9595
singleRun: false,
9696

9797
browserify: {
98-
transform: ['../../tasks/util/shortcut_paths.js'],
98+
transform: ['glslify', '../../tasks/util/shortcut_paths.js'],
9999
extensions: ['.js'],
100100
watch: true,
101101
debug: true

0 commit comments

Comments
 (0)