// Create the scene node for the ocean. We create a plane, add the ocean material, create a scene node // and add the plane to the scene node and return that scene node. // BETWEEN FRAME OPERATION Ogre::SceneNode* Region::CreateOcean(Ogre::SceneNode* regionNode, const float width, const float length, const float waterHeight, Ogre::String waterName) { Ogre::Plane* oceanPlane = new Ogre::Plane(0.0, 0.0, 1.0, 0); Ogre::MeshPtr oceanMesh = Ogre::MeshManager::getSingleton().createPlane(waterName, OLResourceGroupName, *oceanPlane, width, length, 2, 2, true, 2, 2.0, 2.0, Ogre::Vector3::UNIT_Y); Ogre::String oceanMaterialName = LG::GetParameter("Renderer.Ogre.OceanMaterialName"); LG::Log("Region::CreateOcean: r=%s, h=%f, n=%s, m=%s", regionNode->getName().c_str(), waterHeight, waterName.c_str(), oceanMaterialName.c_str()); oceanMesh->getSubMesh(0)->setMaterialName(oceanMaterialName); Ogre::Entity* oceanEntity = LG::RendererOgre::Instance()->m_sceneMgr->createEntity("WaterEntity/" + waterName, oceanMesh->getName()); oceanEntity->addQueryFlags(Ogre::SceneManager::WORLD_GEOMETRY_TYPE_MASK); oceanEntity->setCastShadows(false); Ogre::SceneNode* oceanNode = regionNode->createChildSceneNode("WaterSceneNode/" + waterName); oceanNode->setInheritOrientation(true); oceanNode->setInheritScale(false); oceanNode->translate(width/2.0f, length/2.0f, waterHeight); oceanNode->attachObject(oceanEntity); return oceanNode; }