GLC_ColladaToWorld Class Reference

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

#include <glc_colladatoworld.h>

List of all members.

Classes

struct  ColladaNode
struct  ColladaVertice
struct  InputData
struct  MatOffsetSize
struct  MeshInfo

Signals

void currentQuantum (int)

Public Member Functions

Constructor / Destructor

 GLC_ColladaToWorld (const QGLContext *)
 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

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.
bool endElementNotReached (const QString &element)
 Return true if the end of specified element is not reached.
bool startElementNotReached (const QString &element)
 Return true if the start of specified element is not reached.
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 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.
const QGLContext * m_pQGLContext
 OpenGL Context.
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.
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 49 of file glc_colladatoworld.h.


Member Typedef Documentation

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

Definition at line 144 of file glc_colladatoworld.h.

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

Definition at line 143 of file glc_colladatoworld.h.


Member Enumeration Documentation

Enumerator:
VERTEX 
NORMAL 
TEXCOORD 

Definition at line 55 of file glc_colladatoworld.h.


Constructor & Destructor Documentation

GLC_ColladaToWorld::GLC_ColladaToWorld ( const QGLContext *  pContext  ) 

Default constructor.

Definition at line 32 of file glc_colladatoworld.cpp.

GLC_ColladaToWorld::~GLC_ColladaToWorld (  )  [virtual]

Destructor.

Definition at line 64 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 1637 of file glc_colladatoworld.cpp.

References getContent(), GLC_ColladaToWorld::ColladaNode::m_Matrix, 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]
bool GLC_ColladaToWorld::endElementNotReached ( const QString &  element  )  [inline, private]
QString GLC_ColladaToWorld::getContent ( const QString &  element  )  [private]
void GLC_ColladaToWorld::goToElement ( const QString &  elementName  )  [private]

Go to an Element of a xml.

Definition at line 154 of file glc_colladatoworld.cpp.

References checkForXmlError(), m_pStreamReader, and startElementNotReached().

Referenced by CreateWorldFromCollada(), loadMaterial(), loadVertices(), and loadVisualScenes().

void GLC_ColladaToWorld::goToEndElement ( const QString &  elementName  )  [private]

Go to the end Element of a xml.

Definition at line 164 of file glc_colladatoworld.cpp.

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

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

Get the list of attached files.

Definition at line 166 of file glc_colladatoworld.h.

Referenced by GLC_Factory::createWorldFromFile().

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 1438 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 1363 of file glc_colladatoworld.cpp.

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

Referenced by CreateWorldFromCollada().

void GLC_ColladaToWorld::loadLibraryEffects (  )  [private]

Load library_effects element.

Definition at line 409 of file glc_colladatoworld.cpp.

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

Referenced by CreateWorldFromCollada().

void GLC_ColladaToWorld::loadLibraryGeometries (  )  [private]

Load library_geometries element.

Definition at line 711 of file glc_colladatoworld.cpp.

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

Referenced by CreateWorldFromCollada().

void GLC_ColladaToWorld::loadLibraryImage (  )  [private]

Load library_images element.

Definition at line 307 of file glc_colladatoworld.cpp.

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

Referenced by CreateWorldFromCollada().

void GLC_ColladaToWorld::loadLibraryMaterials (  )  [private]

Load library_materials element.

Definition at line 354 of file glc_colladatoworld.cpp.

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

Referenced by CreateWorldFromCollada().

void GLC_ColladaToWorld::loadLibraryNodes (  )  [private]

Load the library nodes.

Definition at line 1336 of file glc_colladatoworld.cpp.

References checkForXmlError(), endElementNotReached(), loadNode(), m_pStreamReader, and updateProgressBar().

Referenced by CreateWorldFromCollada().

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]

Load profile_COMMON.

Definition at line 453 of file glc_colladatoworld.cpp.

References checkForXmlError(), endElementNotReached(), loadImage(), loadNewParam(), loadTechnique(), and m_pStreamReader.

Referenced by loadEffect().

void GLC_ColladaToWorld::loadSampler2D ( const QString &  sid  )  [private]
void GLC_ColladaToWorld::loadScene (  )  [private]

Load scene element.

Definition at line 1671 of file glc_colladatoworld.cpp.

References endElementNotReached(), and m_pStreamReader.

Referenced by CreateWorldFromCollada().

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

Load a surface.

Definition at line 490 of file glc_colladatoworld.cpp.

References checkForXmlError(), endElementNotReached(), getContent(), m_pStreamReader, and m_SurfaceImageHash.

Referenced by loadNewParam().

void GLC_ColladaToWorld::loadTechnique (  )  [private]

Load technique.

Definition at line 530 of file glc_colladatoworld.cpp.

References checkForXmlError(), endElementNotReached(), loadMaterialTechnique(), and m_pStreamReader.

Referenced by loadProfileCommon().

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

Load transparent.

Definition at line 601 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 831 of file glc_colladatoworld.cpp.

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

Referenced by loadMesh().

void GLC_ColladaToWorld::loadVisualScenes (  )  [private]

Load library_visual_scenes element.

Definition at line 1383 of file glc_colladatoworld.cpp.

References checkForXmlError(), endElementNotReached(), goToElement(), loadNode(), m_pStreamReader, m_TopLevelColladaNode, and updateProgressBar().

Referenced by CreateWorldFromCollada().

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

Read a xml Color.

Definition at line 668 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 1611 of file glc_colladatoworld.cpp.

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

Referenced by loadNode().

void GLC_ColladaToWorld::scaleNode ( ColladaNode pNode  )  [private]
bool GLC_ColladaToWorld::startElementNotReached ( const QString &  element  )  [inline, private]

Return true if the start of specified element is not reached.

Definition at line 206 of file glc_colladatoworld.h.

Referenced by goToElement().

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

Translate the node.

Definition at line 1562 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 415 of file glc_colladatoworld.h.

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

Bulk data hash table.

Definition at line 394 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 406 of file glc_colladatoworld.h.

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

The current offset in the collada file.

Definition at line 427 of file glc_colladatoworld.h.

Referenced by updateProgressBar().

QString GLC_ColladaToWorld::m_FileName [private]

The Collada file size.

Definition at line 424 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 403 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 373 of file glc_colladatoworld.h.

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

The list of attached file name.

Definition at line 430 of file glc_colladatoworld.h.

Referenced by clear(), and linkTexturesToMaterials().

Material Effect hash table.

Definition at line 385 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 412 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 376 of file glc_colladatoworld.h.

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

The current material.

Definition at line 388 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 370 of file glc_colladatoworld.h.

Referenced by clear(), and CreateWorldFromCollada().

const QGLContext* GLC_ColladaToWorld::m_pQGLContext [private]

OpenGL Context.

Definition at line 361 of file glc_colladatoworld.h.

Referenced by linkTexturesToMaterials().

QXmlStreamReader* GLC_ColladaToWorld::m_pStreamReader [private]

The world to built.

Definition at line 358 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 382 of file glc_colladatoworld.h.

Referenced by linkTexturesToMaterials(), and loadSampler2D().

GLC instance Hash table.

Definition at line 418 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 379 of file glc_colladatoworld.h.

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

Texture to material link.

Definition at line 391 of file glc_colladatoworld.h.

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

The list of top level node.

Definition at line 409 of file glc_colladatoworld.h.

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

The transparent mode is RGB_ZERO.

Definition at line 433 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 397 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 Laurent Ribon