Skip to content

Commit 0ad4443

Browse files
committed
Adding epsilon configuration in order to pass it on to newly modified dependencies that now take these new params. The default values are set such that 3D mesh models with minute triangles are also properly included in the GL specular light reflection calculation.
1 parent d3b3513 commit 0ad4443

File tree

4 files changed

+19
-1
lines changed

4 files changed

+19
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
"gl-line2d": "^1.3.0",
6262
"gl-line3d": "^1.1.0",
6363
"gl-mat4": "^1.1.2",
64-
"gl-mesh3d": "^1.0.7",
64+
"gl-mesh3d": "^1.1.0",
6565
"gl-plot2d": "^1.1.6",
6666
"gl-plot3d": "^1.5.0",
6767
"gl-scatter2d": "^1.0.5",

src/traces/mesh3d/convert.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,8 @@ proto.update = function(data) {
111111
specular: data.lighting.specular,
112112
roughness: data.lighting.roughness,
113113
fresnel: data.lighting.fresnel,
114+
vertexNormalsEpsilon: data.lighting.vertexnormalsepsilon,
115+
faceNormalsEpsilon: data.lighting.facenormalsepsilon,
114116
opacity: data.opacity,
115117
contourEnable: data.contour.show,
116118
contourColor: str2RgbaArray(data.contour.color).slice(0, 3),

src/traces/mesh3d/defaults.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
5454
'lighting.specular',
5555
'lighting.roughness',
5656
'lighting.fresnel',
57+
'lighting.vertexnormalsepsilon',
58+
'lighting.facenormalsepsilon',
5759
'contour.show',
5860
'contour.color',
5961
'contour.width',

src/traces/surface/attributes.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,20 @@ module.exports = {
182182
min: 0.00,
183183
max: 5.00,
184184
dflt: 0.2
185+
},
186+
vertexnormalsepsilon : {
187+
valType: 'number',
188+
role: 'style',
189+
min: 0.00,
190+
max: 1,
191+
dflt: 1e-12 // otherwise finely tessellated things eg. the brain will have no specular light reflection
192+
},
193+
facenormalsepsilon : {
194+
valType: 'number',
195+
role: 'style',
196+
min: 0.00,
197+
max: 1,
198+
dflt: 1e-6 // even the brain model doesn't appear to need finer than this
185199
}
186200
},
187201

0 commit comments

Comments
 (0)