QtCraft API C++ classes QML types Handbook

QcDropPool Class

The lists of precipitation drops handed to the view in turn (decision E-397): the view keeps the latest, the renderer the one it last copied, so a third is always free to be filled again and a frame allocates nothing once the lists have grown. More...

Header: #include <clientcore/weather/QcDropPool.h>

Public Functions

std::shared_ptr<const QList<QcPrecipitationDrop>> fill(const QcPrecipitationField &field, float strength, const QcVec3 &origin)

Detailed Description

Thread contract: fill() runs on the GUI thread and hands the list to the view (QcWorldView:: setPrecipitation). The renderer copies the view's pointer only in its synchronize(), while the GUI thread waits, and keeps it for its reads in the frame until the next synchronize() replaces it. Outside synchronize() another thread can therefore only drop a reference, never take one: a list whose only owner is the pool stays unshared while fill() writes it.

Member Function Documentation

std::shared_ptr<const QList<QcPrecipitationDrop>> QcDropPool::fill(const QcPrecipitationField &field, float strength, const QcVec3 &origin)

Returns the particles of field as drops (QcPrecipitationField::dropOf, at the rain's strength) relative to origin in a list nobody else holds (asserted in debug builds); a new list when all three are still held.