Maya 1.0
|
A simple triangle mesh representation. More...
#include <maya.h>
Public Member Functions | |
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... | |
Static Public Member Functions | |
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 | |
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. | |
Protected Member Functions | |
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... | |
A simple triangle mesh representation.
This class has been designed for the manipulation of geometric instances.
Example of a MayaGeometry that stores a tetrahedron:
Note that in this case, the vertices and normals are uniquely defined and correctly shared. Another possibility is to create the tetrahedron by adding triangles directly to the MayaGeometry structure. In that case however, the object is a triangle soup: points (and normals) are replicated.
MayaGeometry::MayaGeometry | ( | const QString & | name, |
const MayaMaterial & | mo = MayaMaterial::None |
||
) |
Creates an empty mesh structure.
name | Name of the object. |
mo | Material. |
MayaGeometry::MayaGeometry | ( | const QString & | name, |
const QVector< Vector > & | vertex, | ||
const QVector< Vector > & | normal, | ||
const QVector< MayaIndexVertexData > & | index, | ||
const MayaMaterial & | mo = 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.
The array of integers stores the index of the vertices interlaced with the indexes of the normals.
MayaGeometry::MayaGeometry | ( | const QString & | name, |
const QVector< Vector > & | vertex, | ||
const QVector< Vector > & | normal, | ||
const QVector< Vector > & | color, | ||
const QVector< MayaIndexVertexData > & | index, | ||
const MayaMaterial & | mo = MayaMaterial::None |
||
) |
MayaGeometry::MayaGeometry | ( | const QString & | name, |
const QVector< Vector > & | vertex, | ||
const QVector< Vector > & | normal, | ||
const QVector< Vector2 > & | UVmap, | ||
const QVector< MayaIndexVertexData > & | index, | ||
const MayaMaterial & | mo = MayaMaterial::None |
||
) |
MayaGeometry::MayaGeometry | ( | const QString & | name, |
const Mesh & | mesh, | ||
const MayaMaterial & | mo = MayaMaterial::None |
||
) |
Creates an geometry from a mesh.
name | Name of the object. |
mesh | The mesh. |
mo | Material. |
References Mesh::GetNormals(), Mesh::GetVertices(), indexes, normal, Mesh::NormalIndex(), Mesh::Triangles(), vertex, and Mesh::VertexIndex().
MayaGeometry::MayaGeometry | ( | const QString & | name, |
const MeshColor & | mesh, | ||
const MayaMaterial & | mo = MayaMaterial::None |
||
) |
Creates an geometry from a mesh.
name | Name of the object. |
mesh | The mesh. |
mo | Material. |
References color, MeshColor::ColorIndex(), MeshColor::GetColor(), MeshColor::GetColors(), Mesh::GetNormals(), Mesh::GetVertices(), indexes, normal, Mesh::NormalIndex(), Mesh::Triangles(), vertex, and Mesh::VertexIndex().
MayaGeometry::MayaGeometry | ( | const QString & | name, |
const Mesh2 & | mesh, | ||
const MayaMaterial & | mo = MayaMaterial::None |
||
) |
Creates an geometry from a mesh.
name | Name of the object. |
mesh | The mesh. |
mo | Material. |
References Mesh2::index(), indexes, normal, Vector2::ToVector(), Mesh2::TriangleSize(), Mesh2::Vertex(), vertex, Mesh2::VertexSize(), and Vector::Z.
MayaGeometry::MayaGeometry | ( | const QString & | name, |
const QVector< Triangle > & | tris, | ||
const MayaMaterial & | mo = MayaMaterial::None |
||
) |
Creates a geometry from a set of triangles.
name | Name of the object. |
tris | the triangles. |
mo | Material. |
References AddTriangle().
MayaGeometry::MayaGeometry | ( | const QString & | name, |
const Vector * | vertex, | ||
int | nv, | ||
const Vector * | normal, | ||
int | nn, | ||
const int * | index, | ||
int | ni, | ||
const MayaMaterial & | mo = MayaMaterial::None |
||
) |
Create a mesh.
This function is the same as the constructor with QVector parameters, but uses C++ arrays instead.
|
protected |
Add a quadrangle to the geometry.
It creates two triangles abc and acd.
a,b,c,d | Index of the vertices. |
n | Index of the normal shared by all vertices. |
References AddTriangle().
void MayaGeometry::AddSmoothTriangle | ( | const Vector & | a, |
const Vector & | b, | ||
const Vector & | c, | ||
const Vector & | na, | ||
const Vector & | nb, | ||
const Vector & | nc | ||
) |
Adds a smooth triangle to the mesh.
a,b,c | Vertices |
na,nb,nc | Normals |
References AddSmoothTriangle(), normal, and vertex.
Referenced by AddSmoothTriangle().
|
protected |
Add a smooth triangle to the geometry.
a,b,c | Index of the vertices. |
na,nb,nc | Index of the normals. |
References indexes.
Adds a triangle to the mesh.
a,b,c | Vertices. |
References AddTriangle(), normal, and vertex.
Referenced by AddQuadrangle(), MayaGeometryStack::AddTriangle(), AddTriangle(), MayaGeometryStack::AddTriangleOffset(), and MayaGeometry().
|
protected |
Add a triangle to the geometry.
a,b,c | Index of the vertices. |
n | Index of the normal shared by all vertices. |
References indexes.
|
static |
Create a set of arrows representing a vector field.
field | Vector field. |
scale | Scaling factor. |
References MayaGeometrySet::Append(), Mesh::Arrow(), Array::GetSizeX(), Array::GetSizeY(), Array::GetSizeZ(), MayaGeometry(), Vector::Null, Matrix::RotationCanonical(), VectorField::Value(), Array::Vertex(), and Vector::Z.
bool MayaGeometry::find_MTL_Address | ( | const QString & | url, |
const QString & | name, | ||
QString & | nameR, | ||
QString & | nameA | ||
) |
Loads the geometrys from an .obj file into a MayaGeometryAll.
url | File name (which should contain the extension .obj). |
name | Name of the current material. |
nameR | Texture name of the diffuse map. |
References name.
Referenced by Load_OBJ().
void MayaGeometry::generatePlannarMapping | ( | const Vector & | dir, |
const double & | step | ||
) |
Apply a planar mapping onto the object using a given normal direction.
Delete old UVmaps.
dir | Normal direction. |
step | Size in spatial coordinates of the tiling texture |
References GetBox(), indexes, Vector::Orthonormal(), UVmap, and vertex.
void MayaGeometry::generatePlannarZ_Mapping | ( | Box2 | box | ) |
Apply a planar mapping onto the object.
Delete ancient UVmaps.
box | Domain. |
References indexes, Box2::Size(), UVmap, and vertex.
|
inline |
|
inline |
Get the color of the k-th vertex of the i-th triangle.
i | Triangle number. |
k | Vertex. |
References color, and indexes.
Referenced by MayaGpu::CreateGpu().
|
inline |
|
inline |
Get the normal of the k-th vertexof the i-th triangle.
i | Triangle number. |
k | Vertex. |
References indexes, and normal.
Referenced by MayaGpu::CreateGpu().
MayaStatistics MayaGeometry::GetStatistics | ( | ) | const |
Compute the statistics of the object.
This member computes the number of vertices and triangles of the object. Since vertices may not be shared, those numbers may be larger than the real number of vertices of the geometric object.
References indexes, and vertex.
Referenced by MayaGpu::MayaGpu().
QString MayaGeometry::GetText | ( | int | spaces = 0 , |
bool | html = false |
||
) | const |
Get the text information.
spaces | Spacing for indenting the text. |
html | Flag to specify syntax highlighting. |
References GetName().
Referenced by MayaSceneStack::GetText().
Triangle MayaGeometry::GetTriangle | ( | int | i | ) | const |
|
inline |
|
inline |
Get the i-th UV in the array.
i,k | Indexes. |
References indexes, and UVmap.
Referenced by MayaGpu::CreateGpu().
|
inline |
|
inline |
Get the k-th vertex of the i-th triangle.
i | Triangle number. |
k | Vertex. |
References indexes, and vertex.
Referenced by MayaGpu::CreateGpu().
MayaGeometry & MayaGeometry::InverseTransform | ( | const FrameScaled & | frame | ) |
Inverse transforms the geometry given a transformation operator.
frame | Transformation. |
References FrameScaled::InverseTransform(), FrameScaled::InverseTransformDirection(), normal, and vertex.
bool MayaGeometry::Load_OBJ | ( | const QString & | url | ) |
Loads the geometry from a OBJ file into a single MayaGeometry.
url | Filename, which should contain the extension .obj. |
References color, find_MTL_Address(), indexes, name, normal, SetName(), UVmap, and vertex.
void MayaGeometry::Merge | ( | const MayaGeometry & | mesh | ) |
Merges an argument mesh with the existing mesh.
Note that this function may be slow as it may require a time consuming copy of several arrays.
mesh | Geometry that will be merged. |
References color, indexes, normal, UVmap, and vertex.
Referenced by MayaGeometryStack::AddQuadrangle(), MayaGeometrySet::Collapse(), MayaGeometryAll::Collapse(), and MayaGeometryAll::GetGeometryByName().
bool MayaGeometry::Save_OBJ | ( | const QString & | url | ) | const |
Save the geometry as a Maya .obj file.
url | Filename. |
References indexes, mat, name, normal, UVmap, and vertex.
Referenced by MayaGeometryAll::Save_OBJ(), and MayaGeometryAll::Save_OBJ_Collapse().
bool MayaGeometry::Save_OBJ | ( | QTextStream & | out, |
int | decV = 1 , |
||
int | decN = 1 , |
||
int | decUV = 1 |
||
) | const |
bool MayaGeometry::Save_OBJ_forVUE | ( | const QString & | url | ) | const |
bool MayaGeometry::Save_PBRT | ( | QTextStream & | out | ) | const |
Save the geometry as a pbrt file (QTextStream).
out | QTextStream. |
References indexes, and vertex.
Referenced by MayaGeometryAll::Save_PBRT().
bool MayaGeometry::Save_PLY | ( | const QString & | name | ) | const |
|
inline |
Set the MayaMaterial.
mo | MayaMaterial. |
References mat.
Referenced by MayaGeometrySet::Collapse().
|
inline |
Set the name.
n | Name. |
References name.
Referenced by MayaSceneStack::AddGeometryToAtlas(), MayaGeometrySet::Collapse(), Load_OBJ(), MayaGeometryAll::Save_OBJ(), and MayaGeometryAll::Save_PBRT().
MayaGeometry & MayaGeometry::Transform | ( | const FrameScaled & | frame | ) |
Transforms the geometry given a transformation operator.
frame | Transformation. |
References normal, FrameScaled::Transform(), FrameScaled::TransformDirection(), and vertex.
Referenced by MayaGeometrySet::Collapse().