finish method
void
finish()
Implementation
void finish() {
_translucentRecords.sort((a, b) {
var aDistance =
a.worldTransform.getTranslation().distanceTo(_camera.position);
var bDistance =
b.worldTransform.getTranslation().distanceTo(_camera.position);
return bDistance.compareTo(aDistance);
});
_renderPass.setDepthWriteEnable(false);
_renderPass.setColorBlendEnable(true);
// Additive source-over blending.
// Note: Expects premultiplied alpha output from the fragment stage!
_renderPass.setColorBlendEquation(gpu.ColorBlendEquation(
colorBlendOperation: gpu.BlendOperation.add,
sourceColorBlendFactor: gpu.BlendFactor.one,
destinationColorBlendFactor: gpu.BlendFactor.oneMinusSourceAlpha,
alphaBlendOperation: gpu.BlendOperation.add,
sourceAlphaBlendFactor: gpu.BlendFactor.one,
destinationAlphaBlendFactor: gpu.BlendFactor.oneMinusSourceAlpha));
for (var record in _translucentRecords) {
_encode(record.worldTransform, record.geometry, record.material);
}
_translucentRecords.clear();
_commandBuffer.submit();
_transientsBuffer.reset();
}