13#include <Common/assertion.h>
14#include <Common/primitive_type.h>
56 std::size_t numSplits,
57 std::vector<std::unique_ptr<SampleGenerator>>& out_sgs)
const;
78 std::size_t numSamples,
79 std::vector<std::size_t> dimSizeHints);
101 virtual void onRebirth() = 0;
103 virtual void genSamples1D(
108 virtual void genSamples2D(
113 virtual bool isSamplesGE3DSupported()
const;
115 virtual void genSamplesGE3D(
123 void allocSampleBuffer();
124 void genSampleBatch(std::size_t cachedBatchIndex);
127 std::size_t m_numSampleBatches;
128 std::size_t m_maxCachedBatches;
130 std::size_t m_numUsedBatches;
131 std::size_t m_numUsedCaches;
132 std::size_t m_numDeclaredDims;
133 std::size_t m_totalBufferSize;
134 std::vector<real> m_sampleBuffer;
135 std::vector<SampleStage> m_stages;
137 bool m_isSampleBatchPrepared;
145 return m_numSampleBatches;
150 return m_maxCachedBatches;
155 PH_ASSERT_LE(m_numUsedBatches, m_numSampleBatches);
157 return m_numSampleBatches - m_numUsedBatches;
162 return m_numUsedBatches < m_numSampleBatches;
Definition SampleContext.h:9
Generates samples in [0, 1]. Generators of different types produces samples with different properties...
Definition SampleGenerator.h:35
virtual void rebirth()
Reset this generator to its initial state, reviving it from dead state. Calling this method starts a ...
Definition SampleGenerator.cpp:175
SamplesNDHandle declareStageND(std::size_t numDims, std::size_t numSamples)
Similar to declareStageND(), with default size hints.
Definition SampleGenerator.cpp:76
bool prepareSampleBatch()
Generates sample values for current sample batch. Advances all sample values in all stages to the nex...
Definition SampleGenerator.cpp:38
std::size_t numSampleBatches() const
Definition SampleGenerator.h:143
virtual std::unique_ptr< SampleGenerator > makeNewborn(std::size_t numSampleBatches) const =0
Make a new generator.
SampleGenerator(std::size_t numSampleBatches, std::size_t maxCachedBatches)
Definition SampleGenerator.cpp:11
SamplesNDStream getSamplesND(const SamplesNDHandle &handle) const
Gets generated N-dimensional sample values in a stage. This method can only be called after sample ba...
Definition SampleGenerator.cpp:152
bool hasMoreBatches() const
Definition SampleGenerator.h:160
void genSplitted(std::size_t numSplits, std::vector< std::unique_ptr< SampleGenerator > > &out_sgs) const
Definition SampleGenerator.cpp:182
std::size_t maxCachedBatches() const
Definition SampleGenerator.h:148
virtual ~SampleGenerator()=default
std::size_t numRemainingBatches() const
Definition SampleGenerator.h:153
Definition SampleStage.h:14
Definition SampleStageReviser.h:12
Definition SamplesNDHandle.h:14
Definition SamplesND.h:16
Definition SamplesNDStream.h:17
The root for all renderer implementations.
Definition EEngineProject.h:6