本文整理汇总了C++中Noise::SetSeed方法的典型用法代码示例。如果您正苦于以下问题:C++ Noise::SetSeed方法的具体用法?C++ Noise::SetSeed怎么用?C++ Noise::SetSeed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Noise
的用法示例。
在下文中一共展示了Noise::SetSeed方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Run
void ModelViewer::Run()
{
TreeNode root;
// Create the environment cube map
{
Noise noise;
noise.SetSeed(7654321);
noise.SetSize(32, 32);
noise.SetSeamless(false);
noise.ApplyFilter("Simple");
void* ptr = noise.GetBuffer();
ITexture* tex = mGraphics->GetTexture("Environment Map");
tex->Set(ptr, ptr, ptr, ptr, ptr, ptr, 32, 32, ITexture::Format::Float, ITexture::Format::Alpha);
tex->SetWrapMode(ITexture::WrapMode::ClampToEdge);
}
// Create the noise map
{
Noise noise;
noise.SetSeed(74625646);
noise.SetSize(32, 32);
noise.SetSeamless(true);
noise.ApplyFilter("Perlin").Set(3.0f);
ITexture* tex = mGraphics->GetTexture("Noise map");
tex->Set(noise.GetBuffer(), 32, 32, 1, ITexture::Format::Float, ITexture::Format::Alpha);
tex->SetWrapMode(ITexture::WrapMode::Repeat);
}
if (!root.Load("Config/Model Viewer.txt")) return;
mCore->Lock();
mCore->SerializeFrom(root);
mCore->Unlock();
// Event listeners
mCore->AddOnKey ( bind(&ModelViewer::OnKeyPress, this) );
mCore->AddOnMouseMove( bind(&ModelViewer::OnMouseMove, this) );
mCore->AddOnScroll ( bind(&ModelViewer::OnScroll, this) );
mCore->AddOnDraw ( bind(&ModelViewer::OnDraw, this) );
Object* rootObj = mCore->GetRoot();
mCam = rootObj->FindObject<DebugCamera> ("Default Camera");
mLight = rootObj->FindObject<Light> ("Default Light");
mStage = rootObj->FindObject<Object> ("Stage");
mInst = rootObj->FindObject<ModelInstance>("Default Instance");
mSbHighlight = mUI->FindWidget<UIHighlight> ("Status Highlight");
mSbLabel = mUI->FindWidget<UILabel> ("Status Label");
// Model viewer deals with only one model
mModel = mCore->GetModel("Default Model");
// If something wasn't found, just exit
if (mCam == 0 || mLight == 0 || mStage == 0 || mInst == 0 || mModel == 0 || !CreateUI()) return;
// Deferred drawing
mDraw = mCam->AddScript<OSDrawDeferred>();
mScene = &mDraw->GetScene();
// Display the current version
ShowAboutInfo();
// Endless loop
while ( mCore->Update() );
#ifndef _DEBUG
// Reset the stage's rotation before saving the scene
mStage->SetRelativeRotation( Quaternion() );
// Save the current scene
root.Release();
mCore->SerializeTo(root);
root.Save("Config/Model Viewer.txt");
#endif
}