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
2 changes: 1 addition & 1 deletion axes.js
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ proto.draw = function(params) {
var v = (i + 1 + (j^1)) % 3
if(this.zeroEnable[v]) {
//Check if zero line in bounds
if(bounds[0][v] <= 0 && bounds[1][v] >= 0) {
if(Math.min(bounds[0][v], bounds[1][v]) <= 0 && Math.max(bounds[0][v], bounds[1][v]) >= 0) {
this._lines.drawZero(u, v, this.bounds, x, this.zeroLineColor[v], this.zeroLineWidth[v]*this.pixelRatio)
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/shaders/backgroundFrag.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ uniform vec4 colors[3];
varying vec3 colorChannel;

void main() {
gl_FragColor = colorChannel.x * colors[0] +
gl_FragColor = colorChannel.x * colors[0] +
colorChannel.y * colors[1] +
colorChannel.z * colors[2];
}
14 changes: 11 additions & 3 deletions lib/shaders/backgroundVert.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,19 @@ uniform vec3 bounds[2];
varying vec3 colorChannel;

void main() {
if(dot(normal, enable) > 0.0) {
vec3 nPosition = mix(bounds[0], bounds[1], 0.5 * (position + 1.0));

vec3 signAxis = sign(bounds[1] - bounds[0]);

vec3 realNormal = signAxis * normal;

if(dot(realNormal, enable) > 0.0) {
vec3 minRange = min(bounds[0], bounds[1]);
vec3 maxRange = max(bounds[0], bounds[1]);
vec3 nPosition = mix(minRange, maxRange, 0.5 * (position + 1.0));
gl_Position = projection * view * model * vec4(nPosition, 1.0);
} else {
gl_Position = vec4(0,0,0,0);
}
colorChannel = abs(normal);

colorChannel = abs(realNormal);
}