FUtils/FUDaeParser.h

00001 /*
00002     Copyright (C) 2005-2006 Feeling Software Inc.
00003     MIT License: http://www.opensource.org/licenses/mit-license.php
00004 */
00005 /*
00006     Based on the FS Import classes:
00007     Copyright (C) 2005-2006 Feeling Software Inc
00008     Copyright (C) 2005-2006 Autodesk Media Entertainment
00009     MIT License: http://www.opensource.org/licenses/mit-license.php
00010 */
00011 
00012 #ifndef _FU_DAE_PARSER_
00013 #define _FU_DAE_PARSER_
00014 
00015 #ifdef HAS_LIBXML
00016 
00017 #include "FUtils/FUDaeSyntax.h"
00018 #include "FUtils/FUUri.h"
00019 #include "FUtils/FUXmlParser.h"
00020 #include "FUtils/FUXmlNodeIdPair.h"
00021 
00022 namespace FUDaeParser
00023 {
00024     using namespace FUXmlParser;
00025 
00026     // Retrieve specific child nodes
00027     FCOLLADA_EXPORT xmlNode* FindChildById(xmlNode* parent, const string& id);
00028     FCOLLADA_EXPORT xmlNode* FindChildByRef(xmlNode* parent, const char* ref);
00029     FCOLLADA_EXPORT xmlNode* FindHierarchyChildBySid(xmlNode* hierarchyRoot, const char* sid);
00030     FCOLLADA_EXPORT xmlNode* FindTechnique(xmlNode* parent, const char* profile);
00031     FCOLLADA_EXPORT xmlNode* FindTechniqueAccessor(xmlNode* parent);
00032     FCOLLADA_EXPORT xmlNode* FindArray(xmlNode* parent, const char* arrayType);
00033     FCOLLADA_EXPORT void FindParameters(xmlNode* parent, StringList& parameterNames, xmlNodeList& parameterNodes);
00034 
00035     // Import source arrays
00036     FCOLLADA_EXPORT uint32 ReadSource(xmlNode* sourceNode, FloatList& array);
00037     FCOLLADA_EXPORT void ReadSource(xmlNode* sourceNode, Int32List& array);
00038     FCOLLADA_EXPORT void ReadSource(xmlNode* sourceNode, StringList& array);
00039     FCOLLADA_EXPORT void ReadSource(xmlNode* sourceNode, FMVector3List& array, float lengthFactor=1.0f);
00040     FCOLLADA_EXPORT void ReadSource(xmlNode* sourceNode, FMMatrix44List& array, float lengthFactor=1.0f);
00041     FCOLLADA_EXPORT void ReadSourceInterleaved(xmlNode* sourceNode, vector<FloatList*>& arrays);
00042     FCOLLADA_EXPORT void ReadSourceInterpolation(xmlNode* sourceNode, UInt32List& array);
00043     FCOLLADA_EXPORT void ReadSourceInterpolationInterleaved(xmlNode* sourceNode, vector<UInt32List*>& arrays);
00044 
00045     // Target support
00046     FCOLLADA_EXPORT void ReadNodeTargetProperty(xmlNode* targetingNode, string& pointer, string& qualifier);
00047     FCOLLADA_EXPORT void SplitTarget(const string& target, string& pointer, string& qualifier);
00048     FCOLLADA_EXPORT void CalculateNodeTargetPointer(xmlNode* targetedNode, string& pointer);
00049     FCOLLADA_EXPORT int32 ReadTargetMatrixElement(string& qualifier);
00050 
00051     // Retrieve common node properties
00052     inline string ReadNodeId(xmlNode* node) { return ReadNodeProperty(node, DAE_ID_ATTRIBUTE); }
00053     inline string ReadNodeSid(xmlNode* node) { return ReadNodeProperty(node, DAE_SID_ATTRIBUTE); }
00054     inline string ReadNodeSemantic(xmlNode* node) { return ReadNodeProperty(node, DAE_SEMANTIC_ATTRIBUTE); }
00055     inline string ReadNodeName(xmlNode* node) { return ReadNodeProperty(node, DAE_NAME_ATTRIBUTE); }
00056     inline string ReadNodeSource(xmlNode* node) { return ReadNodeProperty(node, DAE_SOURCE_ATTRIBUTE); }
00057     inline string ReadNodeStage(xmlNode* node) { return ReadNodeProperty(node, DAE_STAGE_ATTRIBUTE); }
00058     FCOLLADA_EXPORT FUUri ReadNodeUrl(xmlNode* node, const char* attribute=DAE_URL_ATTRIBUTE);
00059     FCOLLADA_EXPORT uint32 ReadNodeCount(xmlNode* node);
00060     FCOLLADA_EXPORT uint32 ReadNodeStride(xmlNode* node);
00061 
00062     // Pre-buffer the children of a node, with their ids, for performance optimization
00063     FCOLLADA_EXPORT void ReadChildrenIds(xmlNode* node, FUXmlNodeIdPairList& pairs);
00064 
00065     // Skip the pound(#) character from a COLLADA id string
00066     FCOLLADA_EXPORT const char* SkipPound(const string& id);
00067 };
00068 
00069 #endif // HAS_LIBXML
00070 
00071 #endif // _FU_DAE_PARSER_

Generated on Fri May 12 16:44:39 2006 for FCollada by  doxygen 1.4.6-NO