Time for action — creating a plane

Until now, we have always loaded a 3D model from a file. Now we will create one directly:

  1. Delete all the code inside the createScene() function.
  2. Add the following line to define a plane in the createScene() function:
    Ogre::Plane plane(Vector3::UNIT_Y, -10);
    
  3. 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);
    
  4. Create an instance of the plane:
    Ogre::Entity* ent = mSceneMgr->createEntity("LightPlaneEntity", "plane");
    
  5. Attach the plane to the scene:
    mSceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(ent);
    
  6. To get anything other than a white plane, set the material ...

Get Ogre 3D 1.7 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.