Hello,
How can I produce fog for the whole world?
How can I color the fog?
I need this information for my mini game, will create a underwater world.
How create FOG?
-
- Posts: 1029
- Joined: Thu Apr 06, 2006 12:45 am
- Location: Tennesee, USA
- Contact:
-
- Posts: 1029
- Joined: Thu Apr 06, 2006 12:45 am
- Location: Tennesee, USA
- Contact:
vitek wrote:Try IVideoDriver::setFog().
Code: Select all
virtual void setFog (SColor color = SColor(0, 255, 255, 255),
bool linearFog = true,
f32 start = 50.0f,
f32 end = 100.0f,
f32 density = 0.01f,
bool pixelFog = false,
bool rangeFog = false
)[pure virtual]
I use dev-cpp I have everything included and I can't figure out how to fix this.
Have the lib linked and everything. (also searched the forums so no flaming on that note either.)
You don't copy and paste that entire code, that is API/documentation and will not compile.
To use fog in your code, you use:
Obviously changing the variables that need to be changed.
The documentation is to note what each parameter is for (fog color, fog start, end, etc.) and what the function may return if not void.
And did you try searching with your eyes open?
http://irrlicht.sourceforge.net/phpBB2/ ... ght=setfog
http://irrlicht.sourceforge.net/phpBB2/ ... ght=setfog
http://irrlicht.sourceforge.net/phpBB2/ ... ght=setfog
http://irrlicht.sourceforge.net/phpBB2/ ... ght=setfog
To use fog in your code, you use:
Code: Select all
driver->setFog(SColor(0,255,255,255),true,50.0f,100.0f,0.01f,false,false);
The documentation is to note what each parameter is for (fog color, fog start, end, etc.) and what the function may return if not void.
And did you try searching with your eyes open?
http://irrlicht.sourceforge.net/phpBB2/ ... ght=setfog
http://irrlicht.sourceforge.net/phpBB2/ ... ght=setfog
http://irrlicht.sourceforge.net/phpBB2/ ... ght=setfog
http://irrlicht.sourceforge.net/phpBB2/ ... ght=setfog
Last edited by zeno60 on Sun Jul 30, 2006 7:36 am, edited 1 time in total.
The function you want to call is called setFog(). It is an abstract method of the IVideoDriver interface. Being so, you need to call the function on an object of type IVideoDriver.
When you declare or define a function, you tell the compiler the type of each of the parameters. When you invoke a function, you do not specify the type of each of the parameters, you just specify the values.
If you have trouble understanding any of what I've said above, you should go find a basic C/C++ tutorial and learn the language _before_ you continue learning about Irrlicht any further. It will make your life as a programmer much easier.
And just because I know someone else will spoon feed you the answer as soon as I tell you to learn the language, I'm going to save them the time.
When you declare or define a function, you tell the compiler the type of each of the parameters. When you invoke a function, you do not specify the type of each of the parameters, you just specify the values.
If you have trouble understanding any of what I've said above, you should go find a basic C/C++ tutorial and learn the language _before_ you continue learning about Irrlicht any further. It will make your life as a programmer much easier.
And just because I know someone else will spoon feed you the answer as soon as I tell you to learn the language, I'm going to save them the time.
Code: Select all
// add camera
smgr->addCameraSceneNodeFPS();
ISceneNode* terrain = smgr->addTerrainSceneNode("media/terrain-heightmap.bmp");
terrain->setMaterialTexture(0, driver->getTexture("media/terrain-texture.jpg"));
terrain->setMaterialFlag(video::EMF_FOG_ENABLE, true);
terrain->setScale(core::vector3df(10, 1, 10));
driver->setFog(video::SColor(32, 160, 192, 212), true, 100.f, 1000.f, .005f, false, true);
driver->setAmbientLight(video::SColorf(.3f, .3f, .3f, 1.f));
-
- Posts: 1029
- Joined: Thu Apr 06, 2006 12:45 am
- Location: Tennesee, USA
- Contact:
zeno60 wrote:You don't copy and paste that entire code, that is API/documentation and will not compile.
To use fog in your code, you use:
Obviously changing the variables that need to be changed.Code: Select all
driver->setFog(SColor(0,255,255,255),true,50.0f,100.0f,0.01f,false,false);
The documentation is to note what each parameter is for (fog color, fog start, end, etc.) and what the function may return if not void.
And did you try searching with your eyes open?
http://irrlicht.sourceforge.net/phpBB2/ ... ght=setfog
http://irrlicht.sourceforge.net/phpBB2/ ... ght=setfog
http://irrlicht.sourceforge.net/phpBB2/ ... ght=setfog
http://irrlicht.sourceforge.net/phpBB2/ ... ght=setfog
Thanks much for the help...and sorry I'm half asleep and I was never any good with that search button
Thanks Vitek! I've been struggling to figure out why my fog won't work and just seen that I've been missing this...
silly silly me....
Code: Select all
terrain->setMaterialFlag(video::EMF_FOG_ENABLE, true);
Of all the things i've lost, i miss my mind the most...