Showing boundaries on Cube Scene Node

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
newbie8787
Posts: 105
Joined: Thu Jan 10, 2008 6:26 pm

Showing boundaries on Cube Scene Node

Post by newbie8787 »

Is it possible to draw boundaries on the cubeSceneNode's I am using a chain of them to form a playing field and need one to be distinguished from the other.
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

maybe show it's bounding box ??? ;)

Code: Select all

theCube->setDebugDataVisible(EDS_BBOX);
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
newbie8787
Posts: 105
Joined: Thu Jan 10, 2008 6:26 pm

Boundig box : Doesnt show boundaries

Post by newbie8787 »

Thanks for the suggestion Acki :)
But the bounding box does not seem to have the effect I need. I need the whole cube, and all its edges to be outlined with black , the bounding box just kinda shows some squiggly white areas outside of the mesh.
nespa
Posts: 167
Joined: Wed Feb 24, 2010 12:02 pm

Post by nespa »

Code: Select all

void OutlineMesh(IAnimatedMeshSceneNode* mesh,float Width,unsigned int R,unsigned int G,unsigned int B)
	{
		SMaterial tmat[MATERIAL_MAX_TEXTURES],lmat;

		lmat.DiffuseColor = SColor(255,R,G,B);
		lmat.SpecularColor = SColor(255,R,G,B);
		lmat.AmbientColor = SColor(255,R,G,B);
		lmat.EmissiveColor = SColor(255,R,G,B);
		lmat.BackfaceCulling = false;
		lmat.FrontfaceCulling = true;
		lmat.Lighting = true;
		lmat.Thickness = Width;
		lmat.Wireframe = true;
		
		for(unsigned int i = 0;i<mesh->getMaterialCount();i++)
		{
			tmat[i] = mesh->getMaterial(i);
			mesh->getMaterial(i) = lmat;
		}

		mesh->render();

		for(unsigned int j = 0;j<mesh->getMaterialCount();j++)
			mesh->getMaterial(j) = tmat[j];
	}
newbie8787
Posts: 105
Joined: Thu Jan 10, 2008 6:26 pm

Whoa !!

Post by newbie8787 »

Whoa !! That much just to get a simple boundary on a cube :P

Still , thanks a lot :) I'll try it out !
nespa
Posts: 167
Joined: Wed Feb 24, 2010 12:02 pm

Post by nespa »

take care, call the function inside the main loop before drawAll
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

You can use the OverrideMaterial to avoid copying all those materials. Also move the material definition to a place before the render loop. Then it's just a few calls.
nespa
Posts: 167
Joined: Wed Feb 24, 2010 12:02 pm

Post by nespa »

yes, is faster this way
Post Reply