@@ -749,6 +749,7 @@ let lastMappedPosition = null
749
749
let cumulativeZoomFactor = 1
750
750
let zMultiplier = - 1
751
751
let buffers = null
752
+ let showLines = true
752
753
let showHeatmap = true
753
754
let lightingOn = true
754
755
@@ -781,6 +782,7 @@ function initialize3DTableGraphic(moodyReport, tableModelMatrix) {
781
782
buffers = getBuffers ( gl , moodyReport , zMultiplier )
782
783
} )
783
784
785
+ document . getElementById ( "showLines" ) . addEventListener ( "change" , event => showLines = event . target . checked )
784
786
document . getElementById ( "showHeatmap" ) . addEventListener ( "change" , event => showHeatmap = event . target . checked )
785
787
document . getElementById ( "lightingOn" ) . addEventListener ( "change" , event => lightingOn = event . target . checked )
786
788
@@ -895,6 +897,7 @@ function initialize3DTableGraphic(moodyReport, tableModelMatrix) {
895
897
lightPos : gl . getUniformLocation ( shaderProgram , "lightPos" ) ,
896
898
lightPower : gl . getUniformLocation ( shaderProgram , "lightPower" ) ,
897
899
sampler : gl . getUniformLocation ( shaderProgram , "sampler" ) ,
900
+ showLines : gl . getUniformLocation ( shaderProgram , "showLines" ) ,
898
901
showHeatmap : gl . getUniformLocation ( shaderProgram , "showHeatmap" ) ,
899
902
lightingOn : gl . getUniformLocation ( shaderProgram , "lightingOn" ) ,
900
903
} ,
@@ -956,6 +959,7 @@ function drawTableSurface(moodyReport, gl, programInfo, buffers, tableModelMatri
956
959
gl . activeTexture ( gl . TEXTURE0 )
957
960
gl . bindTexture ( gl . TEXTURE_2D , texture )
958
961
gl . uniform1i ( programInfo . uniformLocations . sampler , 0 )
962
+ gl . uniform1i ( programInfo . uniformLocations . showLines , showLines )
959
963
gl . uniform1i ( programInfo . uniformLocations . showHeatmap , showHeatmap )
960
964
gl . uniform1i ( programInfo . uniformLocations . lightingOn , lightingOn )
961
965
@@ -1042,14 +1046,19 @@ const fsSource = `#version 300 es
1042
1046
uniform vec3 lightPos;
1043
1047
uniform float lightPower;
1044
1048
uniform sampler2D sampler;
1049
+ uniform bool showLines;
1045
1050
uniform bool showHeatmap;
1046
1051
uniform bool lightingOn;
1047
1052
out vec4 outputColor;
1048
1053
1049
1054
void main() {
1050
1055
if (vVertexType == 0.0) {
1051
1056
// This vertex belongs to one of the Union jack Moody lines.
1052
- outputColor = color;
1057
+ if (showLines) {
1058
+ outputColor = color;
1059
+ } else {
1060
+ discard;
1061
+ }
1053
1062
} else {
1054
1063
// This vertex belongs to the table mesh.
1055
1064
vec3 normal = normalize(normalInterp);
@@ -1075,7 +1084,6 @@ const fsSource = `#version 300 es
1075
1084
// apply gamma correction (assume ambientColor, diffuseColor and specColor
1076
1085
// have been linearized, i.e. have no gamma correction in them)
1077
1086
vec3 colorGammaCorrected = pow(colorLinear, vec3(1.0 / screenGamma));
1078
- // Show the table with a granite texture:
1079
1087
if (!showHeatmap) {
1080
1088
if (lightingOn) {
1081
1089
outputColor = texture(sampler, textureCoord) * vec4(colorGammaCorrected, 1.0);
@@ -1084,6 +1092,7 @@ const fsSource = `#version 300 es
1084
1092
}
1085
1093
} else {
1086
1094
if (lightingOn) {
1095
+ // No heatmap - show the table with a granite texture.
1087
1096
outputColor = vec4(color.rgb * colorGammaCorrected, 1.0);
1088
1097
} else {
1089
1098
outputColor = color;
@@ -1155,7 +1164,7 @@ function getPositionBuffer(gl, moodyReport, zMultiplier) {
1155
1164
const numRepeatsX = 1
1156
1165
const numRepeatsY = numRepeatsX * tableSurfaceRatio
1157
1166
// Map [minX, maxX] => [0, 1] and [minY, maxY] => [0, 1]
1158
- // (val - A)*(b-a)/(B- A) + a
1167
+ // (val - A) * (b - a) / (B - A) + a
1159
1168
const triangleTextureCoords = triangulation . map ( ( triangle , index ) => [
1160
1169
( ( triangle . v0 . x - maxX ) * ( numRepeatsX + 1 ) ) / ( maxX - minX ) , ( ( triangle . v0 . y - maxY ) * ( numRepeatsY + 1 ) ) / ( maxY - minY ) ,
1161
1170
( ( triangle . v1 . x - maxX ) * ( numRepeatsX + 1 ) ) / ( maxX - minX ) , ( ( triangle . v1 . y - maxY ) * ( numRepeatsY + 1 ) ) / ( maxY - minY ) ,
0 commit comments