51 finitePlaneWaterSizeX = planeSizeX;
52 finitePlaneWaterSizeY = planeSizeY;
58 radialWaterRadius = waterRadius;
66void SWater::CommonConstructorsSequence(
const WaterGeometryType& selectedWaterGeometryType)
73 renderingViewport = 0;
75 IslastUnderWater =
false;
78 actualGeometryType = selectedWaterGeometryType;
79 finitePlaneWaterSizeX = 0;
80 finitePlaneWaterSizeY = 0;
81 radialWaterRadius = 0.0f;
84 waterPlanePosition = Ogre::Vector3::ZERO;
85 wavesAnimationSpeed = 1.0f;
86 cachedWindDirection = Ogre::Vector2::ZERO;
89 baseColour = Ogre::ColourValue(0.025, .2, 0.35);
90 RefreshWaterColourGradient();
93 perlinNoiseOptions.Octaves = 8;
94 perlinNoiseOptions.Scale = 0.85f;
95 perlinNoiseOptions.Falloff = 0.49f;
96 perlinNoiseOptions.Animspeed = 1.4f;
97 perlinNoiseOptions.Timemulti = 1.27f;
98 perlinNoiseOptions.GPU_Strength = 0.20f;
99 perlinNoiseOptions.GPU_LODParameters = Ogre::Vector3(0.5f, 50, 150000);
102 fftNoiseOptions.Resolution = 128;
103 fftNoiseOptions.PhysicalResolution = 32.0f;
104 fftNoiseOptions.Scale = 0.25f;
105 fftNoiseOptions.WindDirection = Ogre::Vector2(4,5);
106 fftNoiseOptions.AnimationSpeed = .1;
107 fftNoiseOptions.KwPower = 6.0f;
108 fftNoiseOptions.Amplitude = 1.0f;
109 fftNoiseOptions.GPU_Strength = .20f;
110 fftNoiseOptions.GPU_LODParameters = Ogre::Vector3(0.5f, 50, 150000);
113 godRaysComponent =
new WaterComponentGodRays(
this);
114 underwaterReflectionsComponent =
new WaterComponentUnderwaterReflections(
this);
115 underwaterComponent =
new WaterComponentUnderwater(
this);
116 causticsComponent =
new WaterComponentCaustics(
this);
117 smoothComponent =
new WaterComponentSmooth(
this);
118 depthComponent =
new WaterComponentDepth(
this);
119 foamComponent =
new WaterComponentFoam(
this);
120 sunComponent =
new WaterComponentSun(
this);
129 underwaterReflectionsComponent->
SetEnabled(
true);
133 progGridOptions.Strength = 0.35f;
134 progGridOptions.Elevation = 1.0f;
135 progGridOptions.ChoppyStrength = 0.0375f;
136 progGridOptions.Complexity = 256;
137 progGridOptions.ForceRecalculateGeometry =
false;
143 SO3_SAFE_DELETE(sunComponent);
144 SO3_SAFE_DELETE(foamComponent);
145 SO3_SAFE_DELETE(depthComponent);
146 SO3_SAFE_DELETE(smoothComponent);
147 SO3_SAFE_DELETE(causticsComponent);
148 SO3_SAFE_DELETE(underwaterComponent);
149 SO3_SAFE_DELETE(underwaterReflectionsComponent);
150 SO3_SAFE_DELETE(godRaysComponent);
151 SO3_SAFE_DELETE(hydraxManager);
152 SO3_SAFE_DELETE(hydraxGeometry);
153 SO3_SAFE_DELETE(hydraxNoise);
154 SO3_SAFE_DELETE(hydraxManager);
157bool SWater::Initialize()
160 if (renderingViewport == 0)
165 hydraxManager->setRttVisibilityMask(SO3_VISIBILITY_MASK_VISIBLE_WATER_RTT);
168 hydraxNoise = CreatePerlinNoise();
172 if(hydraxGeometry == 0)
174 switch(actualGeometryType)
177 CreateInfinitePlaneGeometry();
180 CreateFinitePlaneGeometry(finitePlaneWaterSizeX, finitePlaneWaterSizeY);
183 CreateRadialPlaneGeometry(radialWaterRadius);
190 hydraxManager->setUnderwaterCameraSwitchDelta(0.0f);
191 hydraxManager->setGlobalTransparency(0.05f);
192 hydraxManager->setFullReflectionDistance(99999997952.0);
197 hydraxManager->setPosition(waterPlanePosition);
212 ScolWindowHandle awindow = (ScolWindowHandle)SCgetExtra(
"hscol");
213 AConfiguration* config = AConfiguration_new();
216 int nwidth = (int)ANativeWindow_getWidth(awindow) / 2;
217 int nheight = (int)ANativeWindow_getHeight(awindow) / 2;
222 nwidth = (int)ANativeWindow_getHeight(awindow) / 2;
223 nheight = (int)ANativeWindow_getWidth(awindow) / 2;
226 hydraxManager->getRttManager()->setTextureSize(Hydrax::RttManager::RTT_REFLECTION, Hydrax::Size(
nwidth,
nheight));
227 hydraxManager->getRttManager()->setTextureSize(Hydrax::RttManager::RTT_REFRACTION, Hydrax::Size(
nwidth,
nheight));
228 hydraxManager->getRttManager()->setTextureSize(Hydrax::RttManager::RTT_DEPTH, Hydrax::Size(
nwidth,
nheight));
229 hydraxManager->getRttManager()->setTextureSize(Hydrax::RttManager::RTT_DEPTH_REFLECTION, Hydrax::Size(
nwidth,
nheight));
230 hydraxManager->getRttManager()->setTextureSize(Hydrax::RttManager::RTT_GPU_NORMAL_MAP, Hydrax::Size(
nwidth,
nheight));
247 if(!hydraxManager->isCreated())
249 hydraxManager->create();
250 if (hydraxManager->getMesh() && hydraxManager->getMesh()->getEntity())
251 hydraxManager->getMesh()->getEntity()->setVisibilityFlags(SO3_VISIBILITY_FLAG_INVISIBLE_ENVIRONMENT);
254 hydraxManager->getRttManager()->addRttListener(
this);
257 if(renderingViewport != 0)
264 ogreViewport->getTarget()->removeListener(
this);
265 ogreViewport->getTarget()->addListener(
this);
275 if(hydraxManager == 0)
278 if(hydraxManager->isCreated())
281 if(renderingViewport != 0)
288 if(ogreViewport != 0)
290 Ogre::RenderTarget* ogreRenderTarget = ogreViewport->getTarget();
292 ogreRenderTarget->removeListener(
this);
299 hydraxManager->getRttManager()->removeRttListener(
this,
false);
303 SO3_SAFE_DELETE(hydraxManager);
312 hydraxManager->registerViewport(viewport);
318 hydraxManager->unregisterViewport(viewport);
324 renderingViewport = viewport;
332 if(viewport == renderingViewport)
336 renderingViewport = 0;
343 return hydraxManager;
349 switch(componentType)
352 component = sunComponent;
355 component = foamComponent;
358 component = depthComponent;
361 component = smoothComponent;
364 component = causticsComponent;
367 component = underwaterComponent;
370 component = underwaterReflectionsComponent;
373 component = godRaysComponent;
376 OGRE_EXCEPT(Ogre::Exception::ERR_INVALIDPARAMS,
"Invalid water component type requested!",
"SWater::GetComponent");
389 return foamComponent;
394 return depthComponent;
399 return smoothComponent;
404 return causticsComponent;
409 return underwaterComponent;
414 return underwaterReflectionsComponent;
419 return godRaysComponent;
424 return perlinNoiseOptions;
429 perlinNoiseOptions = newOptions;
431 if(hydraxNoise->getName() ==
"Perlin")
434 (
static_cast<Hydrax::Noise::Perlin*
> (hydraxNoise))->setOptions(perlinNoiseOptions);
436 catch(Ogre::Exception)
443 return fftNoiseOptions;
448 fftNoiseOptions = newOptions;
450 if(hydraxNoise->getName() ==
"FFT")
453 (
static_cast<Hydrax::Noise::FFT*
> (hydraxNoise))->setOptions(fftNoiseOptions);
455 catch(Ogre::Exception)
462 return actualGeometryType;
467 CreateInfinitePlaneGeometry();
472 return progGridOptions.Strength;
477 progGridOptions.Strength = value;
485 hydraxManager->setPlanesError(value * 0.5 + 0.02f);
486 static_cast<Hydrax::Module::ProjectedGrid*
>(hydraxGeometry)->setOptions(progGridOptions);
488 catch(Ogre::Exception)
495 return progGridOptions.Elevation;
500 progGridOptions.Elevation = value;
507 static_cast<Hydrax::Module::ProjectedGrid*
>(hydraxGeometry)->setOptions(progGridOptions);
509 catch(Ogre::Exception)
516 return progGridOptions.Complexity;
521 progGridOptions.Complexity = value;
528 static_cast<Hydrax::Module::ProjectedGrid*
>(hydraxGeometry)->setOptions(progGridOptions);
530 catch(Ogre::Exception)
537 return progGridOptions.ChoppyStrength;
542 progGridOptions.ChoppyStrength = value;
549 static_cast<Hydrax::Module::ProjectedGrid*
>(hydraxGeometry)->setOptions(progGridOptions);
551 catch(Ogre::Exception)
558 CreateFinitePlaneGeometry(planeSizeX, planeSizeY);
563 CreateRadialPlaneGeometry(waterRadius);
566void SWater::CreateInfinitePlaneGeometry()
569 Hydrax::Module::ProjectedGrid* newHydraxGeometry;
570 newHydraxGeometry =
new Hydrax::Module::ProjectedGrid(hydraxManager,
572 Ogre::Plane(Ogre::Vector3(0,1,0), Ogre::Vector3(0,0,0)),
573 Hydrax::MaterialManager::NM_VERTEX,
577 hydraxManager->setModule(newHydraxGeometry,
true);
580 hydraxGeometry = newHydraxGeometry;
584void SWater::CreateFinitePlaneGeometry(
const int& planeSizeX,
const int& planeSizeY)
587 Hydrax::Module::SimpleGrid::Options geometryOptions;
588 geometryOptions.MeshSize = Hydrax::Size(planeSizeX, planeSizeY);
591 Hydrax::Module::SimpleGrid* newHydraxGeometry;
592 newHydraxGeometry =
new Hydrax::Module::SimpleGrid(hydraxManager,
594 Hydrax::MaterialManager::NM_VERTEX,
598 hydraxManager->setModule(newHydraxGeometry,
true);
601 hydraxGeometry = newHydraxGeometry;
603 finitePlaneWaterSizeX = planeSizeX;
604 finitePlaneWaterSizeY = planeSizeY;
607void SWater::CreateRadialPlaneGeometry(
const float& waterRadius)
610 Hydrax::Module::RadialGrid::Options geometryOptions;
611 geometryOptions.Radius = waterRadius;
614 Hydrax::Module::RadialGrid* newHydraxGeometry;
615 newHydraxGeometry =
new Hydrax::Module::RadialGrid(hydraxManager,
617 Hydrax::MaterialManager::NM_VERTEX,
621 hydraxManager->setModule(newHydraxGeometry,
true);
624 hydraxGeometry = newHydraxGeometry;
626 radialWaterRadius = waterRadius;
629void SWater::RefreshWaterColourGradient()
632 waterColourGradient.
Clear();
645 Hydrax::HydraxComponent components = Hydrax::HYDRAX_COMPONENTS_NONE;
646 if (godRaysComponent && godRaysComponent->
GetEnabled())
647 components =
static_cast<Hydrax::HydraxComponent
> (components|Hydrax::HYDRAX_COMPONENT_UNDERWATER_GODRAYS);
649 if (underwaterReflectionsComponent && underwaterReflectionsComponent->
GetEnabled())
650 components =
static_cast<Hydrax::HydraxComponent
> (components|Hydrax::HYDRAX_COMPONENT_UNDERWATER_REFLECTIONS);
652 if (underwaterComponent && underwaterComponent->
GetEnabled())
653 components =
static_cast<Hydrax::HydraxComponent
> (components|Hydrax::HYDRAX_COMPONENT_UNDERWATER);
655 if (causticsComponent && causticsComponent->
GetEnabled())
656 components =
static_cast<Hydrax::HydraxComponent
> (components|Hydrax::HYDRAX_COMPONENT_CAUSTICS);
658 if (smoothComponent && smoothComponent->
GetEnabled())
659 components =
static_cast<Hydrax::HydraxComponent
> (components|Hydrax::HYDRAX_COMPONENT_SMOOTH);
661#if !defined(ANDROID) && !defined(APPLE_IOS) && !defined(RPI)
662 if (depthComponent && depthComponent->
GetEnabled())
663 components =
static_cast<Hydrax::HydraxComponent
> (components|Hydrax::HYDRAX_COMPONENT_DEPTH);
666 if (foamComponent && foamComponent->
GetEnabled())
667 components =
static_cast<Hydrax::HydraxComponent
> (components|Hydrax::HYDRAX_COMPONENT_FOAM);
669 if (sunComponent && sunComponent->
GetEnabled())
670 components =
static_cast<Hydrax::HydraxComponent
> (components|Hydrax::HYDRAX_COMPONENT_SUN);
672 hydraxManager->setComponents(components);
681SWater::WaterComponent::WaterComponent(
SWater* parentWaterInstance,
const SWater::WaterComponentType& component,
const Hydrax::HydraxComponent& hydraxComponent) : componentType(component),
682 hydraxComponentType(hydraxComponent)
685 waterComponentEnable =
false;
689 hydraxComponentType(Hydrax::HYDRAX_COMPONENTS_NONE)
693 waterComponentEnable =
false;
704 return waterComponentEnable;
709 if(waterComponentEnable != enable)
711 waterComponentEnable = enable;
718 Hydrax::Hydrax* hydraxManager = parentWater->GetHydrax();
719 if(hydraxManager != 0)
722 if(waterComponentEnable)
725 parentWater->ApplyHydraxComponentTypes();
731 return componentType;
739 horizonPlane = Ogre::Plane(Ogre::Vector3::UNIT_Y, 0);
740 SetParameters(Ogre::Vector3(0.0f, 10000.0f, 0.0f), 1.75f, 1500.0f, Ogre::ColourValue(1.0f, 0.9f, 0.6f));
750 sunPosition = position;
751 sunStrength = strength;
759 Hydrax::Hydrax* hydraxManager = parentWater->GetHydrax();
760 if(hydraxManager != 0)
761 sunPosition = hydraxManager->getSunPosition();
768 sunPosition = position;
769 Hydrax::Hydrax* hydraxManager = parentWater->GetHydrax();
770 if(hydraxManager != 0)
771 hydraxManager->setSunPosition(sunPosition);
776 Hydrax::Hydrax* hydraxManager = parentWater->GetHydrax();
777 if(hydraxManager != 0)
778 sunStrength = hydraxManager->getSunStrength();
785 sunStrength = strength;
786 Hydrax::Hydrax* hydraxManager = parentWater->GetHydrax();
787 if(hydraxManager != 0)
788 hydraxManager->setSunStrength(sunStrength);
793 Hydrax::Hydrax* hydraxManager = parentWater->GetHydrax();
794 if(hydraxManager != 0)
795 sunArea = hydraxManager->getSunArea();
803 Hydrax::Hydrax* hydraxManager = parentWater->GetHydrax();
804 if(hydraxManager != 0)
805 hydraxManager->setSunArea(sunArea);
810 Hydrax::Hydrax* hydraxManager = parentWater->GetHydrax();
811 if(hydraxManager != 0)
813 Ogre::Vector3 sunColourAsVector = hydraxManager->getSunColor();
814 sunColor = Ogre::ColourValue(sunColourAsVector.x, sunColourAsVector.y, sunColourAsVector.z);
823 Hydrax::Hydrax* hydraxManager = parentWater->GetHydrax();
824 if(hydraxManager != 0)
826 Ogre::Vector3 sunColourAsVector(sunColor.r, sunColor.g, sunColor.b);
827 hydraxManager->setSunColor(sunColourAsVector);
833 Hydrax::Hydrax* hydraxManager = parentWater->GetHydrax();
834 if(hydraxManager != 0 && hydraxManager->isCreated())
837 bool hydraxComponentState = hydraxManager->isComponent(hydraxComponentType);
840 Ogre::Vector3 sunLightDirecton = parentWater->GetEnvironment()->GetSun()->GetLightDirection();
843 Ogre::Vector3 sunColourAsVector(0.0f, 0.0f, 0.0f);
844 if(sunLightDirecton.y > -0.07)
847 Ogre::ColourValue tmpSunColour = parentWater->GetEnvironment()->GetSun()->GetLightColour();
848 sunColourAsVector = Ogre::Vector3(tmpSunColour.r, tmpSunColour.g, tmpSunColour.b);
851 if(hydraxComponentState ==
true)
854 hydraxManager->setSunPosition(sunLightDirecton * 10000.0f);
857 hydraxManager->setSunColor(sunColourAsVector);
864 Hydrax::Hydrax* hydraxManager = parentWater->GetHydrax();
865 if(hydraxManager != 0)
867 hydraxManager->setSunPosition(sunPosition);
868 hydraxManager->setSunStrength(sunStrength);
869 hydraxManager->setSunArea(sunArea);
870 Ogre::Vector3 sunColourAsVector(sunColor.r, sunColor.g, sunColor.b);
871 hydraxManager->setSunColor(sunColourAsVector);
890 foamMaxDistance = maxDistance;
893 foamTransparency = transparency;
899 Hydrax::Hydrax* hydraxManager = parentWater->GetHydrax();
900 if(hydraxManager != 0)
901 foamMaxDistance = hydraxManager->getFoamMaxDistance();
903 return foamMaxDistance;
908 foamMaxDistance = maxDistance;
909 Hydrax::Hydrax* hydraxManager = parentWater->GetHydrax();
910 if(hydraxManager != 0)
911 hydraxManager->setFoamMaxDistance(foamMaxDistance);
916 Hydrax::Hydrax* hydraxManager = parentWater->GetHydrax();
917 if(hydraxManager != 0)
918 foamScale = hydraxManager->getFoamScale();
926 Hydrax::Hydrax* hydraxManager = parentWater->GetHydrax();
927 if(hydraxManager != 0)
928 hydraxManager->setFoamScale(foamScale);
933 Hydrax::Hydrax* hydraxManager = parentWater->GetHydrax();
934 if(hydraxManager != 0)
935 foamStart = hydraxManager->getFoamStart();
943 Hydrax::Hydrax* hydraxManager = parentWater->GetHydrax();
944 if(hydraxManager != 0)
945 hydraxManager->setFoamStart(foamStart);
950 Hydrax::Hydrax* hydraxManager = parentWater->GetHydrax();
951 if(hydraxManager != 0)
952 foamTransparency = hydraxManager->getFoamTransparency();
954 return foamTransparency;
959 foamTransparency = transparency;
960 Hydrax::Hydrax* hydraxManager = parentWater->GetHydrax();
961 if(hydraxManager != 0)
962 hydraxManager->setFoamTransparency(foamTransparency);
972 Hydrax::Hydrax* hydraxManager = parentWater->GetHydrax();
973 if(hydraxManager != 0)
975 hydraxManager->setFoamMaxDistance(foamMaxDistance);
976 hydraxManager->setFoamScale(foamScale);
977 hydraxManager->setFoamStart(foamStart);
978 hydraxManager->setFoamTransparency(foamTransparency);
997 depthLimitation = depthLimit;
998 distanceLimitation = distanceLimit;
1004 Hydrax::Hydrax* hydraxManager = parentWater->GetHydrax();
1005 if(hydraxManager != 0)
1006 depthLimitation = hydraxManager->getDepthLimit();
1008 return depthLimitation;
1013 depthLimitation = depthLimit;
1014 Hydrax::Hydrax* hydraxManager = parentWater->GetHydrax();
1015 if(hydraxManager != 0)
1016 hydraxManager->setDepthLimit(depthLimitation);
1021 Hydrax::Hydrax* hydraxManager = parentWater->GetHydrax();
1022 if(hydraxManager != 0)
1023 distanceLimitation = hydraxManager->getDistLimit();
1025 return distanceLimitation;
1030 distanceLimitation = distanceLimit;
1031 Hydrax::Hydrax* hydraxManager = parentWater->GetHydrax();
1032 if(hydraxManager != 0)
1033 hydraxManager->setDistLimit(distanceLimitation);
1043 Hydrax::Hydrax* hydraxManager = parentWater->GetHydrax();
1044 if(hydraxManager != 0)
1046 hydraxManager->setDepthLimit(depthLimitation);
1047 hydraxManager->setDistLimit(distanceLimitation);
1051 parentWater->GetSmooth()->ApplyEnable();
1052 parentWater->GetCaustics()->ApplyEnable();
1070 Hydrax::Hydrax* hydraxManager = parentWater->GetHydrax();
1071 if(hydraxManager != 0)
1072 smoothPower = hydraxManager->getSmoothPower();
1079 smoothPower = power;
1090 Hydrax::Hydrax* hydraxManager = parentWater->GetHydrax();
1091 if(hydraxManager != 0)
1092 hydraxManager->setSmoothPower(smoothPower);
1110 causticsScale = scale;
1111 causticsPower = power;
1118 Hydrax::Hydrax* hydraxManager = parentWater->GetHydrax();
1119 if(hydraxManager != 0)
1120 causticsScale = hydraxManager->getCausticsScale();
1122 return causticsScale;
1127 causticsScale = scale;
1128 Hydrax::Hydrax* hydraxManager = parentWater->GetHydrax();
1129 if(hydraxManager != 0)
1130 hydraxManager->setCausticsScale(causticsScale);
1135 Hydrax::Hydrax* hydraxManager = parentWater->GetHydrax();
1136 if(hydraxManager != 0)
1137 causticsPower = hydraxManager->getCausticsPower();
1139 return causticsPower;
1144 causticsPower = power;
1145 Hydrax::Hydrax* hydraxManager = parentWater->GetHydrax();
1146 if(hydraxManager != 0)
1147 hydraxManager->setCausticsPower(causticsPower);
1152 Hydrax::Hydrax* hydraxManager = parentWater->GetHydrax();
1153 if(hydraxManager != 0)
1154 causticsEnd = hydraxManager->getCausticsEnd();
1162 Hydrax::Hydrax* hydraxManager = parentWater->GetHydrax();
1163 if(hydraxManager != 0)
1164 hydraxManager->setCausticsEnd(causticsEnd);
1174 Hydrax::Hydrax* hydraxManager = parentWater->GetHydrax();
1175 if(hydraxManager != 0)
1177 hydraxManager->setCausticsScale(causticsScale);
1178 hydraxManager->setCausticsPower(causticsPower);
1179 hydraxManager->setCausticsEnd(causticsEnd);
1203 parentWater->GetUnderwaterReflections()->
ApplyEnable();
1204 parentWater->GetGodRays()->ApplyEnable();
1235 SetParameters(Ogre::Vector3(0.76f, 12.46f, 12.29f), 0.015f, 1.0f, 100, 0.0254f,
true);
1245 godRaysExposure = exposure;
1246 godRaysIntensity = intensity;
1247 godRaysSpeed = speed;
1248 godRaysNumberOfRays = numberOfRays;
1249 godRaysRaysSize = raysSize;
1250 godRaysRaysIntersections = raysIntersections;
1256 Hydrax::Hydrax* hydraxManager = parentWater->GetHydrax();
1257 if(hydraxManager != 0)
1259 hydraxManager->setGodRaysExposure(godRaysExposure);
1260 hydraxManager->setGodRaysIntensity(godRaysIntensity);
1261 hydraxManager->getGodRaysManager()->setSimulationSpeed(godRaysSpeed);
1262 hydraxManager->getGodRaysManager()->setNumberOfRays(godRaysNumberOfRays);
1263 hydraxManager->getGodRaysManager()->setRaysSize(godRaysRaysSize);
1264 hydraxManager->getGodRaysManager()->setObjectIntersectionsEnabled(godRaysRaysIntersections);
1270 Hydrax::Hydrax* hydraxManager = parentWater->GetHydrax();
1271 if(hydraxManager != 0)
1272 godRaysExposure = hydraxManager->getGodRaysExposure();
1274 return godRaysExposure;
1279 godRaysExposure = exposure;
1280 Hydrax::Hydrax* hydraxManager = parentWater->GetHydrax();
1281 if(hydraxManager != 0)
1282 hydraxManager->setGodRaysExposure(godRaysExposure);
1287 Hydrax::Hydrax* hydraxManager = parentWater->GetHydrax();
1288 if(hydraxManager != 0)
1289 godRaysIntensity = hydraxManager->getGodRaysIntensity();
1291 return godRaysIntensity;
1296 godRaysIntensity = intensity;
1297 Hydrax::Hydrax* hydraxManager = parentWater->GetHydrax();
1298 if(hydraxManager != 0)
1299 hydraxManager->setGodRaysIntensity(godRaysIntensity);
1304 Hydrax::Hydrax* hydraxManager = parentWater->GetHydrax();
1305 if(hydraxManager != 0)
1306 godRaysSpeed = hydraxManager->getGodRaysManager()->getSimulationSpeed();
1308 return godRaysSpeed;
1313 godRaysSpeed = speed;
1314 Hydrax::Hydrax* hydraxManager = parentWater->GetHydrax();
1315 if(hydraxManager != 0)
1316 hydraxManager->getGodRaysManager()->setSimulationSpeed(godRaysSpeed);
1321 Hydrax::Hydrax* hydraxManager = parentWater->GetHydrax();
1322 if(hydraxManager != 0)
1323 godRaysNumberOfRays = hydraxManager->getGodRaysManager()->getNumberOfRays();
1325 return godRaysNumberOfRays;
1330 godRaysNumberOfRays = numberOfRays;
1331 Hydrax::Hydrax* hydraxManager = parentWater->GetHydrax();
1332 if(hydraxManager != 0)
1333 hydraxManager->getGodRaysManager()->setNumberOfRays(godRaysNumberOfRays);
1338 Hydrax::Hydrax* hydraxManager = parentWater->GetHydrax();
1339 if(hydraxManager != 0)
1340 godRaysRaysSize = hydraxManager->getGodRaysManager()->getRaysSize();
1342 return godRaysRaysSize;
1347 godRaysRaysSize = raysSize;
1348 Hydrax::Hydrax* hydraxManager = parentWater->GetHydrax();
1349 if(hydraxManager != 0)
1350 hydraxManager->getGodRaysManager()->setRaysSize(godRaysRaysSize);
1355 Hydrax::Hydrax* hydraxManager = parentWater->GetHydrax();
1356 if(hydraxManager != 0)
1357 godRaysRaysIntersections = hydraxManager->getGodRaysManager()->areObjectsIntersectionsEnabled();
1359 return godRaysRaysIntersections;
1364 godRaysRaysIntersections = raysIntersections;
1365 Hydrax::Hydrax* hydraxManager = parentWater->GetHydrax();
1366 if(hydraxManager != 0)
1367 hydraxManager->getGodRaysManager()->setObjectIntersectionsEnabled(godRaysRaysIntersections);
1377 if(viewport != renderingViewport)
1390 if(hydraxManager != 0 && hydraxManager->isCreated())
1393 hydraxManager->update(updateTime);
1397 hydraxManager->setWaterColor(Ogre::Vector3(ogreColourValue.r, ogreColourValue.g, ogreColourValue.b));
1401 hydraxManager->setTimeMultiplier(0.0f);
1403 hydraxManager->setTimeMultiplier(wavesAnimationSpeed);
1434 if(cachedWindDirection != newWindDirection)
1436 if(hydraxNoise->getName() ==
"REAL")
1439 fftNoiseOptions.WindDirection = newWindDirection;
1440 cachedWindDirection = newWindDirection;
1442 if(hydraxNoise->getName() ==
"FFT")
1446 (
static_cast<Hydrax::Noise::FFT*
> (hydraxNoise))->setOptions(fftNoiseOptions);
1448 catch(Ogre::Exception)
1459 sunComponent->
Update(updateTime);
1462 foamComponent->
Update(updateTime);
1465 depthComponent->
Update(updateTime);
1468 smoothComponent->
Update(updateTime);
1471 causticsComponent->
Update(updateTime);
1474 underwaterComponent->
Update(updateTime);
1477 godRaysComponent->
Update(updateTime);
1483 if(hydraxManager != 0)
1484 waterPlanePosition = hydraxManager->getPosition();
1486 return waterPlanePosition;
1492 if (waterPlanePosition != newSeaLevel)
1494 waterPlanePosition = newSeaLevel;
1495 if(hydraxManager != 0)
1496 hydraxManager->setPosition(newSeaLevel);
1508 RefreshWaterColourGradient();
1514 wavesAnimationSpeed = hydraxManager->getTimeMultiplier();
1516 return wavesAnimationSpeed;
1521 wavesAnimationSpeed = animationSpeed;
1522 if(hydraxManager != 0)
1523 hydraxManager->setTimeMultiplier(wavesAnimationSpeed);
1526Hydrax::Noise::Noise* SWater::CreatePerlinNoise()
1528 return new Hydrax::Noise::Perlin(perlinNoiseOptions);
1531Hydrax::Noise::Noise* SWater::CreateFftNoise()
1533 return new Hydrax::Noise::FFT(fftNoiseOptions);
1536Hydrax::Noise::Noise* SWater::CreateRealNoise()
1538 return new Hydrax::Noise::Real();
1546 SkyX::SkyX* skyxManager = sky->
GetSkyX();
1547 if(skyxManager != 0)
1552 case Hydrax::RttManager::RTT_REFLECTION:
1555 skyxManager->setStarfieldEnabled(
false);
1559 case Hydrax::RttManager::RTT_REFRACTION:
1564 case Hydrax::RttManager::RTT_DEPTH:
1565 case Hydrax::RttManager::RTT_DEPTH_REFLECTION:
1568 if (hydraxManager && !hydraxManager->_isCurrentFrameUnderwater())
1570 skyxManager->getMeshManager()->getEntity()->setVisible(
false);
1571 skyxManager->getMoonManager()->getMoonBillboard()->setVisible(
false);
1585 SkyX::SkyX* skyxManager = sky->
GetSkyX();
1586 if(skyxManager != 0)
1590 case Hydrax::RttManager::RTT_REFLECTION:
1592 skyxManager->setStarfieldEnabled(
true);
1596 case Hydrax::RttManager::RTT_REFRACTION:
1601 case Hydrax::RttManager::RTT_DEPTH:
1602 case Hydrax::RttManager::RTT_DEPTH_REFLECTION:
1604 if (hydraxManager && !hydraxManager->_isCurrentFrameUnderwater())
1606 skyxManager->getMeshManager()->getEntity()->setVisible(
true);
1607 skyxManager->getMoonManager()->getMoonBillboard()->setVisible(
true);
void AddColourFrame(const ColourFrame &colourFrame)
const Ogre::ColourValue GetColour(const float &gradientPosition) const
SEnvironment * parentEnvironment
void _NotifyEnvironmentComponentRegisterRenderTarget(Ogre::Viewport *targetViewport)
Ogre::Vector2 GetWindDirection()
Ogre::SceneManager * GetOgreScenePointer()
const Ogre::Vector3 GetLightDirection() const
void RegisterStereoViewport()
void UnregisterStereoViewport()
bool IsStereoViewportRegistered()
Ogre::Viewport * GetOgreViewPortPointer()
virtual void ApplyParameters()
void SetScale(const float &scale)
void SetPower(const float &power)
void SetEnd(const float &end)
virtual void Update(const Ogre::Real &updateTime)
void SetParameters(const float &scale, const float &power, const float &end)
virtual void Update(const Ogre::Real &updateTime)
void SetDistanceLimit(const float &distanceLimit)
void SetParameters(const float &depthLimit, const float &distanceLimit)
void SetDepthLimit(const float &depthLimit)
virtual void ApplyParameters()
void SetScale(const float &scale)
virtual void Update(const Ogre::Real &updateTime)
virtual void ApplyParameters()
void SetStart(const float &start)
void SetMaxDistance(const float &maxDistance)
void SetTransparency(const float &transparency)
void SetParameters(const float &maxDistance, const float &scale, const float &start, const float &transparency)
void SetRaysIntersectionEnable(const bool &raysIntersections)
void SetSpeed(const float &speed)
void SetNumberOfRays(const int &numberOfRays)
void SetRaysSize(const float &raysSize)
virtual void ApplyParameters()
void SetParameters(const Ogre::Vector3 &exposure, const float &intensity, const float &speed, const int &numberOfRays, const float &raysSize, const bool &raysIntersections)
Ogre::Vector3 GetExposure()
virtual void Update(const Ogre::Real &updateTime)
bool GetRaysIntersectionEnable()
void SetExposure(const Ogre::Vector3 &exposure)
void SetIntensity(const float &intensity)
void SetEnabled(const bool &enable)
SWater::WaterComponentType GetType()
virtual ~WaterComponent()
virtual void ApplyParameters()
virtual void Update(const Ogre::Real &updateTime)
void SetPower(const float &power)
void SetArea(const float &area)
void SetStrength(const float &strength)
Ogre::ColourValue GetColor()
void SetPosition(const Ogre::Vector3 &position)
virtual void Update(const Ogre::Real &updateTime)
virtual void ApplyParameters()
Ogre::Vector3 GetPosition()
void SetParameters(const Ogre::Vector3 &position, const float &strength, const float &area, const Ogre::ColourValue &color)
void SetColor(const Ogre::ColourValue &color)
virtual void Update(const Ogre::Real &updateTime)
virtual void ApplyParameters()
virtual void ApplyParameters()
virtual void Update(const Ogre::Real &updateTime)
Hydrax::Hydrax * GetHydrax()
void SetGeometryTypeFinitePlane(const int &planeSizeX, const int &planeSizeY)
virtual void SetEnableImpl(const bool &enableComponent)
void SetInfinitePlaneChoppyStrength(const float &value)
virtual void UpdateCamera(SViewPort *viewport)
WaterComponentSun * GetSun()
virtual void preRenderTargetUpdate(const Hydrax::RttManager::RttType &Rtt)
WaterComponentDepth * GetDepth()
@ SO3_WATER_GEOM_FINITE_PLANE
@ SO3_WATER_GEOM_INFINITE_PLANE
WaterComponentGodRays * GetGodRays()
WaterComponentCaustics * GetCaustics()
void AddViewport(Ogre::Viewport *viewport)
float GetInfinitePlaneChoppyStrength()
float GetAnimationSpeed()
void SetAnimationSpeed(const float &animationSpeed)
void RemoveViewport(Ogre::Viewport *viewport)
Ogre::Vector3 GetPosition()
void ApplyHydraxComponentTypes()
float GetInfinitePlaneComplexity()
WaterComponent * GetComponent(const SWater::WaterComponentType &componentType)
void SetColor(const Ogre::ColourValue &color)
virtual void RegisterViewportImpl(SViewPort *viewport)
virtual void postRenderTargetUpdate(const Hydrax::RttManager::RttType &Rtt)
Hydrax::Noise::FFT::Options GetFFTOptions()
void SetInfinitePlaneComplexity(const float &value)
Ogre::ColourValue GetColor()
virtual void UnregisterViewportImpl(SViewPort *viewport)
void SetGeometryTypeRadialPlane(const float &waterRadius)
float GetInfinitePlaneStrength()
void SetInfinitePlaneElevation(const float &value)
WaterComponentFoam * GetFoam()
void SetFFTOptions(const Hydrax::Noise::FFT::Options &newOptions)
WaterComponentUnderwaterReflections * GetUnderwaterReflections()
void SetGeometryTypeInfinitePlane()
float GetInfinitePlaneElevation()
WaterGeometryType GetGeometryType()
void SetPosition(const Ogre::Vector3 &newSeaLevel)
virtual void Update(const Ogre::Real &updateTime)
void SetInfinitePlaneStrength(const float &value)
WaterComponentSmooth * GetSmooth()
virtual void preViewportUpdate(const Ogre::RenderTargetViewportEvent &evt)
Hydrax::Noise::Perlin::Options GetPerlinOptions()
void SetPerlinOptions(const Hydrax::Noise::Perlin::Options &newOptions)
WaterComponentUnderwater * GetUnderwater()
@ SO3_WATER_COMPONENT_UNDERWATER
@ SO3_WATER_COMPONENT_CAUSTICS
@ SO3_WATER_COMPONENT_DEPTH
@ SO3_WATER_COMPONENT_SMOOTH
@ SO3_WATER_COMPONENT_GODRAYS
@ SO3_WATER_COMPONENT_NONE
@ SO3_WATER_COMPONENT_FOAM
@ SO3_WATER_COMPONENT_SUN
@ SO3_WATER_COMPONENT_UNDERWATER_REFLECTIONS