本文整理汇总了C++中PRNG::uniform32方法的典型用法代码示例。如果您正苦于以下问题:C++ PRNG::uniform32方法的具体用法?C++ PRNG::uniform32怎么用?C++ PRNG::uniform32使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PRNG
的用法示例。
在下文中一共展示了PRNG::uniform32方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: script
int Narrator::script(int st, PRNG &prng)
{
static ChaosParticles chaosA(flow, runner.config["chaosParticles"]);
static ChaosParticles chaosB(flow, runner.config["chaosParticles"]);
static OrderParticles orderParticles(flow, runner.config["orderParticles"]);
static Precursor precursor(flow, runner.config["precursor"]);
static RingsEffect ringsA(flow, runner.config["ringsA"]);
static RingsEffect ringsB(flow, runner.config["ringsB"]);
static RingsEffect ringsC(flow, runner.config["ringsC"]);
static PartnerDance partnerDance(flow, runner.config["partnerDance"]);
static CameraFlowDebugEffect flowDebugEffect(flow, runner.config["flowDebugEffect"]);
static Forest forest(flow, runner.config["forest"]);
static DarknessEffect darkness;
rapidjson::Value& config = runner.config["narrator"];
Sampler s(prng.uniform32());
switch (st) {
//////////////////////////////////////////////////////////////////////////////////////////////
// Special states
case 1: {
// Darkness only ("off")
crossfade(&darkness, 1);
delayForever();
}
case 2: {
// Precursor only (sleep mode)
precursor.reseed(prng.uniform32());
crossfade(&precursor, 1);
delayForever();
}
case 3: {
// Debugging the computer vision system
crossfade(&flowDebugEffect, 1);
delayForever();
}
//////////////////////////////////////////////////////////////////////////////////////////////
// Opening sequence
case 0: {
// Darkness until opening
crossfade(&darkness, 1);
delayUntilDate(config["opening"]["date"]);
return config["opening"]["nextState"].GetInt();
}
//////////////////////////////////////////////////////////////////////////////////////////////
// Cyclic states
default: {
endCycle();
return 10;
}
case 10: {
// Order trying to form out of the tiniest sparks; runs for an unpredictable time, fails.
precursor.reseed(prng.uniform32());
crossfade(&precursor, s.value(config["precursorCrossfade"]));
// Bootstrap
delay(s.value(config["precursorBootstrap"]));
// Wait for darkness
while (!precursor.isDone) {
doFrame();
}
return 20;
}
case 20: {
// Bang. Explosive energy, hints of self-organization
ChaosParticles *pChaosA = &chaosA;
ChaosParticles *pChaosB = &chaosB;
int bangCount = s.value(config["bangCount"]);
for (int i = 0; i < bangCount; i++) {
pChaosA->reseed(prng.circularVector() * s.value(config["bangSeedRadius"]), prng.uniform32());
crossfade(pChaosA, s.value(config["bangCrossfadeDuration"]));
delay((1 << i) * s.value(config["bangDelayBasis"]));
std::swap(pChaosA, pChaosB);
}
attention(s, config["bangAttention"]);
return 30;
}
case 30: {
// Textures of light, exploring something formless. Slow crossfade in
ringsA.reseed(prng.uniform32());
crossfade(&ringsA, s.value(config["ringsA-Crossfade"]));
attention(s, config["ringsA-Attention"]);
return 40;
//.........这里部分代码省略.........