Application
Programming Interface
SilverLining™
is easy to integrate into your C or C++ - based graphics applications.
Here's an example of how easy it is to integrate SilverLining™
into an OpenGL application; the process is similar for Direct3D.
First,
after initializing your graphics subsystem, initialize SilverLining™
:
Atmosphere *atm = new Atmosphere();
atm->Initialize(Atmosphere::OPENGL);
Let's
say you want to add a deck of cumulus congestus clouds to the scene:
CloudLayer *cloudLayer = CloudLayerFactory::Create(CUMULUS_CONGESTUS);
cloudLayer->SetBaseAltitude(1000);
cloudLayer->SetThickness(100);
cloudLayer->SetBaseLength(30000);
cloudLayer->SetBaseWidth(40000);
cloudLayer->SetDensity(0.25);
cloudLayer->SetLayerPosition(5000, 5000);
cloudLayer->SeedClouds(*atm);
atm->GetConditions()->AddCloudLayer(cloudLayer);
|
At the beginning of rendering your frame, after setting the view and
projection matrices, call:
atm->BeginFrame(true);
This
will draw the sky and do any necessary lighting computations for your
scene.
Then,
at the end of your frame, call:
atm->EndFrame();
This
will draw the clouds, sorted from back to front.
Of
course, there is much more that SilverLining™ can do, but the
above code is all that's required to get up and running with a scene
of clouds filling the sky.
The
complete public API is well-documented and viewable online.
|