setValueFromString method
key
- String values of the parameter to change.
Sets the properties based on the values
.
Implementation
void setValueFromString(String key, dynamic newValue) {
if (key == "alphaTest") {
alphaTest = newValue.toDouble();
} else if (key == "bumpScale") {
bumpScale = newValue.toDouble();
} else if (key == "alphaMap") {
alphaMap = newValue;
} else if (key == "aoMap") {
aoMap = newValue;
} else if (key == "blendDst") {
blendDst = newValue;
} else if (key == "blendDstAlpha") {
blendDstAlpha = newValue;
} else if (key == "blendSrcAlpha") {
blendSrcAlpha = newValue;
} else if (key == "blendEquation") {
blendEquation = newValue;
} else if (key == "blending") {
blending = newValue;
} else if (key == "blendSrc") {
blendSrc = newValue;
} else if (key == "blendSrcAlpha") {
blendSrcAlpha = newValue;
} else if (key == "clearcoat") {
clearcoat = newValue.toDouble();
} else if (key == "clearcoatRoughness") {
clearcoatRoughness = newValue.toDouble();
} else if (key == "clipIntersection") {
clipIntersection = newValue;
} else if (key == "clipping") {
clipping = newValue;
} else if (key == "clippingPlanes") {
clippingPlanes = newValue;
} else if (key == "clipShadows") {
clipShadows = newValue;
} else if (key == "color") {
if (newValue is Color) {
color = newValue;
} else {
color = Color.fromHex32(newValue);
}
} else if (key == "colorWrite") {
colorWrite = newValue;
} else if (key == "defines") {
defines = newValue;
} else if (key == "depthPacking") {
depthPacking = newValue;
} else if (key == "depthTest") {
depthTest = newValue;
} else if (key == "depthWrite") {
depthWrite = newValue;
} else if (key == "dithering") {
dithering = newValue;
} else if (key == "emissive") {
if (newValue.runtimeType == Color) {
emissive = newValue;
} else {
emissive = Color.fromHex32(newValue);
}
} else if (key == "emissiveMap") {
emissiveMap = newValue;
} else if (key == "flatShading") {
flatShading = newValue;
} else if (key == "fog") {
fog = newValue;
} else if (key == "fragmentShader") {
fragmentShader = newValue;
}else if (key == "specularMap") {
specularMap = newValue;
} else if (key == "instanced") {
instanced = newValue;
} else if (key == "lights") {
lights = newValue;
} else if (key == "linecap") {
linecap = newValue;
} else if (key == "linejoin") {
linejoin = newValue;
} else if (key == "linewidth") {
linewidth = newValue.toDouble();
} else if (key == "matcap") {
matcap = newValue;
} else if (key == "map") {
map = newValue;
} else if (key == "metalness") {
metalness = newValue.toDouble();
} else if (key == "metalnessMap") {
metalnessMap = newValue;
} else if (key == "name") {
name = newValue;
} else if (key == "normalMap") {
normalMap = newValue;
} else if (key == "normalScale") {
normalScale = newValue;
} else if (key == "opacity") {
opacity = newValue.toDouble();
} else if (key == "polygonOffset") {
polygonOffset = newValue;
} else if (key == "polygonOffsetFactor") {
polygonOffsetFactor = newValue.toDouble();
} else if (key == "polygonOffsetUnits") {
polygonOffsetUnits = newValue.toDouble();
} else if (key == "premultipliedAlpha") {
premultipliedAlpha = newValue;
} else if (key == "reflectivity") {
reflectivity = newValue.toDouble();
} else if (key == "roughness") {
roughness = newValue.toDouble();
}else if (key == "refractionRatio") {
refractionRatio = newValue.toDouble();
}else if (key == "roughnessMap") {
roughnessMap = newValue;
} else if (key == "shading") {
// // for backward compatability if shading is set in the constructor
throw ('THREE.$type: .shading has been removed. Use the boolean .flatShading instead.');
// this.flatShading = ( newValue == FlatShading ) ? true : false;
} else if (key == "shininess") {
shininess = newValue.toDouble();
} else if (key == "side") {
side = newValue;
} else if (key == "size") {
size = newValue.toDouble();
} else if (key == "dashSize") {
dashSize = newValue.toDouble();
} else if (key == "gapSize") {
gapSize = newValue.toDouble();
} else if (key == "scale") {
scale = newValue.toDouble();
} else if (key == "sizeAttenuation") {
sizeAttenuation = newValue;
} else if (key == "stencilZFail") {
stencilZFail = newValue;
} else if (key == "stencilZPass") {
stencilZPass = newValue;
} else if (key == "stencilFail") {
stencilFail = newValue;
} else if (key == "stencilFunc") {
stencilFunc = newValue;
} else if (key == "stencilRef") {
stencilRef = newValue;
} else if (key == "stencilWrite") {
stencilWrite = newValue;
} else if (key == "toneMapped") {
toneMapped = newValue;
} else if (key == "transparent") {
transparent = newValue;
} else if (key == "uniforms") {
uniforms = newValue;
} else if (key == "vertexShader") {
vertexShader = newValue;
} else if (key == "visible") {
visible = newValue;
} else if (key == "vertexColors") {
vertexColors = newValue;
} else if (key == "wireframe") {
wireframe = newValue;
} else if (key == "wireframeLinewidth") {
wireframeLinewidth = newValue.toDouble();
} else if (key == "shadowSide") {
shadowSide = newValue;
} else if (key == "specular") {
if (newValue is Color) {
specular = newValue;
} else {
specular = Color.fromHex32(newValue);
}
} else if(key == 'glslVersion'){
glslVersion = newValue;
}else if(key == ''){
}else if (key == 'emissiveIntensity') {
emissiveIntensity = newValue;
}
else {
console.error("Material.setValues key: $key newValue: $newValue is not support");
}
}