diff --git a/src/traces/isosurface/attributes.js b/src/traces/isosurface/attributes.js index 8a0216b9bff..031c89e58ff 100644 --- a/src/traces/isosurface/attributes.js +++ b/src/traces/isosurface/attributes.js @@ -10,7 +10,6 @@ var colorscaleAttrs = require('../../components/colorscale/attributes'); var colorbarAttrs = require('../../components/colorbar/attributes'); -var surfaceAtts = require('../surface/attributes'); var meshAttrs = require('../mesh3d/attributes'); var baseAttrs = require('../../plots/attributes'); @@ -225,7 +224,7 @@ var attrs = module.exports = overrideAll(extendFlat({ 'If trace `hoverinfo` contains a *text* flag and *hovertext* is not set,', 'these elements will be seen in the hover labels.' ].join(' ') - }, + } }, colorscaleAttrs('', { @@ -236,37 +235,16 @@ colorscaleAttrs('', { colorbar: colorbarAttrs, - // Flat shaded mode - flatshading: { - valType: 'boolean', - role: 'style', - dflt: false, - description: [ - 'Determines whether or not normal smoothing is applied to the isosurfaces,', - 'creating isosurfaces with an angular, low-poly look via flat reflections.' - ].join(' ') - }, - - contour: { - show: extendFlat({}, surfaceAtts.contours.x.show, { - description: [ - 'Sets whether or not dynamic contours are shown on hover.', - 'Contours are more useful when hovering on caps and slices.' - ].join(' ') - }), - color: surfaceAtts.contours.x.color, - width: surfaceAtts.contours.x.width - }, - - lightposition: { - x: extendFlat({}, surfaceAtts.lightposition.x, {dflt: 1e5}), - y: extendFlat({}, surfaceAtts.lightposition.y, {dflt: 1e5}), - z: extendFlat({}, surfaceAtts.lightposition.z, {dflt: 0}) - }, + contour: meshAttrs.contour, + lightposition: meshAttrs.lightposition, lighting: meshAttrs.lighting, + flatshading: meshAttrs.flatshading, hoverinfo: extendFlat({}, baseAttrs.hoverinfo) }), 'calc', 'nested'); +// required defaults to speed up surface normal calculations +attrs.flatshading.dflt = true; attrs.lighting.facenormalsepsilon.dflt = 0; + attrs.x.editType = attrs.y.editType = attrs.z.editType = attrs.value.editType = 'calc+clearAxisTypes'; attrs.transforms = undefined; diff --git a/src/traces/isosurface/convert.js b/src/traces/isosurface/convert.js index 044c012dc5a..a7a09220751 100644 --- a/src/traces/isosurface/convert.js +++ b/src/traces/isosurface/convert.js @@ -396,9 +396,9 @@ function generateIsosurfaceMesh(data) { function tryCreateTri(style, xyzv, abc, min, max, isSecondPass) { - abc = [-1, -1, -1]; // Note: for the moment we had to override indices - // for planar surfaces (i.e. caps and slices) due to group shading - // bug of gl-mesh3d. But don't worry this would run faster! + abc = [-1, -1, -1]; // Note: for the moment we override indices + // to run faster! But it is possible to comment this line + // to reduce the number of vertices. var tryDrawTri = function(style, xyzv, abc) { if( // we check here if the points are in `real` iso-min/max range diff --git a/src/traces/isosurface/defaults.js b/src/traces/isosurface/defaults.js index 2c7de188cdd..23dce6b8290 100644 --- a/src/traces/isosurface/defaults.js +++ b/src/traces/isosurface/defaults.js @@ -95,7 +95,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout 'lightposition.x', 'lightposition.y', 'lightposition.z', - 'flatshading', + 'flatshading' ].forEach(function(x) { coerce(x); }); colorscaleDefaults(traceIn, traceOut, layout, coerce, {prefix: '', cLetter: 'c'}); diff --git a/test/image/baselines/gl3d_isosurface_2surfaces-checker_spaceframe.png b/test/image/baselines/gl3d_isosurface_2surfaces-checker_spaceframe.png index 92966d7879e..b08d97e3743 100644 Binary files a/test/image/baselines/gl3d_isosurface_2surfaces-checker_spaceframe.png and b/test/image/baselines/gl3d_isosurface_2surfaces-checker_spaceframe.png differ diff --git a/test/image/baselines/gl3d_isosurface_math.png b/test/image/baselines/gl3d_isosurface_math.png index 21c6fd8cbee..ad94ba75c8a 100644 Binary files a/test/image/baselines/gl3d_isosurface_math.png and b/test/image/baselines/gl3d_isosurface_math.png differ diff --git a/test/image/baselines/gl3d_isosurface_xycaps_volume_slices.png b/test/image/baselines/gl3d_isosurface_xycaps_volume_slices.png index a80717fcc59..75d4a435260 100644 Binary files a/test/image/baselines/gl3d_isosurface_xycaps_volume_slices.png and b/test/image/baselines/gl3d_isosurface_xycaps_volume_slices.png differ diff --git a/test/image/mocks/gl3d_isosurface_log-axis_slices_surface-fill.json b/test/image/mocks/gl3d_isosurface_log-axis_slices_surface-fill.json index 0bd49e0aa3f..6d10db3bd2a 100644 --- a/test/image/mocks/gl3d_isosurface_log-axis_slices_surface-fill.json +++ b/test/image/mocks/gl3d_isosurface_log-axis_slices_surface-fill.json @@ -1878,11 +1878,11 @@ 1.000, 1.450, 1.900, 2.350, 2.800, 3.250, 3.700, 4.150, 4.600, 5.050, 5.500, 5.950, 6.400, 6.850, 7.300, 7.750, 8.200, 8.650, 9.100, 9.550, 10.000 ], "lighting": { - "ambient": 0.5, - "diffuse": 1.0, - "specular": 0.75, - "roughness": 1.0, - "fresnel": 0.25 + "ambient": 0.5, + "diffuse": 1.0, + "specular": 0.75, + "roughness": 1.0, + "fresnel": 0.25 }, "lightposition": { "x": 10000, diff --git a/test/image/mocks/gl3d_isosurface_thin_caps_different_dims.json b/test/image/mocks/gl3d_isosurface_thin_caps_different_dims.json index 23a4c62bd56..c0d10c7a92b 100644 --- a/test/image/mocks/gl3d_isosurface_thin_caps_different_dims.json +++ b/test/image/mocks/gl3d_isosurface_thin_caps_different_dims.json @@ -3638,11 +3638,11 @@ -10, -8, -6, -4, -2, 0, 2, 4, 6, 8, 10 ], "lighting": { - "ambient": 0.5, - "diffuse": 1.0, - "specular": 0.75, - "roughness": 1.0, - "fresnel": 0.25 + "ambient": 0.5, + "diffuse": 1.0, + "specular": 0.75, + "roughness": 1.0, + "fresnel": 0.25 }, "lightposition": { "x": 10000, diff --git a/test/image/mocks/gl3d_isosurface_uneven-scales_ranges_iso-null.json b/test/image/mocks/gl3d_isosurface_uneven-scales_ranges_iso-null.json index c45e9dabcd8..27dc24a9866 100644 --- a/test/image/mocks/gl3d_isosurface_uneven-scales_ranges_iso-null.json +++ b/test/image/mocks/gl3d_isosurface_uneven-scales_ranges_iso-null.json @@ -1878,11 +1878,11 @@ 0.000, 0.015, 0.120, 0.405, 0.960, 1.875, 3.240, 5.145, 7.680, 10.935, 15.000, 19.965, 25.920, 32.955, 41.160, 50.625, 61.440, 73.695, 87.480, 102.885, 120.000 ], "lighting": { - "ambient": 0.5, - "diffuse": 1.0, - "specular": 0.75, - "roughness": 1.0, - "fresnel": 0.25 + "ambient": 0.5, + "diffuse": 1.0, + "specular": 0.75, + "roughness": 1.0, + "fresnel": 0.25 }, "lightposition": { "x": 10000, diff --git a/test/image/mocks/gl3d_isosurface_with_surface-pattern.json b/test/image/mocks/gl3d_isosurface_with_surface-pattern.json index 2de292d9d8f..c9db303e12d 100644 --- a/test/image/mocks/gl3d_isosurface_with_surface-pattern.json +++ b/test/image/mocks/gl3d_isosurface_with_surface-pattern.json @@ -1878,11 +1878,11 @@ -10.000, -9.998, -9.980, -9.932, -9.840, -9.688, -9.460, -9.143, -8.720, -8.178, -7.500, -6.672, -5.680, -4.507, -3.140, -1.563, 0.240, 2.282, 4.580, 7.147, 10.000 ], "lighting": { - "ambient": 0.5, - "diffuse": 1.0, - "specular": 0.75, - "roughness": 1.0, - "fresnel": 0.25 + "ambient": 0.5, + "diffuse": 1.0, + "specular": 0.75, + "roughness": 1.0, + "fresnel": 0.25 }, "lightposition": { "x": 10000, diff --git a/test/image/mocks/gl3d_isosurface_xycaps_volume_slices.json b/test/image/mocks/gl3d_isosurface_xycaps_volume_slices.json index 3352de076fb..68c21aaac16 100644 --- a/test/image/mocks/gl3d_isosurface_xycaps_volume_slices.json +++ b/test/image/mocks/gl3d_isosurface_xycaps_volume_slices.json @@ -2838,11 +2838,11 @@ 0, 0.008, 0.061, 0.207, 0.492, 0.960, 1.659, 2.634, 3.932, 5.599, 7.680, 10.222, 13.271, 16.873, 21.074, 25.920, 31.457, 37.732, 44.790, 52.677, 61.440, 71.124, 81.777, 93.443, 106.168, 120 ], "lighting": { - "ambient": 0.5, - "diffuse": 1.0, - "specular": 0.75, - "roughness": 1.0, - "fresnel": 0.25 + "ambient": 0.5, + "diffuse": 1.0, + "specular": 0.75, + "roughness": 1.0, + "fresnel": 0.25 }, "lightposition": { "x": 10000,