26namespace SkyX {
namespace VClouds
30 const int &a,
const int &b,
const int &c,
31 const int &nx,
const int &ny,
const int &nz,
32 const int &
x,
const int &
y,
const int &
z,
33 const Ogre::Real& Density)
35 , mA2(
Ogre::Math::Pow(a, 2)), mB2(
Ogre::Math::Pow(b, 2)), mC2(
Ogre::Math::Pow(c, 2))
36 , mNx(nx), mNy(ny), mNz(nz)
63 Ogre::Vector3 Direction = Ogre::Vector3(
x-
mX,
y-
mY,
z-
mZ),
64 DirectionNormalized = Direction.normalisedCopy();
66 Ogre::Real a = Ogre::Math::Pow(DirectionNormalized.x, 2) /
mA2 +
67 Ogre::Math::Pow(DirectionNormalized.y, 2) /
mB2 +
68 Ogre::Math::Pow(DirectionNormalized.z, 2) /
mC2,
70 lambda = 1.0f / Ogre::Math::Sqrt(a);
72 return Ogre::Math::Clamp<Ogre::Real>(Direction.length() / lambda, 0, 1);
79 return Ogre::Vector3(density, 1-density, density);
90 uu = (u<0) ? (u + nx) : u;
if (u>=nx) { uu-= nx; }
94 vv = (v<0) ? (v + ny) : v;
if (v>=ny) { vv-= ny; }
102 c[uu][vv][
w].
phum = 0.005f;
103 c[uu][vv][
w].
pext = 0.05f;
104 c[uu][vv][
w].
pact = 0.01f;
106 if (!delayedResponse)
108 c[uu][vv][
w].
cld = Ogre::Math::RangeRandom(0,1) > length ? true :
false;
118 mX += Ax;
mY += Ay;
mZ += Az;
139 mA2 = Ogre::Math::Pow(
mA, 2);
140 mB2 = Ogre::Math::Pow(
mB, 2);
141 mC2 = Ogre::Math::Pow(
mC, 2);
Ellipsoid(const int &a, const int &b, const int &c, const int &nx, const int &ny, const int &nz, const int &x, const int &y, const int &z, const Ogre::Real &DynLibManager=1.0f)
Constructor.
const bool isOutOfCells() const
Determines if the ellipsoid is out of the cells domain and needs to be removed.
int mA
Ellipsoid parameters.
Ogre::Real mDensity
Cloud density.
const float _getLength(const int &x, const int &y, const int &z) const
Get length.
void setDimensions(const Ogre::Vector3 &Dimensions)
Set dimensions.
void updateProbabilities(DataManager::Cell ***c, const int &nx, const int &ny, const int &nz, const bool &delayedResponse=true)
Update probabilities.
void move(const int &Ax, const int &Ay, const int &Az)
Move the ellipsoid.
const Ogre::Vector3 getProbabilities(const int &x, const int &y, const int &z) const
Get probabilities at a point.