Page 1 of 1

how to create floor plane that extends to infinity?

Posted: Thu May 12, 2011 2:02 am
by pverlaine999
Hi,

I create a floor plane with something like this:

Code: Select all

	    SMaterial * material = new SMaterial();
	    material->AntiAliasing = EAAM_QUALITY | EAAM_LINE_SMOOTH | EAAM_POINT_SMOOTH;
	    material->Thickness = 1.0f;

	    IAnimatedMesh *movingPlane = smgr->addHillPlaneMesh("floor",
	    		core::dimension2df(10, 10),
	    		core::dimension2du(100, 100),
	    		material);
	    IAnimatedMeshSceneNode *myfloor = smgr->addAnimatedMeshSceneNode(movingPlane);
This has to set the size of the plane. But I'd like to have a floor plane that extends to infinity in all directions, so that when I move my camera, I'll never reach the end.

How could I do that?

Thanks for all.

Paul

Posted: Thu May 12, 2011 2:49 am
by ChaiRuiPeng
there is no true infinity in computers, however you can simulate this.

it depends on what you want exactly.

judging by your code snippet it seems you want a "terrain", with height and all that extending in all directions? if so then you could just tile it dynamically on the fly.

Posted: Thu May 12, 2011 2:55 am
by pverlaine999
Sorry, newbie here. What does "tile it dynamically on the fly" means?

Thanks

Posted: Thu May 12, 2011 3:09 am
by ChaiRuiPeng
oh sorry :P
well if i were to have to do something like this, i would just make a large mesh of whatever you want to tile, in your case that hillmesh scene node, and create x copies of it positioned all around the camera and maybe have a fog set so you don't have to create so many. as the player camera moves just tile more meshes in their correct positions and remove ones that get too far from the player camera.

Posted: Thu May 12, 2011 3:36 am
by pverlaine999
Thanks for explaining. So let me try to understand this.

Let's say I create 16 IAnimatedMeshSceneNode at the beginning, and stick them together by calling setPosition() for each of them, to form a 4x4 grid. Then as the camera move in one direction, I just stick more of it to the "front" of the camera, while removing some from the "back" of the camera.

Something like that, right?

Posted: Thu May 12, 2011 6:02 am
by roelor
exactly.
However, you'd probably be better off moving the plane on the back to the front.
(instead of removing it and creating a new one).