2008-11-12 17:07:44 +00:00
|
|
|
/*
|
2012-02-03 03:38:30 +00:00
|
|
|
Open Asset Import Library (assimp)
|
2008-11-12 17:07:44 +00:00
|
|
|
----------------------------------------------------------------------
|
|
|
|
|
2015-06-28 19:48:25 +00:00
|
|
|
Copyright (c) 2006-2015, assimp team
|
2008-11-12 17:07:44 +00:00
|
|
|
All rights reserved.
|
|
|
|
|
|
|
|
Redistribution and use of this software in source and binary forms,
|
|
|
|
with or without modification, are permitted provided that the
|
|
|
|
following conditions are met:
|
|
|
|
|
|
|
|
* Redistributions of source code must retain the above
|
|
|
|
copyright notice, this list of conditions and the
|
|
|
|
following disclaimer.
|
|
|
|
|
|
|
|
* Redistributions in binary form must reproduce the above
|
|
|
|
copyright notice, this list of conditions and the
|
|
|
|
following disclaimer in the documentation and/or other
|
|
|
|
materials provided with the distribution.
|
|
|
|
|
2012-02-03 03:38:30 +00:00
|
|
|
* Neither the name of the assimp team, nor the names of its
|
2008-11-12 17:07:44 +00:00
|
|
|
contributors may be used to endorse or promote products
|
|
|
|
derived from this software without specific prior
|
2012-02-03 03:38:30 +00:00
|
|
|
written permission of the assimp team.
|
2008-11-12 17:07:44 +00:00
|
|
|
|
|
|
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
|
|
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
|
|
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
|
|
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
|
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
2009-02-11 20:56:05 +00:00
|
|
|
/** @file ColladaParser.h
|
|
|
|
* @brief Defines the parser helper class for the collada loader
|
|
|
|
*/
|
|
|
|
|
2008-11-12 17:07:44 +00:00
|
|
|
#ifndef AI_COLLADAPARSER_H_INC
|
|
|
|
#define AI_COLLADAPARSER_H_INC
|
|
|
|
|
2009-01-18 23:48:25 +00:00
|
|
|
#include "irrXMLWrapper.h"
|
2008-11-26 15:45:34 +00:00
|
|
|
#include "ColladaHelper.h"
|
2015-04-15 19:22:26 +00:00
|
|
|
#include "../include/assimp/ai_assert.h"
|
|
|
|
#include <boost/format.hpp>
|
2008-11-12 17:07:44 +00:00
|
|
|
|
2009-03-25 21:10:28 +00:00
|
|
|
namespace Assimp
|
|
|
|
{
|
2008-11-12 17:07:44 +00:00
|
|
|
|
2009-02-11 20:56:05 +00:00
|
|
|
// ------------------------------------------------------------------------------------------
|
|
|
|
/** 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.
|
2008-11-12 17:07:44 +00:00
|
|
|
*/
|
|
|
|
class ColladaParser
|
|
|
|
{
|
|
|
|
friend class ColladaLoader;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
/** Constructor from XML file */
|
2009-03-03 15:43:26 +00:00
|
|
|
ColladaParser( IOSystem* pIOHandler, const std::string& pFile);
|
2008-11-12 17:07:44 +00:00
|
|
|
|
|
|
|
/** Destructor */
|
|
|
|
~ColladaParser();
|
|
|
|
|
|
|
|
/** Reads the contents of the file */
|
|
|
|
void ReadContents();
|
|
|
|
|
|
|
|
/** Reads the structure of the file */
|
|
|
|
void ReadStructure();
|
|
|
|
|
|
|
|
/** Reads asset informations such as coordinate system informations and legal blah */
|
|
|
|
void ReadAssetInfo();
|
|
|
|
|
2009-04-06 17:00:03 +00:00
|
|
|
/** Reads the animation library */
|
|
|
|
void ReadAnimationLibrary();
|
|
|
|
|
|
|
|
/** Reads an animation into the given parent structure */
|
|
|
|
void ReadAnimation( Collada::Animation* pParent);
|
|
|
|
|
|
|
|
/** Reads an animation sampler into the given anim channel */
|
|
|
|
void ReadAnimationSampler( Collada::AnimationChannel& pChannel);
|
|
|
|
|
2009-03-25 21:10:28 +00:00
|
|
|
/** Reads the skeleton controller library */
|
|
|
|
void ReadControllerLibrary();
|
|
|
|
|
|
|
|
/** Reads a controller into the given mesh structure */
|
|
|
|
void ReadController( Collada::Controller& pController);
|
|
|
|
|
|
|
|
/** Reads the joint definitions for the given controller */
|
|
|
|
void ReadControllerJoints( Collada::Controller& pController);
|
|
|
|
|
|
|
|
/** Reads the joint weights for the given controller */
|
|
|
|
void ReadControllerWeights( Collada::Controller& pController);
|
|
|
|
|
2008-11-27 15:54:35 +00:00
|
|
|
/** Reads the image library contents */
|
|
|
|
void ReadImageLibrary();
|
|
|
|
|
|
|
|
/** Reads an image entry into the given image */
|
|
|
|
void ReadImage( Collada::Image& pImage);
|
|
|
|
|
|
|
|
/** Reads the material library */
|
|
|
|
void ReadMaterialLibrary();
|
|
|
|
|
|
|
|
/** Reads a material entry into the given material */
|
|
|
|
void ReadMaterial( Collada::Material& pMaterial);
|
|
|
|
|
2009-02-08 22:55:51 +00:00
|
|
|
/** Reads the camera library */
|
|
|
|
void ReadCameraLibrary();
|
|
|
|
|
|
|
|
/** Reads a camera entry into the given camera */
|
|
|
|
void ReadCamera( Collada::Camera& pCamera);
|
|
|
|
|
|
|
|
/** Reads the light library */
|
|
|
|
void ReadLightLibrary();
|
|
|
|
|
|
|
|
/** Reads a light entry into the given light */
|
|
|
|
void ReadLight( Collada::Light& pLight);
|
|
|
|
|
2008-11-27 15:54:35 +00:00
|
|
|
/** Reads the effect library */
|
|
|
|
void ReadEffectLibrary();
|
|
|
|
|
|
|
|
/** Reads an effect entry into the given effect*/
|
2008-12-04 17:06:26 +00:00
|
|
|
void ReadEffect( Collada::Effect& pEffect);
|
|
|
|
|
2009-11-22 12:46:49 +00:00
|
|
|
/** Reads an COMMON effect profile */
|
|
|
|
void ReadEffectProfileCommon( Collada::Effect& pEffect);
|
|
|
|
|
2009-02-08 22:55:51 +00:00
|
|
|
/** Read sampler properties */
|
|
|
|
void ReadSamplerProperties( Collada::Sampler& pSampler);
|
|
|
|
|
2008-12-04 17:06:26 +00:00
|
|
|
/** Reads an effect entry containing a color or a texture defining that color */
|
2009-02-08 22:55:51 +00:00
|
|
|
void ReadEffectColor( aiColor4D& pColor, Collada::Sampler& pSampler);
|
|
|
|
|
2008-12-04 17:06:26 +00:00
|
|
|
/** Reads an effect entry containing a float */
|
|
|
|
void ReadEffectFloat( float& pFloat);
|
|
|
|
|
|
|
|
/** Reads an effect parameter specification of any kind */
|
|
|
|
void ReadEffectParam( Collada::EffectParam& pParam);
|
2008-11-27 15:54:35 +00:00
|
|
|
|
2008-11-12 17:07:44 +00:00
|
|
|
/** Reads the geometry library contents */
|
|
|
|
void ReadGeometryLibrary();
|
|
|
|
|
2009-02-08 22:55:51 +00:00
|
|
|
/** Reads a geometry from the geometry library. */
|
|
|
|
void ReadGeometry( Collada::Mesh* pMesh);
|
2009-01-18 00:52:20 +00:00
|
|
|
|
2008-11-12 17:07:44 +00:00
|
|
|
/** Reads a mesh from the geometry library */
|
2008-11-26 15:45:34 +00:00
|
|
|
void ReadMesh( Collada::Mesh* pMesh);
|
2008-11-20 17:42:55 +00:00
|
|
|
|
2009-03-25 21:10:28 +00:00
|
|
|
/** 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 ReadSource();
|
|
|
|
|
|
|
|
/** 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 ReadDataArray();
|
2008-11-20 17:42:55 +00:00
|
|
|
|
|
|
|
/** Reads an accessor and stores it in the global library under the given ID -
|
|
|
|
* accessors use the ID of the parent <source> element
|
|
|
|
*/
|
|
|
|
void ReadAccessor( const std::string& pID);
|
|
|
|
|
|
|
|
/** Reads input declarations of per-vertex mesh data into the given mesh */
|
2008-11-26 15:45:34 +00:00
|
|
|
void ReadVertexData( Collada::Mesh* pMesh);
|
2008-11-20 17:42:55 +00:00
|
|
|
|
|
|
|
/** Reads input declarations of per-index mesh data into the given mesh */
|
2008-11-26 15:45:34 +00:00
|
|
|
void ReadIndexData( Collada::Mesh* pMesh);
|
2008-11-20 17:42:55 +00:00
|
|
|
|
|
|
|
/** Reads a single input channel element and stores it in the given array, if valid */
|
2008-11-26 15:45:34 +00:00
|
|
|
void ReadInputChannel( std::vector<Collada::InputChannel>& poChannels);
|
2008-11-20 17:42:55 +00:00
|
|
|
|
|
|
|
/** Reads a <p> primitive index list and assembles the mesh data into the given mesh */
|
2014-11-19 13:38:03 +00:00
|
|
|
size_t ReadPrimitives( Collada::Mesh* pMesh, std::vector<Collada::InputChannel>& pPerIndexChannels,
|
2008-11-26 15:45:34 +00:00
|
|
|
size_t pNumPrimitives, const std::vector<size_t>& pVCount, Collada::PrimitiveType pPrimType);
|
2008-11-20 17:42:55 +00:00
|
|
|
|
2014-11-19 13:10:16 +00:00
|
|
|
/** Copies the data for a single primitive into the mesh, based on the InputChannels */
|
2014-11-20 12:12:09 +00:00
|
|
|
void CopyVertex(size_t currentVertex, size_t numOffsets, size_t numPoints, size_t perVertexOffset,
|
2014-11-19 13:10:16 +00:00
|
|
|
Collada::Mesh* pMesh, std::vector<Collada::InputChannel>& pPerIndexChannels,
|
|
|
|
size_t currentPrimitive, const std::vector<size_t>& indices);
|
|
|
|
|
2014-11-19 13:30:18 +00:00
|
|
|
/** Reads one triangle of a tristrip into the mesh */
|
|
|
|
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);
|
|
|
|
|
2008-11-20 17:42:55 +00:00
|
|
|
/** Extracts a single object from an input channel and stores it in the appropriate mesh data array */
|
2008-11-26 15:45:34 +00:00
|
|
|
void ExtractDataObjectFromChannel( const Collada::InputChannel& pInput, size_t pLocalIndex, Collada::Mesh* pMesh);
|
2008-11-12 17:07:44 +00:00
|
|
|
|
|
|
|
/** Reads the library of node hierarchies and scene parts */
|
|
|
|
void ReadSceneLibrary();
|
|
|
|
|
|
|
|
/** Reads a scene node's contents including children and stores it in the given node */
|
2008-11-26 15:45:34 +00:00
|
|
|
void ReadSceneNode( Collada::Node* pNode);
|
2008-11-12 17:07:44 +00:00
|
|
|
|
|
|
|
/** Reads a node transformation entry of the given type and adds it to the given node's transformation list. */
|
2008-11-26 15:45:34 +00:00
|
|
|
void ReadNodeTransformation( Collada::Node* pNode, Collada::TransformType pType);
|
2008-11-12 17:07:44 +00:00
|
|
|
|
2008-11-25 17:58:11 +00:00
|
|
|
/** Reads a mesh reference in a node and adds it to the node's mesh list */
|
2008-11-26 15:45:34 +00:00
|
|
|
void ReadNodeGeometry( Collada::Node* pNode);
|
2008-11-25 17:58:11 +00:00
|
|
|
|
2008-11-12 17:07:44 +00:00
|
|
|
/** Reads the collada scene */
|
|
|
|
void ReadScene();
|
|
|
|
|
2009-02-08 22:55:51 +00:00
|
|
|
// Processes bind_vertex_input and bind elements
|
|
|
|
void ReadMaterialVertexInputBinding( Collada::SemanticMappingTable& tbl);
|
|
|
|
|
2008-11-12 17:07:44 +00:00
|
|
|
protected:
|
|
|
|
/** Aborts the file reading with an exception */
|
2015-02-13 12:45:36 +00:00
|
|
|
AI_WONT_RETURN void ThrowException( const std::string& pError) const AI_WONT_RETURN_SUFFIX;
|
2008-11-12 17:07:44 +00:00
|
|
|
|
|
|
|
/** Skips all data until the end node of the current element */
|
|
|
|
void SkipElement();
|
|
|
|
|
2008-12-04 17:06:26 +00:00
|
|
|
/** Skips all data until the end node of the given element */
|
|
|
|
void SkipElement( const char* pElement);
|
|
|
|
|
2008-11-12 17:07:44 +00:00
|
|
|
/** Compares the current xml element name to the given string and returns true if equal */
|
2009-02-11 20:56:05 +00:00
|
|
|
bool IsElement( const char* pName) const;
|
2008-11-12 17:07:44 +00:00
|
|
|
|
2008-11-20 17:42:55 +00:00
|
|
|
/** Tests for the opening tag of the given element, throws an exception if not found */
|
|
|
|
void TestOpening( const char* pName);
|
|
|
|
|
2008-11-12 17:07:44 +00:00
|
|
|
/** Tests for the closing tag of the given element, throws an exception if not found */
|
|
|
|
void TestClosing( const char* pName);
|
|
|
|
|
2009-02-08 22:55:51 +00:00
|
|
|
/** Checks the present element for the presence of the attribute, returns its index
|
|
|
|
or throws an exception if not found */
|
2008-11-12 17:07:44 +00:00
|
|
|
int GetAttribute( const char* pAttr) const;
|
|
|
|
|
2009-02-08 22:55:51 +00:00
|
|
|
/** Returns the index of the named attribute or -1 if not found. Does not throw,
|
|
|
|
therefore useful for optional attributes */
|
2008-11-12 17:07:44 +00:00
|
|
|
int TestAttribute( const char* pAttr) const;
|
|
|
|
|
2009-02-08 22:55:51 +00:00
|
|
|
/** Reads the text contents of an element, throws an exception if not given.
|
|
|
|
Skips leading whitespace. */
|
2008-11-12 17:07:44 +00:00
|
|
|
const char* GetTextContent();
|
|
|
|
|
2009-02-11 20:56:05 +00:00
|
|
|
/** Reads the text contents of an element, returns NULL if not given.
|
|
|
|
Skips leading whitespace. */
|
General
- Added format auto-detection to most loaders
- Simplified BaseImporter::CanRead() with some utility methods
- improved fast_atof -> no overruns anymore. Fuck you, irrlicht.
- added assimp_cmd tool to allow command line model processing. Mainly adebugging tool for internal purposes, but others might find it useful, too.
- vc8/vc9: revision number is now written to DLL version header
- mkutil: some batch scripts to simplify tagging & building of release versions
- some API cleanup
- fixing some doxygen markup (+now explicit use of @file <filename>)
- Icon for assimp_view and assimp_cmd
3DS
- Normal vectors are not anymore inverted in some cases
- Improved pivot handling
- Improved handling of x-flipped meshes
Collada
- fixed a minor bug (visual_scene element)
LWS
- WIP implementation. No animations yet, some bugs and crashes.
- Animation system remains disabled, WIP code
- many test files for LWS, but most of them test the anim support, which is, read above, currently disabled.
STL
- fixing a log warning which appears for every model
- added binary&ascii test spider, exported from truespace
MD3
- Cleaning up output tags for automatically joined player models.
IRR
- Fixing coordinate system issues.
- Instance handling improved.
- Some of the reported crashes not yet fixed.
PretransformVertices
- Numerous performance improvements.
- Added config option to preserve the hierarchy during the step.
RemoveRedundantMaterials
- Added config option to specify a list of materials which are kept in every case.
UNREAL
- Added support for the old unreal data format (*.a,*.d,*.uc)
- tested only with exports from Milkshape
- more Unreal stuff to come soon
git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@356 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
2009-03-05 22:32:13 +00:00
|
|
|
const char* TestTextContent();
|
2009-02-11 20:56:05 +00:00
|
|
|
|
2009-02-08 22:55:51 +00:00
|
|
|
/** Reads a single bool from current text content */
|
|
|
|
bool ReadBoolFromTextContent();
|
|
|
|
|
|
|
|
/** Reads a single float from current text content */
|
|
|
|
float ReadFloatFromTextContent();
|
|
|
|
|
2009-02-11 20:56:05 +00:00
|
|
|
/** Calculates the resulting transformation from all the given transform steps */
|
2008-11-26 15:45:34 +00:00
|
|
|
aiMatrix4x4 CalculateResultTransform( const std::vector<Collada::Transform>& pTransforms) const;
|
2008-11-12 17:07:44 +00:00
|
|
|
|
2008-11-20 17:42:55 +00:00
|
|
|
/** Determines the input data type for the given semantic string */
|
2008-11-26 15:45:34 +00:00
|
|
|
Collada::InputType GetTypeForSemantic( const std::string& pSemantic);
|
2008-11-20 17:42:55 +00:00
|
|
|
|
|
|
|
/** Finds the item in the given library by its reference, throws if not found */
|
2009-02-08 22:55:51 +00:00
|
|
|
template <typename Type> const Type& ResolveLibraryReference(
|
|
|
|
const std::map<std::string, Type>& pLibrary, const std::string& pURL) const;
|
2008-11-20 17:42:55 +00:00
|
|
|
|
2008-11-12 17:07:44 +00:00
|
|
|
protected:
|
|
|
|
/** Filename, for a verbose error message */
|
|
|
|
std::string mFileName;
|
|
|
|
|
2009-03-03 15:43:26 +00:00
|
|
|
/** XML reader, member for everyday use */
|
2008-11-12 17:07:44 +00:00
|
|
|
irr::io::IrrXMLReader* mReader;
|
|
|
|
|
2009-02-11 20:56:05 +00:00
|
|
|
/** All data arrays found in the file by ID. Might be referred to by actually
|
|
|
|
everyone. Collada, you are a steaming pile of indirection. */
|
2008-11-26 15:45:34 +00:00
|
|
|
typedef std::map<std::string, Collada::Data> DataLibrary;
|
2008-11-20 17:42:55 +00:00
|
|
|
DataLibrary mDataLibrary;
|
|
|
|
|
|
|
|
/** Same for accessors which define how the data in a data array is accessed. */
|
2008-11-26 15:45:34 +00:00
|
|
|
typedef std::map<std::string, Collada::Accessor> AccessorLibrary;
|
2008-11-20 17:42:55 +00:00
|
|
|
AccessorLibrary mAccessorLibrary;
|
|
|
|
|
|
|
|
/** Mesh library: mesh by ID */
|
2008-11-26 15:45:34 +00:00
|
|
|
typedef std::map<std::string, Collada::Mesh*> MeshLibrary;
|
2008-11-20 17:42:55 +00:00
|
|
|
MeshLibrary mMeshLibrary;
|
|
|
|
|
2008-11-12 17:07:44 +00:00
|
|
|
/** node library: root node of the hierarchy part by ID */
|
2008-11-26 15:45:34 +00:00
|
|
|
typedef std::map<std::string, Collada::Node*> NodeLibrary;
|
2008-11-12 17:07:44 +00:00
|
|
|
NodeLibrary mNodeLibrary;
|
|
|
|
|
2008-11-27 15:54:35 +00:00
|
|
|
/** Image library: stores texture properties by ID */
|
|
|
|
typedef std::map<std::string, Collada::Image> ImageLibrary;
|
|
|
|
ImageLibrary mImageLibrary;
|
|
|
|
|
|
|
|
/** Effect library: surface attributes by ID */
|
|
|
|
typedef std::map<std::string, Collada::Effect> EffectLibrary;
|
|
|
|
EffectLibrary mEffectLibrary;
|
|
|
|
|
|
|
|
/** Material library: surface material by ID */
|
|
|
|
typedef std::map<std::string, Collada::Material> MaterialLibrary;
|
|
|
|
MaterialLibrary mMaterialLibrary;
|
|
|
|
|
2009-02-08 22:55:51 +00:00
|
|
|
/** Light library: surface light by ID */
|
|
|
|
typedef std::map<std::string, Collada::Light> LightLibrary;
|
|
|
|
LightLibrary mLightLibrary;
|
|
|
|
|
|
|
|
/** Camera library: surface material by ID */
|
|
|
|
typedef std::map<std::string, Collada::Camera> CameraLibrary;
|
|
|
|
CameraLibrary mCameraLibrary;
|
|
|
|
|
2009-03-25 21:10:28 +00:00
|
|
|
/** Controller library: joint controllers by ID */
|
|
|
|
typedef std::map<std::string, Collada::Controller> ControllerLibrary;
|
|
|
|
ControllerLibrary mControllerLibrary;
|
|
|
|
|
2009-02-11 20:56:05 +00:00
|
|
|
/** Pointer to the root node. Don't delete, it just points to one of
|
|
|
|
the nodes in the node library. */
|
2008-11-26 15:45:34 +00:00
|
|
|
Collada::Node* mRootNode;
|
2008-11-12 17:07:44 +00:00
|
|
|
|
2009-04-06 17:00:03 +00:00
|
|
|
/** Root animation container */
|
|
|
|
Collada::Animation mAnims;
|
|
|
|
|
2008-11-12 17:07:44 +00:00
|
|
|
/** Size unit: how large compared to a meter */
|
|
|
|
float mUnitSize;
|
|
|
|
|
|
|
|
/** Which is the up vector */
|
|
|
|
enum { UP_X, UP_Y, UP_Z } mUpDirection;
|
2009-02-11 20:56:05 +00:00
|
|
|
|
|
|
|
/** Collada file format version */
|
|
|
|
Collada::FormatVersion mFormat;
|
2008-11-12 17:07:44 +00:00
|
|
|
};
|
|
|
|
|
2009-02-11 20:56:05 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// Check for element match
|
|
|
|
inline bool ColladaParser::IsElement( const char* pName) const
|
|
|
|
{
|
|
|
|
ai_assert( mReader->getNodeType() == irr::io::EXN_ELEMENT);
|
|
|
|
return ::strcmp( mReader->getNodeName(), pName) == 0;
|
|
|
|
}
|
|
|
|
|
2008-11-20 17:42:55 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// Finds the item in the given library by its reference, throws if not found
|
|
|
|
template <typename Type>
|
|
|
|
const Type& ColladaParser::ResolveLibraryReference( const std::map<std::string, Type>& pLibrary, const std::string& pURL) const
|
|
|
|
{
|
2008-11-26 13:17:39 +00:00
|
|
|
typename std::map<std::string, Type>::const_iterator it = pLibrary.find( pURL);
|
2008-11-20 17:42:55 +00:00
|
|
|
if( it == pLibrary.end())
|
|
|
|
ThrowException( boost::str( boost::format( "Unable to resolve library reference \"%s\".") % pURL));
|
|
|
|
return it->second;
|
|
|
|
}
|
|
|
|
|
2008-11-12 17:07:44 +00:00
|
|
|
} // end of namespace Assimp
|
|
|
|
|
|
|
|
#endif // AI_COLLADAPARSER_H_INC
|