Quick and Easy Grid

A forum to store posts deemed exceptionally wise and useful
Post Reply
DarkWhoppy
Posts: 386
Joined: Thu Sep 25, 2003 12:43 pm
Contact:

Quick and Easy Grid

Post by DarkWhoppy »

I can't find the righ topic, but someone asked me to post shorter grid code. It's actually only 3 lines if you don't count the space and brackets. This works, I typed it up pretty quick... but if you toy with the numbers you can get the grid the perfect size for you. Also, keep in mind, it has to be redrawn every frame. So put it between "smgr->drawAll()".

I made this orginally to have in IrrSED2, but I removed it. Scene editors don't really need a grid. :roll:

Code: Select all

for(float i = -10; i <= 10; i += 1)
{

	_driver->draw3DLine(vector3df(-20,0,i*3),vector3df(20,0,i*3),  
  		SColor(255, 255, 255, 255));  

	_driver->draw3DLine(vector3df(i*3,0,-20),vector3df(i*3,0,20),  
  		SColor(255, 255, 255, 255));

}
Image
Programmer of the Irrlicht Scene Editor:
Homepage - Forum Thread
Version 2 on its way!!
Midnight
Posts: 1772
Joined: Fri Jul 02, 2004 2:37 pm
Location: Wonderland

Post by Midnight »

Thanks for this whoppy I'm sure many will use it...

Can't wait for IrrSED2!
Post Reply