Maya 1.0
|
A framework for creating an object incrementally. More...
#include <maya.h>
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< Triangle > | GetTriangles () 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. | |
MayaGeometry & | Transform (const FrameScaled &) |
Transforms the geometry given a transformation operator. More... | |
MayaGeometry & | InverseTransform (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 Vector & | GetVertex (int, int) const |
Get the k-th vertex of the i-th triangle. More... | |
const Vector & | GetVertex (int) const |
Get the i-th vertec in the array. More... | |
const Vector & | GetNormal (int, int) const |
Get the normal of the k-th vertexof the i-th triangle. More... | |
const Vector & | GetNormal (int) const |
Get the i-th normal in the array. More... | |
const Vector & | GetColor (int, int) const |
Get the color of the k-th vertex of the i-th triangle. More... | |
const Vector & | GetColor (int) const |
Get the i-th color in the array. More... | |
const Vector2 & | GetUV (int, int) const |
Get the i-th UV in the array. More... | |
const Vector2 & | GetUV (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< FrameScaled > | stackframe |
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< Vector > | vertex |
Array of vertices. | |
QVector< Vector > | normal |
Array of normals. | |
QVector< Vector > | color |
Array of colors. | |
QVector< Vector2 > | UVmap |
Array of UVs. | |
QVector< MayaIndexVertexData > | indexes |
Array of integers referencing vertices, normals, colors and UV. | |
MayaMaterial | mat |
Material of the object. | |
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.
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::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.
geometry | Input geometry. |
References FrameScaled::Id, and theframe.
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.
geometry | Argument shape. |
References MayaGeometry::color, MayaGeometry::indexes, MayaGeometry::normal, theframe, FrameScaled::Transform(), FrameScaled::TransformDirection(), MayaGeometry::UVmap, and MayaGeometry::vertex.
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.
a,b,c,d | Four vertices. |
References MayaGeometry::MayaGeometry(), MayaGeometry::Merge(), theframe, and FrameScaled::Transform().
Add a triangle to the geometry.
a,b,c | Vertices. |
References MayaGeometry::AddTriangle(), theframe, and FrameScaled::Transform().
|
protected |
Append a triangle to the set.
This is an internal function which should be used with care.
a,b,c | Reference to vertices. |
n | Reference to normal. |
References MayaGeometry::AddTriangle(), MayaGeometry::normal, and MayaGeometry::vertex.
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.
void MayaGeometryStack::Push | ( | ) |
Push the current geometry generation state.
This function pushes the transformation matrix.
References stackframe, and theframe.
|
protected |
Reserves some space for the vertex, normal and triangle arrays.
v | Vertex array size. |
n | Normal array size. |
t | Triangle array size (which should be multiplied by 6). |
References MayaGeometry::indexes, MayaGeometry::normal, and MayaGeometry::vertex.
void MayaGeometryStack::Rotate | ( | const Vector & | r | ) |
Apply a given Euler rotation to the next geometric operations.
r | Rotation vector. |
References FrameScaled::Composed(), FrameScaled::Rotation(), and theframe.
void MayaGeometryStack::Scale | ( | const Vector & | s | ) |
Apply a given scale to the next geometric operations.
s | Scaling vector. |
References FrameScaled::Composed(), FrameScaled::Scaling(), and theframe.
void MayaGeometryStack::Transform | ( | const FrameScaled & | frame | ) |
Apply a given transformation to the next geometric operations.
frame | Transformation. |
References FrameScaled::Composed(), and theframe.
void MayaGeometryStack::Translate | ( | const Vector & | t | ) |
Apply a given translation to the next geometric operations.
t | Translation vector. |
References FrameScaled::Composed(), theframe, and FrameScaled::Translation().