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

This class implements a scene construction framework based on MayaResources. More...

#include <maya.h>

Inheritance diagram for MayaSceneStack:
MayaGeometryStack MayaGeometry

Public Member Functions

 MayaSceneStack ()
 Create an empty scene. More...
 
 MayaSceneStack (const MayaGeometry &)
 Create a scene stack from an object. More...
 
 ~MayaSceneStack ()
 Empty.
 
void AddGeometryToAtlas (const QString &)
 Add the current geometry to the atlas. More...
 
void AddGeometryToAtlas (const QString &, const MayaGeometry &)
 Add a given geometry to the atlas. More...
 
void AddInstanceToAtlas (const QString &, const QString &)
 Add a given geometry to the atlas. More...
 
void AddInstanceToScene (const QString &)
 Add an instance to the scene. More...
 
void AddInstanceToScene (const QString &, const FrameScaled &)
 Add an instance to the scene. More...
 
void AddGeometryToScene (const QString &)
 Add the current geometry to the scene. More...
 
MayaGeometryAll GetScene () const
 Create the scene as a MayaGeometryAll. More...
 
QString GetText (bool=false) const
 Get the text information. More...
 
- Public Member Functions inherited from MayaGeometryStack
 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 Attributes

MayaResources atlas
 Set of resources.
 
MayaInstanceAll scene
 The scene.
 
- Protected Attributes inherited from MayaGeometryStack
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.
 
- Protected Member Functions inherited from MayaGeometryStack
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...
 

Detailed Description

This class implements a scene construction framework based on MayaResources.

Constructor & Destructor Documentation

◆ MayaSceneStack() [1/2]

MayaSceneStack::MayaSceneStack ( )

Create an empty scene.

This function initializes the vertex and normal transforms to identity.

◆ MayaSceneStack() [2/2]

MayaSceneStack::MayaSceneStack ( const MayaGeometry geometry)

Create a scene stack from an object.

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

Parameters
geometryInput geometry.

Member Function Documentation

◆ AddGeometryToAtlas() [1/2]

void MayaSceneStack::AddGeometryToAtlas ( const QString &  name)

Add the current geometry to the atlas.

Note that this function does not clear the current geometry, which can be done by calling MayaGEometry::Clear().

See also
MayaGeometry::Clear()
Parameters
nameName of the geometry.

References MayaResources::Append(), atlas, MayaGeometry::name, and MayaGeometry::SetName().

Referenced by AddGeometryToScene().

◆ AddGeometryToAtlas() [2/2]

void MayaSceneStack::AddGeometryToAtlas ( const QString &  name,
const MayaGeometry mg 
)

Add a given geometry to the atlas.

Parameters
nameName of the instance that will be associated to the geometry.
mgGeometry.

References MayaResources::Append(), atlas, and MayaGeometry::name.

◆ AddGeometryToScene()

void MayaSceneStack::AddGeometryToScene ( const QString &  name)

Add the current geometry to the scene.

This is a convenience function that is the same as the following code:

scene.AddGeometryToAtlas("Object");
scene.AddInstanceToScene("Object",FrameScaled::Id);
static const FrameScaled Id
This class implements a scene construction framework based on MayaResources.
Definition: maya.h:600
MayaInstanceAll scene
The scene.
Definition: maya.h:603
Parameters
nameName of the instance.

References AddGeometryToAtlas(), AddInstanceToScene(), FrameScaled::Id, and MayaGeometry::name.

◆ AddInstanceToAtlas()

void MayaSceneStack::AddInstanceToAtlas ( const QString &  name,
const QString &  url 
)

Add a given geometry to the atlas.

This function is more efficient than adding the geometry directly as the geometry is loaded only if the entry does not exist.

Parameters
nameName of the instance that will be associated to the geometry.
urlUrl of the geometry.

References MayaResources::Append(), atlas, and MayaGeometry::name.

◆ AddInstanceToScene() [1/2]

void MayaSceneStack::AddInstanceToScene ( const QString &  name)

Add an instance to the scene.

This function uses the current frame. It is the same as:

scene.AddInstanceToScene(QString("Name"),GetFrame()); // Use GetFrame to get access to current frame
FrameScaled GetFrame() const
Get the current building frame.
Definition: maya-geometrystack.cpp:204
See also
MayaSceneStack::AddInstanceToScene(const QString&,const FrameScaled&)
Parameters
nameName of the instance.

References MayaInstanceAll::Append(), MayaGeometryStack::GetFrame(), MayaGeometry::name, and scene.

Referenced by AddGeometryToScene().

◆ AddInstanceToScene() [2/2]

void MayaSceneStack::AddInstanceToScene ( const QString &  name,
const FrameScaled frame 
)

Add an instance to the scene.

This function uses the argument frame to locate the instance in the scene.

See also
MayaSceneStack::AddInstanceToScene(const QString&)
Parameters
nameName of the instance.
frameThe frame.

References MayaInstanceAll::Append(), MayaGeometry::name, and scene.

◆ GetScene()

MayaGeometryAll MayaSceneStack::GetScene ( ) const

◆ GetText()

QString MayaSceneStack::GetText ( bool  html = false) const

Get the text information.

Parameters
htmlFlag to specify syntax highlighting.

References atlas, MayaResources::GetText(), MayaInstanceAll::GetText(), MayaGeometry::GetText(), and scene.