diff options
Diffstat (limited to 'src/3rdparty/assimp/code/ColladaLoader.h')
-rw-r--r-- | src/3rdparty/assimp/code/ColladaLoader.h | 247 |
1 files changed, 124 insertions, 123 deletions
diff --git a/src/3rdparty/assimp/code/ColladaLoader.h b/src/3rdparty/assimp/code/ColladaLoader.h index 16750906f..8388ab01e 100644 --- a/src/3rdparty/assimp/code/ColladaLoader.h +++ b/src/3rdparty/assimp/code/ColladaLoader.h @@ -4,7 +4,8 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2016, assimp team +Copyright (c) 2006-2017, assimp team + All rights reserved. Redistribution and use of this software in source and binary forms, @@ -95,123 +96,123 @@ public: bool CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig) const; protected: - /** Return importer meta information. - * See #BaseImporter::GetInfo for the details - */ - const aiImporterDesc* GetInfo () const; - - void SetupProperties(const Importer* pImp); - - /** Imports the given file into the given scene structure. - * See BaseImporter::InternReadFile() for details - */ - void InternReadFile( const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler); - - /** Recursively constructs a scene node for the given parser node and returns it. */ - aiNode* BuildHierarchy( const ColladaParser& pParser, const Collada::Node* pNode); - - /** Resolve node instances */ - void ResolveNodeInstances( const ColladaParser& pParser, const Collada::Node* pNode, - std::vector<const Collada::Node*>& resolved); - - /** Builds meshes for the given node and references them */ - void BuildMeshesForNode( const ColladaParser& pParser, const Collada::Node* pNode, - aiNode* pTarget); - - aiMesh *findMesh(std::string meshid); - - /** Creates a mesh for the given ColladaMesh face subset and returns the newly created mesh */ - aiMesh* CreateMesh( const ColladaParser& pParser, const Collada::Mesh* pSrcMesh, const Collada::SubMesh& pSubMesh, - const Collada::Controller* pSrcController, size_t pStartVertex, size_t pStartFace); - - /** Builds cameras for the given node and references them */ - void BuildCamerasForNode( const ColladaParser& pParser, const Collada::Node* pNode, - aiNode* pTarget); - - /** Builds lights for the given node and references them */ - void BuildLightsForNode( const ColladaParser& pParser, const Collada::Node* pNode, - aiNode* pTarget); - - /** Stores all meshes in the given scene */ - void StoreSceneMeshes( aiScene* pScene); - - /** Stores all materials in the given scene */ - void StoreSceneMaterials( aiScene* pScene); - - /** Stores all lights in the given scene */ - void StoreSceneLights( aiScene* pScene); - - /** Stores all cameras in the given scene */ - void StoreSceneCameras( aiScene* pScene); - - /** Stores all textures in the given scene */ - void StoreSceneTextures( aiScene* pScene); - - /** Stores all animations - * @param pScene target scene to store the anims - */ - void StoreAnimations( aiScene* pScene, const ColladaParser& pParser); - - /** Stores all animations for the given source anim and its nested child animations - * @param pScene target scene to store the anims - * @param pSrcAnim the source animation to process - * @param pPrefix Prefix to the name in case of nested animations - */ - void StoreAnimations( aiScene* pScene, const ColladaParser& pParser, const Collada::Animation* pSrcAnim, const std::string &pPrefix); - - /** Constructs the animation for the given source anim */ - void CreateAnimation( aiScene* pScene, const ColladaParser& pParser, const Collada::Animation* pSrcAnim, const std::string& pName); - - /** Constructs materials from the collada material definitions */ - void BuildMaterials( ColladaParser& pParser, aiScene* pScene); - - /** Fill materials from the collada material definitions */ - void FillMaterials( const ColladaParser& pParser, aiScene* pScene); - - /** Resolve UV channel mappings*/ - void ApplyVertexToEffectSemanticMapping(Collada::Sampler& sampler, - const Collada::SemanticMappingTable& table); - - /** Add a texture and all of its sampling properties to a material*/ - void AddTexture ( aiMaterial& mat, const ColladaParser& pParser, - const Collada::Effect& effect, - const Collada::Sampler& sampler, - aiTextureType type, unsigned int idx = 0); - - /** Resolves the texture name for the given effect texture entry */ - aiString FindFilenameForEffectTexture( const ColladaParser& pParser, - const Collada::Effect& pEffect, const std::string& pName); - - /** Converts a path read from a collada file to the usual representation */ - void ConvertPath( aiString& ss); - - /** Reads a float value from an accessor and its data array. - * @param pAccessor The accessor to use for reading - * @param pData The data array to read from - * @param pIndex The index of the element to retrieve - * @param pOffset Offset into the element, for multipart elements such as vectors or matrices - * @return the specified value - */ - float ReadFloat( const Collada::Accessor& pAccessor, const Collada::Data& pData, size_t pIndex, size_t pOffset) const; - - /** Reads a string value from an accessor and its data array. - * @param pAccessor The accessor to use for reading - * @param pData The data array to read from - * @param pIndex The index of the element to retrieve - * @return the specified value - */ - const std::string& ReadString( const Collada::Accessor& pAccessor, const Collada::Data& pData, size_t pIndex) const; - - /** Recursively collects all nodes into the given array */ - void CollectNodes( const aiNode* pNode, std::vector<const aiNode*>& poNodes) const; - - /** Finds a node in the collada scene by the given name */ - const Collada::Node* FindNode( const Collada::Node* pNode, const std::string& pName) const; - /** Finds a node in the collada scene by the given SID */ - const Collada::Node* FindNodeBySID( const Collada::Node* pNode, const std::string& pSID) const; - - /** Finds a proper name for a node derived from the collada-node's properties */ - std::string FindNameForNode( const Collada::Node* pNode); + /** Return importer meta information. + * See #BaseImporter::GetInfo for the details + */ + const aiImporterDesc* GetInfo () const; + + void SetupProperties(const Importer* pImp); + + /** Imports the given file into the given scene structure. + * See BaseImporter::InternReadFile() for details + */ + void InternReadFile( const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler); + + /** Recursively constructs a scene node for the given parser node and returns it. */ + aiNode* BuildHierarchy( const ColladaParser& pParser, const Collada::Node* pNode); + + /** Resolve node instances */ + void ResolveNodeInstances( const ColladaParser& pParser, const Collada::Node* pNode, + std::vector<const Collada::Node*>& resolved); + + /** Builds meshes for the given node and references them */ + void BuildMeshesForNode( const ColladaParser& pParser, const Collada::Node* pNode, + aiNode* pTarget); + + aiMesh *findMesh(std::string meshid); + + /** Creates a mesh for the given ColladaMesh face subset and returns the newly created mesh */ + aiMesh* CreateMesh( const ColladaParser& pParser, const Collada::Mesh* pSrcMesh, const Collada::SubMesh& pSubMesh, + const Collada::Controller* pSrcController, size_t pStartVertex, size_t pStartFace); + + /** Builds cameras for the given node and references them */ + void BuildCamerasForNode( const ColladaParser& pParser, const Collada::Node* pNode, + aiNode* pTarget); + + /** Builds lights for the given node and references them */ + void BuildLightsForNode( const ColladaParser& pParser, const Collada::Node* pNode, + aiNode* pTarget); + + /** Stores all meshes in the given scene */ + void StoreSceneMeshes( aiScene* pScene); + + /** Stores all materials in the given scene */ + void StoreSceneMaterials( aiScene* pScene); + + /** Stores all lights in the given scene */ + void StoreSceneLights( aiScene* pScene); + + /** Stores all cameras in the given scene */ + void StoreSceneCameras( aiScene* pScene); + + /** Stores all textures in the given scene */ + void StoreSceneTextures( aiScene* pScene); + + /** Stores all animations + * @param pScene target scene to store the anims + */ + void StoreAnimations( aiScene* pScene, const ColladaParser& pParser); + + /** Stores all animations for the given source anim and its nested child animations + * @param pScene target scene to store the anims + * @param pSrcAnim the source animation to process + * @param pPrefix Prefix to the name in case of nested animations + */ + void StoreAnimations( aiScene* pScene, const ColladaParser& pParser, const Collada::Animation* pSrcAnim, const std::string& pPrefix); + + /** Constructs the animation for the given source anim */ + void CreateAnimation( aiScene* pScene, const ColladaParser& pParser, const Collada::Animation* pSrcAnim, const std::string& pName); + + /** Constructs materials from the collada material definitions */ + void BuildMaterials( ColladaParser& pParser, aiScene* pScene); + + /** Fill materials from the collada material definitions */ + void FillMaterials( const ColladaParser& pParser, aiScene* pScene); + + /** Resolve UV channel mappings*/ + void ApplyVertexToEffectSemanticMapping(Collada::Sampler& sampler, + const Collada::SemanticMappingTable& table); + + /** Add a texture and all of its sampling properties to a material*/ + void AddTexture ( aiMaterial& mat, const ColladaParser& pParser, + const Collada::Effect& effect, + const Collada::Sampler& sampler, + aiTextureType type, unsigned int idx = 0); + + /** Resolves the texture name for the given effect texture entry */ + aiString FindFilenameForEffectTexture( const ColladaParser& pParser, + const Collada::Effect& pEffect, const std::string& pName); + + /** Converts a path read from a collada file to the usual representation */ + void ConvertPath( aiString& ss); + + /** Reads a float value from an accessor and its data array. + * @param pAccessor The accessor to use for reading + * @param pData The data array to read from + * @param pIndex The index of the element to retrieve + * @param pOffset Offset into the element, for multipart elements such as vectors or matrices + * @return the specified value + */ + ai_real ReadFloat( const Collada::Accessor& pAccessor, const Collada::Data& pData, size_t pIndex, size_t pOffset) const; + + /** Reads a string value from an accessor and its data array. + * @param pAccessor The accessor to use for reading + * @param pData The data array to read from + * @param pIndex The index of the element to retrieve + * @return the specified value + */ + const std::string& ReadString( const Collada::Accessor& pAccessor, const Collada::Data& pData, size_t pIndex) const; + + /** Recursively collects all nodes into the given array */ + void CollectNodes( const aiNode* pNode, std::vector<const aiNode*>& poNodes) const; + + /** Finds a node in the collada scene by the given name */ + const Collada::Node* FindNode( const Collada::Node* pNode, const std::string& pName) const; + /** Finds a node in the collada scene by the given SID */ + const Collada::Node* FindNodeBySID( const Collada::Node* pNode, const std::string& pSID) const; + + /** Finds a proper name for a node derived from the collada-node's properties */ + std::string FindNameForNode( const Collada::Node* pNode); protected: /** Filename, for a verbose error message */ @@ -225,12 +226,12 @@ protected: /** Accumulated meshes for the target scene */ std::vector<aiMesh*> mMeshes; + + /** Accumulated morph target meshes */ + std::vector<aiMesh*> mTargetMeshes; - /** Accumulated morph target meshes */ - std::vector<aiMesh*> mTargetMeshes; - - /** Temporary material list */ - std::vector<std::pair<Collada::Effect*, aiMaterial*> > newMats; + /** Temporary material list */ + std::vector<std::pair<Collada::Effect*, aiMaterial*> > newMats; /** Temporary camera list */ std::vector<aiCamera*> mCameras; |