Assimp
v4.1. (December 2018)
|
Loader class to read Collada scenes. More...
Inherits Assimp::BaseImporter.
Public Member Functions | |
bool | CanRead (const std::string &pFile, IOSystem *pIOHandler, bool checkSig) const |
Returns whether the class can handle the format of the given file. More... | |
ColladaLoader () | |
~ColladaLoader () | |
![]() | |
BaseImporter () | |
Constructor to be privately used by Importer. More... | |
const std::string & | GetErrorText () const |
Returns the error description of the last error that occurred. More... | |
void | GetExtensionList (std::set< std::string > &extensions) |
Called by #Importer::GetExtensionList for each loaded importer. More... | |
aiScene * | ReadFile (const Importer *pImp, const std::string &pFile, IOSystem *pIOHandler) |
Imports the given file and returns the imported data. More... | |
virtual | ~BaseImporter () |
Destructor, private as well. More... | |
Protected Member Functions | |
void | AddTexture (aiMaterial &mat, const ColladaParser &pParser, const Collada::Effect &effect, const Collada::Sampler &sampler, aiTextureType type, unsigned int idx=0) |
Add a texture and all of its sampling properties to a material. More... | |
void | ApplyVertexToEffectSemanticMapping (Collada::Sampler &sampler, const Collada::SemanticMappingTable &table) |
Resolve UV channel mappings. More... | |
void | BuildCamerasForNode (const ColladaParser &pParser, const Collada::Node *pNode, aiNode *pTarget) |
Builds cameras for the given node and references them. More... | |
aiNode * | BuildHierarchy (const ColladaParser &pParser, const Collada::Node *pNode) |
Recursively constructs a scene node for the given parser node and returns it. More... | |
void | BuildLightsForNode (const ColladaParser &pParser, const Collada::Node *pNode, aiNode *pTarget) |
Builds lights for the given node and references them. More... | |
void | BuildMaterials (ColladaParser &pParser, aiScene *pScene) |
Constructs materials from the collada material definitions. More... | |
void | BuildMeshesForNode (const ColladaParser &pParser, const Collada::Node *pNode, aiNode *pTarget) |
Builds meshes for the given node and references them. More... | |
void | CollectNodes (const aiNode *pNode, std::vector< const aiNode *> &poNodes) const |
Recursively collects all nodes into the given array. More... | |
void | ConvertPath (aiString &ss) |
Converts a path read from a collada file to the usual representation. More... | |
void | CreateAnimation (aiScene *pScene, const ColladaParser &pParser, const Collada::Animation *pSrcAnim, const std::string &pName) |
Constructs the animation for the given source anim. More... | |
aiMesh * | CreateMesh (const ColladaParser &pParser, const Collada::Mesh *pSrcMesh, const Collada::SubMesh &pSubMesh, const Collada::Controller *pSrcController, size_t pStartVertex, size_t pStartFace) |
Creates a mesh for the given ColladaMesh face subset and returns the newly created mesh. More... | |
void | FillMaterials (const ColladaParser &pParser, aiScene *pScene) |
Fill materials from the collada material definitions. More... | |
aiString | FindFilenameForEffectTexture (const ColladaParser &pParser, const Collada::Effect &pEffect, const std::string &pName) |
Resolves the texture name for the given effect texture entry. More... | |
aiMesh * | findMesh (std::string meshid) |
std::string | FindNameForNode (const Collada::Node *pNode) |
Finds a proper name for a node derived from the collada-node's properties. More... | |
const Collada::Node * | FindNode (const Collada::Node *pNode, const std::string &pName) const |
Finds a node in the collada scene by the given name. More... | |
const Collada::Node * | FindNodeBySID (const Collada::Node *pNode, const std::string &pSID) const |
Finds a node in the collada scene by the given SID. More... | |
const aiImporterDesc * | GetInfo () const |
Return importer meta information. More... | |
void | InternReadFile (const std::string &pFile, aiScene *pScene, IOSystem *pIOHandler) |
Imports the given file into the given scene structure. More... | |
ai_real | ReadFloat (const Collada::Accessor &pAccessor, const Collada::Data &pData, size_t pIndex, size_t pOffset) const |
Reads a float value from an accessor and its data array. More... | |
const std::string & | ReadString (const Collada::Accessor &pAccessor, const Collada::Data &pData, size_t pIndex) const |
Reads a string value from an accessor and its data array. More... | |
void | ResolveNodeInstances (const ColladaParser &pParser, const Collada::Node *pNode, std::vector< const Collada::Node *> &resolved) |
Resolve node instances. More... | |
void | SetupProperties (const Importer *pImp) |
Called prior to ReadFile(). More... | |
void | StoreAnimations (aiScene *pScene, const ColladaParser &pParser) |
Stores all animations. More... | |
void | StoreAnimations (aiScene *pScene, const ColladaParser &pParser, const Collada::Animation *pSrcAnim, const std::string &pPrefix) |
Stores all animations for the given source anim and its nested child animations. More... | |
void | StoreSceneCameras (aiScene *pScene) |
Stores all cameras in the given scene. More... | |
void | StoreSceneLights (aiScene *pScene) |
Stores all lights in the given scene. More... | |
void | StoreSceneMaterials (aiScene *pScene) |
Stores all materials in the given scene. More... | |
void | StoreSceneMeshes (aiScene *pScene) |
Stores all meshes in the given scene. More... | |
void | StoreSceneTextures (aiScene *pScene) |
Stores all textures in the given scene. More... | |
Protected Attributes | |
bool | ignoreUpDirection |
std::vector< aiAnimation * > | mAnims |
Accumulated animations for the target scene. More... | |
std::vector< aiCamera * > | mCameras |
Temporary camera list. More... | |
std::string | mFileName |
Filename, for a verbose error message. More... | |
std::vector< aiLight * > | mLights |
Temporary light list. More... | |
std::map< std::string, size_t > | mMaterialIndexByName |
Which material was stored under which index in the scene. More... | |
std::vector< aiMesh * > | mMeshes |
Accumulated meshes for the target scene. More... | |
std::map< ColladaMeshIndex, size_t > | mMeshIndexByID |
Which mesh-material compound was stored under which mesh ID. More... | |
unsigned int | mNodeNameCounter |
Used by FindNameForNode() to generate unique node names. More... | |
std::vector< aiMesh * > | mTargetMeshes |
Accumulated morph target meshes. More... | |
std::vector< aiTexture * > | mTextures |
Temporary texture list. More... | |
std::vector< std::pair< Collada::Effect *, aiMaterial * > > | newMats |
Temporary material list. More... | |
bool | noSkeletonMesh |
![]() | |
std::string | m_ErrorText |
Error description in case there was one. More... | |
ProgressHandler * | m_progress |
Currently set progress handler. More... | |
Additional Inherited Members | |
![]() | |
enum | TextFileMode { ALLOW_EMPTY, FORBID_EMPTY } |
Enum to define, if empty files are ok or not. More... | |
![]() | |
static bool | CheckMagicToken (IOSystem *pIOHandler, const std::string &pFile, const void *magic, unsigned int num, unsigned int offset=0, unsigned int size=4) |
Check whether a file starts with one or more magic tokens. More... | |
static void | ConvertToUTF8 (std::vector< char > &data) |
An utility for all text file loaders. More... | |
static void | ConvertUTF8toISO8859_1 (std::string &data) |
An utility for all text file loaders. More... | |
template<typename T > | |
static AI_FORCE_INLINE void | CopyVector (std::vector< T > &vec, T *&out, unsigned int &outLength) |
Utility function to move a std::vector into a aiScene array. More... | |
static std::string | GetExtension (const std::string &pFile) |
Extract file extension from a string. More... | |
static bool | SearchFileHeaderForToken (IOSystem *pIOSystem, const std::string &file, const char **tokens, unsigned int numTokens, unsigned int searchBytes=200, bool tokensSol=false) |
A utility for CanRead(). More... | |
static bool | SimpleExtensionCheck (const std::string &pFile, const char *ext0, const char *ext1=NULL, const char *ext2=NULL) |
Check whether a file has a specific file extension. More... | |
static void | TextFileToBuffer (IOStream *stream, std::vector< char > &data, TextFileMode mode=FORBID_EMPTY) |
Utility for text file loaders which copies the contents of the file into a memory buffer and converts it to our UTF8 representation. More... | |
Loader class to read Collada scenes.
Collada is over-engineered to death, with every new iteration bringing more useless stuff, so I limited the data to what I think is useful for games.
ColladaLoader::ColladaLoader | ( | ) |
ColladaLoader::~ColladaLoader | ( | ) |
|
protected |
Add a texture and all of its sampling properties to a material.
|
protected |
Resolve UV channel mappings.
|
protected |
Builds cameras for the given node and references them.
|
protected |
Recursively constructs a scene node for the given parser node and returns it.
|
protected |
Builds lights for the given node and references them.
|
protected |
Constructs materials from the collada material definitions.
|
protected |
Builds meshes for the given node and references them.
|
virtual |
Returns whether the class can handle the format of the given file.
See BaseImporter::CanRead() for details.
Implements Assimp::BaseImporter.
|
protected |
Recursively collects all nodes into the given array.
|
protected |
Converts a path read from a collada file to the usual representation.
|
protected |
Constructs the animation for the given source anim.
|
protected |
Creates a mesh for the given ColladaMesh face subset and returns the newly created mesh.
|
protected |
Fill materials from the collada material definitions.
|
protected |
Resolves the texture name for the given effect texture entry.
|
protected |
|
protected |
Finds a proper name for a node derived from the collada-node's properties.
|
protected |
Finds a node in the collada scene by the given name.
|
protected |
Finds a node in the collada scene by the given SID.
|
protectedvirtual |
Return importer meta information.
See #BaseImporter::GetInfo for the details
Implements Assimp::BaseImporter.
|
protectedvirtual |
Imports the given file into the given scene structure.
See BaseImporter::InternReadFile() for details
Implements Assimp::BaseImporter.
|
protected |
Reads a float value from an accessor and its data array.
pAccessor | The accessor to use for reading |
pData | The data array to read from |
pIndex | The index of the element to retrieve |
pOffset | Offset into the element, for multipart elements such as vectors or matrices |
|
protected |
Reads a string value from an accessor and its data array.
pAccessor | The accessor to use for reading |
pData | The data array to read from |
pIndex | The index of the element to retrieve |
|
protected |
Resolve node instances.
|
protectedvirtual |
Called prior to ReadFile().
The function is a request to the importer to update its configuration basing on the Importer's configuration property list.
pImp | Importer instance |
Reimplemented from Assimp::BaseImporter.
|
protected |
Stores all animations.
pScene | target scene to store the anims |
|
protected |
Stores all animations for the given source anim and its nested child animations.
pScene | target scene to store the anims |
pSrcAnim | the source animation to process |
pPrefix | Prefix to the name in case of nested animations |
|
protected |
Stores all cameras in the given scene.
|
protected |
Stores all lights in the given scene.
|
protected |
Stores all materials in the given scene.
|
protected |
Stores all meshes in the given scene.
|
protected |
Stores all textures in the given scene.
|
protected |
|
protected |
Accumulated animations for the target scene.
|
protected |
Temporary camera list.
|
protected |
Filename, for a verbose error message.
|
protected |
Temporary light list.
|
protected |
Which material was stored under which index in the scene.
|
protected |
Accumulated meshes for the target scene.
|
protected |
Which mesh-material compound was stored under which mesh ID.
|
protected |
Used by FindNameForNode() to generate unique node names.
|
protected |
Accumulated morph target meshes.
|
protected |
Temporary texture list.
|
protected |
Temporary material list.
|
protected |