History: ParticleExampleSun
Source of version: 6 (current)
Copy to clipboard
{maketoc} This example code can be used for something like a Sun. Save the following as a ''.particle'' file: !!Particle script: {CODE(wrap="1", colors="c++")}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 } }{CODE} !!Usage: Then you can load it within the ''createScene()'' method of your application: {CODE(wrap="1", colors="c++")} mSceneMgr->setSkyBox( true, "Examples/SpaceSkyBox" ); ParticleSystem* sunParticle = mSceneMgr->createParticleSystem("Sun", "Space/Sun"); SceneNode* particleNode = mSceneMgr->getRootSceneNode()->createChildSceneNode("Particle"); particleNode->attachObject(sunParticle);{CODE} __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! {IMG(src="dl2123&display",desc="Modified flare image by Mansur",alt="modified flare texture")}{IMG} !!See also: * [http://www.ogre3d.org/phpBB2/viewtopic.php?t=16102|Forum thread] for detailed dicussion * [http://www.ogre3d.org/phpBB2/viewtopic.php?t=32090|Forum thread] for an implementation of this sun with day/night transitions.