Trouble about node - fog [ SOLVED ]

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
oginnam
Posts: 7
Joined: Mon Dec 14, 2009 4:20 pm
Location: Colombia

Trouble about node - fog [ SOLVED ]

Post by oginnam »

Hi, first that all excuseme for maybe this "noob question".

Now in my Irrlicht's scene i have set one mesh in a node with fog effect... it's works.

So, but when i try to set in the same node another mesh, only this mesh is affected for the fog, the first mesh now is unaffected, why???? . I did try to set or add more meshes, and always is the same result: the last mesh is correct, no the others.

Im using Irllicht 1.7.1. Maybe it's a BUG??

thanks.
Last edited by oginnam on Sat Apr 10, 2010 10:56 pm, edited 1 time in total.
Virion
Competition winner
Posts: 2148
Joined: Mon Dec 18, 2006 5:04 am

Post by Virion »

code code code code code code code code code code code code
oginnam
Posts: 7
Joined: Mon Dec 14, 2009 4:20 pm
Location: Colombia

Post by oginnam »

Virion wrote:code code code code code code code code code code code code
ok the part of code is:

Code: Select all


.....
.....
mDriver->setFog(SColor(0,85,121,121),EFT_FOG_LINEAR,1000,10000, 0.01f,false, false);
....
....
.....

IAnimatedMesh* hydrantmesh = mScene->getMesh("hydrant.x");
	IAnimatedMeshSceneNode* city = mScene->addAnimatedMeshSceneNode(hydrantmesh);
	
	IAnimatedMesh* streetmesh = mScene->getMesh("street.x");
	city = mScene->addAnimatedMeshSceneNode(streetmesh);
	
	IAnimatedMesh* segment1 = mScene->getMesh("segment1.x");
	city = mScene->addAnimatedMeshSceneNode(segment1);
	
        city->setMaterialFlag(video::EMF_FOG_ENABLE, true);
	city->setMaterialFlag(video::EMF_NORMALIZE_NORMALS, true); 
In this case, only segment1 have a fog effect.
randomMesh
Posts: 1186
Joined: Fri Dec 29, 2006 12:04 am

Post by randomMesh »

oginnam wrote:In this case, only segment1 have a fog effect.
Yes, of course. You only set the fog for the last node.

You have to call setMaterialFlag for every node.

Code: Select all

	IAnimatedMesh* hydrantmesh = mScene->getMesh("hydrant.x");
	IAnimatedMeshSceneNode* city = mScene->addAnimatedMeshSceneNode(hydrantmesh);
	city->setMaterialFlag(video::EMF_FOG_ENABLE, true);
	city->setMaterialFlag(video::EMF_NORMALIZE_NORMALS, true);

	IAnimatedMesh* streetmesh = mScene->getMesh("street.x");
	city = mScene->addAnimatedMeshSceneNode(streetmesh);
	city->setMaterialFlag(video::EMF_FOG_ENABLE, true);
	city->setMaterialFlag(video::EMF_NORMALIZE_NORMALS, true);

	IAnimatedMesh* segment1 = mScene->getMesh("segment1.x");
	city = mScene->addAnimatedMeshSceneNode(segment1);
	city->setMaterialFlag(video::EMF_FOG_ENABLE, true);
	city->setMaterialFlag(video::EMF_NORMALIZE_NORMALS, true); 
"Whoops..."
freetimecoder
Posts: 226
Joined: Fri Aug 22, 2008 8:50 pm
Contact:

Post by freetimecoder »

Maybe you should brush up your knowledge about classes and pointers a little.

greetings
oginnam
Posts: 7
Joined: Mon Dec 14, 2009 4:20 pm
Location: Colombia

Post by oginnam »

randomMesh wrote: Yes, of course. You only set the fog for the last node.
...
You have to call setMaterialFlag for every node.
Ok, it's works thanks RandomMesh by your response. :D
Post Reply