28 #ifndef __Ogre_Volume_CSGSource_H__
29 #define __Ogre_Volume_CSGSource_H__
64 virtual Vector4 getValueAndGradient(
const Vector3 &position)
const;
68 virtual Real getValue(
const Vector3 &position)
const;
95 virtual Vector4 getValueAndGradient(
const Vector3 &position)
const;
99 virtual Real getValue(
const Vector3 &position)
const;
123 const Vector3 dMin = position - mBox.getMinimum();
124 const Vector3 dMax = mBox.getMaximum() - position;
127 if (dMin.
x >= (
Real)0.0 && dMin.
y >= (
Real)0.0 && dMin.
z >= (
Real)0.0 &&
130 const Real d[6] = {dMin.
x, dMin.
y, dMin.
z, dMax.
x, dMax.
y, dMax.
z};
132 for (
size_t i = 0; i < 6; ++i)
142 distance = -mBox.distance(position);
159 virtual Vector4 getValueAndGradient(
const Vector3 &position)
const;
163 virtual Real getValue(
const Vector3 &position)
const;
196 virtual const Source* getSourceA()
const;
202 virtual void setSourceA(
Source *a);
208 virtual const Source* getSourceB(
void)
const;
214 virtual void setSourceB(
Source *b);
237 virtual Vector4 getValueAndGradient(
const Vector3 &position)
const;
241 virtual Real getValue(
const Vector3 &position)
const;
264 virtual Vector4 getValueAndGradient(
const Vector3 &position)
const;
268 virtual Real getValue(
const Vector3 &position)
const;
292 virtual Vector4 getValueAndGradient(
const Vector3 &position)
const;
296 virtual Real getValue(
const Vector3 &position)
const;
325 virtual const Source* getSource(
void)
const;
331 virtual void setSource(
Source *a);
352 virtual Vector4 getValueAndGradient(
const Vector3 &position)
const;
356 virtual Real getValue(
const Vector3 &position)
const;
379 virtual Vector4 getValueAndGradient(
const Vector3 &position)
const;
383 virtual Real getValue(
const Vector3 &position)
const;
420 for (
size_t i = 0; i < mNumOctaves; ++i)
422 toAdd += mNoise.noise(position.
x * mFrequencies[i], position.
y * mFrequencies[i], position.
z * mFrequencies[i]) * mAmplitudes[i];
424 return mSrc->getValue(position) + toAdd;
457 virtual Vector4 getValueAndGradient(
const Vector3 &position)
const;
461 virtual Real getValue(
const Vector3 &position)
const;
467 long getSeed(
void)
const;
long mSeed
The initial seed.
float Real
Software floating point type.
Builds the intersection between two sources.
Real mGradientOff
To calculate the gradient.
Real * mAmplitudes
The amplitudes of the octaves.
SimplexNoise mNoise
To make some noise.
size_t mNumOctaves
The amount of octaves.
A 3D box aligned with the x/y/z axes.
Abstract operation volume source holding two sources as operants.
const Vector3 mCenter
The center.
Abstract class defining the density function.
const Source * mA
The first operant.
static const Real POS_INFINITY
Real * mFrequencies
The frequencies of the octaves.
AxisAlignedBox mBox
The box.
Builds the difference between two sources.
const Source * mSrc
The first operant.
Real getInternalValue(const Vector3 &position) const
Simplex Noise ported from public domain Java Implementation http://webstaff.itn.liu.se/~stegu/simplexnoise/SimplexNoise.java Thanks Stefan Gustavson!
Negates the given volume.
Standard 3-dimensional vector.
Real mScale
Holds the dimensions of the volume.
Source which does a unary operation to another one.
const Source * mB
The second operant.
const Real mD
The distance to zero of the plane.
Real distanceTo(const Vector3 &position) const
Gets the distance of a point to the nearest cube element.
Builds the union between two sources.
Scales the given volume source.
#define _OgreVolumeExport
4-dimensional homogeneous vector.
Vector3 mNormal
The normal of the plane.