convert method
dynamic
convert(
- dynamic materialsInfo
Implementation
convert(materialsInfo) {
Map<String, dynamic> converted = {};
for (var mn in materialsInfo.keys) {
// Convert materials info into normalized form based on options
var mat = materialsInfo[mn];
Map<String, dynamic> covmat = {};
converted[mn] = covmat;
for (var prop in mat.keys) {
var save = true;
var value = mat[prop];
var lprop = prop.toLowerCase();
switch (lprop) {
case 'kd':
case 'ka':
case 'ks':
// Diffuse color (color under white light) using RGB values
if (options["normalizeRGB"] != null) {
value = [value[0] / 255, value[1] / 255, value[2] / 255];
}
if (options["ignoreZeroRGBs"] != null) {
if (value[0] == 0 && value[1] == 0 && value[2] == 0) {
// ignore
save = false;
}
}
break;
default:
break;
}
if (save) {
covmat[lprop] = value;
}
}
}
return converted;
}