Assimp  v3.1.1 (June 2014)
Assimp::ColladaParser Class Reference

Parser helper class for the Collada loader. More...

Protected Types

enum  { UP_X, UP_Y, UP_Z }
 Which is the up vector. More...
 
typedef std::map< std::string,
Collada::Accessor
AccessorLibrary
 Same for accessors which define how the data in a data array is accessed. More...
 
typedef std::vector< std::pair
< std::string, std::vector
< std::string > > > 
AnimationClipLibrary
 Animation clip library: clip animation references by ID. More...
 
typedef std::map< std::string,
Collada::Animation * > 
AnimationLibrary
 Animation library: animation references by ID. More...
 
typedef std::map< std::string,
Collada::Camera
CameraLibrary
 Camera library: surface material by ID. More...
 
typedef std::map< std::string,
Collada::Controller
ControllerLibrary
 Controller library: joint controllers by ID. More...
 
typedef std::map< std::string,
Collada::Data
DataLibrary
 All data arrays found in the file by ID. More...
 
typedef std::map< std::string,
Collada::Effect
EffectLibrary
 Effect library: surface attributes by ID. More...
 
typedef std::map< std::string,
Collada::Image
ImageLibrary
 Image library: stores texture properties by ID. More...
 
typedef std::map< std::string,
Collada::Light
LightLibrary
 Light library: surface light by ID. More...
 
typedef std::map< std::string,
Collada::Material
MaterialLibrary
 Material library: surface material by ID. More...
 
typedef std::map< std::string,
Collada::Mesh * > 
MeshLibrary
 Mesh library: mesh by ID. More...
 
typedef std::map< std::string,
Collada::Node * > 
NodeLibrary
 node library: root node of the hierarchy part by ID More...
 

Protected Member Functions

aiMatrix4x4 CalculateResultTransform (const std::vector< Collada::Transform > &pTransforms) const
 Calculates the resulting transformation from all the given transform steps. More...
 
 ColladaParser (IOSystem *pIOHandler, const std::string &pFile)
 Constructor from XML file. More...
 
void CopyVertex (size_t currentVertex, size_t numOffsets, size_t numPoints, size_t perVertexOffset, Collada::Mesh *pMesh, std::vector< Collada::InputChannel > &pPerIndexChannels, size_t currentPrimitive, const std::vector< size_t > &indices)
 Copies the data for a single primitive into the mesh, based on the InputChannels. More...
 
void ExtractDataObjectFromChannel (const Collada::InputChannel &pInput, size_t pLocalIndex, Collada::Mesh *pMesh)
 Extracts a single object from an input channel and stores it in the appropriate mesh data array. More...
 
int GetAttribute (const char *pAttr) const
 Checks the present element for the presence of the attribute, returns its index or throws an exception if not found. More...
 
const char * GetTextContent ()
 Reads the text contents of an element, throws an exception if not given. More...
 
Collada::InputType GetTypeForSemantic (const std::string &pSemantic)
 Determines the input data type for the given semantic string. More...
 
bool IsElement (const char *pName) const
 Compares the current xml element name to the given string and returns true if equal. More...
 
void PostProcessRootAnimations ()
 Re-build animations from animation clip library, if present, otherwise combine single-channel animations. More...
 
void ReadAccessor (const std::string &pID)
 Reads an accessor and stores it in the global library under the given ID - accessors use the ID of the parent <source> element. More...
 
void ReadAnimation (Collada::Animation *pParent)
 Reads an animation into the given parent structure. More...
 
void ReadAnimationClipLibrary ()
 Reads the animation clip library. More...
 
void ReadAnimationLibrary ()
 Reads the animation library. More...
 
void ReadAnimationSampler (Collada::AnimationChannel &pChannel)
 Reads an animation sampler into the given anim channel. More...
 
void ReadAssetInfo ()
 Reads asset informations such as coordinate system informations and legal blah. More...
 
bool ReadBoolFromTextContent ()
 Reads a single bool from current text content. More...
 
void ReadCamera (Collada::Camera &pCamera)
 Reads a camera entry into the given camera. More...
 
void ReadCameraLibrary ()
 Reads the camera library. More...
 
void ReadContents ()
 Reads the contents of the file. More...
 
void ReadController (Collada::Controller &pController)
 Reads a controller into the given mesh structure. More...
 
void ReadControllerJoints (Collada::Controller &pController)
 Reads the joint definitions for the given controller. More...
 
void ReadControllerLibrary ()
 Reads the skeleton controller library. More...
 
void ReadControllerWeights (Collada::Controller &pController)
 Reads the joint weights for the given controller. More...
 
void ReadDataArray ()
 Reads a data array holding a number of elements, and stores it in the global library. More...
 
void ReadEffect (Collada::Effect &pEffect)
 Reads an effect entry into the given effect. More...
 
void ReadEffectColor (aiColor4D &pColor, Collada::Sampler &pSampler)
 Reads an effect entry containing a color or a texture defining that color. More...
 
void ReadEffectFloat (float &pFloat)
 Reads an effect entry containing a float. More...
 
void ReadEffectLibrary ()
 Reads the effect library. More...
 
void ReadEffectParam (Collada::EffectParam &pParam)
 Reads an effect parameter specification of any kind. More...
 
void ReadEffectProfileCommon (Collada::Effect &pEffect)
 Reads an COMMON effect profile. More...
 
float ReadFloatFromTextContent ()
 Reads a single float from current text content. More...
 
void ReadGeometry (Collada::Mesh *pMesh)
 Reads a geometry from the geometry library. More...
 
void ReadGeometryLibrary ()
 Reads the geometry library contents. More...
 
void ReadImage (Collada::Image &pImage)
 Reads an image entry into the given image. More...
 
void ReadImageLibrary ()
 Reads the image library contents. More...
 
void ReadIndexData (Collada::Mesh *pMesh)
 Reads input declarations of per-index mesh data into the given mesh. More...
 
void ReadInputChannel (std::vector< Collada::InputChannel > &poChannels)
 Reads a single input channel element and stores it in the given array, if valid. More...
 
void ReadLight (Collada::Light &pLight)
 Reads a light entry into the given light. More...
 
void ReadLightLibrary ()
 Reads the light library. More...
 
void ReadMaterial (Collada::Material &pMaterial)
 Reads a material entry into the given material. More...
 
void ReadMaterialLibrary ()
 Reads the material library. More...
 
void ReadMaterialVertexInputBinding (Collada::SemanticMappingTable &tbl)
 
void ReadMesh (Collada::Mesh *pMesh)
 Reads a mesh from the geometry library. More...
 
void ReadNodeGeometry (Collada::Node *pNode)
 Reads a mesh reference in a node and adds it to the node's mesh list. More...
 
void ReadNodeTransformation (Collada::Node *pNode, Collada::TransformType pType)
 Reads a node transformation entry of the given type and adds it to the given node's transformation list. More...
 
size_t ReadPrimitives (Collada::Mesh *pMesh, std::vector< Collada::InputChannel > &pPerIndexChannels, size_t pNumPrimitives, const std::vector< size_t > &pVCount, Collada::PrimitiveType pPrimType)
 Reads a. More...
 
void ReadPrimTriStrips (size_t numOffsets, size_t perVertexOffset, Collada::Mesh *pMesh, std::vector< Collada::InputChannel > &pPerIndexChannels, size_t currentPrimitive, const std::vector< size_t > &indices)
 Reads one triangle of a tristrip into the mesh. More...
 
void ReadSamplerProperties (Collada::Sampler &pSampler)
 Read sampler properties. More...
 
void ReadScene ()
 Reads the collada scene. More...
 
void ReadSceneLibrary ()
 Reads the library of node hierarchies and scene parts. More...
 
void ReadSceneNode (Collada::Node *pNode)
 Reads a scene node's contents including children and stores it in the given node. More...
 
void ReadSource ()
 Reads a source element - a combination of raw data and an accessor defining things that should not be redefinable. More...
 
void ReadStructure ()
 Reads the structure of the file. More...
 
void ReadVertexData (Collada::Mesh *pMesh)
 Reads input declarations of per-vertex mesh data into the given mesh. More...
 
void ReportWarning (const char *msg,...)
 
template<typename Type >
const TypeResolveLibraryReference (const std::map< std::string, Type > &pLibrary, const std::string &pURL) const
 Finds the item in the given library by its reference, throws if not found. More...
 
void SkipElement ()
 Skips all data until the end node of the current element. More...
 
void SkipElement (const char *pElement)
 Skips all data until the end node of the given element. More...
 
int TestAttribute (const char *pAttr) const
 Returns the index of the named attribute or -1 if not found. More...
 
void TestClosing (const char *pName)
 Tests for the closing tag of the given element, throws an exception if not found. More...
 
void TestOpening (const char *pName)
 Tests for the opening tag of the given element, throws an exception if not found. More...
 
const char * TestTextContent ()
 Reads the text contents of an element, returns NULL if not given. More...
 
AI_WONT_RETURN void ThrowException (const std::string &pError) const AI_WONT_RETURN_SUFFIX
 Aborts the file reading with an exception. More...
 
 ~ColladaParser ()
 Destructor. More...
 

Protected Attributes

AccessorLibrary mAccessorLibrary
 
AnimationClipLibrary mAnimationClipLibrary
 
AnimationLibrary mAnimationLibrary
 
Collada::Animation mAnims
 Root animation container. More...
 
CameraLibrary mCameraLibrary
 
ControllerLibrary mControllerLibrary
 
DataLibrary mDataLibrary
 
EffectLibrary mEffectLibrary
 
std::string mFileName
 Filename, for a verbose error message. More...
 
Collada::FormatVersion mFormat
 Collada file format version. More...
 
ImageLibrary mImageLibrary
 
LightLibrary mLightLibrary
 
MaterialLibrary mMaterialLibrary
 
MeshLibrary mMeshLibrary
 
NodeLibrary mNodeLibrary
 
irr::io::IrrXMLReader * mReader
 XML reader, member for everyday use. More...
 
Collada::NodemRootNode
 Pointer to the root node. More...
 
float mUnitSize
 Size unit: how large compared to a meter. More...
 
enum Assimp::ColladaParser:: { ... }  mUpDirection
 Which is the up vector. More...
 

Friends

class ColladaLoader
 

Detailed Description

Parser helper class for the Collada loader.

Does all the XML reading and builds internal data structures from it, but leaves the resolving of all the references to the loader.

Member Typedef Documentation

typedef std::map<std::string, Collada::Accessor> Assimp::ColladaParser::AccessorLibrary
protected

Same for accessors which define how the data in a data array is accessed.

typedef std::vector<std::pair<std::string, std::vector<std::string> > > Assimp::ColladaParser::AnimationClipLibrary
protected

Animation clip library: clip animation references by ID.

typedef std::map<std::string, Collada::Animation*> Assimp::ColladaParser::AnimationLibrary
protected

Animation library: animation references by ID.

typedef std::map<std::string, Collada::Camera> Assimp::ColladaParser::CameraLibrary
protected

Camera library: surface material by ID.

typedef std::map<std::string, Collada::Controller> Assimp::ColladaParser::ControllerLibrary
protected

Controller library: joint controllers by ID.

typedef std::map<std::string, Collada::Data> Assimp::ColladaParser::DataLibrary
protected

All data arrays found in the file by ID.

Might be referred to by actually everyone. Collada, you are a steaming pile of indirection.

typedef std::map<std::string, Collada::Effect> Assimp::ColladaParser::EffectLibrary
protected

Effect library: surface attributes by ID.

typedef std::map<std::string, Collada::Image> Assimp::ColladaParser::ImageLibrary
protected

Image library: stores texture properties by ID.

typedef std::map<std::string, Collada::Light> Assimp::ColladaParser::LightLibrary
protected

Light library: surface light by ID.

typedef std::map<std::string, Collada::Material> Assimp::ColladaParser::MaterialLibrary
protected

Material library: surface material by ID.

typedef std::map<std::string, Collada::Mesh*> Assimp::ColladaParser::MeshLibrary
protected

Mesh library: mesh by ID.

typedef std::map<std::string, Collada::Node*> Assimp::ColladaParser::NodeLibrary
protected

node library: root node of the hierarchy part by ID

Member Enumeration Documentation

anonymous enum
protected

Which is the up vector.

Enumerator
UP_X 
UP_Y 
UP_Z 

Constructor & Destructor Documentation

ColladaParser::ColladaParser ( IOSystem pIOHandler,
const std::string &  pFile 
)
protected

Constructor from XML file.

ColladaParser::~ColladaParser ( )
protected

Destructor.

Member Function Documentation

aiMatrix4x4 ColladaParser::CalculateResultTransform ( const std::vector< Collada::Transform > &  pTransforms) const
protected

Calculates the resulting transformation from all the given transform steps.

void ColladaParser::CopyVertex ( size_t  currentVertex,
size_t  numOffsets,
size_t  numPoints,
size_t  perVertexOffset,
Collada::Mesh pMesh,
std::vector< Collada::InputChannel > &  pPerIndexChannels,
size_t  currentPrimitive,
const std::vector< size_t > &  indices 
)
protected

Copies the data for a single primitive into the mesh, based on the InputChannels.

void ColladaParser::ExtractDataObjectFromChannel ( const Collada::InputChannel pInput,
size_t  pLocalIndex,
Collada::Mesh pMesh 
)
protected

Extracts a single object from an input channel and stores it in the appropriate mesh data array.

int ColladaParser::GetAttribute ( const char *  pAttr) const
protected

Checks the present element for the presence of the attribute, returns its index or throws an exception if not found.

const char * ColladaParser::GetTextContent ( )
protected

Reads the text contents of an element, throws an exception if not given.

Skips leading whitespace.

Collada::InputType ColladaParser::GetTypeForSemantic ( const std::string &  pSemantic)
protected

Determines the input data type for the given semantic string.

bool Assimp::ColladaParser::IsElement ( const char *  pName) const
inlineprotected

Compares the current xml element name to the given string and returns true if equal.

void ColladaParser::PostProcessRootAnimations ( )
protected

Re-build animations from animation clip library, if present, otherwise combine single-channel animations.

void ColladaParser::ReadAccessor ( const std::string &  pID)
protected

Reads an accessor and stores it in the global library under the given ID - accessors use the ID of the parent <source> element.

void ColladaParser::ReadAnimation ( Collada::Animation pParent)
protected

Reads an animation into the given parent structure.

void ColladaParser::ReadAnimationClipLibrary ( )
protected

Reads the animation clip library.

void ColladaParser::ReadAnimationLibrary ( )
protected

Reads the animation library.

void ColladaParser::ReadAnimationSampler ( Collada::AnimationChannel pChannel)
protected

Reads an animation sampler into the given anim channel.

void ColladaParser::ReadAssetInfo ( )
protected

Reads asset informations such as coordinate system informations and legal blah.

bool ColladaParser::ReadBoolFromTextContent ( )
protected

Reads a single bool from current text content.

void ColladaParser::ReadCamera ( Collada::Camera pCamera)
protected

Reads a camera entry into the given camera.

void ColladaParser::ReadCameraLibrary ( )
protected

Reads the camera library.

void ColladaParser::ReadContents ( )
protected

Reads the contents of the file.

void ColladaParser::ReadController ( Collada::Controller pController)
protected

Reads a controller into the given mesh structure.

void ColladaParser::ReadControllerJoints ( Collada::Controller pController)
protected

Reads the joint definitions for the given controller.

void ColladaParser::ReadControllerLibrary ( )
protected

Reads the skeleton controller library.

void ColladaParser::ReadControllerWeights ( Collada::Controller pController)
protected

Reads the joint weights for the given controller.

void ColladaParser::ReadDataArray ( )
protected

Reads a data array holding a number of elements, and stores it in the global library.

Currently supported are array of floats and arrays of strings.

void ColladaParser::ReadEffect ( Collada::Effect pEffect)
protected

Reads an effect entry into the given effect.

void ColladaParser::ReadEffectColor ( aiColor4D pColor,
Collada::Sampler pSampler 
)
protected

Reads an effect entry containing a color or a texture defining that color.

void ColladaParser::ReadEffectFloat ( float &  pFloat)
protected

Reads an effect entry containing a float.

void ColladaParser::ReadEffectLibrary ( )
protected

Reads the effect library.

void ColladaParser::ReadEffectParam ( Collada::EffectParam pParam)
protected

Reads an effect parameter specification of any kind.

void ColladaParser::ReadEffectProfileCommon ( Collada::Effect pEffect)
protected

Reads an COMMON effect profile.

float ColladaParser::ReadFloatFromTextContent ( )
protected

Reads a single float from current text content.

void ColladaParser::ReadGeometry ( Collada::Mesh pMesh)
protected

Reads a geometry from the geometry library.

void ColladaParser::ReadGeometryLibrary ( )
protected

Reads the geometry library contents.

void ColladaParser::ReadImage ( Collada::Image pImage)
protected

Reads an image entry into the given image.

void ColladaParser::ReadImageLibrary ( )
protected

Reads the image library contents.

void ColladaParser::ReadIndexData ( Collada::Mesh pMesh)
protected

Reads input declarations of per-index mesh data into the given mesh.

void ColladaParser::ReadInputChannel ( std::vector< Collada::InputChannel > &  poChannels)
protected

Reads a single input channel element and stores it in the given array, if valid.

void ColladaParser::ReadLight ( Collada::Light pLight)
protected

Reads a light entry into the given light.

void ColladaParser::ReadLightLibrary ( )
protected

Reads the light library.

void ColladaParser::ReadMaterial ( Collada::Material pMaterial)
protected

Reads a material entry into the given material.

void ColladaParser::ReadMaterialLibrary ( )
protected

Reads the material library.

void ColladaParser::ReadMaterialVertexInputBinding ( Collada::SemanticMappingTable tbl)
protected
void ColladaParser::ReadMesh ( Collada::Mesh pMesh)
protected

Reads a mesh from the geometry library.

void ColladaParser::ReadNodeGeometry ( Collada::Node pNode)
protected

Reads a mesh reference in a node and adds it to the node's mesh list.

void ColladaParser::ReadNodeTransformation ( Collada::Node pNode,
Collada::TransformType  pType 
)
protected

Reads a node transformation entry of the given type and adds it to the given node's transformation list.

size_t ColladaParser::ReadPrimitives ( Collada::Mesh pMesh,
std::vector< Collada::InputChannel > &  pPerIndexChannels,
size_t  pNumPrimitives,
const std::vector< size_t > &  pVCount,
Collada::PrimitiveType  pPrimType 
)
protected

Reads a.

primitive index list and assembles the mesh data into the given mesh

void ColladaParser::ReadPrimTriStrips ( size_t  numOffsets,
size_t  perVertexOffset,
Collada::Mesh pMesh,
std::vector< Collada::InputChannel > &  pPerIndexChannels,
size_t  currentPrimitive,
const std::vector< size_t > &  indices 
)
protected

Reads one triangle of a tristrip into the mesh.

void ColladaParser::ReadSamplerProperties ( Collada::Sampler pSampler)
protected

Read sampler properties.

void ColladaParser::ReadScene ( )
protected

Reads the collada scene.

void ColladaParser::ReadSceneLibrary ( )
protected

Reads the library of node hierarchies and scene parts.

void ColladaParser::ReadSceneNode ( Collada::Node pNode)
protected

Reads a scene node's contents including children and stores it in the given node.

void ColladaParser::ReadSource ( )
protected

Reads a source element - a combination of raw data and an accessor defining things that should not be redefinable.

Yes, that's another rant.

void ColladaParser::ReadStructure ( )
protected

Reads the structure of the file.

void ColladaParser::ReadVertexData ( Collada::Mesh pMesh)
protected

Reads input declarations of per-vertex mesh data into the given mesh.

void ColladaParser::ReportWarning ( const char *  msg,
  ... 
)
protected
template<typename Type >
const Type & Assimp::ColladaParser::ResolveLibraryReference ( const std::map< std::string, Type > &  pLibrary,
const std::string &  pURL 
) const
protected

Finds the item in the given library by its reference, throws if not found.

void ColladaParser::SkipElement ( )
protected

Skips all data until the end node of the current element.

void ColladaParser::SkipElement ( const char *  pElement)
protected

Skips all data until the end node of the given element.

int ColladaParser::TestAttribute ( const char *  pAttr) const
protected

Returns the index of the named attribute or -1 if not found.

Does not throw, therefore useful for optional attributes

void ColladaParser::TestClosing ( const char *  pName)
protected

Tests for the closing tag of the given element, throws an exception if not found.

void ColladaParser::TestOpening ( const char *  pName)
protected

Tests for the opening tag of the given element, throws an exception if not found.

const char * ColladaParser::TestTextContent ( )
protected

Reads the text contents of an element, returns NULL if not given.

Skips leading whitespace.

AI_WONT_RETURN void ColladaParser::ThrowException ( const std::string &  pError) const
protected

Aborts the file reading with an exception.

Friends And Related Function Documentation

friend class ColladaLoader
friend

Member Data Documentation

AccessorLibrary Assimp::ColladaParser::mAccessorLibrary
protected
AnimationClipLibrary Assimp::ColladaParser::mAnimationClipLibrary
protected
AnimationLibrary Assimp::ColladaParser::mAnimationLibrary
protected
Collada::Animation Assimp::ColladaParser::mAnims
protected

Root animation container.

CameraLibrary Assimp::ColladaParser::mCameraLibrary
protected
ControllerLibrary Assimp::ColladaParser::mControllerLibrary
protected
DataLibrary Assimp::ColladaParser::mDataLibrary
protected
EffectLibrary Assimp::ColladaParser::mEffectLibrary
protected
std::string Assimp::ColladaParser::mFileName
protected

Filename, for a verbose error message.

Collada::FormatVersion Assimp::ColladaParser::mFormat
protected

Collada file format version.

ImageLibrary Assimp::ColladaParser::mImageLibrary
protected
LightLibrary Assimp::ColladaParser::mLightLibrary
protected
MaterialLibrary Assimp::ColladaParser::mMaterialLibrary
protected
MeshLibrary Assimp::ColladaParser::mMeshLibrary
protected
NodeLibrary Assimp::ColladaParser::mNodeLibrary
protected
irr::io::IrrXMLReader* Assimp::ColladaParser::mReader
protected

XML reader, member for everyday use.

Collada::Node* Assimp::ColladaParser::mRootNode
protected

Pointer to the root node.

Don't delete, it just points to one of the nodes in the node library.

float Assimp::ColladaParser::mUnitSize
protected

Size unit: how large compared to a meter.

enum { ... } Assimp::ColladaParser::mUpDirection

Which is the up vector.


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