138 const RenderSystemCapabilities* caps = Root::getSingleton().getRenderSystem()->getCapabilities();
139 if (!caps->hasCapability(RSC_VERTEX_PROGRAM) || !(caps->hasCapability(RSC_FRAGMENT_PROGRAM)))
141 OGRE_EXCEPT(Exception::ERR_RENDERINGAPI_ERROR,
"Your card does not support vertex and fragment programs, so cannot "
142 "run Water effects. Sorry!",
147 if (!GpuProgramManager::getSingleton().isSyntaxSupported(
"arbfp1") &&
148 !GpuProgramManager::getSingleton().isSyntaxSupported(
"ps_2_0") &&
149 !GpuProgramManager::getSingleton().isSyntaxSupported(
"ps_1_4")
152 OGRE_EXCEPT(Exception::ERR_RENDERINGAPI_ERROR,
"Your card does not support advanced fragment programs, "
153 "so cannot run Water effects. Sorry!",
166 TexturePtr m_refract_rtt_targetPtr = Ogre::TextureManager::getSingleton ().getByName (
"Refraction");
181 MaterialPtr mat = MaterialManager::getSingleton().getByName(
"Examples/FresnelReflectionRefraction");
182 mat->getTechnique(0)->getPass(0)->getTextureUnitState(2)->setTextureName(
"Refraction");
184 mat = MaterialManager::getSingleton().getByName(
"Examples/FresnelReflectionRefractioninverted");
185 mat->getTechnique(0)->getPass(0)->getTextureUnitState(2)->setTextureName(
"Refraction");
199 TexturePtr m_reflect_rtt_targetPtr = Ogre::TextureManager::getSingleton ().getByName (
"Reflection");
217 mat = MaterialManager::getSingleton().getByName(
"Examples/FresnelReflectionRefraction");
218 mat->getTechnique(0)->getPass(0)->getTextureUnitState(1)->setTextureName(
"Reflection");
220 mat = MaterialManager::getSingleton().getByName(
"Examples/FresnelReflectionRefractioninverted");
221 mat->getTechnique(0)->getPass(0)->getTextureUnitState(1)->setTextureName(
"Reflection");
225 mat = MaterialManager::getSingleton().getByName(
"Examples/FresnelReflection");
226 mat->getTechnique(0)->getPass(0)->getTextureUnitState(1)->setTextureName(
"Reflection");
243 ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
256 ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
274 MeshManager::getSingleton().createPlane(
"BottomPlane",
275 ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
279 pE->setMaterialName(
"tracks/seabottom");
280 pE->setCastShadows(
false);
376 Vector3 sightPos(water_cam_pos);
378 Ogre::Vector3 cameraDir = camera_rot * -Ogre::Vector3::UNIT_Z;
380 Ray lineOfSight(camera_pos, cameraDir);
383 std::pair<bool, Real> intersection = lineOfSight.intersects(waterPlane);
385 if (intersection.first && intersection.second > 0.0f)
386 sightPos = lineOfSight.getPoint(intersection.second);
388 Real offset = std::min(water_cam_pos.distance(sightPos), std::min(
m_map_size.x,
m_map_size.z) * 0.5f);
390 Vector3 waterPos = water_cam_pos + (sightPos - water_cam_pos).normalisedCopy() * offset;
System integration layer; inspired by OgreBites::ApplicationContext.
const TerrainPtr & GetTerrain()