Maya 1.0
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
MayaGeometryStack Class Reference

A framework for creating an object incrementally. More...

#include <maya.h>

Inheritance diagram for MayaGeometryStack:
MayaGeometry MayaSceneStack

Public Member Functions

 MayaGeometryStack ()
 Create an empty object. More...
 
 MayaGeometryStack (const MayaGeometry &)
 Create a geometry stack from a given object. More...
 
 ~MayaGeometryStack ()
 Empty.
 
void Push ()
 Push the current geometry generation state. More...
 
void Pop ()
 Pop a previously pushed geometry generation state. More...
 
void PopAll ()
 Pop all previously pushed geometry generation states and resets to original frame.
 
void Transform (const FrameScaled &)
 Apply a given transformation to the next geometric operations. More...
 
void Translate (const Vector &)
 Apply a given translation to the next geometric operations. More...
 
void Rotate (const Vector &)
 Apply a given Euler rotation to the next geometric operations. More...
 
void Scale (const Vector &)
 Apply a given scale to the next geometric operations. More...
 
void AddTriangle (const Vector &, const Vector &, const Vector &)
 Add a triangle to the geometry. More...
 
void AddQuadrangle (const Vector &, const Vector &, const Vector &, const Vector &)
 Add a quadrangle to the geometry. More...
 
void AddGeometry (const MayaGeometryStack &)
 Add a given object to the shape. More...
 
FrameScaled GetFrame () const
 Get the current building frame.
 
- Public Member Functions inherited from MayaGeometry
 MayaGeometry ()
 Creates an empty mesh structure.
 
 MayaGeometry (const QString &, const MayaMaterial &=MayaMaterial::None)
 Creates an empty mesh structure. More...
 
 MayaGeometry (const QString &, const QVector< Vector > &, const QVector< Vector > &, const QVector< MayaIndexVertexData > &, const MayaMaterial &=MayaMaterial::None)
 Creates a mesh given an array of vertices and normals, and an array of integers defining the (possibly smooth) triangles of the mesh. More...
 
 MayaGeometry (const QString &, const QVector< Vector > &, const QVector< Vector > &, const QVector< Vector > &, const QVector< MayaIndexVertexData > &, const MayaMaterial &=MayaMaterial::None)
 Creates a mesh. More...
 
 MayaGeometry (const QString &, const QVector< Vector > &, const QVector< Vector > &, const QVector< Vector2 > &, const QVector< MayaIndexVertexData > &, const MayaMaterial &=MayaMaterial::None)
 Creates a mesh given an array of vertices, normals and colors, and an array of integers defining the (possibly smooth) triangles of the mesh. More...
 
 MayaGeometry (const QString &, const Mesh &, const MayaMaterial &=MayaMaterial::None)
 Creates an geometry from a mesh. More...
 
 MayaGeometry (const QString &, const MeshColor &, const MayaMaterial &=MayaMaterial::None)
 Creates an geometry from a mesh. More...
 
 MayaGeometry (const QString &, const Mesh2 &, const MayaMaterial &=MayaMaterial::None)
 Creates an geometry from a mesh. More...
 
 MayaGeometry (const QString &, const QVector< Triangle > &, const MayaMaterial &=MayaMaterial::None)
 Creates a geometry from a set of triangles. More...
 
 ~MayaGeometry ()
 Empty.
 
 MayaGeometry (const QString &, const Vector *, int, const Vector *, int, const int *, int, const MayaMaterial &=MayaMaterial::None)
 Create a mesh. More...
 
void AddTriangle (const Vector &, const Vector &, const Vector &)
 Adds a triangle to the mesh. More...
 
void AddSmoothTriangle (const Vector &, const Vector &, const Vector &, const Vector &, const Vector &, const Vector &)
 Adds a smooth triangle to the mesh. More...
 
void SetName (const QString &)
 Set the name. More...
 
void SetMaterial (const MayaMaterial &)
 Set the MayaMaterial. More...
 
void Merge (const MayaGeometry &)
 Merges an argument mesh with the existing mesh. More...
 
Triangle GetTriangle (int) const
 Get the i-th triangle from the mesh as a flat triangle. More...
 
QVector< TriangleGetTriangles () const
 Returns the geometry as a set of triangles.
 
QString GetName () const
 Get the name of the geometry.
 
MayaMaterial GetMaterial () const
 Get the material of the geometry.
 
Box GetBox () const
 Compute the bounding box of the object.
 
MayaGeometryTransform (const FrameScaled &)
 Transforms the geometry given a transformation operator. More...
 
MayaGeometryInverseTransform (const FrameScaled &)
 Inverse transforms the geometry given a transformation operator. More...
 
bool Load_OBJ (const QString &)
 Loads the geometry from a OBJ file into a single MayaGeometry. More...
 
bool find_MTL_Address (const QString &url, const QString &name, QString &nameR, QString &nameA)
 Loads the geometrys from an .obj file into a MayaGeometryAll. More...
 
bool Save_OBJ (const QString &) const
 Save the geometry as a Maya .obj file. More...
 
bool Save_OBJ_forVUE (const QString &url) const
 Save the geometry as a Maya .obj file. !!!! Y up for VUE. More...
 
bool Save_OBJ (QTextStream &, int=1, int=1, int=1) const
 Save the geometry as a Maya .obj file (QTextStream). More...
 
bool Save_PLY (const QString &) const
 Save the geometry as a Maya .obj file. More...
 
bool Save_PBRT (QTextStream &) const
 Save the geometry as a pbrt file (QTextStream). More...
 
MayaStatistics GetStatistics () const
 Compute the statistics of the object. More...
 
QString GetText (int=0, bool=false) const
 Get the text information. More...
 
const VectorGetVertex (int, int) const
 Get the k-th vertex of the i-th triangle. More...
 
const VectorGetVertex (int) const
 Get the i-th vertec in the array. More...
 
const VectorGetNormal (int, int) const
 Get the normal of the k-th vertexof the i-th triangle. More...
 
const VectorGetNormal (int) const
 Get the i-th normal in the array. More...
 
const VectorGetColor (int, int) const
 Get the color of the k-th vertex of the i-th triangle. More...
 
const VectorGetColor (int) const
 Get the i-th color in the array. More...
 
const Vector2GetUV (int, int) const
 Get the i-th UV in the array. More...
 
const Vector2GetUV (int) const
 Get the i-th UV in the array. More...
 
void Clear ()
 Clear every data and set a neutral grey material.
 
void generatePlannarZ_Mapping (Box2)
 Apply a planar mapping onto the object. More...
 
void generatePlannarMapping (const Vector &dir, const double &step)
 Apply a planar mapping onto the object using a given normal direction. More...
 

Protected Member Functions

void Reserve (int, int, int)
 Reserves some space for the vertex, normal and triangle arrays. More...
 
void AddTriangleOffset (int, int, int, int)
 Append a triangle to the set. More...
 
- Protected Member Functions inherited from MayaGeometry
void AddTriangle (int, int, int, int)
 Add a triangle to the geometry. More...
 
void AddSmoothTriangle (int, int, int, int, int, int)
 Add a smooth triangle to the geometry. More...
 
void AddQuadrangle (int, int, int, int, int)
 Add a quadrangle to the geometry. More...
 

Protected Attributes

FrameScaled theframe
 Current transformation.
 
QVector< FrameScaledstackframe
 Stack of frames.
 

Additional Inherited Members

- Static Public Member Functions inherited from MayaGeometry
static MayaGeometryAll CreateVectorField (const VectorField &, const double &=1.0)
 Create a set of arrows representing a vector field. More...
 
static MayaGeometry extrusion8new (const QString &, QVector< Vector >, double, double, double)
  Warning Extrusion en pointillés
 
static MayaGeometry extrusion5new (const QString &, Vector, Vector, QVector< QVector< Vector > >, QVector< QVector< Vector > >)
  Warning Extrusion d'un ensemble de contours autour d'une position et en fonction d'une direction ou chaque contour a une normale.
 
static MayaGeometry extrusion4new (const QString &, Vector, Vector, QVector< QVector< Vector > >)
  Warning Extrusion d'un ensemble de contours autour d'une position et en fonction d'une direction.
 
static MayaGeometry extrusion3new (const QString &, QVector< Vector >, QVector< QVector< Vector > >, QVector< int >, QVector< double >)
  Warning Extrusion le long d'une courbe en utilisant différents profils. Le choix des profils est paramétré par des indices et des distances.
 
static MayaGeometry extrusion9new (const QString &, Vector, QVector< Vector >, double, double, double)
 extrusion circulaire
 
- Public Attributes inherited from MayaGeometry
QString name
 Signature of the object.
 
QVector< Vectorvertex
 Array of vertices.
 
QVector< Vectornormal
 Array of normals.
 
QVector< Vectorcolor
 Array of colors.
 
QVector< Vector2UVmap
 Array of UVs.
 
QVector< MayaIndexVertexData > indexes
 Array of integers referencing vertices, normals, colors and UV.
 
MayaMaterial mat
 Material of the object.
 

Detailed Description

A framework for creating an object incrementally.

The geometry can be created by using low level specific member functions adding triangles or quadrangles to the object. Higher level primitives such as box, cylinders, or surfaces of revolution are provided.

Constructor & Destructor Documentation

◆ MayaGeometryStack() [1/2]

MayaGeometryStack::MayaGeometryStack ( )

Create an empty object.

This function initializes the transformation to identity and the transformation stack is empty.

References FrameScaled::Id, and theframe.

◆ MayaGeometryStack() [2/2]

MayaGeometryStack::MayaGeometryStack ( const MayaGeometry geometry)

Create a geometry stack from a given object.

The starting geometry is retrieved from the argument object. This function initializes the vertex and normal transforms to identity.

Parameters
geometryInput geometry.

References FrameScaled::Id, and theframe.

Member Function Documentation

◆ AddGeometry()

void MayaGeometryStack::AddGeometry ( const MayaGeometryStack geometry)

Add a given object to the shape.

Note that this function can be used to add some MayaGeometry directly thanks to the MayaGeometryStack::MayaGeometryStack(const MayaGeometry&) constructor that performs the conversion.

Parameters
geometryArgument shape.

References MayaGeometry::color, MayaGeometry::indexes, MayaGeometry::normal, theframe, FrameScaled::Transform(), FrameScaled::TransformDirection(), MayaGeometry::UVmap, and MayaGeometry::vertex.

◆ AddQuadrangle()

void MayaGeometryStack::AddQuadrangle ( const Vector a,
const Vector b,
const Vector c,
const Vector d 
)

Add a quadrangle to the geometry.

This function is more efficient than adding two triangles using MayaGeometryStack::AddTriangle since the two common vertices are shared in the index array.

Parameters
a,b,c,dFour vertices.
See also
MayaGeometryStack::AddTriangle

References MayaGeometry::MayaGeometry(), MayaGeometry::Merge(), theframe, and FrameScaled::Transform().

◆ AddTriangle()

void MayaGeometryStack::AddTriangle ( const Vector a,
const Vector b,
const Vector c 
)

Add a triangle to the geometry.

Parameters
a,b,cVertices.

References MayaGeometry::AddTriangle(), theframe, and FrameScaled::Transform().

◆ AddTriangleOffset()

void MayaGeometryStack::AddTriangleOffset ( int  a,
int  b,
int  c,
int  n 
)
protected

Append a triangle to the set.

This is an internal function which should be used with care.

Parameters
a,b,cReference to vertices.
nReference to normal.

References MayaGeometry::AddTriangle(), MayaGeometry::normal, and MayaGeometry::vertex.

◆ Pop()

void MayaGeometryStack::Pop ( )

Pop a previously pushed geometry generation state.

In theory, there should be as many Pop calls as Push calls. If too many Pop() are made, the system will not crash however and the transformation state will be identity.

References stackframe, and theframe.

◆ Push()

void MayaGeometryStack::Push ( )

Push the current geometry generation state.

This function pushes the transformation matrix.

References stackframe, and theframe.

◆ Reserve()

void MayaGeometryStack::Reserve ( int  v,
int  n,
int  t 
)
protected

Reserves some space for the vertex, normal and triangle arrays.

Parameters
vVertex array size.
nNormal array size.
tTriangle array size (which should be multiplied by 6).

References MayaGeometry::indexes, MayaGeometry::normal, and MayaGeometry::vertex.

◆ Rotate()

void MayaGeometryStack::Rotate ( const Vector r)

Apply a given Euler rotation to the next geometric operations.

Parameters
rRotation vector.

References FrameScaled::Composed(), FrameScaled::Rotation(), and theframe.

◆ Scale()

void MayaGeometryStack::Scale ( const Vector s)

Apply a given scale to the next geometric operations.

Parameters
sScaling vector.

References FrameScaled::Composed(), FrameScaled::Scaling(), and theframe.

◆ Transform()

void MayaGeometryStack::Transform ( const FrameScaled frame)

Apply a given transformation to the next geometric operations.

Parameters
frameTransformation.

References FrameScaled::Composed(), and theframe.

◆ Translate()

void MayaGeometryStack::Translate ( const Vector t)

Apply a given translation to the next geometric operations.

Parameters
tTranslation vector.

References FrameScaled::Composed(), theframe, and FrameScaled::Translation().