ParticleExampleSun
A particle effect like a sun
Welcome to the new Ogre Wiki!
If you haven't done so already, be sure to visit the Wiki Portal to read about how the wiki works. Especially the Ogre Wiki Overview page.
If you haven't done so already, be sure to visit the Wiki Portal to read about how the wiki works. Especially the Ogre Wiki Overview page.
Table of contents
This example code can be used for something like a Sun. Save the following as a .particle file:
Particle script:
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:
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.
Contributors to this page: jacmoe
and
Spacegaier
.
Page last modified on Saturday 02 of January, 2010 07:11:52 GMT by jacmoe
.
The content on this page is licensed under the terms of the Creative Commons Attribution-ShareAlike License.
As an exception, any source code contributed within the content is released into the Public Domain.
Sidebar
Search box
Online users
43
online users

