28 #ifndef __Ogre_Volume_CSGSource_H__
29 #define __Ogre_Volume_CSGSource_H__
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);
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;
#define _OgreVolumeExport
A 3D box aligned with the x/y/z axes.
const Vector3 & getMinimum(void) const
Gets the minimum corner of the box.
Real distance(const Vector3 &v) const
Returns the minimum distance between a given point and any part of the box.
const Vector3 & getMaximum(void) const
Gets the maximum corner of the box.
static const Real POS_INFINITY
Standard 3-dimensional vector.
4-dimensional homogeneous vector.
Real distanceTo(const Vector3 &position) const
Gets the distance of a point to the nearest cube element.
CSGCubeSource(const Vector3 &min, const Vector3 &max)
Constructor.
AxisAlignedBox mBox
The box.
virtual Vector4 getValueAndGradient(const Vector3 &position) const
Overridden from Source.
virtual Real getValue(const Vector3 &position) const
Overridden from Source.
Builds the difference between two sources.
virtual Real getValue(const Vector3 &position) const
Overridden from Source.
CSGDifferenceSource(void)
Constructor, sets the sources to null.
CSGDifferenceSource(const Source *a, const Source *b)
Constructor.
virtual Vector4 getValueAndGradient(const Vector3 &position) const
Overridden from Source.
Builds the intersection between two sources.
virtual Vector4 getValueAndGradient(const Vector3 &position) const
Overridden from Source.
CSGIntersectionSource(const Source *a, const Source *b)
Constructor.
CSGIntersectionSource(void)
Constructor, sets the sources to null.
virtual Real getValue(const Vector3 &position) const
Overridden from Source.
Negates the given volume.
virtual Real getValue(const Vector3 &position) const
Overridden from Source.
CSGNegateSource(void)
Constructor.
virtual Vector4 getValueAndGradient(const Vector3 &position) const
Overridden from Source.
CSGNegateSource(const Source *src)
Constructor.
long mSeed
The initial seed.
long getSeed(void) const
Gets the initial seed.
Real * mAmplitudes
The amplitudes of the octaves.
Real * mFrequencies
The frequencies of the octaves.
size_t mNumOctaves
The amount of octaves.
SimplexNoise mNoise
To make some noise.
virtual Real getValue(const Vector3 &position) const
Overridden from Source.
void setData(void)
Prepares the node members.
Real getInternalValue(const Vector3 &position) const
virtual Vector4 getValueAndGradient(const Vector3 &position) const
Overridden from Source.
CSGNoiseSource(const Source *src, Real *frequencies, Real *amplitudes, size_t numOctaves)
Constructor with current time as seed.
CSGNoiseSource(const Source *src, Real *frequencies, Real *amplitudes, size_t numOctaves, long seed)
Constructor.
Real mGradientOff
To calculate the gradient.
Abstract operation volume source holding two sources as operants.
const Source * mA
The first operant.
CSGOperationSource(const Source *a, const Source *b)
Constructor.
CSGOperationSource(void)
Constructor, sets the sources to null.
virtual void setSourceB(Source *b)
Sets the second operator source.
virtual const Source * getSourceA() const
Gets the first operator source.
virtual void setSourceA(Source *a)
Sets the first operator source.
virtual const Source * getSourceB(void) const
Gets the second operator source.
const Source * mB
The second operant.
Vector3 mNormal
The normal of the plane.
const Real mD
The distance to zero of the plane.
CSGPlaneSource(const Real d, const Vector3 &normal)
Constructor.
virtual Real getValue(const Vector3 &position) const
Overridden from Source.
virtual Vector4 getValueAndGradient(const Vector3 &position) const
Overridden from Source.
Scales the given volume source.
virtual Real getValue(const Vector3 &position) const
Overridden from Source.
virtual Vector4 getValueAndGradient(const Vector3 &position) const
Overridden from Source.
CSGScaleSource(const Source *src, const Real scale)
Constructor.
Real mScale
Holds the dimensions of the volume.
CSGSphereSource(const Real r, const Vector3 ¢er)
Constructor.
virtual Real getValue(const Vector3 &position) const
Overridden from Source.
virtual Vector4 getValueAndGradient(const Vector3 &position) const
Overridden from Source.
const Vector3 mCenter
The center.
Source which does a unary operation to another one.
const Source * mSrc
The first operant.
CSGUnarySource(void)
Constructor.
CSGUnarySource(const Source *src)
Constructor.
virtual void setSource(Source *a)
Sets the source.
virtual const Source * getSource(void) const
Gets the source.
Builds the union between two sources.
CSGUnionSource(void)
Constructor, sets the sources to null.
CSGUnionSource(const Source *a, const Source *b)
Constructor.
virtual Vector4 getValueAndGradient(const Vector3 &position) const
Overridden from Source.
virtual Real getValue(const Vector3 &position) const
Overridden from Source.
Simplex Noise ported from public domain Java Implementation http://webstaff.itn.liu....
Real noise(Real xIn, Real yIn, Real zIn) const
3D noise function.
Abstract class defining the density function.
float Real
Software floating point type.