28 namespace SkyX {
namespace VClouds
34 , mHeight(
Ogre::Vector2())
40 , mNa(0), mNb(0), mNc(0)
42 , mWorldOffset(
Ogre::Vector2(0,0))
43 , mCurrentDistance(
Ogre::Vector3(0,0,0))
53 const Ogre::Radian& Alpha,
const Ogre::Radian& Beta,
54 const int& NumberOfBlocks,
const int& Na,
const int& Nb,
const int& Nc)
62 mPhi = Ogre::Math::TWO_PI / NumberOfBlocks;
135 mA =
mHeight.y / Ogre::Math::Cos(Ogre::Math::PI/2-
mBeta.valueRadians());
136 mB =
mHeight.y / Ogre::Math::Cos(Ogre::Math::PI/2-
mAlpha.valueRadians());
141 mGeometryBlocks.push_back(
new GeometryBlock(
mVClouds,
mHeight.y,
mAlpha,
mBeta,
mRadius,
mPhi,
mNa,
mNb,
mNc,
mA,
mB,
mC, k));
144 Ogre::SceneNode *sn =
mSceneNode->createChildSceneNode();
153 std::vector<VClouds::CameraData>::iterator currentCameraDataIt;
155 for (currentCameraDataIt = camerasData.begin(); currentCameraDataIt != camerasData.end(); currentCameraDataIt++)
157 if ((*currentCameraDataIt).camera == c)
163 std::vector<VClouds::CameraData>::reference currentCameraData = (*currentCameraDataIt);
166 Ogre::Vector2 CameraDirection = Ogre::Vector2(c->getDerivedDirection().x, c->getDerivedDirection().z);
170 Ogre::Vector2 CameraOffset = Ogre::Vector2(c->getDerivedPosition().x - currentCameraData.lastPosition.x, c->getDerivedPosition().z - currentCameraData.lastPosition.z);
171 offset -= CameraOffset.dotProduct(CameraDirection);
174 currentCameraData.cameraOffset += CameraOffset;
175 currentCameraData.lastPosition = c->getDerivedPosition();
178 currentCameraData.geometryDisplacement += Ogre::Vector3(offset);
180 if (currentCameraData.geometryDisplacement.z < 0 || currentCameraData.geometryDisplacement.z > (
mC-
mB)/
mNc)
182 currentCameraData.geometryDisplacement.z -= ((
mC-
mB)/
mNc)*Ogre::Math::IFloor((currentCameraData.geometryDisplacement.z)/((
mC-
mB)/
mNc));
185 if (currentCameraData.geometryDisplacement.y < 0 || currentCameraData.geometryDisplacement.y > (
mB-
mA)/
mNb)
187 currentCameraData.geometryDisplacement.y -= ((
mB-
mA)/
mNb)*Ogre::Math::IFloor((currentCameraData.geometryDisplacement.y)/((
mB-
mA)/
mNb));
190 if (currentCameraData.geometryDisplacement.x < 0 || currentCameraData.geometryDisplacement.x >
mA/
mNa)
192 currentCameraData.geometryDisplacement.x -= (
mA/
mNa)*Ogre::Math::IFloor((currentCameraData.geometryDisplacement.x)/(
mA/
mNa));