Page 1 of 1

Trouble about node - fog [ SOLVED ]

Posted: Sat Apr 10, 2010 1:35 pm
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.

Posted: Sat Apr 10, 2010 3:19 pm
by Virion
code code code code code code code code code code code code

Posted: Sat Apr 10, 2010 7:29 pm
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.

Posted: Sat Apr 10, 2010 7:36 pm
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); 

Posted: Sat Apr 10, 2010 8:13 pm
by freetimecoder
Maybe you should brush up your knowledge about classes and pointers a little.

greetings

Posted: Sat Apr 10, 2010 10:55 pm
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