67 #ifndef _graphicsproceduraltubegenerator_cpp
68 #define _graphicsproceduraltubegenerator_cpp
70 #include "Graphics/Procedural/Mesh/tubegenerator.h"
72 #include "MathTools/mathtools.h"
82 TubeInnerRadius(InnerRadius),
83 TubeOuterRadius(OuterRadius),
85 NumSegCircle(SegCircle),
86 NumSegHeight(SegHeight)
112 Vector3( x0, 0, z0 ).GetNormal(),
115 if( i != this->NumSegHeight ) {
116 Buffer.
AddIndex( Offset + this->NumSegCircle + 1 );
118 Buffer.
AddIndex( Offset + this->NumSegCircle );
119 Buffer.
AddIndex( Offset + this->NumSegCircle + 1 );
134 -
Vector3( x0, 0, z0 ).GetNormal(),
137 if( i != this->NumSegHeight ) {
138 Buffer.
AddIndex( Offset + this->NumSegCircle + 1 );
139 Buffer.
AddIndex( Offset + this->NumSegCircle );
141 Buffer.
AddIndex( Offset + this->NumSegCircle + 1 );
166 if( j != this->NumSegCircle ) {
195 if( j != this->NumSegCircle ) {
212 if( InnerRadius <= 0.0 )
224 if( OuterRadius <= 0.0 )
Real TubeInnerRadius
The radius of the inner edge of the tube.
TubeGenerator & SetInnerRadius(const Real InnerRadius)
Sets the inner radius of the tube. the radius is set to 0 or less OR if the radius is greater than th...
Real TubeHeight
The height of the tube.
TubeGenerator & SetHeight(const Real Height)
Sets the height of the tube. the height is set to 0 or less, a PARAMETERS_EXCEPTION will be thrown...
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.
void EstimateIndexCount(const Whole IndexCount)
Gives an estimation of the number of indices needed for this triangle buffer.
void RebaseOffset()
Rebase index offset.
Whole NumSegCircle
The resolution of the circular component of the tube.
TubeGenerator & SetNumSegCircle(const Whole SegCircle)
Sets the number of segments when rotating around the tube's axis. the number of segments is less than...
TubeGenerator & SetNumSegHeight(const Whole SegHeight)
Sets the number of segments along the height of the cylinder. the number of segments is set to 0...
This implements the exception hiearchy for Mezzanine.
float Real
A Datatype used to represent a real floating point number.
virtual void AddToTriangleBuffer(TriangleBuffer &Buffer) const
Adds the vertices and indices as configured in this generator to a triangle buffer.
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.
A generator class for a tube mesh.
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.
TubeGenerator(const Real InnerRadius, const Real OuterRadius, const Real Height, const Whole SegCircle, const Whole SegHeight)
Class constructor.
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.
Real TubeOuterRadius
The radius of the outer edge of the tube.
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.
TubeGenerator & SetOuterRadius(const Real OuterRadius)
Sets the outer radius of the tube. the radius is set to 0 or less OR if the radius is less than the i...
Whole NumSegHeight
The number of segments in the tubes length.
virtual ~TubeGenerator()
Class destructor.
static Vector3 Neg_Unit_Y()
Gets a vector representing the negative Y unit of a Vector3.