LightNode->setDebugDataVisible

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
etcaptor
Posts: 871
Joined: Fri Apr 09, 2004 10:32 pm
Location: Valhalla
Contact:

LightNode->setDebugDataVisible

Post by etcaptor »

Hi all,
I try switch LightNode->setDebugDataVisible(true),
but cannot see Debug box. Someone knows how?
Thanks in advance.
SuryIIID
Posts: 14
Joined: Mon Dec 29, 2003 8:54 pm
Location: Bulgaria..?

Post by SuryIIID »

Well debugDataVisible(the AABB rendering) is only applied to the following sceneNodes :
CAnimatedMeshSceneNode,
CMeshSceneNode,
COctTreeSceneNode,
CParticleSystemSceneNode
in the CLightSceneNode the method is simply inherited from irr::scene::ISceneNode but setting debugDataVisible to true doesn't affect the rendering , well i guess Niko ommited this part since a light source isn't
actually a mesh or ParticleSysyem and it could be represented by a single vector for the position and other parameters depending of the light type cone direction ,fall off etc so in theory talking about a light's AABB is kinda unnatural IMHO , but in practice you see that sometimes you need to see a box around a light in order to get the idea of where it is actually in space , but as you can see you loose the information about the direction , range etc. A better representation would be a 3D arrow or something and a bounding sphere.

Anyway i appreciate your Irrlicht->Borland port(yeah i'm a Borland bitch:)) and i wanna return the favour as much as i can :)
Here is what i came up with so far :
in the void CLightSceneNode::render() [file CLightSceneNode.cpp (line 41)]
in the end of the function put this :

Code: Select all

 // for debug purposes only:
if (DebugDataVisible)
    {
        core::matrix4 mat ;
        mat.makeIdentity();

        mat.setTranslation(LightData.Position);
        driver->setTransform(video::ETS_WORLD, mat);
            	BBox.reset(core::vector3df(0,0,0));
                BBox.MaxEdge = core::vector3df(20,20,20);
                BBox.MinEdge = core::vector3df(-20,-20,-20) ;

	video::SMaterial m;
	m.Lighting = false;
	driver->setMaterial(m);
	driver->draw3DBox(BBox,      video::SColor0,255,255,255));
       }


Push compile button, Enjoy :)
etcaptor
Posts: 871
Joined: Fri Apr 09, 2004 10:32 pm
Location: Valhalla
Contact:

Post by etcaptor »

Hehe, sounds great. I'll try it.
Thanks for help, now I not feel lonely with C++Builder in this forum :lol:
Cheers! :lol:
etcaptor
Posts: 871
Joined: Fri Apr 09, 2004 10:32 pm
Location: Valhalla
Contact:

Post by etcaptor »

OK, that works!
Only
driver->draw3DBox(BBox,video::SColor (0,255,255,255));
must be instead
driver->draw3DBox(BBox, video::SColor0,255,255,255));
Sticky keyboard keys? :wink:
I still don't know whether in v.07 are directional lights included.
But after some experiments have tried this

For sphere light:

Code: Select all

//internal 3dbox for orientation of position /white/.
                BBox.MaxEdge = core::vector3df(20,20,20);
                BBox.MinEdge = core::vector3df(-20,-20,-20) ;
//additional external 3dbox for approximately range orientation /with color of this light/             
                float r = LightData.Radius;
                BBox.MaxEdge = core::vector3df(r,r,r);
                BBox.MinEdge = core::vector3df(-r,-r,-r) ;
Irrlicht have not any octahedron /sphere/ drawing functions, but it's possible to make it. At this time I'm so lazy for implementation of similar drawing functions :wink: , but it's not so hard. Well, time will show - I hope some other user to make it instead me :lol:

Image
SuryIIID
Posts: 14
Joined: Mon Dec 29, 2003 8:54 pm
Location: Bulgaria..?

Post by SuryIIID »

Irrlicht have not any octahedron /sphere/ drawing functions, but it's possible to make it. At this time I'm so lazy for implementation of similar drawing functions , but it's not so hard. Well, time will show - I hope some other user to make it instead me
Well i'll try to add the following scene nodes to DX part of Irrlicht :

Paralelepiped(Box)
Cylinder
n-sided polygon
Sphere
Teapot
3D text
Torus
etcaptor
Posts: 871
Joined: Fri Apr 09, 2004 10:32 pm
Location: Valhalla
Contact:

Post by etcaptor »

Great! I'll be waiting!!!!
Post Reply