Comment to explain checker code.

This commit is contained in:
Viktor Kovacs 2021-06-05 09:15:12 +02:00
parent c7ef690933
commit edd2245915
2 changed files with 7 additions and 2 deletions

View File

@ -75,7 +75,6 @@ OV.ThreeModelLoader = class
let obj = this;
this.callbacks.onVisualizationStart ();
let params = new OV.ModelToThreeConversionParams ();
// https://github.com/kovacsv/Online3DViewer/issues/69
params.forceMediumpForMaterials = this.hasHighpDriverIssue;
OV.ConvertModelToThreeMeshes (importResult.model, params, {
onTextureLoaded : function () {

View File

@ -1,3 +1,7 @@
// Some mobile devices say that they support mediump, but in reality they don't. At the end
// all materials rendered as black. This hack renders a single plane with red material and
// it checks if it's really red. If it's not, then probably there is a driver issue.
// https://github.com/kovacsv/Online3DViewer/issues/69
OV.HasHighpDriverIssue = function ()
{
let canvas = document.createElement ('canvas');
@ -43,7 +47,9 @@ OV.HasHighpDriverIssue = function ()
);
document.body.removeChild (canvas);
if (pixels[0] < 50 && pixels[1] < 50 && pixels[2] < 50) {
let blackThreshold = 50;
if (pixels[0] < blackThreshold && pixels[1] < blackThreshold && pixels[2] < blackThreshold) {
return true;
}
return false;