Until now, we have always loaded a 3D model from a file. Now we will create one directly:
Delete all the code inside the
createScene()
function.Add the following line to define a plane in the
createScene()
function:Ogre::Plane plane(Vector3::UNIT_Y, -10);
Now create the plane into your memory:
Ogre::MeshManager::getSingleton().createPlane("plane", ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, plane, 1500,1500,20,20,true,1,5,5,Vector3::UNIT_Z);
Create an instance of the plane:
Ogre::Entity* ent = mSceneMgr->createEntity("LightPlaneEntity", "plane");
Attach the plane to the scene:
mSceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(ent);
To get anything other than a white plane, set the material of the plane to an existing material:
ent->setMaterialName("Examples/BeachStones");
Compile the application and run it. You should see some dark stones.
We have inverted the colors for ease of reading!