[964] | 1 | /*
|
---|
| 2 | Copyright (C) 2005-2006 Feeling Software Inc.
|
---|
| 3 | MIT License: http://www.opensource.org/licenses/mit-license.php
|
---|
| 4 | */
|
---|
| 5 | /*
|
---|
| 6 | Based on the FS Import classes:
|
---|
| 7 | Copyright (C) 2005-2006 Feeling Software Inc
|
---|
| 8 | Copyright (C) 2005-2006 Autodesk Media Entertainment
|
---|
| 9 | MIT License: http://www.opensource.org/licenses/mit-license.php
|
---|
| 10 | */
|
---|
| 11 |
|
---|
| 12 | #ifndef _FU_DAE_PARSER_
|
---|
| 13 | #define _FU_DAE_PARSER_
|
---|
| 14 |
|
---|
| 15 | #ifdef HAS_LIBXML
|
---|
| 16 |
|
---|
| 17 | #include "FUtils/FUDaeSyntax.h"
|
---|
| 18 | #include "FUtils/FUUri.h"
|
---|
| 19 | #include "FUtils/FUXmlParser.h"
|
---|
| 20 | #include "FUtils/FUXmlNodeIdPair.h"
|
---|
| 21 |
|
---|
| 22 | namespace FUDaeParser
|
---|
| 23 | {
|
---|
| 24 | using namespace FUXmlParser;
|
---|
| 25 |
|
---|
| 26 | // Retrieve specific child nodes
|
---|
| 27 | FCOLLADA_EXPORT xmlNode* FindChildById(xmlNode* parent, const string& id);
|
---|
| 28 | FCOLLADA_EXPORT xmlNode* FindChildByRef(xmlNode* parent, const char* ref);
|
---|
| 29 | FCOLLADA_EXPORT xmlNode* FindHierarchyChildBySid(xmlNode* hierarchyRoot, const char* sid);
|
---|
| 30 | FCOLLADA_EXPORT xmlNode* FindTechnique(xmlNode* parent, const char* profile);
|
---|
| 31 | FCOLLADA_EXPORT xmlNode* FindTechniqueAccessor(xmlNode* parent);
|
---|
| 32 | FCOLLADA_EXPORT xmlNode* FindArray(xmlNode* parent, const char* arrayType);
|
---|
| 33 | FCOLLADA_EXPORT void FindParameters(xmlNode* parent, StringList& parameterNames, xmlNodeList& parameterNodes);
|
---|
| 34 |
|
---|
| 35 | // Import source arrays
|
---|
| 36 | FCOLLADA_EXPORT uint32 ReadSource(xmlNode* sourceNode, FloatList& array);
|
---|
| 37 | FCOLLADA_EXPORT void ReadSource(xmlNode* sourceNode, Int32List& array);
|
---|
| 38 | FCOLLADA_EXPORT void ReadSource(xmlNode* sourceNode, StringList& array);
|
---|
| 39 | FCOLLADA_EXPORT void ReadSource(xmlNode* sourceNode, FMVector3List& array, float lengthFactor=1.0f);
|
---|
| 40 | FCOLLADA_EXPORT void ReadSource(xmlNode* sourceNode, FMMatrix44List& array, float lengthFactor=1.0f);
|
---|
| 41 | FCOLLADA_EXPORT void ReadSourceInterleaved(xmlNode* sourceNode, vector<FloatList*>& arrays);
|
---|
| 42 | FCOLLADA_EXPORT void ReadSourceInterpolation(xmlNode* sourceNode, UInt32List& array);
|
---|
| 43 | FCOLLADA_EXPORT void ReadSourceInterpolationInterleaved(xmlNode* sourceNode, vector<UInt32List*>& arrays);
|
---|
| 44 |
|
---|
| 45 | // Target support
|
---|
| 46 | FCOLLADA_EXPORT void ReadNodeTargetProperty(xmlNode* targetingNode, string& pointer, string& qualifier);
|
---|
| 47 | FCOLLADA_EXPORT void SplitTarget(const string& target, string& pointer, string& qualifier);
|
---|
| 48 | FCOLLADA_EXPORT void CalculateNodeTargetPointer(xmlNode* targetedNode, string& pointer);
|
---|
| 49 | FCOLLADA_EXPORT int32 ReadTargetMatrixElement(string& qualifier);
|
---|
| 50 |
|
---|
| 51 | // Retrieve common node properties
|
---|
| 52 | inline string ReadNodeId(xmlNode* node) { return ReadNodeProperty(node, DAE_ID_ATTRIBUTE); }
|
---|
| 53 | inline string ReadNodeSid(xmlNode* node) { return ReadNodeProperty(node, DAE_SID_ATTRIBUTE); }
|
---|
| 54 | inline string ReadNodeSemantic(xmlNode* node) { return ReadNodeProperty(node, DAE_SEMANTIC_ATTRIBUTE); }
|
---|
| 55 | inline string ReadNodeName(xmlNode* node) { return ReadNodeProperty(node, DAE_NAME_ATTRIBUTE); }
|
---|
| 56 | inline string ReadNodeSource(xmlNode* node) { return ReadNodeProperty(node, DAE_SOURCE_ATTRIBUTE); }
|
---|
| 57 | inline string ReadNodeStage(xmlNode* node) { return ReadNodeProperty(node, DAE_STAGE_ATTRIBUTE); }
|
---|
| 58 | FCOLLADA_EXPORT FUUri ReadNodeUrl(xmlNode* node, const char* attribute=DAE_URL_ATTRIBUTE);
|
---|
| 59 | FCOLLADA_EXPORT uint32 ReadNodeCount(xmlNode* node);
|
---|
| 60 | FCOLLADA_EXPORT uint32 ReadNodeStride(xmlNode* node);
|
---|
| 61 |
|
---|
| 62 | // Pre-buffer the children of a node, with their ids, for performance optimization
|
---|
| 63 | FCOLLADA_EXPORT void ReadChildrenIds(xmlNode* node, FUXmlNodeIdPairList& pairs);
|
---|
| 64 |
|
---|
| 65 | // Skip the pound(#) character from a COLLADA id string
|
---|
| 66 | FCOLLADA_EXPORT const char* SkipPound(const string& id);
|
---|
| 67 | };
|
---|
| 68 |
|
---|
| 69 | #endif // HAS_LIBXML
|
---|
| 70 |
|
---|
| 71 | #endif // _FU_DAE_PARSER_
|
---|