GLC_ColladaToWorld Class Reference

GLC_ColladaToWorld : Create an GLC_World from dae file. More...

#include <glc_colladatoworld.h>

List of all members.

Classes

struct  Accessor
struct  ColladaNode
struct  ColladaVertice
struct  InputData
struct  MatOffsetSize
struct  MeshInfo

Signals

void currentQuantum (int)

Public Member Functions

Constructor / Destructor

 GLC_ColladaToWorld ()
 Default constructor.
virtual ~GLC_ColladaToWorld ()
 Destructor.
Set Functions

GLC_WorldCreateWorldFromCollada (QFile &)
 Create an GLC_World from an input Collada File.
QStringList listOfAttachedFileName () const
 Get the list of attached files.

Private Types

enum  Semantic { VERTEX = 0, NORMAL = 1, TEXCOORD = 2 }
typedef QHash< const QString,
GLC_Material * > 
MaterialHash
typedef QHash< const QString,
QList< float > > 
BulkDataHash
typedef QHash< const QString,
Accessor
DataAccessorHash

Private Member Functions

Private services functions

void goToElement (const QString &)
 Go to an Element of a xml.
void goToEndElement (const QString &)
 Go to the end Element of a xml.
QString getContent (const QString &)
QString readAttribute (const QString &, bool required=false)
 Read the specified attribute.
void checkForXmlError (const QString &)
void throwException (const QString &)
 Throw an exception with the specified text.
void clear ()
 Clear memmory.
void loadLibraryImage ()
 Load library_images element.
void loadImage ()
 Load image element.
void loadLibraryMaterials ()
 Load library_materials element.
void loadMaterial ()
 Load a material.
void loadLibraryEffects ()
 Load library_effects element.
void loadEffect ()
 Load an effect.
void loadProfileCommon ()
 Load profile_COMMON.
void loadNewParam ()
 Load a new param.
void loadSurface (const QString &)
 Load a surface.
void loadSampler2D (const QString &)
 Load Sampler 2D.
void loadTechnique ()
 Load technique.
void loadMaterialTechnique (const QString &)
 load material technique
void loadCommonColorOrTexture (const QString &)
 load common color or texture
void loadTransparent ()
 Load transparent.
void loadTransparency (const QString &)
 Load transparency.
void loadShininess (const QString &)
 Load shininess.
QColor readXmlColor ()
 Read a xml Color.
void loadLibraryGeometries ()
 Load library_geometries element.
void loadGeometry ()
 Load an geometry element.
void loadMesh ()
 Load a mesh.
void loadVertexBulkData ()
 Load Vertex bulk data.
void loadTechniqueCommon ()
 Load Technique Common.
void loadAccessor ()
 Load Accessor.
void loadVertices ()
 Load attributes and identity of mesh vertices.
void loadPolylist ()
 Load polylist.
void loadPolygons ()
 Load Polygons.
void addPolylistToCurrentMesh (const QList< InputData > &, const QList< int > &, const QList< int > &, const QString &)
 Add the polylist to the current mesh.
void computeNormalOfCurrentPrimitiveOfCurrentMesh (int offset)
 Compute Normals for the current primitive element of the current mesh from the specified offset.
void loadTriangles ()
 Load triangles.
void addTrianglesToCurrentMesh (const QList< InputData > &, const QList< int > &, const QString &)
 Add the triangles to current mesh.
void loadLibraryNodes ()
 Load the library nodes.
void loadLibraryContollers ()
 Load the library controllers.
void loadVisualScenes ()
 Load library_visual_scenes element.
void loadInstanceGeometry (ColladaNode *)
 Load an instance geometry.
void loadInstanceNode (ColladaNode *)
 Load an instance geometry.
void loadInstanceController (ColladaNode *)
 Load an instance Controller.
void loadController ()
 Load a collada controller node.
ColladaNodeloadNode (ColladaNode *)
 Load a Collada Node element and return it.
void translateNode (ColladaNode *)
 Translate the node.
void scaleNode (ColladaNode *)
 Scale the node.
void rotateNode (ColladaNode *)
 Rotate the node.
void composeMatrixNode (ColladaNode *)
 Compose Node matrix.
void loadScene ()
 Load scene element.
void linkTexturesToMaterials ()
 Link texture to material.
void createMesh ()
 Create mesh and link them to material.
void createSceneGraph ()
 Create the scene graph struct.
GLC_StructOccurencecreateOccurenceFromNode (ColladaNode *)
 Create Occurence tree from node tree.
void updateProgressBar ()
 Update progress bar.

Private Attributes

GLC_Worldm_pWorld
 The world to built.
QXmlStreamReader * m_pStreamReader
 Xml Reader.
QString m_FileName
 The collada fileName.
QFile * m_pFile
 The collada file.
QHash< QString, QString > m_ImageFileHash
 Map image id to image file name.
QHash< QString, QString > m_MaterialLibHash
 Map materialInstance to material.
QHash< QString, QString > m_SurfaceImageHash
 Map surface sid to image id.
QHash< QString, QString > m_Sampler2DSurfaceHash
 Map sampler2D sid to surface sid.
MaterialHash m_MaterialEffectHash
 Material Effect hash table.
GLC_Materialm_pCurrentMaterial
 The current material.
MaterialHash m_TextureToMaterialHash
 Texture to material link.
BulkDataHash m_BulkDataHash
 Bulk data hash table.
DataAccessorHash m_DataAccessorHash
 Data accessor hash.
QHash< QString, QString > m_VerticesSourceHash
 Map vertices id to source data id.
MeshInfom_pMeshInfo
 The current loadeed mesh.
QHash< const QString, MeshInfo * > m_GeometryHash
 Hash table off geometry (MeshInfo*).
QHash< const QString,
ColladaNode * > 
m_ColladaNodeHash
 Hash table off collada node.
QList< ColladaNode * > m_TopLevelColladaNode
 The list of top level node.
QHash< const QString, QString > m_MaterialInstanceMap
 Mapping between material instance and material.
QHash< const QString, GLC_3DRep * > m_3DRepHash
 3DRep hash table
QHash< const QString,
GLC_StructInstance * > 
m_StructInstanceHash
 GLC instance Hash table.
QString m_CurrentId
 The current Collada Element id.
qint64 m_FileSize
 The Collada file size.
int m_CurrentOffset
 The current offset in the collada file.
QSet< QString > m_ListOfAttachedFileName
 The list of attached file name.
bool m_TransparentIsRgbZero
 The transparent mode is RGB_ZERO.

Detailed Description

GLC_ColladaToWorld : Create an GLC_World from dae file.

Definition at line 47 of file glc_colladatoworld.h.


Member Typedef Documentation

typedef QHash<const QString, QList<float> > GLC_ColladaToWorld::BulkDataHash [private]

Definition at line 156 of file glc_colladatoworld.h.

typedef QHash<const QString, Accessor> GLC_ColladaToWorld::DataAccessorHash [private]

Definition at line 157 of file glc_colladatoworld.h.

typedef QHash<const QString, GLC_Material*> GLC_ColladaToWorld::MaterialHash [private]

Definition at line 155 of file glc_colladatoworld.h.


Member Enumeration Documentation

Enumerator:
VERTEX 
NORMAL 
TEXCOORD 

Definition at line 53 of file glc_colladatoworld.h.


Constructor & Destructor Documentation

GLC_ColladaToWorld::GLC_ColladaToWorld (  ) 

Default constructor.

Definition at line 36 of file glc_colladatoworld.cpp.

References currentNodeId.

GLC_ColladaToWorld::~GLC_ColladaToWorld (  )  [virtual]

Destructor.

Definition at line 68 of file glc_colladatoworld.cpp.

References clear(), and m_pWorld.


Member Function Documentation

void GLC_ColladaToWorld::addPolylistToCurrentMesh ( const QList< InputData > &  inputDataList,
const QList< int > &  vcountList,
const QList< int > &  polyIndexList,
const QString &  materialId 
) [private]
void GLC_ColladaToWorld::addTrianglesToCurrentMesh ( const QList< InputData > &  inputDataList,
const QList< int > &  trianglesIndexList,
const QString &  materialId 
) [private]
void GLC_ColladaToWorld::checkForXmlError ( const QString &  info  )  [private]
void GLC_ColladaToWorld::clear (  )  [private]
void GLC_ColladaToWorld::composeMatrixNode ( ColladaNode pNode  )  [private]

Compose Node matrix.

Definition at line 1721 of file glc_colladatoworld.cpp.

References getContent(), GLC_ColladaToWorld::ColladaNode::m_Matrix, GLC_Matrix4x4::optimise(), and throwException().

Referenced by loadNode().

void GLC_ColladaToWorld::computeNormalOfCurrentPrimitiveOfCurrentMesh ( int  offset  )  [private]
void GLC_ColladaToWorld::createMesh (  )  [private]
GLC_StructOccurence * GLC_ColladaToWorld::createOccurenceFromNode ( ColladaNode pNode  )  [private]
void GLC_ColladaToWorld::createSceneGraph (  )  [private]
GLC_World * GLC_ColladaToWorld::CreateWorldFromCollada ( QFile &  file  ) 
void GLC_ColladaToWorld::currentQuantum ( int   )  [signal]
QString GLC_ColladaToWorld::getContent ( const QString &  element  )  [private]
void GLC_ColladaToWorld::goToElement ( const QString &  elementName  )  [private]
void GLC_ColladaToWorld::goToEndElement ( const QString &  elementName  )  [private]

Go to the end Element of a xml.

Definition at line 168 of file glc_colladatoworld.cpp.

References checkForXmlError(), glcXmlUtil::endElementNotReached(), and m_pStreamReader.

void GLC_ColladaToWorld::linkTexturesToMaterials (  )  [private]
QStringList GLC_ColladaToWorld::listOfAttachedFileName (  )  const [inline]

Get the list of attached files.

Definition at line 179 of file glc_colladatoworld.h.

Referenced by GLC_FileLoader::createWorldFromFile().

void GLC_ColladaToWorld::loadAccessor (  )  [private]
void GLC_ColladaToWorld::loadCommonColorOrTexture ( const QString &  name  )  [private]
void GLC_ColladaToWorld::loadController (  )  [private]
void GLC_ColladaToWorld::loadEffect (  )  [private]
void GLC_ColladaToWorld::loadGeometry (  )  [private]
void GLC_ColladaToWorld::loadImage (  )  [private]
void GLC_ColladaToWorld::loadInstanceController ( ColladaNode pNode  )  [private]
void GLC_ColladaToWorld::loadInstanceGeometry ( ColladaNode pNode  )  [private]
void GLC_ColladaToWorld::loadInstanceNode ( ColladaNode pNode  )  [private]

Load an instance geometry.

Definition at line 1513 of file glc_colladatoworld.cpp.

References GLC_ColladaToWorld::ColladaNode::m_InstanceOffNodeIds, and readAttribute().

Referenced by loadNode().

void GLC_ColladaToWorld::loadLibraryContollers (  )  [private]

Load the library controllers.

Definition at line 1438 of file glc_colladatoworld.cpp.

References checkForXmlError(), glcXmlUtil::endElementNotReached(), loadController(), m_pStreamReader, and updateProgressBar().

Referenced by CreateWorldFromCollada().

void GLC_ColladaToWorld::loadLibraryEffects (  )  [private]

Load library_effects element.

Definition at line 411 of file glc_colladatoworld.cpp.

References checkForXmlError(), glcXmlUtil::endElementNotReached(), loadEffect(), m_pStreamReader, and updateProgressBar().

Referenced by CreateWorldFromCollada().

void GLC_ColladaToWorld::loadLibraryGeometries (  )  [private]

Load library_geometries element.

Definition at line 718 of file glc_colladatoworld.cpp.

References checkForXmlError(), glcXmlUtil::endElementNotReached(), loadGeometry(), m_pStreamReader, and updateProgressBar().

Referenced by CreateWorldFromCollada().

void GLC_ColladaToWorld::loadLibraryImage (  )  [private]

Load library_images element.

Definition at line 309 of file glc_colladatoworld.cpp.

References checkForXmlError(), glcXmlUtil::endElementNotReached(), loadImage(), m_pStreamReader, and updateProgressBar().

Referenced by CreateWorldFromCollada().

void GLC_ColladaToWorld::loadLibraryMaterials (  )  [private]

Load library_materials element.

Definition at line 356 of file glc_colladatoworld.cpp.

References checkForXmlError(), glcXmlUtil::endElementNotReached(), loadMaterial(), m_pStreamReader, and updateProgressBar().

Referenced by CreateWorldFromCollada().

void GLC_ColladaToWorld::loadLibraryNodes (  )  [private]
void GLC_ColladaToWorld::loadMaterial (  )  [private]
void GLC_ColladaToWorld::loadMaterialTechnique ( const QString &  elementName  )  [private]
void GLC_ColladaToWorld::loadMesh (  )  [private]
void GLC_ColladaToWorld::loadNewParam (  )  [private]
GLC_ColladaToWorld::ColladaNode * GLC_ColladaToWorld::loadNode ( ColladaNode pParent  )  [private]
void GLC_ColladaToWorld::loadPolygons (  )  [private]
void GLC_ColladaToWorld::loadPolylist (  )  [private]
void GLC_ColladaToWorld::loadProfileCommon (  )  [private]
void GLC_ColladaToWorld::loadSampler2D ( const QString &  sid  )  [private]
void GLC_ColladaToWorld::loadScene (  )  [private]

Load scene element.

Definition at line 1757 of file glc_colladatoworld.cpp.

References glcXmlUtil::endElementNotReached(), and m_pStreamReader.

Referenced by CreateWorldFromCollada().

void GLC_ColladaToWorld::loadShininess ( const QString &  name  )  [private]
void GLC_ColladaToWorld::loadSurface ( const QString &  sid  )  [private]
void GLC_ColladaToWorld::loadTechnique (  )  [private]
void GLC_ColladaToWorld::loadTechniqueCommon (  )  [private]

Load Technique Common.

Definition at line 834 of file glc_colladatoworld.cpp.

References checkForXmlError(), glcXmlUtil::endElementNotReached(), loadAccessor(), and m_pStreamReader.

Referenced by loadVertexBulkData().

void GLC_ColladaToWorld::loadTransparency ( const QString &  name  )  [private]
void GLC_ColladaToWorld::loadTransparent (  )  [private]

Load transparent.

Definition at line 603 of file glc_colladatoworld.cpp.

References m_TransparentIsRgbZero, and readAttribute().

Referenced by loadMaterialTechnique().

void GLC_ColladaToWorld::loadTriangles (  )  [private]
void GLC_ColladaToWorld::loadVertexBulkData (  )  [private]
void GLC_ColladaToWorld::loadVertices (  )  [private]

Load attributes and identity of mesh vertices.

Definition at line 883 of file glc_colladatoworld.cpp.

References checkForXmlError(), goToElement(), m_CurrentId, m_VerticesSourceHash, and readAttribute().

Referenced by loadMesh().

void GLC_ColladaToWorld::loadVisualScenes (  )  [private]
QString GLC_ColladaToWorld::readAttribute ( const QString &  name,
bool  required = false 
) [private]
QColor GLC_ColladaToWorld::readXmlColor (  )  [private]

Read a xml Color.

Definition at line 675 of file glc_colladatoworld.cpp.

References clear(), getContent(), m_FileName, and GLC_FileFormatException::WrongFileFormat.

Referenced by loadCommonColorOrTexture().

void GLC_ColladaToWorld::rotateNode ( ColladaNode pNode  )  [private]

Rotate the node.

Definition at line 1695 of file glc_colladatoworld.cpp.

References getContent(), GLC_ColladaToWorld::ColladaNode::m_Matrix, and throwException().

Referenced by loadNode().

void GLC_ColladaToWorld::scaleNode ( ColladaNode pNode  )  [private]
void GLC_ColladaToWorld::throwException ( const QString &  message  )  [private]
void GLC_ColladaToWorld::translateNode ( ColladaNode pNode  )  [private]

Translate the node.

Definition at line 1645 of file glc_colladatoworld.cpp.

References getContent(), GLC_ColladaToWorld::ColladaNode::m_Matrix, and throwException().

Referenced by loadNode().

void GLC_ColladaToWorld::updateProgressBar (  )  [private]

Member Data Documentation

QHash<const QString, GLC_3DRep*> GLC_ColladaToWorld::m_3DRepHash [private]

3DRep hash table

Definition at line 426 of file glc_colladatoworld.h.

Referenced by clear(), createMesh(), and createOccurenceFromNode().

Bulk data hash table.

Definition at line 402 of file glc_colladatoworld.h.

Referenced by addPolylistToCurrentMesh(), addTrianglesToCurrentMesh(), clear(), and loadVertexBulkData().

QHash<const QString, ColladaNode*> GLC_ColladaToWorld::m_ColladaNodeHash [private]

Hash table off collada node.

Definition at line 417 of file glc_colladatoworld.h.

Referenced by clear(), createOccurenceFromNode(), loadController(), and loadNode().

The current offset in the collada file.

Definition at line 438 of file glc_colladatoworld.h.

Referenced by updateProgressBar().

Data accessor hash.

Definition at line 405 of file glc_colladatoworld.h.

Referenced by addPolylistToCurrentMesh(), addTrianglesToCurrentMesh(), clear(), and loadAccessor().

QString GLC_ColladaToWorld::m_FileName [private]

The Collada file size.

Definition at line 435 of file glc_colladatoworld.h.

Referenced by CreateWorldFromCollada(), and updateProgressBar().

QHash<const QString, MeshInfo*> GLC_ColladaToWorld::m_GeometryHash [private]

Hash table off geometry (MeshInfo*).

Definition at line 414 of file glc_colladatoworld.h.

Referenced by clear(), createMesh(), and loadGeometry().

QHash<QString, QString> GLC_ColladaToWorld::m_ImageFileHash [private]

Map image id to image file name.

Definition at line 381 of file glc_colladatoworld.h.

Referenced by clear(), linkTexturesToMaterials(), and loadImage().

The list of attached file name.

Definition at line 441 of file glc_colladatoworld.h.

Referenced by clear(), and linkTexturesToMaterials().

Material Effect hash table.

Definition at line 393 of file glc_colladatoworld.h.

Referenced by clear(), createMesh(), and loadEffect().

QHash<const QString, QString> GLC_ColladaToWorld::m_MaterialInstanceMap [private]

Mapping between material instance and material.

Definition at line 423 of file glc_colladatoworld.h.

Referenced by clear(), createMesh(), loadInstanceController(), and loadInstanceGeometry().

QHash<QString, QString> GLC_ColladaToWorld::m_MaterialLibHash [private]

Map materialInstance to material.

Definition at line 384 of file glc_colladatoworld.h.

Referenced by clear(), createMesh(), and loadMaterial().

The current material.

Definition at line 396 of file glc_colladatoworld.h.

Referenced by clear(), loadCommonColorOrTexture(), loadEffect(), loadShininess(), and loadTransparency().

QFile* GLC_ColladaToWorld::m_pFile [private]

The collada file.

Definition at line 378 of file glc_colladatoworld.h.

Referenced by clear(), and CreateWorldFromCollada().

QXmlStreamReader* GLC_ColladaToWorld::m_pStreamReader [private]

The world to built.

Definition at line 369 of file glc_colladatoworld.h.

Referenced by clear(), createSceneGraph(), CreateWorldFromCollada(), and ~GLC_ColladaToWorld().

QHash<QString, QString> GLC_ColladaToWorld::m_Sampler2DSurfaceHash [private]

Map sampler2D sid to surface sid.

Definition at line 390 of file glc_colladatoworld.h.

Referenced by linkTexturesToMaterials(), and loadSampler2D().

GLC instance Hash table.

Definition at line 429 of file glc_colladatoworld.h.

Referenced by clear(), and createOccurenceFromNode().

QHash<QString, QString> GLC_ColladaToWorld::m_SurfaceImageHash [private]

Map surface sid to image id.

Definition at line 387 of file glc_colladatoworld.h.

Referenced by clear(), linkTexturesToMaterials(), and loadSurface().

Texture to material link.

Definition at line 399 of file glc_colladatoworld.h.

Referenced by clear(), linkTexturesToMaterials(), and loadCommonColorOrTexture().

The list of top level node.

Definition at line 420 of file glc_colladatoworld.h.

Referenced by clear(), createSceneGraph(), and loadVisualScenes().

The transparent mode is RGB_ZERO.

Definition at line 444 of file glc_colladatoworld.h.

Referenced by loadTransparency(), and loadTransparent().

QHash<QString, QString> GLC_ColladaToWorld::m_VerticesSourceHash [private]

Map vertices id to source data id.

Definition at line 408 of file glc_colladatoworld.h.

Referenced by clear(), loadPolygons(), loadPolylist(), loadTriangles(), and loadVertices().


The documentation for this class was generated from the following files:

SourceForge.net Logo

©2005-2011 Laurent Ribon