setState method
Implementation
void setState(Material material, Camera camera, bool useCache) {
final planes = material.clippingPlanes;
final clipIntersection = material.clipIntersection;
final clipShadows = material.clipShadows;
final materialProperties = properties.get(material);
if (!localClippingEnabled || planes == null || planes.isEmpty || renderingShadows && !clipShadows) {
// there's no local clipping
if (renderingShadows) {
// there's no global clipping
projectPlanes();
} else {
resetGlobalState();
}
}
else {
final nGlobal = renderingShadows ? 0 : numGlobalPlanes;
final lGlobal = nGlobal * 4;
List<double>? dstArray = materialProperties["clippingState"];
uniform["value"] = dstArray; // ensure unique state
dstArray = projectPlanes(planes, camera, lGlobal, useCache);
for (int i = 0; i != lGlobal; ++i) {
dstArray?[i] = globalState[i];
}
materialProperties["clippingState"] = dstArray;
numIntersection = clipIntersection ? numPlanes : 0;
numPlanes += nGlobal;
}
}