67 #ifndef _graphicsproceduraltorusgenerator_cpp
68 #define _graphicsproceduraltorusgenerator_cpp
70 #include "Graphics/Procedural/Mesh/torusgenerator.h"
72 #include "MathTools/mathtools.h"
82 TorusPoloidalRadius(PoloidalRadius),
83 TorusToroidalRadius(ToroidalRadius),
84 NumPoloidalSeg(PoloidalSeg),
85 NumToroidalSeg(ToroidalSeg)
114 ( v - c ).GetNormal(),
117 if( i != this->NumPoloidalSeg ) {
118 Buffer.
AddIndex( Offset + this->NumToroidalSeg + 1 );
120 Buffer.
AddIndex( Offset + this->NumToroidalSeg );
121 Buffer.
AddIndex( Offset + this->NumToroidalSeg + 1 );
135 if( PoloidalRadius <= 0.0 )
144 if( ToroidalRadius <= 0.0 )
153 if( PoloidalSeg < 3 )
162 if( ToroidalSeg < 3 )
A convenience buffer that stores vertices and indices of a mesh to be generated.
#define MEZZ_EXCEPTION(num, desc)
An easy way to throw exceptions with rich information.
TorusGenerator(const Real PoloidalRadius, const Real ToroidalRadius, const Whole PoloidalSeg=16, const Whole ToroidalSeg=16)
Class constructor.
void EstimateIndexCount(const Whole IndexCount)
Gives an estimation of the number of indices needed for this triangle buffer.
void RebaseOffset()
Rebase index offset.
int Integer
A datatype used to represent any integer close to.
This implements the exception hiearchy for Mezzanine.
Real TorusPoloidalRadius
The radius of the primary ring of the torus.
float Real
A Datatype used to represent a real floating point number.
TorusGenerator & SetNumToroidalSeg(const Whole ToroidalSeg)
Sets the number of segments along the guiding circle. the number of segments is less than three...
void EstimateVertexCount(const Whole VertexCount)
Gives an estimation of the number of vertices need for this triangle buffer.
This is used to represent a point on a 2 dimentional area, such as a screen.
static Vector3 Unit_Y()
Gets a vector representing the Y unit of a Vector3.
virtual ~TorusGenerator()
Class destructor.
TorusGenerator & SetToroidalRadius(const Real ToroidalRadius)
Sets the radius of the torus ring. AKA it's thickness. the radius is set to 0 or less, a PARAMETERS_EXCEPTION will be thrown.
void AddPoint(TriangleBuffer &Buffer, const Vector3 &Loc, const Vector3 &Norm, const Vector2 &UV) const
Adds a new point to a triangle buffer, using the format defined for that MeshGenerator.
Thrown when parameters are checked at runtime and found invalid.
Real TorusToroidalRadius
The radius of the secondary ring of the torus.
TorusGenerator & SetNumPoloidalSeg(const Whole PoloidalSeg)
Sets the number of segments on the Poloidal ring. the number of segments is less than three...
Whole NumPoloidalSeg
The resolution of the Poloidal ring.
TriangleBuffer & AddIndex(const Integer Index)
Adds an index to the index buffer.
This is used to represent a point in space, or a vector through space.
The bulk of the engine components go in this namspace.
unsigned long Whole
Whole is an unsigned integer, it will be at least 32bits in size.
virtual void AddToTriangleBuffer(TriangleBuffer &Buffer) const
Adds the vertices and indices as configured in this generator to a triangle buffer.
A generator class for a torus mesh.
TorusGenerator & SetPoloidalRadius(const Real PoloidalRadius)
Sets the radius of the torus. the radius is set to 0 or less, a PARAMETERS_EXCEPTION will be thrown...
This is used to store information about rotation in 3d space.
Whole NumToroidalSeg
The resolution of the Toroidal ring.