refreshUniformsPhysical method
void
refreshUniformsPhysical(
- Map<
String, dynamic> uniforms, - Material material,
- RenderTarget? transmissionRenderTarget
Implementation
void refreshUniformsPhysical(Map<String, dynamic> uniforms,Material material, RenderTarget? transmissionRenderTarget) {
uniforms["ior"]["value"] = material.ior; // also part of uniforms common
if (material.sheen > 0) {
uniforms["sheenColor"]["value"].setFrom(material.sheenColor);
uniforms["sheenRoughness"]["value"] = material.sheenRoughness;
if (material.sheenColorMap != null) {
uniforms["sheenColorMap"]["value"] = material.sheenColorMap;
}
if (material.sheenRoughnessMap != null) {
uniforms["sheenRoughnessMap"]["value"] = material.sheenRoughnessMap;
}
}
if (material.clearcoat > 0) {
uniforms["clearcoat"]["value"] = material.clearcoat;
uniforms["clearcoatRoughness"]["value"] = material.clearcoatRoughness;
if (material.clearcoatMap != null) {
uniforms["clearcoatMap"]["value"] = material.clearcoatMap;
}
if (material.clearcoatRoughnessMap != null) {
uniforms["clearcoatRoughnessMap"]["value"] = material.clearcoatRoughnessMap;
}
if (material.clearcoatNormalMap != null) {
uniforms["clearcoatNormalScale"]["value"].setFrom(material.clearcoatNormalScale);
uniforms["clearcoatNormalMap"]["value"] = material.clearcoatNormalMap;
if (material.side == BackSide) {
uniforms["clearcoatNormalScale"]["value"].negate();
}
}
}
if (material.transmission > 0) {
uniforms["transmission"]["value"] = material.transmission;
uniforms["transmissionSamplerMap"]["value"] = transmissionRenderTarget?.texture;
uniforms["transmissionSamplerSize"]["value"].set(transmissionRenderTarget?.width, transmissionRenderTarget?.height);
if (material.transmissionMap != null) {
uniforms["transmissionMap"]["value"] = material.transmissionMap;
}
uniforms["thickness"]["value"] = material.thickness;
if (material.thicknessMap != null) {
uniforms["thicknessMap"]["value"] = material.thicknessMap;
}
}
uniforms["attenuationDistance"]["value"] = material.attenuationDistance;
uniforms["attenuationColor"]["value"].setFrom(material.attenuationColor);
uniforms["specularIntensity"]["value"] = material.specularIntensity;
uniforms["attenuationColor"]["value"].setFrom(material.attenuationColor);
if (material.specularIntensityMap != null) {
uniforms["specularIntensityMap"]["value"] = material.specularIntensityMap;
}
if (material.specularColorMap != null) {
uniforms["specularColorMap"]["value"] = material.specularColorMap;
}
}