Table of contents
This example code can be used for something like a Sun. Save the following as a .particle file:
Particle script:
Copy to clipboard
particle_system Space/Sun { material Examples/Flare particle_width 20 particle_height 20 cull_each false quota 100 billboard_type point // Area emitter emitter Ellipsoid { angle 30 emission_rate 30 time_to_live_min 2 time_to_live_max 5 direction 0 1 0 velocity 0.001 colour 0.15 0.1 0.0 width 5 height 5 depth 5 } // Fader affector ColourFader { red -0.010 green -0.025 blue -0.025 } }
Usage:
Then you can load it within the createScene() method of your application:
Copy to clipboard
mSceneMgr->setSkyBox( true, "Examples/SpaceSkyBox" ); ParticleSystem* sunParticle = mSceneMgr->createParticleSystem("Sun", "Space/Sun"); SceneNode* particleNode = mSceneMgr->getRootSceneNode()->createChildSceneNode("Particle"); particleNode->attachObject(sunParticle);
Note: For a better result you have to change the flare.png from the example. Around the flare it should be really black, then you see no edges at the sun!
See also:
- Forum thread for detailed dicussion
- Forum thread for an implementation of this sun with day/night transitions.