You can subscribe to this list here.
2009 |
Jan
(14) |
Feb
(44) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
---|
From: <rob...@us...> - 2009-02-10 14:34:34
|
Revision: 350 http://colladamaya.svn.sourceforge.net/colladamaya/?rev=350&view=rev Author: robertwuerfel Date: 2009-02-10 14:34:30 +0000 (Tue, 10 Feb 2009) Log Message: ----------- improve material import set normal for tristrips correctly. Modified Paths: -------------- branches/nextgen/COLLADAMax/src/COLLADAMaxGeometryImporter.cpp branches/nextgen/COLLADAMax/src/COLLADAMaxMaterialCreator.cpp Modified: branches/nextgen/COLLADAMax/src/COLLADAMaxGeometryImporter.cpp =================================================================== --- branches/nextgen/COLLADAMax/src/COLLADAMaxGeometryImporter.cpp 2009-02-10 12:32:05 UTC (rev 349) +++ branches/nextgen/COLLADAMax/src/COLLADAMaxGeometryImporter.cpp 2009-02-10 14:34:30 UTC (rev 350) @@ -142,7 +142,7 @@ if ( ! meshPrimitive ) continue; // We use the frame work material id as max material id - MtlID maxMaterialId = meshPrimitive->getMaterialId(); + MtlID maxMaterialId = (MtlID)meshPrimitive->getMaterialId(); switch (meshPrimitive->getPrimitiveType()) { case COLLADAFW::MeshPrimitive::TRIANGLES: @@ -206,11 +206,9 @@ for ( size_t j = nextTrifanStartIndex + 2, lastVertex = nextTrifanStartIndex + faceVertexCount; j < lastVertex; ++j ) { Face& face = triangleMesh.faces[faceIndex]; - MtlID gg1 =fWMaterialIdMaxMtlIdMap[meshPrimitive->getMaterialId()]; // face.setMatID(fWMaterialIdMaxMtlIdMap[meshPrimitive->getMaterialId()]); - if ( maxMaterialId != 0 ) + if ( maxMaterialId != 0 ) face.setMatID(maxMaterialId); - MtlID gg = face.getMatID(); face.setEdgeVisFlags(1, 1, 1); face.setVerts(commonVertexIndex, positionIndices[j - 1], positionIndices[j]); ++faceIndex; @@ -307,13 +305,25 @@ for ( size_t k = 0, count = faceVertexCountArray.getCount(); k < count; ++k) { unsigned int faceVertexCount = faceVertexCountArray[k]; + bool switchOrientation = false; for ( size_t j = nextTristripStartIndex + 2, lastVertex = nextTristripStartIndex + faceVertexCount; j < lastVertex; ++j ) { MeshNormalFace& normalFace = normalsSpecifier->Face((int) faceIndex); normalFace.SpecifyAll(); - normalFace.SetNormalID(0, normalIndices[j - 2]); - normalFace.SetNormalID(1, normalIndices[j - 1]); - normalFace.SetNormalID(2, normalIndices[j]); + if ( switchOrientation ) + { + normalFace.SetNormalID(0, normalIndices[j - 1]); + normalFace.SetNormalID(1, normalIndices[j - 2]); + normalFace.SetNormalID(2, normalIndices[j]); + switchOrientation = false; + } + else + { + normalFace.SetNormalID(0, normalIndices[j - 2]); + normalFace.SetNormalID(1, normalIndices[j - 1]); + normalFace.SetNormalID(2, normalIndices[j]); + switchOrientation = true; + } ++faceIndex; } nextTristripStartIndex += faceVertexCount; @@ -602,14 +612,26 @@ for ( size_t k = 0, count = faceVertexCountArray.getCount(); k < count; ++k) { unsigned int faceVertexCount = faceVertexCountArray[k]; + bool switchOrientation = false; for ( size_t j = nextTristripStartIndex + 2, lastVertex = nextTristripStartIndex + faceVertexCount; j < lastVertex; ++j ) { MNNormalFace& normalFace = normalsSpecifier->Face((int) faceIndex); normalFace.SetDegree(3); normalFace.SpecifyAll(); - normalFace.SetNormalID(0, normalIndices[j - 2]); - normalFace.SetNormalID(1, normalIndices[j - 1]); - normalFace.SetNormalID(2, normalIndices[j]); + if ( switchOrientation ) + { + normalFace.SetNormalID(0, normalIndices[j - 1]); + normalFace.SetNormalID(1, normalIndices[j - 2]); + normalFace.SetNormalID(2, normalIndices[j]); + switchOrientation = false; + } + else + { + normalFace.SetNormalID(0, normalIndices[j - 2]); + normalFace.SetNormalID(1, normalIndices[j - 1]); + normalFace.SetNormalID(2, normalIndices[j]); + switchOrientation = true; + } ++faceIndex; } nextTristripStartIndex += faceVertexCount; Modified: branches/nextgen/COLLADAMax/src/COLLADAMaxMaterialCreator.cpp =================================================================== --- branches/nextgen/COLLADAMax/src/COLLADAMaxMaterialCreator.cpp 2009-02-10 12:32:05 UTC (rev 349) +++ branches/nextgen/COLLADAMax/src/COLLADAMaxMaterialCreator.cpp 2009-02-10 14:34:30 UTC (rev 350) @@ -101,7 +101,7 @@ const COLLADAFW::InstanceGeometry::MaterialBinding& materialBinding = materialBindings[0]; const COLLADAFW::Effect* effect = getEffect(materialBinding); if ( !effect ) - return false; + return true; Mtl* newMaterial = getMaxMaterial(*effect); maxNode->SetMtl( newMaterial ); return true; @@ -117,17 +117,12 @@ const COLLADAFW::InstanceGeometry::MaterialBinding& materialBinding = *it; const COLLADAFW::Effect* effect = getEffect(materialBinding); if ( !effect ) - return false; + continue; Mtl* newMaterial = getMaxMaterial(*effect); - //newMaterial->SetName("Material"); multiMaterial->SetSubMtl( materialBinding.getMaterialId(), newMaterial); } maxNode->SetMtl( multiMaterial ); return true; - - -// StandardMaterial*h; - return true; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rob...@us...> - 2009-02-10 13:07:21
|
Revision: 349 http://colladamaya.svn.sourceforge.net/colladamaya/?rev=349&view=rev Author: robertwuerfel Date: 2009-02-10 12:32:05 +0000 (Tue, 10 Feb 2009) Log Message: ----------- fix bug in instance node import and tristrips import Modified Paths: -------------- branches/nextgen/COLLADAMax/include/COLLADAMaxDocumentImporter.h branches/nextgen/COLLADAMax/include/COLLADAMaxImporterBase.h branches/nextgen/COLLADAMax/include/COLLADAMaxNodeImporter.h branches/nextgen/COLLADAMax/src/COLLADAMaxGeometryImporter.cpp branches/nextgen/COLLADAMax/src/COLLADAMaxImporterBase.cpp branches/nextgen/COLLADAMax/src/COLLADAMaxMaterialCreator.cpp branches/nextgen/COLLADAMax/src/COLLADAMaxNodeImporter.cpp Modified: branches/nextgen/COLLADAMax/include/COLLADAMaxDocumentImporter.h =================================================================== --- branches/nextgen/COLLADAMax/include/COLLADAMaxDocumentImporter.h 2009-02-10 09:14:41 UTC (rev 348) +++ branches/nextgen/COLLADAMax/include/COLLADAMaxDocumentImporter.h 2009-02-10 12:32:05 UTC (rev 349) @@ -93,7 +93,10 @@ /** Maps the unique id of a geometry to the material id mapping.*/ typedef std::map<COLLADAFW::UniqueId, FWMaterialIdMaxMtlIdMap > GeometryMaterialIdMapMap; + /** List of inode inode pairs.*/ + typedef std::vector<std::pair<INode*, INode*>> INodeINodePairList; + private: /** Max interface.*/ Interface* mMaxInterface; @@ -150,6 +153,10 @@ /** Maps the unique id of a geometry to the material id mapping.*/ GeometryMaterialIdMapMap mGeometryMaterialIdMapMap; + /** List of pairs of cloned nodes and their originals. This is used to assign materials. When ever + an inode is cloned, the cloned one and itself should be added to that list.*/ + INodeINodePairList mClonedINodeOriginalINodePairList; + public: /** Constructor . @param maxInterface The max interface. @@ -249,6 +256,10 @@ /** Return the GeometryMaterialIdMapMap.*/ GeometryMaterialIdMapMap& getGeometryMaterialIdMapMap() { return mGeometryMaterialIdMapMap; } + /**Returns the list of pairs of cloned nodes and their originals. This is used to assign materials. + When ever an inode is cloned, the cloned one and itself should be added to that list.*/ + INodeINodePairList& getClonedINodeOriginalINodePairList() { return mClonedINodeOriginalINodePairList; } + friend class ImporterBase; }; Modified: branches/nextgen/COLLADAMax/include/COLLADAMaxImporterBase.h =================================================================== --- branches/nextgen/COLLADAMax/include/COLLADAMaxImporterBase.h 2009-02-10 09:14:41 UTC (rev 348) +++ branches/nextgen/COLLADAMax/include/COLLADAMaxImporterBase.h 2009-02-10 12:32:05 UTC (rev 349) @@ -127,6 +127,9 @@ /** Adds @a libraryNodes to the list of library nodes.*/ void addLibraryNodes( const COLLADAFW::LibraryNodes* libraryNodes ); + /** Adds the @pair clonedNode and @a originalNode to the list of cloned and original inodes.*/ + void addClonedINodeOriginalINodePair(INode* clonedNode, INode* originalNode); + /** Returns the object that was created from the imported object with UniqueId @a uniqueId. If @a uniqueId has not been added using addUniqueIdObjectPair, null is returned.*/ Object* getObjectByUniqueId( const COLLADAFW::UniqueId& uniqueId); @@ -158,6 +161,10 @@ one is created.*/ DocumentImporter::FWMaterialIdMaxMtlIdMap& getMaterialIdMapByGeometryUniqueId( const COLLADAFW::UniqueId& uniqueId); + /**Returns the list of pairs of cloned nodes and their originals. This is used to assign materials. + When ever an inode is cloned, the cloned one and itself should be added to that list.*/ + const DocumentImporter::INodeINodePairList& getClonedINodeOriginalINodePairList(); + private: /** Disable default copy ctor. */ Modified: branches/nextgen/COLLADAMax/include/COLLADAMaxNodeImporter.h =================================================================== --- branches/nextgen/COLLADAMax/include/COLLADAMaxNodeImporter.h 2009-02-10 09:14:41 UTC (rev 348) +++ branches/nextgen/COLLADAMax/include/COLLADAMaxNodeImporter.h 2009-02-10 12:32:05 UTC (rev 349) @@ -70,7 +70,7 @@ /** Recursively clones @a nodeToClone and attaches the cloned graph to @a parentImportNode. The cloned nodes with reference the same object and transformation controller.*/ - bool recursivlyCloneINode( ImpNode* parentImportNode, INode* nodeToClone ); + bool recursivelyCloneINode( ImpNode* parentImportNode, INode* nodeToClone ); /** Store the information about material bindings of @a instanceGeometry attached to max node @a node*/ void storeMaterialBindings( INode* node, COLLADAFW::InstanceGeometry* instanceGeometry); Modified: branches/nextgen/COLLADAMax/src/COLLADAMaxGeometryImporter.cpp =================================================================== --- branches/nextgen/COLLADAMax/src/COLLADAMaxGeometryImporter.cpp 2009-02-10 09:14:41 UTC (rev 348) +++ branches/nextgen/COLLADAMax/src/COLLADAMaxGeometryImporter.cpp 2009-02-10 12:32:05 UTC (rev 349) @@ -170,13 +170,23 @@ for ( size_t k = 0, count = faceVertexCountArray.getCount(); k < count; ++k) { unsigned int faceVertexCount = faceVertexCountArray[k]; + bool switchOrientation = false; for ( size_t j = nextTristripStartIndex + 2, lastVertex = nextTristripStartIndex + faceVertexCount; j < lastVertex; ++j ) { Face& face = triangleMesh.faces[faceIndex]; // face.setMatID(fWMaterialIdMaxMtlIdMap[meshPrimitive->getMaterialId()]); if ( maxMaterialId != 0 ) face.setMatID(maxMaterialId); - face.setVerts(positionIndices[j - 2], positionIndices[j - 1], positionIndices[j]); + if ( switchOrientation ) + { + face.setVerts(positionIndices[j - 1], positionIndices[j - 2], positionIndices[j]); + switchOrientation = false; + } + else + { + face.setVerts(positionIndices[j - 2], positionIndices[j - 1], positionIndices[j]); + switchOrientation = true; + } ++faceIndex; } nextTristripStartIndex += faceVertexCount; @@ -440,10 +450,24 @@ for ( size_t k = 0, count = faceVertexCountArray.getCount(); k < count; ++k) { unsigned int faceVertexCount = faceVertexCountArray[k]; + bool switchOrientation = false; for ( size_t j = nextTristripStartIndex + 2, lastVertex = nextTristripStartIndex + faceVertexCount; j < lastVertex; ++j ) { MNFace* face = polgonMesh.F((int)faceIndex); - face->MakePoly(3, (int*) (&positionIndices[j - 2])); + if ( switchOrientation ) + { + int indices[3]; + indices[0] = (int)positionIndices[j - 1]; + indices[1] = (int)positionIndices[j - 2]; + indices[2] = (int)positionIndices[j ]; + face->MakePoly(3, indices); + switchOrientation = false; + } + else + { + face->MakePoly(3, (int*) (&positionIndices[j - 2])); + switchOrientation = true; + } ++faceIndex; } Modified: branches/nextgen/COLLADAMax/src/COLLADAMaxImporterBase.cpp =================================================================== --- branches/nextgen/COLLADAMax/src/COLLADAMaxImporterBase.cpp 2009-02-10 09:14:41 UTC (rev 348) +++ branches/nextgen/COLLADAMax/src/COLLADAMaxImporterBase.cpp 2009-02-10 12:32:05 UTC (rev 349) @@ -161,6 +161,13 @@ } //------------------------------ + void ImporterBase::addClonedINodeOriginalINodePair( INode* clonedNode, INode* originalNode ) + { + DocumentImporter::INodeINodePairList& inodeInodePairList = mDocumentImporter->getClonedINodeOriginalINodePairList(); + inodeInodePairList.push_back(std::pair<INode*, INode*>(clonedNode, originalNode)); + } + + //------------------------------ Object* ImporterBase::getObjectByUniqueId( const COLLADAFW::UniqueId& uniqueId ) { const DocumentImporter::UniqueIdObjectMap& uniqueIdObjectMap = mDocumentImporter->getUniqueIdObjectMap(); @@ -238,4 +245,9 @@ { return mDocumentImporter->getGeometryMaterialIdMapMap()[uniqueId]; } + + const DocumentImporter::INodeINodePairList& ImporterBase::getClonedINodeOriginalINodePairList() + { + return mDocumentImporter->getClonedINodeOriginalINodePairList(); + } } // namespace COLLADAMax Modified: branches/nextgen/COLLADAMax/src/COLLADAMaxMaterialCreator.cpp =================================================================== --- branches/nextgen/COLLADAMax/src/COLLADAMaxMaterialCreator.cpp 2009-02-10 09:14:41 UTC (rev 348) +++ branches/nextgen/COLLADAMax/src/COLLADAMaxMaterialCreator.cpp 2009-02-10 12:32:05 UTC (rev 349) @@ -63,6 +63,16 @@ if ( !createAndAssingMaxMaterial(materialBinding) ) return false; } + + // assign materials to cloned nodes + const DocumentImporter::INodeINodePairList& clonedInodeOriginalInodeList = getClonedINodeOriginalINodePairList(); + DocumentImporter::INodeINodePairList::const_iterator itClone = clonedInodeOriginalInodeList.begin(); + for ( ; itClone != clonedInodeOriginalInodeList.end(); ++itClone) + { + itClone->first->SetMtl(itClone->second->GetMtl()); + } + + return true; } Modified: branches/nextgen/COLLADAMax/src/COLLADAMaxNodeImporter.cpp =================================================================== --- branches/nextgen/COLLADAMax/src/COLLADAMaxNodeImporter.cpp 2009-02-10 09:14:41 UTC (rev 348) +++ branches/nextgen/COLLADAMax/src/COLLADAMaxNodeImporter.cpp 2009-02-10 12:32:05 UTC (rev 349) @@ -113,7 +113,7 @@ while ( referencingImpNode = getReferencingImpNodesByUniqueId(nodeUniqueId) ) { removeUniqueIdReferencingImpNodePair( nodeUniqueId, referencingImpNode); - recursivlyCloneINode( referencingImpNode, newImportNode->GetINode() ); + recursivelyCloneINode( referencingImpNode, newImportNode->GetINode() ); } return newImportNode; @@ -216,7 +216,7 @@ // check if the referenced node is already in the max scene graph if ( instanciatedINode ) { - if ( !recursivlyCloneINode(parentImportNode, instanciatedINode) ) + if ( !recursivelyCloneINode(parentImportNode, instanciatedINode) ) return false;; } else @@ -240,7 +240,7 @@ } //------------------------------ - bool NodeImporter::recursivlyCloneINode( ImpNode* parentImportNode, INode* nodeToClone ) + bool NodeImporter::recursivelyCloneINode( ImpNode* parentImportNode, INode* nodeToClone ) { ImpNode* newImportNode = getMaxImportInterface()->CreateNode(); getMaxImportInterface()->AddNodeToScene(newImportNode); @@ -251,7 +251,7 @@ newImportNode->Reference(object); newNode->SetTMController(nodeToClone->GetTMController()); newImportNode->SetName(nodeToClone->GetName()); - newNode->SetMtl(nodeToClone->GetMtl()); + addClonedINodeOriginalINodePair(newNode, nodeToClone); INode* parentNode = parentImportNode->GetINode(); parentNode->AttachChild(newNode, TRUE); @@ -259,11 +259,14 @@ /* If the node to clone references an object, the cloned one must references the same object.*/ COLLADAFW::UniqueId id = getUniqueIdByObjectINode(nodeToClone); if ( id.isValid() ) + { addUniqueIdObjectINodePair(id, newNode); + addObjectINodeUniqueIdPair(newNode, id); + } // Clone the children for ( int i = 0, count = nodeToClone->NumberOfChildren(); i < count; ++i) - recursivlyCloneINode(newImportNode, nodeToClone->GetChildNode(i)); + recursivelyCloneINode(newImportNode, nodeToClone->GetChildNode(i)); return true; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rob...@us...> - 2009-02-10 09:14:49
|
Revision: 348 http://colladamaya.svn.sourceforge.net/colladamaya/?rev=348&view=rev Author: robertwuerfel Date: 2009-02-10 09:14:41 +0000 (Tue, 10 Feb 2009) Log Message: ----------- basic material import for max ( only colors) still incomplete Modified Paths: -------------- branches/nextgen/COLLADAFramework/include/COLLADAFWArray.h branches/nextgen/COLLADAFramework/include/COLLADAFWColorOrTexture.h branches/nextgen/COLLADAFramework/include/COLLADAFWInstanceGeometry.h branches/nextgen/COLLADAMax/include/COLLADAMaxDocumentImporter.h branches/nextgen/COLLADAMax/include/COLLADAMaxGeometryImporter.h branches/nextgen/COLLADAMax/include/COLLADAMaxImporterBase.h branches/nextgen/COLLADAMax/include/COLLADAMaxNodeImporter.h branches/nextgen/COLLADAMax/scripts/COLLADAMax.vcproj branches/nextgen/COLLADAMax/src/COLLADAMaxDocumentImporter.cpp branches/nextgen/COLLADAMax/src/COLLADAMaxGeometryImporter.cpp branches/nextgen/COLLADAMax/src/COLLADAMaxImporterBase.cpp branches/nextgen/COLLADAMax/src/COLLADAMaxNodeImporter.cpp branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLLibraryEffectsLoader.cpp branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLNodeLoader.cpp Added Paths: ----------- branches/nextgen/COLLADAMax/include/COLLADAMaxEffectImporter.h branches/nextgen/COLLADAMax/include/COLLADAMaxMaterialCreator.h branches/nextgen/COLLADAMax/src/COLLADAMaxEffectImporter.cpp branches/nextgen/COLLADAMax/src/COLLADAMaxMaterialCreator.cpp Modified: branches/nextgen/COLLADAFramework/include/COLLADAFWArray.h =================================================================== --- branches/nextgen/COLLADAFramework/include/COLLADAFWArray.h 2009-02-06 16:36:45 UTC (rev 347) +++ branches/nextgen/COLLADAFramework/include/COLLADAFWArray.h 2009-02-10 09:14:41 UTC (rev 348) @@ -153,6 +153,9 @@ setData ( 0, 0, 0 ); } + /** Returns true if the array is empty, false otherwise.*/ + bool empty() { return mCount == 0; } + /** Return s the index'th element in the array. No check is performed, if the index is out of bounds.*/ Type& operator[] ( size_t index ) { return mData[index]; } Modified: branches/nextgen/COLLADAFramework/include/COLLADAFWColorOrTexture.h =================================================================== --- branches/nextgen/COLLADAFramework/include/COLLADAFWColorOrTexture.h 2009-02-06 16:36:45 UTC (rev 347) +++ branches/nextgen/COLLADAFramework/include/COLLADAFWColorOrTexture.h 2009-02-10 09:14:41 UTC (rev 348) @@ -25,7 +25,7 @@ class ColorOrTexture { - private: + public: enum Type { @@ -33,8 +33,10 @@ COLOR, TEXTURE }; + + private: Type mType; - Color mColor; + Color mColor; //Texture mTexture; String mSid; @@ -69,6 +71,12 @@ mSid = cot.mSid; } + /** Returns the type of the color or texture.*/ + Type getType() const { return mType; } + + /** Returns the type of the color or texture.*/ + void setType(Type type) { mType = type; } + /** Returns the sid. */ const String& getSid () const { Modified: branches/nextgen/COLLADAFramework/include/COLLADAFWInstanceGeometry.h =================================================================== --- branches/nextgen/COLLADAFramework/include/COLLADAFWInstanceGeometry.h 2009-02-06 16:36:45 UTC (rev 347) +++ branches/nextgen/COLLADAFramework/include/COLLADAFWInstanceGeometry.h 2009-02-10 09:14:41 UTC (rev 348) @@ -57,13 +57,13 @@ }; - typedef Array<MaterialBinding> MaterialBindings; + typedef Array<MaterialBinding> MaterialBindingArray; private: /** The list of all material bindings of this instance geometry. The Material bindings must be order according to MaterialBinding::operator<.*/ - MaterialBindings mMaterialBindings; + MaterialBindingArray mMaterialBindings; public: /** Constructor. Creates an instance geometry, that does not instantiate a geometry.*/ @@ -80,10 +80,10 @@ InstanceGeometry* clone() const { return new InstanceGeometry(*this); } /** Returns the list of all material bindings.*/ - MaterialBindings& getMaterialBindings() { return mMaterialBindings; } + MaterialBindingArray& getMaterialBindings() { return mMaterialBindings; } /** Returns the list of all material bindings.*/ - const MaterialBindings& getMaterialBindings() const { return mMaterialBindings; } + const MaterialBindingArray& getMaterialBindings() const { return mMaterialBindings; } private: /** Disable default copy ctor. */ Modified: branches/nextgen/COLLADAMax/include/COLLADAMaxDocumentImporter.h =================================================================== --- branches/nextgen/COLLADAMax/include/COLLADAMaxDocumentImporter.h 2009-02-06 16:36:45 UTC (rev 347) +++ branches/nextgen/COLLADAMax/include/COLLADAMaxDocumentImporter.h 2009-02-10 09:14:41 UTC (rev 348) @@ -23,6 +23,7 @@ #include "COLLADAFWIWriter.h" #include "COLLADAFWMaterial.h" #include "COLLADAFWEffect.h" +#include "COLLADAFWInstanceGeometry.h" #include <list> //#include "dummy.h" @@ -73,6 +74,26 @@ /** Maps unique ids of framework effects to the corresponding framework material.*/ typedef std::map<COLLADAFW::UniqueId, COLLADAFW::Effect> UniqueIdFWEffectMap; + /** Vector of material bindings.*/ + typedef std::vector<COLLADAFW::InstanceGeometry::MaterialBinding> MaterialBindingVector; + + /** Pair of nodes an the instantiated materials.*/ + struct NodeMaterialBindingsPair + { + INode* maxNode; + MaterialBindingVector materialBindings; + }; + + /** List of all max nodes that reference a material and their material bindings.*/ + typedef std::list<NodeMaterialBindingsPair> NodeMaterialBindingsList; + + /** Maps frame work material ids to max material ids.*/ + typedef std::map<COLLADAFW::MaterialId, MtlID > FWMaterialIdMaxMtlIdMap; + + /** Maps the unique id of a geometry to the material id mapping.*/ + typedef std::map<COLLADAFW::UniqueId, FWMaterialIdMaxMtlIdMap > GeometryMaterialIdMapMap; + + private: /** Max interface.*/ Interface* mMaxInterface; @@ -123,6 +144,12 @@ /** Maps unique ids of framework effects to the corresponding framework material.*/ UniqueIdFWEffectMap mUniqueIdFWEffectMap; + /** of all max nodes that reference a material and their material bindings.*/ + NodeMaterialBindingsList mNodeMaterialBindingsList; + + /** Maps the unique id of a geometry to the material id mapping.*/ + GeometryMaterialIdMapMap mGeometryMaterialIdMapMap; + public: /** Constructor . @param maxInterface The max interface. @@ -183,6 +210,9 @@ /** Disable default assignment operator. */ const DocumentImporter& operator= ( const DocumentImporter& pre ); + /** Creates all the materials that are instantiated/referenced in the scene.*/ + bool createAndAssignMaterials(); + /** Returns the dummy object used for nodes that do not have an object assigned to.*/ DummyObject* getDummyObject(){ return mDummyObject; } @@ -213,7 +243,12 @@ /** Returns the UniqueIdFWEffectMap.*/ UniqueIdFWEffectMap& getUniqueIdFWEffectMap() { return mUniqueIdFWEffectMap; } + /** Returns the NodeMaterialBindingsList.*/ + NodeMaterialBindingsList& getNodeMaterialBindingsList() { return mNodeMaterialBindingsList; } + /** Return the GeometryMaterialIdMapMap.*/ + GeometryMaterialIdMapMap& getGeometryMaterialIdMapMap() { return mGeometryMaterialIdMapMap; } + friend class ImporterBase; }; Added: branches/nextgen/COLLADAMax/include/COLLADAMaxEffectImporter.h =================================================================== --- branches/nextgen/COLLADAMax/include/COLLADAMaxEffectImporter.h (rev 0) +++ branches/nextgen/COLLADAMax/include/COLLADAMaxEffectImporter.h 2009-02-10 09:14:41 UTC (rev 348) @@ -0,0 +1,65 @@ +/* +Copyright (c) 2008 NetAllied Systems GmbH + +This file is part of COLLADAMax. + +Portions of the code are: +Copyright (c) 2005-2007 Feeling Software Inc. +Copyright (c) 2005-2007 Sony Computer Entertainment America + +Based on the 3dsMax COLLADASW Tools: +Copyright (c) 2005-2006 Autodesk Media Entertainment + +Licensed under the MIT Open Source License, +for details please see LICENSE file or the website +http://www.opensource.org/licenses/mit-license.php +*/ + +#ifndef __COLLADAMAX_EFFECTIMPORTER_H__ +#define __COLLADAMAX_EFFECTIMPORTER_H__ + +#include "COLLADAMaxPrerequisites.h" +#include "COLLADAMaxImporterBase.h" + + +namespace COLLADAFW +{ + class Effect; +}; + + +namespace COLLADAMax +{ + + /** Imports one effect */ + class EffectImporter : public ImporterBase + { + private: + /** The effect to import.*/ + const COLLADAFW::Effect* mEffect; + + public: + + /** Constructor. */ + EffectImporter(DocumentImporter* documentImporter, const COLLADAFW::Effect* effect); + + /** Destructor. */ + virtual ~EffectImporter(); + + /** Performs the import of the effect. + @return True on success, false otherwise.*/ + bool import(); + + private: + + /** Disable default copy ctor. */ + EffectImporter( const EffectImporter& pre ); + + /** Disable default assignment operator. */ + const EffectImporter& operator= ( const EffectImporter& pre ); + + }; + +} // namespace COLLADAMAX + +#endif // __COLLADAMAX_EFFECTIMPORTER_H__ Modified: branches/nextgen/COLLADAMax/include/COLLADAMaxGeometryImporter.h =================================================================== --- branches/nextgen/COLLADAMax/include/COLLADAMaxGeometryImporter.h 2009-02-06 16:36:45 UTC (rev 347) +++ branches/nextgen/COLLADAMax/include/COLLADAMaxGeometryImporter.h 2009-02-10 09:14:41 UTC (rev 348) @@ -20,6 +20,7 @@ #include "COLLADAMaxPrerequisites.h" #include "COLLADAMaxImporterBase.h" +#include "COLLADAFWMeshPrimitive.h" namespace COLLADAFW { @@ -37,6 +38,8 @@ class GeometryImporter : public ImporterBase { private: + + private: /** The geometry that should be imported.*/ const COLLADAFW::Geometry* mGeometry; @@ -100,6 +103,10 @@ that need to reference it.*/ bool handleReferences(COLLADAFW::Geometry* geometry, Object* object); + /** Fills the map with pair of frame work material ids of the used by primitives in @a primitiveArray + and material ids used in Max. The max material ids start with 1 and are increased for each new + framework material id.*/ + void createFWMaterialIdMaxMtlIdMap( const COLLADAFW::MeshPrimitiveArray& primitiveArray, DocumentImporter::FWMaterialIdMaxMtlIdMap& materialMap); private: /** Disable default copy ctor. */ Modified: branches/nextgen/COLLADAMax/include/COLLADAMaxImporterBase.h =================================================================== --- branches/nextgen/COLLADAMax/include/COLLADAMaxImporterBase.h 2009-02-06 16:36:45 UTC (rev 347) +++ branches/nextgen/COLLADAMax/include/COLLADAMaxImporterBase.h 2009-02-10 09:14:41 UTC (rev 348) @@ -21,6 +21,8 @@ #include "COLLADAMaxPrerequisites.h" #include "COLLADAMaxTypes.h" +#include "COLLADAMaxDocumentImporter.h" + class Interface; class ImpInterface; class INode; @@ -117,6 +119,11 @@ For every received effect that is in a library effect this method should be called. */ void addUniqueIdFWEffectPair( const COLLADAFW::UniqueId& uniqueId, const COLLADAFW::Effect& effect ); + /** Creates a new NodeMaterialBindingsPair with maxNode set to @a node and an empty material bindings + vector and adds it to the NodeMaterialBindingsList. + For every max node that references a geometry with set material this method should be called. */ + DocumentImporter::NodeMaterialBindingsPair& createAndAddNodeMaterialBindingsPair( INode* node ); + /** Adds @a libraryNodes to the list of library nodes.*/ void addLibraryNodes( const COLLADAFW::LibraryNodes* libraryNodes ); @@ -144,7 +151,13 @@ received effect, null otherwise.*/ const COLLADAFW::Effect* getFWEffectByUniqueId( const COLLADAFW::UniqueId& uniqueId ); + /** Returns the list of all nodes that have a material and their material bindings.*/ + const DocumentImporter::NodeMaterialBindingsList& getNodeMaterialBindings(); + /** Returns the material id of geometry with @a uniqueId. If it is not already in the map, a new + one is created.*/ + DocumentImporter::FWMaterialIdMaxMtlIdMap& getMaterialIdMapByGeometryUniqueId( const COLLADAFW::UniqueId& uniqueId); + private: /** Disable default copy ctor. */ Added: branches/nextgen/COLLADAMax/include/COLLADAMaxMaterialCreator.h =================================================================== --- branches/nextgen/COLLADAMax/include/COLLADAMaxMaterialCreator.h (rev 0) +++ branches/nextgen/COLLADAMax/include/COLLADAMaxMaterialCreator.h 2009-02-10 09:14:41 UTC (rev 348) @@ -0,0 +1,82 @@ +/* +Copyright (c) 2008 NetAllied Systems GmbH + +This file is part of COLLADAMax. + +Portions of the code are: +Copyright (c) 2005-2007 Feeling Software Inc. +Copyright (c) 2005-2007 Sony Computer Entertainment America + +Based on the 3dsMax COLLADASW Tools: +Copyright (c) 2005-2006 Autodesk Media Entertainment + +Licensed under the MIT Open Source License, +for details please see LICENSE file or the website +http://www.opensource.org/licenses/mit-license.php +*/ + +#ifndef __COLLADAMAX_MATERIALCREATOR_H__ +#define __COLLADAMAX_MATERIALCREATOR_H__ + +#include "COLLADAMaxPrerequisites.h" +#include "COLLADAMaxImporterBase.h" + + +namespace COLLADAMax +{ + + /** TODO Documentation */ + class MaterialCreator : public ImporterBase + { + public: + /** Maps framework effects to max materials.*/ + typedef std::map<COLLADAFW::UniqueId, Mtl*> UniqueIdMaxMaterialMap; + private: + + /** Maps all the framework effects already created a max material for, to the max + material.*/ + UniqueIdMaxMaterialMap mUniqueIdMaxMaterialMap; + + public: + + /** Constructor. */ + MaterialCreator( DocumentImporter* documentImporter ); + + /** Destructor. */ + virtual ~MaterialCreator(); + + /** Performs the creation of all material. + @return True on success, false otherwise.*/ + bool create(); + + /** Creates all the material referenced in @a materialBinding, if not already created and + assigns them to the node in @a materialBinding.*/ + bool createAndAssingMaxMaterial( const DocumentImporter::NodeMaterialBindingsPair& materialBinding ); + + /** Creates a standard material from @a effectCommon.*/ + StdMat2* createStandardMaterial( const COLLADAFW::EffectCommon& effectCommon, const String& name); + + /** Creates a material from @a effect.*/ + Mtl* createMaxMaterial( const COLLADAFW::Effect& effect); + + /** Returns the material created for @a effect. If for the same effect a max material has already been + created for, the formally created one is returned, otherwise a new one is created.*/ + Mtl* getMaxMaterial( const COLLADAFW::Effect& effect); + + /** Returns the effect used by @a materialBinding. It resolves first the material and than the effect. + If the effect could not be resolved, null is returned.*/ + const COLLADAFW::Effect* getEffect( const COLLADAFW::InstanceGeometry::MaterialBinding& materialBinding ); + + private: + + /** Disable default copy ctor. */ + MaterialCreator( const MaterialCreator& pre ); + + /** Disable default assignment operator. */ + const MaterialCreator& operator= ( const MaterialCreator& pre ); + + }; + +} // namespace COLLADAMAX + +#endif // __COLLADAMAX_MATERIALCREATOR_H__ Modified: branches/nextgen/COLLADAMax/include/COLLADAMaxNodeImporter.h =================================================================== --- branches/nextgen/COLLADAMax/include/COLLADAMaxNodeImporter.h 2009-02-06 16:36:45 UTC (rev 347) +++ branches/nextgen/COLLADAMax/include/COLLADAMaxNodeImporter.h 2009-02-10 09:14:41 UTC (rev 348) @@ -72,6 +72,9 @@ nodes with reference the same object and transformation controller.*/ bool recursivlyCloneINode( ImpNode* parentImportNode, INode* nodeToClone ); + /** Store the information about material bindings of @a instanceGeometry attached to max node @a node*/ + void storeMaterialBindings( INode* node, COLLADAFW::InstanceGeometry* instanceGeometry); + private: /** Disable default copy ctor. */ Modified: branches/nextgen/COLLADAMax/scripts/COLLADAMax.vcproj =================================================================== --- branches/nextgen/COLLADAMax/scripts/COLLADAMax.vcproj 2009-02-06 16:36:45 UTC (rev 347) +++ branches/nextgen/COLLADAMax/scripts/COLLADAMax.vcproj 2009-02-10 09:14:41 UTC (rev 348) @@ -2051,6 +2051,10 @@ > </File> <File + RelativePath="..\src\COLLADAMaxEffectImporter.cpp" + > + </File> + <File RelativePath="..\src\COLLADAMaxFWLErrorHandler.cpp" > </File> @@ -2067,6 +2071,10 @@ > </File> <File + RelativePath="..\src\COLLADAMaxMaterialCreator.cpp" + > + </File> + <File RelativePath="..\src\COLLADAMaxMaterialImporter.cpp" > </File> @@ -2090,6 +2098,10 @@ > </File> <File + RelativePath="..\include\COLLADAMaxMultiMtl.h" + > + </File> + <File RelativePath="..\include\COLLADAMaxPrerequisites.h" > </File> @@ -2177,10 +2189,6 @@ > </File> <File - RelativePath="..\include\COLLADAMaxMultiMtl.h" - > - </File> - <File RelativePath="..\include\COLLADAMaxOptions.h" > </File> @@ -2225,6 +2233,10 @@ > </File> <File + RelativePath="..\include\COLLADAMaxEffectImporter.h" + > + </File> + <File RelativePath="..\include\COLLADAMaxFWLErrorHandler.h" > </File> @@ -2241,6 +2253,10 @@ > </File> <File + RelativePath="..\include\COLLADAMaxMaterialCreator.h" + > + </File> + <File RelativePath="..\include\COLLADAMaxMaterialImporter.h" > </File> Modified: branches/nextgen/COLLADAMax/src/COLLADAMaxDocumentImporter.cpp =================================================================== --- branches/nextgen/COLLADAMax/src/COLLADAMaxDocumentImporter.cpp 2009-02-06 16:36:45 UTC (rev 347) +++ branches/nextgen/COLLADAMax/src/COLLADAMaxDocumentImporter.cpp 2009-02-10 09:14:41 UTC (rev 348) @@ -21,6 +21,8 @@ #include "COLLADAMaxLibraryNodesImporter.h" #include "COLLADAMaxGeometryImporter.h" #include "COLLADAMaxMaterialImporter.h" +#include "COLLADAMaxMaterialCreator.h" +#include "COLLADAMaxEffectImporter.h" #include "COLLADAMaxFWLErrorHandler.h" #include "COLLADAFWLibraryNodes.h" @@ -58,10 +60,20 @@ COLLADAFW::Root root(&loader, this); // return root.loadDocument("dsfsdf.dae"); - return root.loadDocument(mImportFilePath); + if ( !root.loadDocument(mImportFilePath) ) + return false; + + return createAndAssignMaterials(); } //--------------------------------------------------------------- + bool DocumentImporter::createAndAssignMaterials() + { + MaterialCreator materialCreator(this); + return materialCreator.create(); + } + + //--------------------------------------------------------------- bool DocumentImporter::writeVisualScene( const COLLADAFW::VisualScene* visualScene ) { VisualSceneImporter visualSceneImporter(this, visualScene); @@ -92,6 +104,8 @@ //--------------------------------------------------------------- bool DocumentImporter::writeEffect( const COLLADAFW::Effect* effect ) { - return true; + EffectImporter effectImporter(this, effect); + return effectImporter.import(); } + } // namespace COLLADAMax Added: branches/nextgen/COLLADAMax/src/COLLADAMaxEffectImporter.cpp =================================================================== --- branches/nextgen/COLLADAMax/src/COLLADAMaxEffectImporter.cpp (rev 0) +++ branches/nextgen/COLLADAMax/src/COLLADAMaxEffectImporter.cpp 2009-02-10 09:14:41 UTC (rev 348) @@ -0,0 +1,50 @@ +/* +Copyright (c) 2008 NetAllied Systems GmbH + +This file is part of COLLADAMax. + +Portions of the code are: +Copyright (c) 2005-2007 Feeling Software Inc. +Copyright (c) 2005-2007 Sony Computer Entertainment America + +Based on the 3dsMax COLLADASW Tools: +Copyright (c) 2005-2006 Autodesk Media Entertainment + +Licensed under the MIT Open Source License, +for details please see LICENSE file or the website +http://www.opensource.org/licenses/mit-license.php +*/ + +#include "COLLADAMaxStableHeaders.h" +#include "COLLADAMaxEffectImporter.h" + +#include "COLLADAFWEffect.h" + + +namespace COLLADAMax +{ + + //------------------------------ + EffectImporter::EffectImporter( DocumentImporter* documentImporter, const COLLADAFW::Effect* effect ) + : ImporterBase(documentImporter) + , mEffect(effect) + { + } + + + //------------------------------ + EffectImporter::~EffectImporter() + { + } + + bool EffectImporter::import() + { + const COLLADAFW::UniqueId& effectUniqueId = mEffect->getUniqueId(); + if ( effectUniqueId.isValid() ) + addUniqueIdFWEffectPair(effectUniqueId, *mEffect); + return true; + } + + + +} // namespace COLLADAMax Modified: branches/nextgen/COLLADAMax/src/COLLADAMaxGeometryImporter.cpp =================================================================== --- branches/nextgen/COLLADAMax/src/COLLADAMaxGeometryImporter.cpp 2009-02-06 16:36:45 UTC (rev 347) +++ branches/nextgen/COLLADAMax/src/COLLADAMaxGeometryImporter.cpp 2009-02-10 09:14:41 UTC (rev 348) @@ -134,11 +134,15 @@ triangleMesh.setNumFaces((int)mTotalTrianglesCount); COLLADAFW::MeshPrimitiveArray& meshPrimitiveArray = mesh->getMeshPrimitives(); size_t faceIndex = 0; + DocumentImporter::FWMaterialIdMaxMtlIdMap& fWMaterialIdMaxMtlIdMap = getMaterialIdMapByGeometryUniqueId(mGeometry->getUniqueId()); + createFWMaterialIdMaxMtlIdMap( meshPrimitiveArray, fWMaterialIdMaxMtlIdMap); for ( size_t i = 0, count = meshPrimitiveArray.getCount(); i < count; ++i) { const COLLADAFW::MeshPrimitive* meshPrimitive = meshPrimitiveArray[i]; if ( ! meshPrimitive ) continue; + // We use the frame work material id as max material id + MtlID maxMaterialId = meshPrimitive->getMaterialId(); switch (meshPrimitive->getPrimitiveType()) { case COLLADAFW::MeshPrimitive::TRIANGLES: @@ -148,6 +152,9 @@ for ( size_t j = 0, count = positionIndices.getCount() ; j < count; j+=3 ) { Face& face = triangleMesh.faces[faceIndex]; +// face.setMatID(fWMaterialIdMaxMtlIdMap[meshPrimitive->getMaterialId()]); + if ( maxMaterialId != 0 ) + face.setMatID(maxMaterialId); face.setEdgeVisFlags(1, 1, 1); face.setVerts(positionIndices[j], positionIndices[j + 1], positionIndices[j + 2]); ++faceIndex; @@ -166,7 +173,9 @@ for ( size_t j = nextTristripStartIndex + 2, lastVertex = nextTristripStartIndex + faceVertexCount; j < lastVertex; ++j ) { Face& face = triangleMesh.faces[faceIndex]; - face.setEdgeVisFlags(1, 1, 1); +// face.setMatID(fWMaterialIdMaxMtlIdMap[meshPrimitive->getMaterialId()]); + if ( maxMaterialId != 0 ) + face.setMatID(maxMaterialId); face.setVerts(positionIndices[j - 2], positionIndices[j - 1], positionIndices[j]); ++faceIndex; } @@ -187,6 +196,11 @@ for ( size_t j = nextTrifanStartIndex + 2, lastVertex = nextTrifanStartIndex + faceVertexCount; j < lastVertex; ++j ) { Face& face = triangleMesh.faces[faceIndex]; + MtlID gg1 =fWMaterialIdMaxMtlIdMap[meshPrimitive->getMaterialId()]; +// face.setMatID(fWMaterialIdMaxMtlIdMap[meshPrimitive->getMaterialId()]); + if ( maxMaterialId != 0 ) + face.setMatID(maxMaterialId); + MtlID gg = face.getMatID(); face.setEdgeVisFlags(1, 1, 1); face.setVerts(commonVertexIndex, positionIndices[j - 1], positionIndices[j]); ++faceIndex; @@ -662,4 +676,19 @@ return true; } + //------------------------------ + void GeometryImporter::createFWMaterialIdMaxMtlIdMap( const COLLADAFW::MeshPrimitiveArray& primitiveArray, DocumentImporter::FWMaterialIdMaxMtlIdMap& materialMap ) + { + MtlID nextMaxMaterialId = 1; + for ( size_t i = 0, count = primitiveArray.getCount(); i < count; ++i ) + { + const COLLADAFW::MeshPrimitive* primitive = primitiveArray[i]; + COLLADAFW::MaterialId fWMaterialId = primitive->getMaterialId(); + if ( materialMap.count(fWMaterialId) == 0 ) + { + materialMap[fWMaterialId] = nextMaxMaterialId++; + } + } + } + } // namespace COLLADAMax Modified: branches/nextgen/COLLADAMax/src/COLLADAMaxImporterBase.cpp =================================================================== --- branches/nextgen/COLLADAMax/src/COLLADAMaxImporterBase.cpp 2009-02-06 16:36:45 UTC (rev 347) +++ branches/nextgen/COLLADAMax/src/COLLADAMaxImporterBase.cpp 2009-02-10 09:14:41 UTC (rev 348) @@ -17,7 +17,6 @@ #include "COLLADAMaxStableHeaders.h" #include "COLLADAMaxImporterBase.h" -#include "COLLADAMaxDocumentImporter.h" #include "COLLADAFWUniqueId.h" @@ -145,6 +144,15 @@ mDocumentImporter->getUniqueIdFWEffectMap().insert(std::pair<COLLADAFW::UniqueId, COLLADAFW::Effect>(uniqueId, effect));; } + //------------------------------ + DocumentImporter::NodeMaterialBindingsPair& ImporterBase::createAndAddNodeMaterialBindingsPair( INode* node ) + { + DocumentImporter::NodeMaterialBindingsPair newPair; + newPair.maxNode = node; + DocumentImporter::NodeMaterialBindingsList& list = mDocumentImporter->getNodeMaterialBindingsList(); + list.push_back(newPair); + return *list.rbegin(); + } //------------------------------ void ImporterBase::addLibraryNodes( const COLLADAFW::LibraryNodes* libraryNodes ) @@ -219,4 +227,15 @@ return &it->second; } + //------------------------------ + const DocumentImporter::NodeMaterialBindingsList& ImporterBase::getNodeMaterialBindings() + { + return mDocumentImporter->getNodeMaterialBindingsList(); + } + + //------------------------------ + DocumentImporter::FWMaterialIdMaxMtlIdMap& ImporterBase::getMaterialIdMapByGeometryUniqueId( const COLLADAFW::UniqueId& uniqueId ) + { + return mDocumentImporter->getGeometryMaterialIdMapMap()[uniqueId]; + } } // namespace COLLADAMax Added: branches/nextgen/COLLADAMax/src/COLLADAMaxMaterialCreator.cpp =================================================================== --- branches/nextgen/COLLADAMax/src/COLLADAMaxMaterialCreator.cpp (rev 0) +++ branches/nextgen/COLLADAMax/src/COLLADAMaxMaterialCreator.cpp 2009-02-10 09:14:41 UTC (rev 348) @@ -0,0 +1,271 @@ +/* +Copyright (c) 2008 NetAllied Systems GmbH + +This file is part of COLLADAMax. + +Portions of the code are: +Copyright (c) 2005-2007 Feeling Software Inc. +Copyright (c) 2005-2007 Sony Computer Entertainment America + +Based on the 3dsMax COLLADASW Tools: +Copyright (c) 2005-2006 Autodesk Media Entertainment + +Licensed under the MIT Open Source License, +for details please see LICENSE file or the website +http://www.opensource.org/licenses/mit-license.php +*/ + +#include "COLLADAMaxStableHeaders.h" +#include "COLLADAMaxMaterialCreator.h" + +#include "COLLADAMaxMultiMtl.h" + +#include <max.h> + + +namespace COLLADAMax +{ + + /** Converts @a color to a max color. @a color must be valid.*/ + Color toMaxColor( const COLLADAFW::Color& color ) + { + assert(color.isValid()); + return Color(color.getRed(), color.getGreen(), color.getBlue()); + } + + /** Converts @a colorOrTexture to a max color. @a colorOrTexture must be a valid color.*/ + Color toMaxColor( const COLLADAFW::ColorOrTexture& colorOrTexture ) + { + assert(colorOrTexture.isColor()); + return toMaxColor(colorOrTexture.getColor()); + } + + + + MaterialCreator::MaterialCreator( DocumentImporter* documentImporter ) + : ImporterBase(documentImporter) + { + } + + //------------------------------ + MaterialCreator::~MaterialCreator() + { + } + + //------------------------------ + bool MaterialCreator::create() + { + const DocumentImporter::NodeMaterialBindingsList& materialBindings = getNodeMaterialBindings(); + DocumentImporter::NodeMaterialBindingsList::const_iterator it = materialBindings.begin(); + for ( ; it != materialBindings.end(); ++it) + { + const DocumentImporter::NodeMaterialBindingsPair& materialBinding = *it; + if ( !createAndAssingMaxMaterial(materialBinding) ) + return false; + } + return true; + } + + //------------------------------ + bool MaterialCreator::createAndAssingMaxMaterial( const DocumentImporter::NodeMaterialBindingsPair& materialBinding ) + { + const DocumentImporter::MaterialBindingVector& materialBindings = materialBinding.materialBindings; + INode* maxNode = materialBinding.maxNode; + + if ( materialBindings.size() == 0 ) + return true; + + // calculate largest material id + int largestMaterialId = 0; + DocumentImporter::MaterialBindingVector::const_iterator it = materialBindings.begin(); + + for ( ; it != materialBindings.end(); ++it) + { + int materialId = (int)it->getMaterialId(); + if ( materialId > largestMaterialId ) + largestMaterialId = materialId; + } + + if ( largestMaterialId == 1 && false ) + { + const COLLADAFW::InstanceGeometry::MaterialBinding& materialBinding = materialBindings[0]; + const COLLADAFW::Effect* effect = getEffect(materialBinding); + if ( !effect ) + return false; + Mtl* newMaterial = getMaxMaterial(*effect); + maxNode->SetMtl( newMaterial ); + return true; + } + + MultiMtl * multiMaterial = NewDefaultMultiMtl(); + multiMaterial->SetNumSubMtls( largestMaterialId + 1 ); + multiMaterial->SetName("MultiMaterial"); + + it = materialBindings.begin(); + for ( ; it != materialBindings.end(); ++it) + { + const COLLADAFW::InstanceGeometry::MaterialBinding& materialBinding = *it; + const COLLADAFW::Effect* effect = getEffect(materialBinding); + if ( !effect ) + return false; + Mtl* newMaterial = getMaxMaterial(*effect); + //newMaterial->SetName("Material"); + multiMaterial->SetSubMtl( materialBinding.getMaterialId(), newMaterial); + } + maxNode->SetMtl( multiMaterial ); + return true; + + +// StandardMaterial*h; + return true; + } + + + //------------------------------ + Mtl* MaterialCreator::createMaxMaterial( const COLLADAFW::Effect& effect ) + { + const COLLADAFW::CommonEffectPointerArray& commonEffects = effect.getCommonEffects(); + if ( commonEffects.getCount() > 0) + { + return createStandardMaterial(*commonEffects[0], effect.getName()); + } + + return 0; + } + + //------------------------------ + Mtl* MaterialCreator::getMaxMaterial( const COLLADAFW::Effect& effect ) + { + const COLLADAFW::UniqueId& effectUniqueId = effect.getUniqueId(); + UniqueIdMaxMaterialMap::const_iterator it = mUniqueIdMaxMaterialMap.find(effectUniqueId); + if ( it == mUniqueIdMaxMaterialMap.end() ) + { + // we need to create a new material + Mtl* newMaterial = createMaxMaterial(effect); + mUniqueIdMaxMaterialMap.insert(std::pair<COLLADAFW::UniqueId, Mtl*>(effectUniqueId, newMaterial)); + return newMaterial; + } + else + { + return it->second; + } + + } + + + //------------------------------ + StdMat2* MaterialCreator::createStandardMaterial( const COLLADAFW::EffectCommon& effectCommon, const String& name ) + { + StdMat2* material = NewDefaultStdMat(); + + + COLLADAFW::EffectCommon::ShaderType shaderType = effectCommon.getShaderType(); + switch ( shaderType ) + { + case COLLADAFW::EffectCommon::SHADER_CONSTANT: + material->SetFaceted(true); // BUG393: Max actually does not support a constant shader! + case COLLADAFW::EffectCommon::SHADER_BLINN: + material->SwitchShader(Class_ID(StandardMaterial::STD2_BLINN_SHADER_CLASS_ID, 0)); + break; + case COLLADAFW::EffectCommon::SHADER_LAMBERT: + case COLLADAFW::EffectCommon::SHADER_PHONG: + case COLLADAFW::EffectCommon::SHADER_UNKNOWN: + default: + material->SwitchShader(Class_ID(StandardMaterial::STD2_PHONG_CLASS_ID, 0)); + break; + } + + + // Retrieve the shader parameter blocks + Shader* materialShader = material->GetShader(); + IParamBlock2* shaderParameters = (IParamBlock2*) materialShader->GetReference(0); + IParamBlock2* extendedParameters = (IParamBlock2*) material->GetReference(StandardMaterial::EXTENDED_PB_REF); + + // Common material parameters + material->SetName(name.c_str()); + const COLLADAFW::ColorOrTexture& diffuse = effectCommon.getDiffuse(); + + if ( diffuse.isColor() ) + material->SetDiffuse( toMaxColor(diffuse), 0); + + const COLLADAFW::ColorOrTexture& emission = effectCommon.getEmission(); + if ( emission.isColor() ) + { + material->SetSelfIllumColorOn(TRUE); + material->SetSelfIllumColor( toMaxColor(emission), 0); + } + else + { + material->SetSelfIllumColorOn(FALSE); + material->SetSelfIllum( 0, 0 ); + } + + + // TODO: handle opacity a bit smarter (evaluate opacity) + float opacity; + float transparency = (float)effectCommon.getTransparency(); + const COLLADAFW::ColorOrTexture& transparent = effectCommon.getTransparent(); + if ( transparent.isColor() ) + { + const COLLADAFW::Color& transparentColor = transparent.getColor(); + float averageTransparent = (float)(transparentColor.getRed() + transparentColor.getGreen() + transparentColor.getBlue())/3; + if ( transparency > 0) + opacity = averageTransparent * transparency; + else + opacity = averageTransparent; + } + else + { + if ( transparency > 0) + opacity = transparency; + else + opacity = 0; + } + // todo include and fix + // material->SetOpacity( opacity, 0); + + if (shaderType != COLLADAFW::EffectCommon::SHADER_CONSTANT && shaderType != COLLADAFW::EffectCommon::SHADER_UNKNOWN) + { + // Unlock the ambient and diffuse colors + materialShader->SetLockAD(FALSE); + materialShader->SetLockADTex(FALSE); + material->LockAmbDiffTex(FALSE); + material->SyncADTexLock(FALSE); + + // Lambert/Phong material parameters + const COLLADAFW::ColorOrTexture& ambient = effectCommon.getAmbient(); + if ( ambient.isColor() ) + material->SetAmbient( toMaxColor(ambient), 0); + // ANIM->ImportAnimatedFRGBA(shaderParameters, FSStandardMaterial::shdr_ambient, *ambientColor); + } + else + { + // Approximate constant shader, specular is the same color + if ( diffuse.isColor() ) + material->SetSpecular( toMaxColor(diffuse), 0 ); + } + + //TODO specular + + return material; + } + + //------------------------------ + const COLLADAFW::Effect* MaterialCreator::getEffect( const COLLADAFW::InstanceGeometry::MaterialBinding& materialBinding ) + { + const COLLADAFW::UniqueId& materialUniqueId = materialBinding.getReferencedMaterial(); + if ( !materialUniqueId.isValid() ) + return 0; + + const COLLADAFW::Material* material = getFWMaterialByUniqueId(materialUniqueId); + if ( !material ) + return 0; + + const COLLADAFW::UniqueId& effectUniqueId = material->getInstantiatedEffect(); + if ( !effectUniqueId.isValid() ) + return 0; + + return getFWEffectByUniqueId(effectUniqueId); + } + +} // namespace COLLADAMax Modified: branches/nextgen/COLLADAMax/src/COLLADAMaxNodeImporter.cpp =================================================================== --- branches/nextgen/COLLADAMax/src/COLLADAMaxNodeImporter.cpp 2009-02-06 16:36:45 UTC (rev 347) +++ branches/nextgen/COLLADAMax/src/COLLADAMaxNodeImporter.cpp 2009-02-10 09:14:41 UTC (rev 348) @@ -159,6 +159,9 @@ INode* parentNode = parentImportNode->GetINode(); parentNode->AttachChild(newNode, FALSE); + + // Store the information about material bindings + storeMaterialBindings(newNode, instanceGeometry); } return true; @@ -193,6 +196,9 @@ INode* parentNode = parentImportNode->GetINode(); parentNode->AttachChild(newNode, FALSE); + // Store the information about material bindings + storeMaterialBindings(newNode, instanceGeometry); + return newImportNode; } @@ -245,6 +251,7 @@ newImportNode->Reference(object); newNode->SetTMController(nodeToClone->GetTMController()); newImportNode->SetName(nodeToClone->GetName()); + newNode->SetMtl(nodeToClone->GetMtl()); INode* parentNode = parentImportNode->GetINode(); parentNode->AttachChild(newNode, TRUE); @@ -261,6 +268,19 @@ return true; } + //------------------------------ + void NodeImporter::storeMaterialBindings( INode* node, COLLADAFW::InstanceGeometry* instanceGeometry ) + { + COLLADAFW::InstanceGeometry::MaterialBindingArray& materialBindings = instanceGeometry->getMaterialBindings(); + if ( !materialBindings.empty() ) + { + DocumentImporter::NodeMaterialBindingsPair& materialBindingsPair = createAndAddNodeMaterialBindingsPair(node); + size_t bindingsCount = materialBindings.getCount(); + materialBindingsPair.materialBindings.reserve(bindingsCount); + for ( size_t i = 0; i < bindingsCount; ++i) + materialBindingsPair.materialBindings.push_back(materialBindings[i]); + } + } } // namespace COLLADAMax Modified: branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLLibraryEffectsLoader.cpp =================================================================== --- branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLLibraryEffectsLoader.cpp 2009-02-06 16:36:45 UTC (rev 347) +++ branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLLibraryEffectsLoader.cpp 2009-02-10 09:14:41 UTC (rev 348) @@ -53,45 +53,42 @@ { case PROFILE_COMMON: { + COLLADAFW::ColorOrTexture* colorOrTexture = 0; switch ( mCurrentShaderParameterType ) { case SHADER_PARAMETER_EMISSION: { - COLLADAFW::Color& color = mCurrentEffect->getCommonEffects().back()->getEmission().getColor(); - handleColorData(data, length, color); + colorOrTexture = &mCurrentEffect->getCommonEffects().back()->getEmission(); break; } case SHADER_PARAMETER_AMBIENT: { - COLLADAFW::Color& color = mCurrentEffect->getCommonEffects().back()->getAmbient().getColor(); - handleColorData(data, length, color); + colorOrTexture = &mCurrentEffect->getCommonEffects().back()->getAmbient(); break; } case SHADER_PARAMETER_DIFFUSE: { - COLLADAFW::Color& color = mCurrentEffect->getCommonEffects().back()->getDiffuse().getColor(); - handleColorData(data, length, color); + colorOrTexture = &mCurrentEffect->getCommonEffects().back()->getDiffuse(); break; } case SHADER_PARAMETER_SPECULAR: { - COLLADAFW::Color& color = mCurrentEffect->getCommonEffects().back()->getSpecular().getColor(); - handleColorData(data, length, color); + colorOrTexture = &mCurrentEffect->getCommonEffects().back()->getSpecular(); break; } case SHADER_PARAMETER_REFLECTIVE: { - COLLADAFW::Color& color = mCurrentEffect->getCommonEffects().back()->getReflective().getColor(); - handleColorData(data, length, color); + colorOrTexture = &mCurrentEffect->getCommonEffects().back()->getReflective(); break; } case SHADER_PARAMETER_TRANSPARANT: { - COLLADAFW::Color& color = mCurrentEffect->getCommonEffects().back()->getTransparent().getColor(); - handleColorData(data, length, color); + colorOrTexture = &mCurrentEffect->getCommonEffects().back()->getTransparent(); break; } } + colorOrTexture->setType(COLLADAFW::ColorOrTexture::COLOR); + handleColorData(data, length, colorOrTexture->getColor()); break; } } @@ -130,7 +127,13 @@ { mCurrentEffect = FW_NEW COLLADAFW::Effect(getUniqueIdFromId(attributeData.id, COLLADAFW::Effect::ID()).getObjectId()); if ( attributeData.name ) + { mCurrentEffect->setName((const char*)attributeData.name); + } + else if ( attributeData.id) + { + mCurrentEffect->setName((const char*)attributeData.id); + } return true; } Modified: branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLNodeLoader.cpp =================================================================== --- branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLNodeLoader.cpp 2009-02-06 16:36:45 UTC (rev 347) +++ branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLNodeLoader.cpp 2009-02-10 09:14:41 UTC (rev 348) @@ -351,7 +351,7 @@ size_t materialBindingsCount = mCurrentMaterialBindings.size(); if ( materialBindingsCount > 0 ) { - COLLADAFW::InstanceGeometry::MaterialBindings& materialBindings = mCurrentInstanceGeometry->getMaterialBindings(); + COLLADAFW::InstanceGeometry::MaterialBindingArray& materialBindings = mCurrentInstanceGeometry->getMaterialBindings(); materialBindings.allocMemory( materialBindingsCount); MaterialBindingsSet::const_iterator it = mCurrentMaterialBindings.begin(); size_t index = 0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jud...@us...> - 2009-02-06 16:36:53
|
Revision: 347 http://colladamaya.svn.sourceforge.net/colladamaya/?rev=347&view=rev Author: judithschenk Date: 2009-02-06 16:36:45 +0000 (Fri, 06 Feb 2009) Log Message: ----------- unit conversion with up axis Modified Paths: -------------- branches/nextgen/COLLADAFramework/include/COLLADAFWFileInfo.h branches/nextgen/COLLADAMaya/include/COLLADAMayaBaseImporter.h branches/nextgen/COLLADAMaya/include/COLLADAMayaDocumentImporter.h branches/nextgen/COLLADAMaya/src/COLLADAMayaDocumentImporter.cpp branches/nextgen/COLLADAMaya/src/COLLADAMayaGeometryImporter.cpp branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLAssetLoader.h branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLFileLoader.cpp Modified: branches/nextgen/COLLADAFramework/include/COLLADAFWFileInfo.h =================================================================== --- branches/nextgen/COLLADAFramework/include/COLLADAFWFileInfo.h 2009-02-06 15:07:55 UTC (rev 346) +++ branches/nextgen/COLLADAFramework/include/COLLADAFWFileInfo.h 2009-02-06 16:36:45 UTC (rev 347) @@ -159,7 +159,7 @@ void setUpAxisType ( const String& upAxis ); /** Returns the up axis. */ - UpAxisType& getUpAxisType() + const UpAxisType& getUpAxisType() const { return mUpAxisType; } Modified: branches/nextgen/COLLADAMaya/include/COLLADAMayaBaseImporter.h =================================================================== --- branches/nextgen/COLLADAMaya/include/COLLADAMayaBaseImporter.h 2009-02-06 15:07:55 UTC (rev 346) +++ branches/nextgen/COLLADAMaya/include/COLLADAMayaBaseImporter.h 2009-02-06 16:36:45 UTC (rev 347) @@ -19,6 +19,8 @@ #include "COLLADAMayaStableHeaders.h" #include "COLLADAMayaDocumentImporter.h" +#include "math/COLLADABUMathVector3.h" + #include "MayaDMTypes.h" @@ -51,9 +53,13 @@ * For example, 1.0 for the name "meter"; 1000 for the name "kilometer"; * 0.3048 for the name "foot". */ - double toLinearUnit ( const double val ) + MayaDM::double3 toLinearUnit ( const MayaDM::double3& val ) { - return ( val * mDocumentImporter->getLinearUnitMeter () ); + if ( mDocumentImporter->getUpAxisType () == COLLADAFW::FileInfo::X_UP ) + return ( MayaDM::double3 ( toLinearUnit ( val[1] ), toLinearUnit ( val[0]*(-1) ), toLinearUnit ( val[2] ) ) ); + else if ( mDocumentImporter->getUpAxisType () == COLLADAFW::FileInfo::Z_UP ) + return ( MayaDM::double3 ( toLinearUnit ( val[0] ), toLinearUnit ( val[2] ), toLinearUnit ( val[1]*(-1) ) ) ); + else return ( MayaDM::double3 ( toLinearUnit ( val[0] ), toLinearUnit ( val[1] ), toLinearUnit ( val[2] ) ) ); } /** @@ -62,20 +68,13 @@ * For example, 1.0 for the name "meter"; 1000 for the name "kilometer"; * 0.3048 for the name "foot". */ - float toLinearUnit ( const float val ) - { - return ( val * (float) mDocumentImporter->getLinearUnitMeter () ); - } - - /** - * Converts the given value to the linear unit in meters. - * How many real-world meters in one distance unit as a floating-point number. - * For example, 1.0 for the name "meter"; 1000 for the name "kilometer"; - * 0.3048 for the name "foot". - */ MVector toLinearUnit ( const MVector& val ) { - return ( val * mDocumentImporter->getLinearUnitMeter () ); + if ( mDocumentImporter->getUpAxisType () == COLLADAFW::FileInfo::X_UP ) + return ( MVector ( toLinearUnit ( val[1] ), toLinearUnit ( val[0]*(-1) ), toLinearUnit ( val[2] ) ) ); + else if ( mDocumentImporter->getUpAxisType () == COLLADAFW::FileInfo::Z_UP ) + return ( MVector ( toLinearUnit ( val[0] ), toLinearUnit ( val[2] ), toLinearUnit ( val[1]*(-1) ) ) ); + else return ( MVector ( toLinearUnit ( val[0] ), toLinearUnit ( val[1] ), toLinearUnit ( val[2] ) ) ); } /** @@ -84,9 +83,26 @@ * For example, 1.0 for the name "meter"; 1000 for the name "kilometer"; * 0.3048 for the name "foot". */ - MayaDM::double3 toLinearUnit ( const MayaDM::double3& val ) + void toLinearUnit ( const double val0, const double val1, const double val2, COLLADABU::Math::Vector3& retVal ) { - return ( MayaDM::double3 ( toLinearUnit ( val[0] ), toLinearUnit ( val[1] ), toLinearUnit ( val[2] ) ) ); + if ( mDocumentImporter->getUpAxisType () == COLLADAFW::FileInfo::X_UP ) + { + retVal [0] = toLinearUnit ( val1 ); + retVal [1] = toLinearUnit ( val0*(-1) ); + retVal [2] = toLinearUnit ( val2 ); + } + else if ( mDocumentImporter->getUpAxisType () == COLLADAFW::FileInfo::Z_UP ) + { + retVal [0] = toLinearUnit ( val0 ); + retVal [1] = toLinearUnit ( val2 ); + retVal [2] = toLinearUnit ( val1*(-1) ); + } + else + { + retVal [0] = toLinearUnit ( val0 ); + retVal [1] = toLinearUnit ( val1 ); + retVal [2] = toLinearUnit ( val2 ); + } } protected: @@ -121,6 +137,30 @@ // return mDocumentImporter->getDocumentLoader (); // } + private: + + /** + * Converts the given value to the linear unit in meters. + * How many real-world meters in one distance unit as a floating-point number. + * For example, 1.0 for the name "meter"; 1000 for the name "kilometer"; + * 0.3048 for the name "foot". + */ + double toLinearUnit ( const double val ) + { + return ( val * mDocumentImporter->getLinearUnitMeter () ); + } + + /** + * Converts the given value to the linear unit in meters. + * How many real-world meters in one distance unit as a floating-point number. + * For example, 1.0 for the name "meter"; 1000 for the name "kilometer"; + * 0.3048 for the name "foot". + */ + float toLinearUnit ( const float val ) + { + return ( val * (float) mDocumentImporter->getLinearUnitMeter () ); + } + }; } Modified: branches/nextgen/COLLADAMaya/include/COLLADAMayaDocumentImporter.h =================================================================== --- branches/nextgen/COLLADAMaya/include/COLLADAMayaDocumentImporter.h 2009-02-06 15:07:55 UTC (rev 346) +++ branches/nextgen/COLLADAMaya/include/COLLADAMayaDocumentImporter.h 2009-02-06 16:36:45 UTC (rev 347) @@ -66,6 +66,7 @@ * 0.3048 for the name "foot". */ double mLinearUnitMeter; + COLLADAFW::FileInfo::UpAxisType mUpAxisType; bool mAssetWritten; bool mSceneGraphWritten; @@ -146,6 +147,8 @@ void getCurrentDate ( std::stringstream& curDate ); + const COLLADAFW::FileInfo::UpAxisType& getUpAxisType () const { return mUpAxisType; } + /** * How many real-world meters in one distance unit as a floating-point number. * For example, 1.0 for the name "meter"; 1000 for the name "kilometer"; Modified: branches/nextgen/COLLADAMaya/src/COLLADAMayaDocumentImporter.cpp =================================================================== --- branches/nextgen/COLLADAMaya/src/COLLADAMayaDocumentImporter.cpp 2009-02-06 15:07:55 UTC (rev 346) +++ branches/nextgen/COLLADAMaya/src/COLLADAMayaDocumentImporter.cpp 2009-02-06 16:36:45 UTC (rev 347) @@ -194,6 +194,7 @@ // Set the linear unit in meters mLinearUnitMeter = unit.mLinearUnitMeter; + mUpAxisType = asset->getUpAxisType (); // String application ( MGlobal::executeCommandStringResult ( "about -application" ).asChar () ); // fprintf_s ( mFile, "fileInfo \"application\" \"%s\";\n", application.c_str () ); @@ -226,6 +227,7 @@ if ( !mAssetWritten ) { mSceneGraphRead = true; + return true; } if ( mSceneGraphWritten ) return true; @@ -254,7 +256,7 @@ if ( !mAssetWritten || !mSceneGraphWritten ) { mGeometryRead = true; - return false; + return true; } // Create the file, if not already done. Modified: branches/nextgen/COLLADAMaya/src/COLLADAMayaGeometryImporter.cpp =================================================================== --- branches/nextgen/COLLADAMaya/src/COLLADAMayaGeometryImporter.cpp 2009-02-06 15:07:55 UTC (rev 346) +++ branches/nextgen/COLLADAMaya/src/COLLADAMayaGeometryImporter.cpp 2009-02-06 16:36:45 UTC (rev 347) @@ -199,9 +199,11 @@ meshNode.startVrts ( 0, (count/stride)-1 ); for ( size_t i=0, index=0; i<count; i+=stride, ++index ) { - meshNode.appendVrts ( toLinearUnit ( (*values)[i] ) ); - meshNode.appendVrts ( toLinearUnit ( (*values)[i+1] ) ); - meshNode.appendVrts ( toLinearUnit ( (*values)[i+2] ) ); + COLLADABU::Math::Vector3 converted; + toLinearUnit ( (*values)[i], (*values)[i+1], (*values)[i+2], converted ); + meshNode.appendVrts ( converted[0] ); + meshNode.appendVrts ( converted[1] ); + meshNode.appendVrts ( converted[2] ); } meshNode.endVrts (); } @@ -213,9 +215,11 @@ meshNode.startVrts ( 0, (count/stride)-1 ); for ( size_t i=0, index=0; i<count; i+=stride, ++index ) { - meshNode.appendVrts ( toLinearUnit ( (float)(*values)[i] ) ); - meshNode.appendVrts ( toLinearUnit ( (float)(*values)[i+1] ) ); - meshNode.appendVrts ( toLinearUnit ( (float)(*values)[i+2] ) ); + COLLADABU::Math::Vector3 converted; + toLinearUnit ( (*values)[i], (*values)[i+1], (*values)[i+2], converted ); + meshNode.appendVrts ( converted[0] ); + meshNode.appendVrts ( converted[1] ); + meshNode.appendVrts ( converted[2] ); } meshNode.endVrts (); } Modified: branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLAssetLoader.h =================================================================== --- branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLAssetLoader.h 2009-02-06 15:07:55 UTC (rev 346) +++ branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLAssetLoader.h 2009-02-06 16:36:45 UTC (rev 347) @@ -147,9 +147,22 @@ virtual bool begin__up_axis(){return true;} virtual bool end__up_axis(){return true;} - virtual bool data__up_axis( const ParserChar* data, size_t length ) + virtual bool data__up_axis( const COLLADASaxFWL::UpAxisType val ) { - mAsset->setUpAxisType ( String ( (char*) data, length ) ); + switch ( val ) + { + case COLLADASaxFWL::UpAxisType__X_UP: + mAsset->setUpAxisType ( COLLADAFW::FileInfo::X_UP_STRING ); + break; + case COLLADASaxFWL::UpAxisType__Y_UP: + mAsset->setUpAxisType ( COLLADAFW::FileInfo::Y_UP_STRING ); + break; + case COLLADASaxFWL::UpAxisType__Z_UP: + mAsset->setUpAxisType ( COLLADAFW::FileInfo::Z_UP_STRING ); + break; + default: + mAsset->setUpAxisType ( COLLADAFW::FileInfo::Y_UP_STRING ); + } return true; } Modified: branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLFileLoader.cpp =================================================================== --- branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLFileLoader.cpp 2009-02-06 15:07:55 UTC (rev 346) +++ branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLFileLoader.cpp 2009-02-06 16:36:45 UTC (rev 347) @@ -54,12 +54,10 @@ //----------------------------- bool FileLoader::begin__COLLADA__asset () { - /* deleteFilePartLoader(); AssetLoader* assetLoader = new AssetLoader(this); setPartLoader(assetLoader); setParser(assetLoader); - */ return true; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jud...@us...> - 2009-02-06 15:08:01
|
Revision: 346 http://colladamaya.svn.sourceforge.net/colladamaya/?rev=346&view=rev Author: judithschenk Date: 2009-02-06 15:07:55 +0000 (Fri, 06 Feb 2009) Log Message: ----------- unit conversion Modified Paths: -------------- branches/nextgen/COLLADAFramework/include/COLLADAFWFileInfo.h branches/nextgen/COLLADAMaya/include/COLLADAMayaBaseImporter.h branches/nextgen/COLLADAMaya/include/COLLADAMayaDocumentImporter.h branches/nextgen/COLLADAMaya/src/COLLADAMayaDocumentImporter.cpp branches/nextgen/COLLADAMaya/src/COLLADAMayaGeometryImporter.cpp branches/nextgen/COLLADAMaya/src/COLLADAMayaVisualSceneImporter.cpp branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLAssetLoader.h Modified: branches/nextgen/COLLADAFramework/include/COLLADAFWFileInfo.h =================================================================== --- branches/nextgen/COLLADAFramework/include/COLLADAFWFileInfo.h 2009-02-06 13:12:27 UTC (rev 345) +++ branches/nextgen/COLLADAFramework/include/COLLADAFWFileInfo.h 2009-02-06 15:07:55 UTC (rev 346) @@ -45,6 +45,13 @@ String mLinearUnit; /** + * How many real-world meters in one distance unit as a floating-point number. + * For example, 1.0 for the name "meter"; 1000 for the name "kilometer"; + * 0.3048 for the name "foot". + */ + double mLinearUnitMeter; + + /** * The angular unit; */ String mAngularUnit; @@ -122,6 +129,14 @@ mUnit.mLinearUnit = linearUnit; } + /** + * Sets the linear unit meter. + */ + void setLinearUnitMeter ( const double linearUnitMeter ) + { + mUnit.mLinearUnitMeter = linearUnitMeter; + } + /** Returns the unit. */ Unit& getUnit() { Modified: branches/nextgen/COLLADAMaya/include/COLLADAMayaBaseImporter.h =================================================================== --- branches/nextgen/COLLADAMaya/include/COLLADAMayaBaseImporter.h 2009-02-06 13:12:27 UTC (rev 345) +++ branches/nextgen/COLLADAMaya/include/COLLADAMayaBaseImporter.h 2009-02-06 15:07:55 UTC (rev 346) @@ -19,7 +19,9 @@ #include "COLLADAMayaStableHeaders.h" #include "COLLADAMayaDocumentImporter.h" +#include "MayaDMTypes.h" + namespace COLLADAMaya { @@ -43,6 +45,50 @@ /** Destructor. */ virtual ~BaseImporter () {} + /** + * Converts the given value to the linear unit in meters. + * How many real-world meters in one distance unit as a floating-point number. + * For example, 1.0 for the name "meter"; 1000 for the name "kilometer"; + * 0.3048 for the name "foot". + */ + double toLinearUnit ( const double val ) + { + return ( val * mDocumentImporter->getLinearUnitMeter () ); + } + + /** + * Converts the given value to the linear unit in meters. + * How many real-world meters in one distance unit as a floating-point number. + * For example, 1.0 for the name "meter"; 1000 for the name "kilometer"; + * 0.3048 for the name "foot". + */ + float toLinearUnit ( const float val ) + { + return ( val * (float) mDocumentImporter->getLinearUnitMeter () ); + } + + /** + * Converts the given value to the linear unit in meters. + * How many real-world meters in one distance unit as a floating-point number. + * For example, 1.0 for the name "meter"; 1000 for the name "kilometer"; + * 0.3048 for the name "foot". + */ + MVector toLinearUnit ( const MVector& val ) + { + return ( val * mDocumentImporter->getLinearUnitMeter () ); + } + + /** + * Converts the given value to the linear unit in meters. + * How many real-world meters in one distance unit as a floating-point number. + * For example, 1.0 for the name "meter"; 1000 for the name "kilometer"; + * 0.3048 for the name "foot". + */ + MayaDM::double3 toLinearUnit ( const MayaDM::double3& val ) + { + return ( MayaDM::double3 ( toLinearUnit ( val[0] ), toLinearUnit ( val[1] ), toLinearUnit ( val[2] ) ) ); + } + protected: /** Returns a pointer to the current document importer. */ Modified: branches/nextgen/COLLADAMaya/include/COLLADAMayaDocumentImporter.h =================================================================== --- branches/nextgen/COLLADAMaya/include/COLLADAMayaDocumentImporter.h 2009-02-06 13:12:27 UTC (rev 345) +++ branches/nextgen/COLLADAMaya/include/COLLADAMayaDocumentImporter.h 2009-02-06 15:07:55 UTC (rev 346) @@ -60,6 +60,13 @@ /** The LC_NUMERIC locale that was set before the Streamwriter was instantiated. */ String mLocale; + /** + * How many real-world meters in one distance unit as a floating-point number. + * For example, 1.0 for the name "meter"; 1000 for the name "kilometer"; + * 0.3048 for the name "foot". + */ + double mLinearUnitMeter; + bool mAssetWritten; bool mSceneGraphWritten; bool mGeometryWritten; @@ -139,6 +146,13 @@ void getCurrentDate ( std::stringstream& curDate ); + /** + * How many real-world meters in one distance unit as a floating-point number. + * For example, 1.0 for the name "meter"; 1000 for the name "kilometer"; + * 0.3048 for the name "foot". + */ + const double getLinearUnitMeter () const { return mLinearUnitMeter; } + /** When this method is called, the writer must write the entire visual scene. @return The writer should return true, if writing succeeded, false otherwise.*/ virtual bool writeVisualScene ( const COLLADAFW::VisualScene* visualScene ); Modified: branches/nextgen/COLLADAMaya/src/COLLADAMayaDocumentImporter.cpp =================================================================== --- branches/nextgen/COLLADAMaya/src/COLLADAMayaDocumentImporter.cpp 2009-02-06 13:12:27 UTC (rev 345) +++ branches/nextgen/COLLADAMaya/src/COLLADAMayaDocumentImporter.cpp 2009-02-06 15:07:55 UTC (rev 346) @@ -49,6 +49,7 @@ , mAssetWritten ( false ) , mSceneGraphRead ( false ) , mGeometryRead ( false ) + , mLinearUnitMeter (1) { } @@ -191,6 +192,9 @@ const COLLADAFW::FileInfo::Unit& unit = asset->getUnit (); fprintf_s ( mFile, "currentUnit -l %s -a %s -t %s;\n", unit.mLinearUnit.c_str (), unit.mAngularUnit.c_str (), unit.mTimeUnit.c_str () ); + // Set the linear unit in meters + mLinearUnitMeter = unit.mLinearUnitMeter; + // String application ( MGlobal::executeCommandStringResult ( "about -application" ).asChar () ); // fprintf_s ( mFile, "fileInfo \"application\" \"%s\";\n", application.c_str () ); // String product ( MGlobal::executeCommandStringResult ( "about -product" ).asChar () ); Modified: branches/nextgen/COLLADAMaya/src/COLLADAMayaGeometryImporter.cpp =================================================================== --- branches/nextgen/COLLADAMaya/src/COLLADAMayaGeometryImporter.cpp 2009-02-06 13:12:27 UTC (rev 345) +++ branches/nextgen/COLLADAMaya/src/COLLADAMayaGeometryImporter.cpp 2009-02-06 15:07:55 UTC (rev 346) @@ -199,9 +199,9 @@ meshNode.startVrts ( 0, (count/stride)-1 ); for ( size_t i=0, index=0; i<count; i+=stride, ++index ) { - meshNode.appendVrts ( (*values)[i] ); - meshNode.appendVrts ( (*values)[i+1] ); - meshNode.appendVrts ( (*values)[i+2] ); + meshNode.appendVrts ( toLinearUnit ( (*values)[i] ) ); + meshNode.appendVrts ( toLinearUnit ( (*values)[i+1] ) ); + meshNode.appendVrts ( toLinearUnit ( (*values)[i+2] ) ); } meshNode.endVrts (); } @@ -213,9 +213,9 @@ meshNode.startVrts ( 0, (count/stride)-1 ); for ( size_t i=0, index=0; i<count; i+=stride, ++index ) { - meshNode.appendVrts ( (float)(*values)[i] ); - meshNode.appendVrts ( (float)(*values)[i+1] ); - meshNode.appendVrts ( (float)(*values)[i+2] ); + meshNode.appendVrts ( toLinearUnit ( (float)(*values)[i] ) ); + meshNode.appendVrts ( toLinearUnit ( (float)(*values)[i+1] ) ); + meshNode.appendVrts ( toLinearUnit ( (float)(*values)[i+2] ) ); } meshNode.endVrts (); } Modified: branches/nextgen/COLLADAMaya/src/COLLADAMayaVisualSceneImporter.cpp =================================================================== --- branches/nextgen/COLLADAMaya/src/COLLADAMayaVisualSceneImporter.cpp 2009-02-06 13:12:27 UTC (rev 345) +++ branches/nextgen/COLLADAMaya/src/COLLADAMayaVisualSceneImporter.cpp 2009-02-06 15:07:55 UTC (rev 346) @@ -656,7 +656,7 @@ // Write the transformations directly into the maya file. if ( translate != MVector (0, 0, 0) ) - transformNode->setTranslate ( MayaDM::double3 ( translate.x, translate.y, translate.z ) ); + transformNode->setTranslate ( toLinearUnit ( MayaDM::double3 ( translate.x , translate.y, translate.z ) ) ); if ( rotation != MVector (0, 0, 0) ) transformNode->setRotate ( MayaDM::double3 ( COLLADABU::Math::Utils::radToDeg(rotation.x), COLLADABU::Math::Utils::radToDeg(rotation.y), COLLADABU::Math::Utils::radToDeg(rotation.z) ) ); if ( scale != MVector (1, 1, 1) ) @@ -666,14 +666,14 @@ transformNode->setShear ( MayaDM::double3 ( skew.x, skew.y, skew.z ) ); if ( rotatePivot != MVector (0, 0, 0) ) - transformNode->setRotatePivot ( MayaDM::double3 ( rotatePivot.x, rotatePivot.y, rotatePivot.z ) ); + transformNode->setRotatePivot ( toLinearUnit ( MayaDM::double3 ( rotatePivot.x, rotatePivot.y, rotatePivot.z ) ) ); if ( rotatePivotTranslate != MVector (0, 0, 0) ) - transformNode->setRotatePivotTranslate ( MayaDM::double3 ( rotatePivotTranslate.x, rotatePivotTranslate.y, rotatePivotTranslate.z ) ); + transformNode->setRotatePivotTranslate ( toLinearUnit ( MayaDM::double3 ( rotatePivotTranslate.x, rotatePivotTranslate.y, rotatePivotTranslate.z ) ) ); if ( scalePivot != MVector (0, 0, 0) ) - transformNode->setScalePivot ( MayaDM::double3 ( scalePivot.x, scalePivot.y, scalePivot.z ) ); + transformNode->setScalePivot ( toLinearUnit ( MayaDM::double3 ( scalePivot.x, scalePivot.y, scalePivot.z ) ) ); if ( scalePivotTranslate != MVector (0, 0, 0) ) - transformNode->setScalePivotTranslate ( MayaDM::double3 ( scalePivotTranslate.x, scalePivotTranslate.y, scalePivotTranslate.z ) ); + transformNode->setScalePivotTranslate ( toLinearUnit ( MayaDM::double3 ( scalePivotTranslate.x, scalePivotTranslate.y, scalePivotTranslate.z ) ) ); if ( order != MEulerRotation::kXYZ ) transformNode->setRotateOrder ( order ); Modified: branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLAssetLoader.h =================================================================== --- branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLAssetLoader.h 2009-02-06 13:12:27 UTC (rev 345) +++ branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLAssetLoader.h 2009-02-06 15:07:55 UTC (rev 346) @@ -140,6 +140,7 @@ virtual bool begin__unit( const unit__AttributeData& attributeData ) { mAsset->getUnit().mLinearUnit = String ( (char*) attributeData.name ); + mAsset->getUnit().mLinearUnitMeter = attributeData.meter; return true; } virtual bool end__unit(){return true;} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rob...@us...> - 2009-02-06 13:12:29
|
Revision: 345 http://colladamaya.svn.sourceforge.net/colladamaya/?rev=345&view=rev Author: robertwuerfel Date: 2009-02-06 13:12:27 +0000 (Fri, 06 Feb 2009) Log Message: ----------- add support to load effects ( only profile_common and only colors ) into the framework Modified Paths: -------------- branches/nextgen/COLLADAFramework/include/COLLADAFWArray.h branches/nextgen/COLLADAFramework/include/COLLADAFWColor.h branches/nextgen/COLLADAFramework/include/COLLADAFWColorOrTexture.h branches/nextgen/COLLADAFramework/include/COLLADAFWEffect.h branches/nextgen/COLLADAFramework/scripts/COLLADAFramework.vcproj branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLColladaParserAutoGenAttributes.h branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLLibraryEffectsLoader.h branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLFileLoader.cpp branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLLibraryEffectsLoader.cpp Added Paths: ----------- branches/nextgen/COLLADAFramework/include/COLLADAFWEffectCommon.h branches/nextgen/COLLADAFramework/src/COLLADAFWEffectCommon.cpp Modified: branches/nextgen/COLLADAFramework/include/COLLADAFWArray.h =================================================================== --- branches/nextgen/COLLADAFramework/include/COLLADAFWArray.h 2009-02-06 12:50:36 UTC (rev 344) +++ branches/nextgen/COLLADAFramework/include/COLLADAFWArray.h 2009-02-06 13:12:27 UTC (rev 345) @@ -159,6 +159,12 @@ /** Return s the index'th element in the array. No check is performed, if the index is out of bounds.*/ const Type& operator[] ( size_t index ) const { return mData[index]; } + /** Returns a reference to the last element in the array. The array must not be empty.*/ + Type& back() { assert(mData && (mCount > 0)); return mData[mCount - 1]; } + + /** Returns a reference to the last element in the array. The array must not be empty.*/ + const Type& back() const { assert(mData && (mCount > 0)); return mData[mCount - 1]; } + /** Disable default copy ctor. */ Array( const Array& pre ); Modified: branches/nextgen/COLLADAFramework/include/COLLADAFWColor.h =================================================================== --- branches/nextgen/COLLADAFramework/include/COLLADAFWColor.h 2009-02-06 12:50:36 UTC (rev 344) +++ branches/nextgen/COLLADAFramework/include/COLLADAFWColor.h 2009-02-06 13:12:27 UTC (rev 345) @@ -49,29 +49,29 @@ bool isValid() const; /** Returns the red component*/ - double getRed() const - { - return mR; - } + double getRed() const {return mR; } + /** Sets the red component*/ + void setRed( double r ) {mR = r; } + /** Returns the green component*/ - double getGreen() const - { - return mG; - } + double getGreen() const { return mG; } + /** Sets the green component*/ + void setGreen( double g ) {mG = g; } + /** Returns the blue component*/ - double getBlue() const - { - return mB; - } + double getBlue() const { return mB; } + /** Sets the red component*/ + void setBlue( double b ) {mB = b; } + /** Returns the alpha component*/ - double getAlpha() const - { - return mA; - } + double getAlpha() const { return mA; } + /** Sets the red component*/ + void setAlpha( double a ) {mA = a; } + /** A white color object*/ static const Color WHITE; Modified: branches/nextgen/COLLADAFramework/include/COLLADAFWColorOrTexture.h =================================================================== --- branches/nextgen/COLLADAFramework/include/COLLADAFWColorOrTexture.h 2009-02-06 12:50:36 UTC (rev 344) +++ branches/nextgen/COLLADAFramework/include/COLLADAFWColorOrTexture.h 2009-02-06 13:12:27 UTC (rev 345) @@ -13,7 +13,7 @@ #include "COLLADAFWPrerequisites.h" #include "COLLADAFWColor.h" -#include "COLLADAFWTexture.h" +//#include "COLLADAFWTexture.h" #include <vector> #include <map> @@ -35,7 +35,7 @@ }; Type mType; Color mColor; - Texture mTexture; + //Texture mTexture; String mSid; public: @@ -51,12 +51,12 @@ /** Constructor to create a ColorOrTexture object that represents a color. @param texture The color that should be represented. */ - ColorOrTexture ( Texture texture, const String& sid = "" ) +/* ColorOrTexture ( Texture texture, const String& sid = "" ) : mTexture ( texture ) , mType ( TEXTURE ) , mSid ( sid ) {}; - +*/ /** Creates an invalid CommonColorOrTextureType*/ ColorOrTexture() : mType ( UNSPECIFIED ) {}; @@ -64,7 +64,7 @@ ColorOrTexture ( const ColorOrTexture& cot ) { mColor = cot.mColor; - mTexture = cot.mTexture; +// mTexture = cot.mTexture; mType = cot.mType; mSid = cot.mSid; } @@ -82,15 +82,15 @@ } /** Return true if the CommonColorOrTextureType is a valid Texture, false otherwise.*/ - bool isTexture() const + /* bool isTexture() const { return ( mType == TEXTURE ) && ( mTexture.isValid() ); } - +*/ /** Return true if the CommonColorOrTextureType is a valid Texture, false otherwise.*/ bool isValid() const { - return ( mType != UNSPECIFIED ) && ( isTexture() || isColor() ); + return ( mType != UNSPECIFIED ) /*&& ( isTexture() || isColor() ) */; } @@ -107,16 +107,17 @@ } /** Returns the texture */ - const Texture& getTexture() const +/* const Texture& getTexture() const { return mTexture; - } + }*/ /** Returns the texture */ - Texture& getTexture() +/* Texture& getTexture() { return mTexture; } + */ }; Modified: branches/nextgen/COLLADAFramework/include/COLLADAFWEffect.h =================================================================== --- branches/nextgen/COLLADAFramework/include/COLLADAFWEffect.h 2009-02-06 12:50:36 UTC (rev 344) +++ branches/nextgen/COLLADAFramework/include/COLLADAFWEffect.h 2009-02-06 13:12:27 UTC (rev 345) @@ -16,7 +16,9 @@ #include "COLLADAFWObject.h" #include "COLLADAFWColor.h" +#include "COLLADAFWEffectCommon.h" + namespace COLLADAFW { @@ -58,9 +60,12 @@ // TODO Fix members!!! // Profile* mProfile; - // TODO Implementation of a minimized standard material! + /** All the COLLADA common effects .*/ + CommonEffectPointerArray mCommonEffects; + + /** The standard color, i.e. the color to by used by systems that support only + one color, like most of the CAD-systems.*/ Color mStandardColor; - public: /** Constructor. */ @@ -75,6 +80,21 @@ /** Pretty-print name for this effect. Optional. */ void setName ( const String Name ) { mName = Name; } + /** Returns the standard color, i.e. the color to by used by systems that support only + one color, like most of the CAD-systems.*/ + const Color& getStandardColor() const { return mStandardColor; } + + /** Sets the standard color, i.e. the color to by used by systems that support only + one color, like most of the CAD-systems.*/ + void setStandardColor(Color val) { mStandardColor = val; } + + /** Returns the common effects.*/ + CommonEffectPointerArray& getCommonEffects() { return mCommonEffects; } + + /** Returns the common effects.*/ + const CommonEffectPointerArray& getCommonEffects()const { return mCommonEffects; } + + private: /** TODO Implement copy constructor if necessary. */ Added: branches/nextgen/COLLADAFramework/include/COLLADAFWEffectCommon.h =================================================================== --- branches/nextgen/COLLADAFramework/include/COLLADAFWEffectCommon.h (rev 0) +++ branches/nextgen/COLLADAFramework/include/COLLADAFWEffectCommon.h 2009-02-06 13:12:27 UTC (rev 345) @@ -0,0 +1,429 @@ +/* + Copyright(c) 2008 NetAllied Systems GmbH + + This file is part of COLLADAFramework. + + Licensed under the MIT Open Source License, + for details please see LICENSE file or the website + http://www.opensource.org/licenses/mit-license.php +*/ + +#ifndef __COLLADAFW_EFFECTCOMMON_H__ +#define __COLLADAFW_EFFECTCOMMON_H__ + +#include "COLLADAFWPrerequisites.h" +#include "COLLADAFWColorOrTexture.h" +#include "COLLADAFWPointerArray.h" + + +namespace COLLADAFW +{ + /** Once we implement referencing of floats, this might become a class.*/ + typedef double FloatOrParam; + + /** An effect defined as in the COLLADA common profile. */ + class EffectCommon + { + public: + /** Possible shaders that can be represented by EffectCommon.*/ + enum ShaderType + { + SHADER_UNKNOWN, + SHADER_BLINN, + SHADER_CONSTANT, + SHADER_PHONG, + SHADER_LAMBERT + }; + private: + + /** The shader used by the effect.*/ + ShaderType mShaderType; + + /** Declares the amount of light emitted from the surface of this object. + Used by the following shaders: + Blinn + Constant + Phong + Lambert + */ + ColorOrTexture mEmission; + + /** Declares the amount of ambient light emitted from the surface of this object. + Used by the following shaders: + Blinn + Phong + Lambert + */ + ColorOrTexture mAmbient; + + /** Declares the amount of light diffusely reflected from the surface of this object. + Used by the following shaders: + Blinn + Phong + Lambert + */ + ColorOrTexture mDiffuse; + + /** Declares the color of light specularly reflected from the surface of this object. + Used by the following shaders: + Blinn + Phong + */ + ColorOrTexture mSpecular; + + /** Declares the specularity or roughness of the specular reflection lobe. + Used by the following shaders: + Blinn + Phong + */ + FloatOrParam mShininess; + + + /** Declares the color of a perfect mirror reflection. + Used by the following shaders: + Blinn + Constant + Phong + Lambert + */ + ColorOrTexture mReflective; + + /** Declares the amount of perfect mirror reflection to be added to the reflected light + as a value between 0.0 and 1.0. + Used by the following shaders: + Blinn + Constant + Phong + Lambert + */ + FloatOrParam mReflectivity; + + /** Declares the color of perfectly refracted light. + Used by the following shaders: + Blinn + Constant + Phong + Lambert + */ + ColorOrTexture mTransparent; + + /** Declares the amount of perfectly refracted light added to the reflected color as a + scalar value between 0.0 and 1.0. + Used by the following shaders: + Blinn + Constant + Phong + Lambert + */ + FloatOrParam mTransparency; + + /** Declares the index of refraction for perfectly refracted light as a single scalar index. + Used by the following shaders: + Blinn + Constant + Phong + Lambert + */ + FloatOrParam mIndexOfRefraction; + + public: + + /** Constructor. */ + EffectCommon(); + + /** Destructor. */ + virtual ~EffectCommon(); + + /** Returns the type of the shader used by the effect.*/ + ShaderType getShaderType() const { return mShaderType; } + + /** Sets the type of the shader used by the effect.*/ + void setShaderType(ShaderType val) { mShaderType = val; } + + + /** Declares the amount of light emitted from the surface of this object. + Used by the following shaders: + Blinn + Constant + Phong + Lambert + */ + const ColorOrTexture& getEmission() const { return mEmission; } + + /** Declares the amount of light emitted from the surface of this object. + Used by the following shaders: + Blinn + Constant + Phong + Lambert + */ + ColorOrTexture& getEmission() { return mEmission; } + + /** Declares the amount of light emitted from the surface of this object. + Used by the following shaders: + Blinn + Constant + Phong + Lambert + */ + void setEmission( const ColorOrTexture& Emission ) { mEmission = Emission; } + + + /** Declares the amount of ambient light emitted from the surface of this object. + Used by the following shaders: + Blinn + Phong + Lambert + */ + const ColorOrTexture& getAmbient () const { return mAmbient; } + + /** Declares the amount of ambient light emitted from the surface of this object. + Used by the following shaders: + Blinn + Phong + Lambert + */ + ColorOrTexture& getAmbient () { return mAmbient; } + + /** Declares the amount of ambient light emitted from the surface of this object. + Used by the following shaders: + Blinn + Phong + Lambert + */ + void setAmbient ( const ColorOrTexture& Ambient ) { mAmbient = Ambient; } + + + /** Declares the amount of light diffusely reflected from the surface of this object. + Used by the following shaders: + Blinn + Phong + Lambert + */ + const ColorOrTexture& getDiffuse () const { return mDiffuse; } + + /** Declares the amount of light diffusely reflected from the surface of this object. + Used by the following shaders: + Blinn + Phong + Lambert + */ + ColorOrTexture& getDiffuse () { return mDiffuse; } + + /** Declares the amount of light diffusely reflected from the surface of this object. + Used by the following shaders: + Blinn + Phong + Lambert + */ + void setDiffuse ( const ColorOrTexture& Diffuse ) { mDiffuse = Diffuse; } + + + /** Declares the color of light specularly reflected from the surface of this object. + Used by the following shaders: + Blinn + Phong + */ + const ColorOrTexture& getSpecular () const { return mSpecular; } + + /** Declares the color of light specularly reflected from the surface of this object. + Used by the following shaders: + Blinn + Phong + */ + ColorOrTexture& getSpecular () { return mSpecular; } + + /** Declares the color of light specularly reflected from the surface of this object. + Used by the following shaders: + Blinn + Phong + */ + void setSpecular ( const ColorOrTexture& Specular ) { mSpecular = Specular; } + + + /** Declares the specularity or roughness of the specular reflection lobe. + Used by the following shaders: + Blinn + Phong + */ + const FloatOrParam& getShininess () const { return mShininess; } + + /** Declares the specularity or roughness of the specular reflection lobe. + Used by the following shaders: + Blinn + Phong + */ + FloatOrParam& getShininess () { return mShininess; } + + /** Declares the specularity or roughness of the specular reflection lobe. + Used by the following shaders: + Blinn + Phong + */ + void setShininess ( const FloatOrParam& Shininess ) { mShininess = Shininess; } + + + + /** Declares the color of a perfect mirror reflection. + Used by the following shaders: + Blinn + Constant + Phong + Lambert + */ + const ColorOrTexture& getReflective() const { return mReflective; } + + /** Declares the color of a perfect mirror reflection. + Used by the following shaders: + Blinn + Constant + Phong + Lambert + */ + ColorOrTexture& getReflective() { return mReflective; } + + /** Declares the color of a perfect mirror reflection. + Used by the following shaders: + Blinn + Constant + Phong + Lambert + */ + void setReflective( const ColorOrTexture& Reflective ) { mReflective = Reflective; } + + + /** Declares the amount of perfect mirror reflection to be added to the reflected light + as a value between 0.0 and 1.0. + Used by the following shaders: + Blinn + Constant + Phong + Lambert + */ + const FloatOrParam& getReflectivity() const { return mReflectivity; } + + /** Declares the amount of perfect mirror reflection to be added to the reflected light + as a value between 0.0 and 1.0. + Used by the following shaders: + Blinn + Constant + Phong + Lambert + */ + FloatOrParam& getReflectivity() { return mReflectivity; } + + /** Declares the amount of perfect mirror reflection to be added to the reflected light + as a value between 0.0 and 1.0. + Used by the following shaders: + Blinn + Constant + Phong + Lambert + */ + void setReflectivity( const FloatOrParam& Reflectivity ) { mReflectivity = Reflectivity; } + + + /** Declares the color of perfectly refracted light. + Used by the following shaders: + Blinn + Phong + Lambert + */ + const ColorOrTexture& getTransparent() const { return mTransparent; } + + /** Declares the color of perfectly refracted light. + Used by the following shaders: + Blinn + Constant + Phong + Lambert + */ + ColorOrTexture& getTransparent() { return mTransparent; } + + /** Declares the color of perfectly refracted light. + Used by the following shaders: + Blinn + Constant + Phong + Lambert + */ + void setTransparent( const ColorOrTexture& Transparent ) { mTransparent = Transparent; } + + + /** Declares the amount of perfectly refracted light added to the reflected color as a + scalar value between 0.0 and 1.0. + Used by the following shaders: + Blinn + Constant + Phong + Lambert + */ + const FloatOrParam& getTransparency() const { return mTransparency; } + + /** Declares the amount of perfectly refracted light added to the reflected color as a + scalar value between 0.0 and 1.0. + Used by the following shaders: + Blinn + Constant + Phong + Lambert + */ + FloatOrParam& getTransparency() { return mTransparency; } + + /** Declares the amount of perfectly refracted light added to the reflected color as a + scalar value between 0.0 and 1.0. + Used by the following shaders: + Blinn + Constant + Phong + Lambert + */ + void setTransparency( const FloatOrParam& Transparency ) { mTransparency = Transparency; } + + + /** Declares the index of refraction for perfectly refracted light as a single scalar index. + Used by the following shaders: + Blinn + Constant + Phong + Lambert + */ + const FloatOrParam& getIndexOfRefraction() const { return mIndexOfRefraction; } + + /** Declares the index of refraction for perfectly refracted light as a single scalar index. + Used by the following shaders: + Blinn + Constant + Phong + Lambert + */ + FloatOrParam& getIndexOfRefraction() { return mIndexOfRefraction; } + + /** Declares the index of refraction for perfectly refracted light as a single scalar index. + Used by the following shaders: + Blinn + Constant + Phong + Lambert + */ + void setIndexOfRefraction( const FloatOrParam& IndexOfRefraction ) { mIndexOfRefraction = IndexOfRefraction; } + + /** clones the effect*/ + EffectCommon* clone( ) { return FW_NEW EffectCommon(*this); } + + private: + + /** Disable default copy ctor. */ +// EffectCommon( const EffectCommon& pre ); + + /** Disable default assignment operator. */ +// const EffectCommon& operator=( const EffectCommon& pre ); + + }; + + typedef PointerArray<EffectCommon> CommonEffectPointerArray; + + +} // namespace COLLADAFW + +#endif // __COLLADAFW_EFFECTCOMMON_H__ Modified: branches/nextgen/COLLADAFramework/scripts/COLLADAFramework.vcproj =================================================================== --- branches/nextgen/COLLADAFramework/scripts/COLLADAFramework.vcproj 2009-02-06 12:50:36 UTC (rev 344) +++ branches/nextgen/COLLADAFramework/scripts/COLLADAFramework.vcproj 2009-02-06 13:12:27 UTC (rev 345) @@ -308,6 +308,10 @@ > </File> <File + RelativePath="..\src\COLLADAFWEffectCommon.cpp" + > + </File> + <File RelativePath="..\src\COLLADAFWFileInfo.cpp" > </File> @@ -458,6 +462,10 @@ > </File> <File + RelativePath="..\include\COLLADAFWEffectCommon.h" + > + </File> + <File RelativePath="..\include\COLLADAFWException.h" > </File> Added: branches/nextgen/COLLADAFramework/src/COLLADAFWEffectCommon.cpp =================================================================== --- branches/nextgen/COLLADAFramework/src/COLLADAFWEffectCommon.cpp (rev 0) +++ branches/nextgen/COLLADAFramework/src/COLLADAFWEffectCommon.cpp 2009-02-06 13:12:27 UTC (rev 345) @@ -0,0 +1,33 @@ +/* + Copyright (c) 2008 NetAllied Systems GmbH + + This file is part of COLLADAFramework. + + Licensed under the MIT Open Source License, + for details please see LICENSE file or the website + http://www.opensource.org/licenses/mit-license.php +*/ + +#include "COLLADAFWStableHeaders.h" +#include "COLLADAFWEffectCommon.h" + + +namespace COLLADAFW +{ + + //------------------------------ + EffectCommon::EffectCommon() + : mShaderType(SHADER_UNKNOWN) + , mShininess(-1) + , mReflectivity(-1) + , mTransparency(-1) + , mIndexOfRefraction(-1) + { + } + + //------------------------------ + EffectCommon::~EffectCommon() + { + } + +} // namespace COLLADAFW Modified: branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLColladaParserAutoGenAttributes.h =================================================================== --- branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLColladaParserAutoGenAttributes.h 2009-02-06 12:50:36 UTC (rev 344) +++ branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLColladaParserAutoGenAttributes.h 2009-02-06 13:12:27 UTC (rev 345) @@ -6064,7 +6064,7 @@ const StringHash HASH_ELEMENT_PROFILE_CG__EXTRA = 84040097; extern const char* NAME_ELEMENT_PROFILE_CG__EXTRA; -const StringHash HASH_ELEMENT_PROFILE_COMMON = 171910622; +const StringHash HASH_ELEMENT_PROFILE_COMMON = 128854558; extern const char* NAME_ELEMENT_PROFILE_COMMON; struct profile_COMMON__AttributeData { Modified: branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLLibraryEffectsLoader.h =================================================================== --- branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLLibraryEffectsLoader.h 2009-02-06 12:50:36 UTC (rev 344) +++ branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLLibraryEffectsLoader.h 2009-02-06 13:12:27 UTC (rev 345) @@ -13,6 +13,7 @@ #include "COLLADASaxFWLPrerequisites.h" #include "COLLADASaxFWLFilePartLoader.h" +#include "COLLADAFWEffectCommon.h" namespace COLLADAFW { @@ -39,12 +40,33 @@ PROFILE_UNKNOWN }; + enum ShaderParameterTypes + { + SHADER_PARAMETER_EMISSION, + SHADER_PARAMETER_AMBIENT, + SHADER_PARAMETER_DIFFUSE, + SHADER_PARAMETER_SPECULAR, + SHADER_PARAMETER_SHININESS, + SHADER_PARAMETER_REFLECTIVE, + SHADER_PARAMETER_REFLECTIVITY, + SHADER_PARAMETER_TRANSPARANT, + SHADER_PARAMETER_TRANSPARANCY, + SHADER_PARAMETER_INDEX_OF_REFRECTION, + UNKNOWN_SHADER_TYPE + }; + private: /** The effect currently being imported.*/ COLLADAFW::Effect* mCurrentEffect; /** The current profile.*/ Profile mCurrentProfile; + + /** The type of the current shader parameter.*/ + ShaderParameterTypes mCurrentShaderParameterType; + + /** The index of the next color component to read.*/ + size_t mCurrentColorValueIndex; public: @@ -54,16 +76,157 @@ /** Destructor. */ virtual ~LibraryEffectsLoader(); + /** Creates a new current effect.*/ virtual bool begin__effect( const effect__AttributeData& attributeData ); /** Sends current material to the writer an deletes it afterwards.*/ virtual bool end__effect(); + + /** Set the current profile to PROFILE_COMMON. Create and append common effect to current + effect.*/ + virtual bool begin__profile_COMMON( const profile_COMMON__AttributeData& attributeData ); + + /** Set the current profile to unknown.*/ + virtual bool end__profile_COMMON(); + + + /** Set the shader type of the current profile.*/ + virtual bool begin__technique__constant(); + + /** We don't need to do anything here.*/ + virtual bool end__technique__constant(){return true;} + + + /** Set the shader type of the current profile.*/ + virtual bool begin__lambert(); + + /** We don't need to do anything here.*/ + virtual bool end__lambert(){return true;} + + + /** Set the shader type of the current profile.*/ + virtual bool begin__phong(); + + /** We don't need to do anything here.*/ + virtual bool end__phong(){return true;} + + /** Set the color or texture kind.*/ + virtual bool begin__phong__emission(){ return true;} + virtual bool end__phong__emission() {return true;} + virtual bool begin__phong__ambient(){return true;} + virtual bool end__phong__ambient(){return true;} + virtual bool begin__phong__diffuse(){return true;} + virtual bool end__phong__diffuse(){return true;} + virtual bool begin__phong__specular(){return true;} + virtual bool end__phong__specular(){return true;} + virtual bool begin__phong__shininess(){return true;} + virtual bool end__phong__shininess(){return true;} + virtual bool begin__phong__reflective(){return true;} + virtual bool end__phong__reflective(){return true;} + virtual bool begin__phong__reflectivity(){return true;} + virtual bool end__phong__reflectivity(){return true;} + virtual bool begin__phong__transparent( const transparent__AttributeData& attributeData ){return true;} + virtual bool end__phong__transparent(){return true;} + virtual bool begin__phong__transparency(){return true;} + virtual bool end__phong__transparency(){return true;} + virtual bool begin__phong__index_of_refraction(){return true;} + virtual bool end__phong__index_of_refraction(){return true;} + + + /** Set the shader type of the current profile.*/ + virtual bool begin__blinn(); + + /** We don't need to do anything here.*/ + virtual bool end__blinn(){return true;} + + + /** Sets the shader parameter type.*/ + virtual bool begin__emission__color( const emission__color__AttributeData& attributeData ); + /** Resets the shader parameter type.*/ + virtual bool end__emission__color(); + /** Stores color data into the correct color object.*/ + virtual bool data__emission__color( const double* value, size_t length ); + + /** Sets the shader parameter type.*/ + virtual bool begin__ambient__color( const ambient__color__AttributeData& attributeData ); + /** Resets the shader parameter type.*/ + virtual bool end__ambient__color(); + /** Stores color data into the correct color object.*/ + virtual bool data__ambient__color( const double* value, size_t length ); + + + /** Sets the shader parameter type.*/ + virtual bool begin__diffuse__color( const diffuse__color__AttributeData& attributeData ); + /** Resets the shader parameter type.*/ + virtual bool end__diffuse__color(); + /** Stores color data into the correct color object.*/ + virtual bool data__diffuse__color( const double* value, size_t length ); + + + /** Sets the shader parameter type.*/ + virtual bool begin__specular__color( const specular__color__AttributeData& attributeData ); + /** Resets the shader parameter type.*/ + virtual bool end__specular__color(); + /** Stores color data into the correct color object.*/ + virtual bool data__specular__color( const double* value, size_t length ); + + /** Sets the shader parameter type.*/ + virtual bool begin__reflective__color( const reflective__color__AttributeData& attributeData ); + /** Resets the shader parameter type.*/ + virtual bool end__reflective__color(); + /** Stores color data into the correct color object.*/ + virtual bool data__reflective__color( const double* value, size_t length ); + + /** Sets the shader parameter type.*/ + virtual bool begin__transparent__color( const transparent__color__AttributeData& attributeData ); + /** Resets the shader parameter type.*/ + virtual bool end__transparent__color(); + /** Stores color data into the correct color object.*/ + virtual bool data__transparent__color( const double* value, size_t length ); + + /** We don't need to do anything here.*/ + virtual bool begin__shininess__float( const shininess__float__AttributeData& attributeData ){return true;} + /** We don't need to do anything here.*/ + virtual bool end__shininess__float(){return true;} + /** Set the value in the effect.*/ + virtual bool data__shininess__float( double value ); + + /** We don't need to do anything here.*/ + virtual bool begin__reflectivity__float( const reflectivity__float__AttributeData& attributeData ){return true;} + /** We don't need to do anything here.*/ + virtual bool end__reflectivity__float(){return true;} + /** Set the value in the effect.*/ + virtual bool data__reflectivity__float( double value ); + + /** We don't need to do anything here.*/ + virtual bool begin__transparency__float( const transparency__float__AttributeData& attributeData ){return true;} + /** We don't need to do anything here.*/ + virtual bool end__transparency__float(){return true;} + /** Set the value in the effect.*/ + virtual bool data__transparency__float( double value ); + + /** We don't need to do anything here.*/ + virtual bool begin__index_of_refraction__float( const index_of_refraction__float__AttributeData& attributeData ){return true;} + /** We don't need to do anything here.*/ + virtual bool end__index_of_refraction__float(){return true;} + /** Set the value in the effect.*/ + virtual bool data__index_of_refraction__float( double value ); + /** Finishes loading a library effects.*/ virtual bool end__library_effects(); + private: + /** Set the shader type of the current profile.*/ + bool setCommonEffectShaderType( COLLADAFW::EffectCommon::ShaderType shaderType); + /** Stores color data into the correct color object.*/ + bool handleColorData( const double* value, size_t length ); + + /** Stores color data into the @a color object.*/ + bool handleColorData( const double* value, size_t length, COLLADAFW::Color& color ); + private: /** Disable default copy ctor. */ Modified: branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLFileLoader.cpp =================================================================== --- branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLFileLoader.cpp 2009-02-06 12:50:36 UTC (rev 344) +++ branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLFileLoader.cpp 2009-02-06 13:12:27 UTC (rev 345) @@ -54,10 +54,12 @@ //----------------------------- bool FileLoader::begin__COLLADA__asset () { + /* deleteFilePartLoader(); AssetLoader* assetLoader = new AssetLoader(this); setPartLoader(assetLoader); setParser(assetLoader); + */ return true; } Modified: branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLLibraryEffectsLoader.cpp =================================================================== --- branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLLibraryEffectsLoader.cpp 2009-02-06 12:50:36 UTC (rev 344) +++ branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLLibraryEffectsLoader.cpp 2009-02-06 13:12:27 UTC (rev 345) @@ -22,6 +22,8 @@ : FilePartLoader(callingFilePartLoader) , mCurrentEffect(0) , mCurrentProfile(PROFILE_UNKNOWN) + , mCurrentShaderParameterType(UNKNOWN_SHADER_TYPE) + , mCurrentColorValueIndex(0) { } @@ -31,8 +33,99 @@ { } + //------------------------------ + bool LibraryEffectsLoader::setCommonEffectShaderType( COLLADAFW::EffectCommon::ShaderType shaderType ) + { + switch ( mCurrentProfile ) + { + case PROFILE_COMMON: + mCurrentEffect->getCommonEffects().back()->setShaderType( shaderType ); + break; + } + return true; + } + //------------------------------ + bool LibraryEffectsLoader::handleColorData( const double* data, size_t length ) + { + switch ( mCurrentProfile ) + { + case PROFILE_COMMON: + { + switch ( mCurrentShaderParameterType ) + { + case SHADER_PARAMETER_EMISSION: + { + COLLADAFW::Color& color = mCurrentEffect->getCommonEffects().back()->getEmission().getColor(); + handleColorData(data, length, color); + break; + } + case SHADER_PARAMETER_AMBIENT: + { + COLLADAFW::Color& color = mCurrentEffect->getCommonEffects().back()->getAmbient().getColor(); + handleColorData(data, length, color); + break; + } + case SHADER_PARAMETER_DIFFUSE: + { + COLLADAFW::Color& color = mCurrentEffect->getCommonEffects().back()->getDiffuse().getColor(); + handleColorData(data, length, color); + break; + } + case SHADER_PARAMETER_SPECULAR: + { + COLLADAFW::Color& color = mCurrentEffect->getCommonEffects().back()->getSpecular().getColor(); + handleColorData(data, length, color); + break; + } + case SHADER_PARAMETER_REFLECTIVE: + { + COLLADAFW::Color& color = mCurrentEffect->getCommonEffects().back()->getReflective().getColor(); + handleColorData(data, length, color); + break; + } + case SHADER_PARAMETER_TRANSPARANT: + { + COLLADAFW::Color& color = mCurrentEffect->getCommonEffects().back()->getTransparent().getColor(); + handleColorData(data, length, color); + break; + } + } + break; + } + } + return true; + + } + + //------------------------------ + bool LibraryEffectsLoader::handleColorData( const double* data, size_t length, COLLADAFW::Color& color ) + { + for ( size_t i = 0; i < length; ++i) + { + switch ( mCurrentColorValueIndex ) + { + case 0: + color.setRed(data[i]); + break; + case 1: + color.setGreen(data[i]); + break; + case 2: + color.setBlue(data[i]); + break; + case 3: + color.setAlpha(data[i]); + break; + } + mCurrentColorValueIndex++; + } + return true; + } + + + //------------------------------ bool LibraryEffectsLoader::begin__effect( const effect__AttributeData& attributeData ) { mCurrentEffect = FW_NEW COLLADAFW::Effect(getUniqueIdFromId(attributeData.id, COLLADAFW::Effect::ID()).getObjectId()); @@ -51,10 +144,209 @@ } //------------------------------ + bool LibraryEffectsLoader::begin__profile_COMMON( const profile_COMMON__AttributeData& attributeData ) + { + mCurrentProfile = PROFILE_COMMON; + mCurrentEffect->getCommonEffects().append(FW_NEW COLLADAFW::EffectCommon() ); + return true; + } + + //------------------------------ + bool LibraryEffectsLoader::end__profile_COMMON() + { + mCurrentProfile = PROFILE_UNKNOWN; + return true; + } + + //------------------------------ + bool LibraryEffectsLoader::begin__technique__constant() + { + return setCommonEffectShaderType(COLLADAFW::EffectCommon::SHADER_CONSTANT); + } + + //------------------------------ + bool LibraryEffectsLoader::begin__lambert() + { + return setCommonEffectShaderType(COLLADAFW::EffectCommon::SHADER_LAMBERT); + } + + //------------------------------ + bool LibraryEffectsLoader::begin__blinn() + { + return setCommonEffectShaderType(COLLADAFW::EffectCommon::SHADER_BLINN); + } + + + //------------------------------ + bool LibraryEffectsLoader::begin__phong() + { + return setCommonEffectShaderType(COLLADAFW::EffectCommon::SHADER_PHONG); + } + + //------------------------------ bool LibraryEffectsLoader::end__library_effects() { finish(); return true; } + //------------------------------ + bool LibraryEffectsLoader::begin__emission__color( const emission__color__AttributeData& attributeData ) + { + mCurrentShaderParameterType = SHADER_PARAMETER_EMISSION; + return true; + } + + //------------------------------ + bool LibraryEffectsLoader::end__emission__color() + { + mCurrentShaderParameterType = UNKNOWN_SHADER_TYPE; + mCurrentColorValueIndex = 0; + return true; + } + + //------------------------------ + bool LibraryEffectsLoader::data__emission__color( const double* data, size_t length ) + { + return handleColorData(data, length); + } + + + //------------------------------ + bool LibraryEffectsLoader::begin__ambient__color( const ambient__color__AttributeData& attributeData ) + { + mCurrentShaderParameterType = SHADER_PARAMETER_AMBIENT; + return true; + } + + //------------------------------ + bool LibraryEffectsLoader::end__ambient__color() + { + mCurrentShaderParameterType = UNKNOWN_SHADER_TYPE; + mCurrentColorValueIndex = 0; + return true; + } + + //------------------------------ + bool LibraryEffectsLoader::data__ambient__color( const double* data, size_t length ) + { + return handleColorData(data, length); + } + + + //------------------------------ + bool LibraryEffectsLoader::begin__diffuse__color( const diffuse__color__AttributeData& attributeData ) + { + mCurrentShaderParameterType = SHADER_PARAMETER_DIFFUSE; + return true; + } + + //------------------------------ + bool LibraryEffectsLoader::end__diffuse__color() + { + mCurrentShaderParameterType = UNKNOWN_SHADER_TYPE; + mCurrentColorValueIndex = 0; + return true; + } + + //------------------------------ + bool LibraryEffectsLoader::data__diffuse__color( const double* data, size_t length ) + { + return handleColorData(data, length); + } + + + + //------------------------------ + bool LibraryEffectsLoader::begin__specular__color( const specular__color__AttributeData& attributeData ) + { + mCurrentShaderParameterType = SHADER_PARAMETER_SPECULAR; + return true; + } + + //------------------------------ + bool LibraryEffectsLoader::end__specular__color() + { + mCurrentShaderParameterType = UNKNOWN_SHADER_TYPE; + mCurrentColorValueIndex = 0; + return true; + } + + //------------------------------ + bool LibraryEffectsLoader::data__specular__color( const double* data, size_t length ) + { + return handleColorData(data, length); + } + + + //------------------------------ + bool LibraryEffectsLoader::begin__reflective__color( const reflective__color__AttributeData& attributeData ) + { + mCurrentShaderParameterType = SHADER_PARAMETER_REFLECTIVE; + return true; + } + + //------------------------------ + bool LibraryEffectsLoader::end__reflective__color() + { + mCurrentShaderParameterType = UNKNOWN_SHADER_TYPE; + mCurrentColorValueIndex = 0; + return true; + } + + //------------------------------ + bool LibraryEffectsLoader::data__reflective__color( const double* data, size_t length ) + { + return handleColorData(data, length); + } + + //------------------------------ + bool LibraryEffectsLoader::begin__transparent__color( const transparent__color__AttributeData& attributeData ) + { + mCurrentShaderParameterType = SHADER_PARAMETER_TRANSPARANT; + return true; + } + + //------------------------------ + bool LibraryEffectsLoader::end__transparent__color() + { + mCurrentShaderParameterType = UNKNOWN_SHADER_TYPE; + mCurrentColorValueIndex = 0; + return true; + } + + //------------------------------ + bool LibraryEffectsLoader::data__transparent__color( const double* data, size_t length ) + { + return handleColorData(data, length); + } + + //------------------------------ + bool LibraryEffectsLoader::data__shininess__float( double value ) + { + mCurrentEffect->getCommonEffects().back()->setShininess(value); + return true; + } + + //------------------------------ + bool LibraryEffectsLoader::data__reflectivity__float( double value ) + { + mCurrentEffect->getCommonEffects().back()->setReflectivity(value); + return true; + } + + //------------------------------ + bool LibraryEffectsLoader::data__transparency__float( double value ) + { + mCurrentEffect->getCommonEffects().back()->setTransparency(value); + return true; + } + + //------------------------------ + bool LibraryEffectsLoader::data__index_of_refraction__float( double value ) + { + mCurrentEffect->getCommonEffects().back()->setIndexOfRefraction(value); + return true; + } + } // namespace COLLADASaxFWL This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jud...@us...> - 2009-02-06 12:50:41
|
Revision: 344 http://colladamaya.svn.sourceforge.net/colladamaya/?rev=344&view=rev Author: judithschenk Date: 2009-02-06 12:50:36 +0000 (Fri, 06 Feb 2009) Log Message: ----------- Implementation of maya tristrips and trifans import Modified Paths: -------------- branches/nextgen/COLLADAFramework/include/COLLADAFWFileInfo.h branches/nextgen/COLLADAFramework/include/COLLADAFWMeshPrimitive.h branches/nextgen/COLLADAFramework/include/COLLADAFWMeshPrimitiveWithFaceVertexCount.h branches/nextgen/COLLADAFramework/src/COLLADAFWFileInfo.cpp branches/nextgen/COLLADAFramework/src/COLLADAFWMeshPrimitive.cpp branches/nextgen/COLLADAMaya/include/COLLADAMayaDocumentImporter.h branches/nextgen/COLLADAMaya/include/COLLADAMayaGeometryImporter.h branches/nextgen/COLLADAMaya/include/COLLADAMayaVisualSceneImporter.h branches/nextgen/COLLADAMaya/scripts/COLLADAMaya.vcproj branches/nextgen/COLLADAMaya/src/COLLADAMayaDocumentImporter.cpp branches/nextgen/COLLADAMaya/src/COLLADAMayaFileTranslator.cpp branches/nextgen/COLLADAMaya/src/COLLADAMayaGeometryImporter.cpp branches/nextgen/COLLADAMaya/src/COLLADAMayaVisualSceneImporter.cpp branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLMeshLoader.cpp branches/nextgen/GeneratedSaxParser/scripts/GeneratedSaxParser.vcproj Removed Paths: ------------- branches/nextgen/COLLADAMaya/include/COLLADAMayaSceneNodeTraverser.h branches/nextgen/COLLADAMaya/include/COLLADAMayaSceneTraverserListener.h branches/nextgen/COLLADAMaya/src/COLLADAMayaSceneNodeTraverser.cpp branches/nextgen/COLLADAMaya/src/COLLADAMayaSceneTraverserListener.cpp Modified: branches/nextgen/COLLADAFramework/include/COLLADAFWFileInfo.h =================================================================== --- branches/nextgen/COLLADAFramework/include/COLLADAFWFileInfo.h 2009-02-05 15:00:48 UTC (rev 343) +++ branches/nextgen/COLLADAFramework/include/COLLADAFWFileInfo.h 2009-02-06 12:50:36 UTC (rev 344) @@ -29,9 +29,11 @@ { public: - /** A pair where you can hold file informations. */ - ArrayPrimitiveType<std::pair<String, String>> mValuePairArray; + typedef std::pair<String, String> ValuePair; + typedef ArrayPrimitiveType<ValuePair*> ValuePairArray; + public: + /** Descriptive information about unit of measure. Its optional attributes are:*/ struct Unit { @@ -83,6 +85,9 @@ to the right, and which is considered inward. */ UpAxisType mUpAxisType; + /** A pair where you can hold file informations. */ + ValuePairArray mValuePairArray; + public: /** Constructor. */ @@ -92,19 +97,13 @@ virtual ~FileInfo(); /** A pair where you can hold file informations. */ - void appendValuePair ( const std::pair<String, String>& valuePair ) - { - mValuePairArray.append ( valuePair ); - } + void appendValuePair ( ValuePair* valuePair ); /** A pair where you can hold file informations. */ - void appendValuePair ( const String& value1, String& value2 ) - { - mValuePairArray.append ( std::pair<String, String> ( value1, value2 ) ); - } + void appendValuePair ( const String& value1, const String& value2 ); /** A pair where you can hold file informations. */ - const ArrayPrimitiveType<std::pair<String, String>> getValuePairArray () const { return mValuePairArray; } + const ValuePairArray& getValuePairArray () const { return mValuePairArray; } /** Sets the unit used by the document. Modified: branches/nextgen/COLLADAFramework/include/COLLADAFWMeshPrimitive.h =================================================================== --- branches/nextgen/COLLADAFramework/include/COLLADAFWMeshPrimitive.h 2009-02-05 15:00:48 UTC (rev 343) +++ branches/nextgen/COLLADAFramework/include/COLLADAFWMeshPrimitive.h 2009-02-06 12:50:36 UTC (rev 344) @@ -279,6 +279,8 @@ /* * Determine the edge indices (unique edges, also for multiple primitive elements) * and write it into the lists (the indices referes on the position indices). + * Does it for triangle elements, polygons or polylist. Trifans and tristrips are a little + * bit special. * @param edgeIndices * A vector of edge indices. We use it to write the list of edges into the maya * file. The vector is already sorted. @@ -292,6 +294,59 @@ std::map<Edge,size_t>& edgeIndicesMap ); /* + * Determine the edge indices (unique edges, also for multiple primitive elements) + * and write it into the lists (the indices referes on the position indices). + * Does it for triangle elements, polygons or polylist. + * @param edgeIndices + * A vector of edge indices. We use it to write the list of edges into the maya + * file. The vector is already sorted. + * @param edgeIndicesMap + * We store the edge indices also in a sorted map. The dublicate data holding + * is reasonable, because we need the index of a given edge. The search of + * values in a map is much faster than in a vector! + */ + void appendPolygonEdgeIndices ( + std::vector<Edge>& edgeIndices, + std::map<Edge,size_t>& edgeIndicesMap ); + + /* + * Determine the edge indices (unique edges, also for multiple primitive elements) + * and write it into the lists (the indices referes on the position indices). + * Does it for trifans. + * @param edgeIndices + * A vector of edge indices. We use it to write the list of edges into the maya + * file. The vector is already sorted. + * @param edgeIndicesMap + * We store the edge indices also in a sorted map. The dublicate data holding + * is reasonable, because we need the index of a given edge. The search of + * values in a map is much faster than in a vector! + */ + void appendTrifansEdgeIndices ( + std::vector<Edge>& edgeIndices, + std::map<Edge,size_t>& edgeIndicesMap ); + + /* + * Determine the edge indices (unique edges, also for multiple primitive elements) + * and write it into the lists (the indices referes on the position indices). + * Does it for tristrips. + * @param edgeIndices + * A vector of edge indices. We use it to write the list of edges into the maya + * file. The vector is already sorted. + * @param edgeIndicesMap + * We store the edge indices also in a sorted map. The dublicate data holding + * is reasonable, because we need the index of a given edge. The search of + * values in a map is much faster than in a vector! + */ + void appendTristripsEdgeIndices ( + std::vector<Edge>& edgeIndices, + std::map<Edge,size_t>& edgeIndicesMap ); + + /* + * Determine the number of grouped vertex elements in the current mesh primitive. + */ + int getGroupedVertexElementsCount () const; + + /* * Appends the data of an edge, if it is not already in the list. */ void appendEdge( Modified: branches/nextgen/COLLADAFramework/include/COLLADAFWMeshPrimitiveWithFaceVertexCount.h =================================================================== --- branches/nextgen/COLLADAFramework/include/COLLADAFWMeshPrimitiveWithFaceVertexCount.h 2009-02-05 15:00:48 UTC (rev 343) +++ branches/nextgen/COLLADAFramework/include/COLLADAFWMeshPrimitiveWithFaceVertexCount.h 2009-02-06 12:50:36 UTC (rev 344) @@ -85,7 +85,7 @@ if ( faceIndex >= mGroupedVerticesVertexCountArray.getCount () ) { std::cerr << "Face index out of range: " << faceIndex << std::endl; - throw new FrameworkException ( "Face index out of range: " + faceIndex ); + assert ( "Face index out of range: " + faceIndex ); } return mGroupedVerticesVertexCountArray [ faceIndex ]; Modified: branches/nextgen/COLLADAFramework/src/COLLADAFWFileInfo.cpp =================================================================== --- branches/nextgen/COLLADAFramework/src/COLLADAFWFileInfo.cpp 2009-02-05 15:00:48 UTC (rev 343) +++ branches/nextgen/COLLADAFramework/src/COLLADAFWFileInfo.cpp 2009-02-06 12:50:36 UTC (rev 344) @@ -24,6 +24,7 @@ //------------------------------ FileInfo::FileInfo() : mUpAxisType ( Y_UP ) + , mValuePairArray ( ValuePairArray::OWNER ) { mUnit.mLinearUnit = "centimeter"; mUnit.mAngularUnit = "degree"; @@ -47,4 +48,16 @@ else mUpAxisType = NONE; } + + //------------------------------ + void FileInfo::appendValuePair ( ValuePair* valuePair ) + { + mValuePairArray.append ( valuePair ); + } + + //------------------------------ + void FileInfo::appendValuePair ( const String& value1, const String& value2 ) + { + mValuePairArray.append ( new ValuePair ( value1, value2 ) ); + } } // namespace COLLADAFW Modified: branches/nextgen/COLLADAFramework/src/COLLADAFWMeshPrimitive.cpp =================================================================== --- branches/nextgen/COLLADAFramework/src/COLLADAFWMeshPrimitive.cpp 2009-02-05 15:00:48 UTC (rev 343) +++ branches/nextgen/COLLADAFramework/src/COLLADAFWMeshPrimitive.cpp 2009-02-06 12:50:36 UTC (rev 344) @@ -12,6 +12,8 @@ #include "COLLADAFWMeshPrimitive.h" #include "COLLADAFWPolygons.h" #include "COLLADAFWMeshPrimitiveWithFaceVertexCount.h" +#include "COLLADAFWTrifans.h" +#include "COLLADAFWTristrips.h" namespace COLLADAFW @@ -49,9 +51,13 @@ switch ( mPrimitiveType ) { case TRIANGLES: + return 3; + break; case TRIANGLE_FANS: + return ((Trifans*)this)->getGroupedVerticesVertexCount ( faceIndex ); + break; case TRIANGLE_STRIPS: - return 3; + return ((Tristrips*)this)->getGroupedVerticesVertexCount ( faceIndex ); break; case POINTS: return 1; @@ -75,31 +81,34 @@ std::vector<Edge>& edgeIndices, std::map<Edge,size_t>& edgeIndicesMap ) { - // Get the number of grouped vertex elements (faces, holes, tristrips or trifans). - int groupedVertexElementsCount = 0; - COLLADAFW::MeshPrimitive::PrimitiveType primitiveType = this->getPrimitiveType (); switch ( primitiveType ) { - case COLLADAFW::MeshPrimitive::TRIANGLES: case COLLADAFW::MeshPrimitive::TRIANGLE_FANS: + appendTrifansEdgeIndices ( edgeIndices, edgeIndicesMap ); + break; case COLLADAFW::MeshPrimitive::TRIANGLE_STRIPS: - groupedVertexElementsCount = (int)this->getFaceCount (); + appendTristripsEdgeIndices ( edgeIndices, edgeIndicesMap ); break; case COLLADAFW::MeshPrimitive::POLYGONS: case COLLADAFW::MeshPrimitive::POLYLIST: - { - COLLADAFW::Polygons* polygons = (COLLADAFW::Polygons*)this; - COLLADAFW::Polygons::VertexCountArray& vertexCountArray = - polygons->getGroupedVerticesVertexCountArray (); - groupedVertexElementsCount = (int)vertexCountArray.getCount (); - } + case COLLADAFW::MeshPrimitive::TRIANGLES: + appendPolygonEdgeIndices(edgeIndices, edgeIndicesMap); break; default: - std::cerr << "Primitive type not supported: " << primitiveType << std::endl; - return; + std::cerr << "Primitive type not implemented!" << std::endl; + assert ( "Primitive type not implemented!"); } + } + //----------------------------- + void MeshPrimitive::appendPolygonEdgeIndices ( + std::vector<Edge>& edgeIndices, + std::map<Edge,size_t>& edgeIndicesMap ) + { + // Get the number of grouped vertex elements (faces, holes, tristrips or trifans). + int groupedVertexElementsCount = getGroupedVertexElementsCount (); + // Make the count positive, if we have a hole. if ( groupedVertexElementsCount < 0 ) groupedVertexElementsCount *= -1; @@ -127,9 +136,12 @@ { // Set the edge vertex index values into an edge object. edgeStartVertexIndex = positionIndices[positionIndex]; + if ( edgeIndex<(numEdges-1) ) edgeEndVertexIndex = positionIndices[++positionIndex]; - else edgeEndVertexIndex = positionIndices[positionIndex-numEdges+1]; + else + edgeEndVertexIndex = positionIndices[positionIndex-numEdges+1]; + Edge edge ( edgeStartVertexIndex, edgeEndVertexIndex ); // Appends the data of an edge to the edgeIndices list, @@ -137,12 +149,186 @@ appendEdge ( edge, edgeIndices, edgeIndicesMap ); } - // Increment the positions index for the next face + // Increment the positions index for the next face, if it is a triangle or polygon. + // A trifan has the first edge of the next face always at the position of the last edge. ++positionIndex; } } //----------------------------- + void MeshPrimitive::appendTrifansEdgeIndices ( + std::vector<Edge>& edgeIndices, + std::map<Edge,size_t>& edgeIndicesMap ) + { + // Get the position indices. + const COLLADAFW::UIntValuesArray& positionIndices = getPositionIndices (); + + // The points of an edge + int edgeStartVtxIndex=0, edgeEndVtxIndex=0; + + // The current index in the positions list. + size_t initialPositionIndex=0; + size_t positionIndex=0; + + // Iterate over the grouped vertices and get the edges for every group. + COLLADAFW::Trifans* trifans = (COLLADAFW::Trifans*) this; + COLLADAFW::Trifans::VertexCountArray& vertexCountArray = + trifans->getGroupedVerticesVertexCountArray (); + size_t groupedVertexElementsCount = vertexCountArray.getCount (); + for ( size_t groupedVerticesIndex=0; groupedVerticesIndex<groupedVertexElementsCount; ++groupedVerticesIndex ) + { + // A trifan has always triangles, which have 3 edges + size_t triangleEdgeCounter = 0; + + // The number of vertices in the current vertex group. + unsigned int vertexCount = vertexCountArray [groupedVerticesIndex]; + + // Determine the number of edges and iterate over it. + unsigned int numEdges = ( vertexCount - 3 ) * 3 + 3; + for ( unsigned int edgeIndex=0; edgeIndex<numEdges; ++edgeIndex ) + { + // Increment the current triangle edge counter, so we know if we have the full triangle. + ++triangleEdgeCounter; + + // Get the start edge index + if ( triangleEdgeCounter > 1 ) + edgeStartVtxIndex = positionIndices[positionIndex]; + else edgeStartVtxIndex = positionIndices[initialPositionIndex]; + + // With the third edge of a triangle, we have to go back to the trifans root. + if ( triangleEdgeCounter < 3 ) + edgeEndVtxIndex = positionIndices[++positionIndex]; + else edgeEndVtxIndex = positionIndices[initialPositionIndex]; + + Edge edge ( edgeStartVtxIndex, edgeEndVtxIndex ); + + // Appends the data of an edge to the edgeIndices list, + // if it is not already in the list. + appendEdge ( edge, edgeIndices, edgeIndicesMap ); + + // Reset the edge counter, if we have all three edges of a triangle. + if ( triangleEdgeCounter == 3 ) + { + triangleEdgeCounter = 0; + --positionIndex; + } + } + + // Increment the initial trifan position index for the next trifan object. + initialPositionIndex += vertexCount; + positionIndex += 2; + } + } + + //----------------------------- + void MeshPrimitive::appendTristripsEdgeIndices ( + std::vector<Edge>& edgeIndices, + std::map<Edge,size_t>& edgeIndicesMap ) + { + // Get the position indices. + const COLLADAFW::UIntValuesArray& positionIndices = getPositionIndices (); + + // The points of an edge + int edgeStartVtxIndex=0, edgeEndVtxIndex=0; + + // The current index in the positions list. + size_t initialPositionIndex=0; + size_t positionIndex=0; + + // Iterate over the grouped vertices and get the edges for every group. + COLLADAFW::Tristrips* trifans = (COLLADAFW::Tristrips*) this; + COLLADAFW::Tristrips::VertexCountArray& vertexCountArray = + trifans->getGroupedVerticesVertexCountArray (); + size_t groupedVertexElementsCount = vertexCountArray.getCount (); + for ( size_t groupedVerticesIndex=0; groupedVerticesIndex<groupedVertexElementsCount; ++groupedVerticesIndex ) + { + // A trifan has always triangles, which have 3 edges + size_t triangleEdgeCounter = 0; + + // The number of vertices in the current vertex group. + unsigned int vertexCount = vertexCountArray [groupedVerticesIndex]; + + // Determine the number of edges and iterate over it. + unsigned int numEdges = ( vertexCount - 3 ) * 3 + 3; + for ( unsigned int edgeIndex=0; edgeIndex<numEdges; ++edgeIndex ) + { + // Increment the current triangle edge counter, so we know if we have the full triangle. + ++triangleEdgeCounter; + + // Get the start edge index + edgeStartVtxIndex = positionIndices[positionIndex]; + + // With the third edge of a triangle, we have to go back to the trifans root. + if ( triangleEdgeCounter < 3 ) + edgeEndVtxIndex = positionIndices[++positionIndex]; + else edgeEndVtxIndex = positionIndices[initialPositionIndex]; + + Edge edge ( edgeStartVtxIndex, edgeEndVtxIndex ); + + // Appends the data of an edge to the edgeIndices list, + // if it is not already in the list. + appendEdge ( edge, edgeIndices, edgeIndicesMap ); + + // Reset the edge counter, if we have all three edges of a triangle. + if ( triangleEdgeCounter == 3 ) + { + triangleEdgeCounter = 0; + --positionIndex; + initialPositionIndex = positionIndex; + } + } + + // Increment the initial tristrip position index for the next tristrip object. + positionIndex += 2; + initialPositionIndex = positionIndex; + } + } + + //----------------------------- + int MeshPrimitive::getGroupedVertexElementsCount () const + { + // Get the number of grouped vertex elements (faces, holes, tristrips or trifans). + int groupedVertexElementsCount = 0; + + COLLADAFW::MeshPrimitive::PrimitiveType primitiveType = this->getPrimitiveType (); + switch ( primitiveType ) + { + case COLLADAFW::MeshPrimitive::TRIANGLES: + { + groupedVertexElementsCount = (int) this->getFaceCount (); + break; + } + case COLLADAFW::MeshPrimitive::TRIANGLE_FANS: + { + COLLADAFW::Trifans* trifans = (COLLADAFW::Trifans*) this; + groupedVertexElementsCount = (int) trifans->getTrifanCount (); + break; + } + case COLLADAFW::MeshPrimitive::TRIANGLE_STRIPS: + { + COLLADAFW::Tristrips* tristrips = (COLLADAFW::Tristrips*) this; + groupedVertexElementsCount = (int) tristrips->getTristripCount (); + break; + } + case COLLADAFW::MeshPrimitive::POLYGONS: + case COLLADAFW::MeshPrimitive::POLYLIST: + { + COLLADAFW::Polygons* polygons = (COLLADAFW::Polygons*) this; + COLLADAFW::Polygons::VertexCountArray& vertexCountArray = + polygons->getGroupedVerticesVertexCountArray (); + groupedVertexElementsCount = (int) vertexCountArray.getCount (); + } + break; + default: + std::cerr << "Primitive type not supported: " << primitiveType << std::endl; + assert ( "Primitive type not supported: " + primitiveType ); + return 0; + } + + return groupedVertexElementsCount; + } + + //----------------------------- void MeshPrimitive::appendEdge ( const Edge& edge, std::vector<Edge>& edgeIndices, Modified: branches/nextgen/COLLADAMaya/include/COLLADAMayaDocumentImporter.h =================================================================== --- branches/nextgen/COLLADAMaya/include/COLLADAMayaDocumentImporter.h 2009-02-05 15:00:48 UTC (rev 343) +++ branches/nextgen/COLLADAMaya/include/COLLADAMayaDocumentImporter.h 2009-02-06 12:50:36 UTC (rev 344) @@ -24,6 +24,8 @@ #include "COLLADAFWFileInfo.h" #include "COLLADAFWVisualScene.h" #include "COLLADAFWGeometry.h" +#include "COLLADAFWMaterial.h" +#include "COLLADAFWEffect.h" #include <set> @@ -105,12 +107,6 @@ */ const COLLADABU::URI& getMayaAsciiFileURI () const; - /** - * Set the name of the current maya ascii file to export. - * @param const COLLADABU::URI& The current maya ascii file. - */ - void setMayaAsciiFileURI ( const COLLADABU::URI& fileURI ); - /** Pointer to the visual scene importer. */ VisualSceneImporter* getVisualSceneImporter () { return mVisualSceneImporter; } const VisualSceneImporter* getVisualSceneImporter () const { return mVisualSceneImporter; } @@ -156,6 +152,14 @@ @return The writer should return true, if writing succeeded, false otherwise.*/ virtual bool writeLibraryNodes ( const COLLADAFW::LibraryNodes* libraryNodes ); + /** When this method is called, the writer must write the material. + @return The writer should return true, if writing succeeded, false otherwise.*/ + virtual bool writeMaterial( const COLLADAFW::Material* material ) { return true; } + + /** When this method is called, the writer must write the effect. + @return The writer should return true, if writing succeeded, false otherwise.*/ + virtual bool writeEffect( const COLLADAFW::Effect* effect ) { return true; } + private: /** Imports the current scene. */ Modified: branches/nextgen/COLLADAMaya/include/COLLADAMayaGeometryImporter.h =================================================================== --- branches/nextgen/COLLADAMaya/include/COLLADAMayaGeometryImporter.h 2009-02-05 15:00:48 UTC (rev 343) +++ branches/nextgen/COLLADAMaya/include/COLLADAMayaGeometryImporter.h 2009-02-06 12:50:36 UTC (rev 344) @@ -76,19 +76,27 @@ /** * Imports the data of the current mesh element. */ - bool importMesh ( const COLLADAFW::Mesh* mesh ); + void importMesh ( const COLLADAFW::Mesh* mesh ); /** * Writes the geometry of the current mesh. */ - bool createMesh ( + void createMesh ( const COLLADAFW::Mesh* mesh, MayaNode* parentMayaNode ); + /** + * Iterates over the mesh primitives and reads the edge indices. + */ + void getEdgeIndices ( + const COLLADAFW::Mesh* mesh, + std::vector<COLLADAFW::Edge>& edgeIndices, + std::map<COLLADAFW::Edge,size_t>& edgeIndicesMap ); + /* * Write the face informations into the maya file. */ - bool writeFaces ( + void writeFaces ( const COLLADAFW::Mesh* mesh, const std::map<COLLADAFW::Edge,size_t>& edgeIndicesMap, MayaDM::Mesh &meshNode ); @@ -96,16 +104,34 @@ /* * Write the face values of the given primitive element into the maya file. */ - bool appendPolyFaces ( + void appendPolygonPolyFaces ( const COLLADAFW::Mesh* mesh, const COLLADAFW::MeshPrimitive* primitiveElement, const std::map<COLLADAFW::Edge,size_t>& edgeIndicesMap, MayaDM::Mesh &meshNode ); + /* + * Write the face values of the given primitive element into the maya file. + */ + void appendTrifansPolyFaces ( + const COLLADAFW::Mesh* mesh, + const COLLADAFW::MeshPrimitive* primitiveElement, + const std::map<COLLADAFW::Edge,size_t>& edgeIndicesMap, + MayaDM::Mesh &meshNode ); + + /* + * Write the face values of the given primitive element into the maya file. + */ + void appendTristripsPolyFaces ( + const COLLADAFW::Mesh* mesh, + const COLLADAFW::MeshPrimitive* primitiveElement, + const std::map<COLLADAFW::Edge,size_t>& edgeIndicesMap, + MayaDM::Mesh &meshNode ); + /** * Set the face infos into the maya poly face element. */ - void setFaceInfos ( + void setPolygonFaceInfos ( const COLLADAFW::Mesh* mesh, const COLLADAFW::MeshPrimitive* primitiveElement, const std::map<COLLADAFW::Edge,size_t>& edgeIndicesMap, @@ -114,20 +140,11 @@ size_t &positionIndex, std::vector<COLLADABU::Math::Vector3*> &polygonPoints ); - void setFaceInfo ( + void setPolygonHoleInfos ( const COLLADAFW::Mesh* mesh, const COLLADAFW::MeshPrimitive* primitiveElement, const std::map<COLLADAFW::Edge,size_t>& edgeIndicesMap, MayaDM::polyFaces &polyFace, - int & numEdges, - size_t & positionIndex, - std::vector<COLLADABU::Math::Vector3*> &polygonPoints ); - - void setHoleInfo ( - const COLLADAFW::Mesh* mesh, - const COLLADAFW::MeshPrimitive* primitiveElement, - const std::map<COLLADAFW::Edge,size_t>& edgeIndicesMap, - MayaDM::polyFaces &polyFace, int &numEdges, size_t &positionIndex, std::vector<COLLADABU::Math::Vector3*> & polygonPoints ); @@ -160,11 +177,6 @@ void changePolyFaceHoleOrientation( MayaDM::polyFaces &polyFace ); /* - * Returns the number of grouped vertices (polygons, triangles, faces, holes, ...). - */ - size_t getGroupedVerticesCount( const COLLADAFW::MeshPrimitive* primitiveElement ); - - /* * Returns true, if we have to change the orientation of the current hole. */ bool changeHoleOrientation ( @@ -181,36 +193,36 @@ /* * Write the edges into the maya file. */ - bool writeEdges ( + void writeEdges ( const std::vector<COLLADAFW::Edge> &edgeIndices, MayaDM::Mesh &meshNode ); /* * Write the uv coordinates into the maya file. */ - bool writeUVSets ( const COLLADAFW::Mesh* mesh, MayaDM::Mesh &meshNode ); + void writeUVSets ( const COLLADAFW::Mesh* mesh, MayaDM::Mesh &meshNode ); /* * Write the uv coordinates into the maya file. */ - bool writeColorSets ( const COLLADAFW::Mesh* mesh, MayaDM::Mesh &meshNode ); + void writeColorSets ( const COLLADAFW::Mesh* mesh, MayaDM::Mesh &meshNode ); /* * Write the normals values into the maya file. */ - bool writeNormals ( const COLLADAFW::Mesh* mesh, MayaDM::Mesh &meshNode ); + void writeNormals ( const COLLADAFW::Mesh* mesh, MayaDM::Mesh &meshNode ); /* * Appends the normal values of all mesh primitive elements into the maya file. */ - bool appendNormalValues ( + void appendNormalValues ( const COLLADAFW::Mesh* mesh, MayaDM::Mesh &meshNode ); /* * Write the vertex position values into the maya file. */ - bool writeVertexPositions ( + void writeVertexPositions ( const COLLADAFW::Mesh* mesh, MayaDM::Mesh &meshNode ); Deleted: branches/nextgen/COLLADAMaya/include/COLLADAMayaSceneNodeTraverser.h =================================================================== --- branches/nextgen/COLLADAMaya/include/COLLADAMayaSceneNodeTraverser.h 2009-02-05 15:00:48 UTC (rev 343) +++ branches/nextgen/COLLADAMaya/include/COLLADAMayaSceneNodeTraverser.h 2009-02-06 12:50:36 UTC (rev 344) @@ -1,55 +0,0 @@ -/* - Copyright (c) 2008 NetAllied Systems GmbH - - This file is part of COLLADAMaya. - - Portions of the code are: - Copyright (c) 2005-2007 Feeling Software Inc. - Copyright (c) 2005-2007 Sony Computer Entertainment America - Copyright (c) 2004-2005 Alias Systems Corp. - - Licensed under the MIT Open Source License, - for details please see LICENSE file or the website - http://www.opensource.org/licenses/mit-license.php -*/ - -#ifndef __COLLADA_MAYA_SCENE_NODE_TRAVERSER_H__ -#define __COLLADA_MAYA_SCENE_NODE_TRAVERSER_H__ - -#include "COLLADAMayaStableHeaders.h" -#include "COLLADAMayaDocumentImporter.h" - -#include "COLLADADHNodeTraverser.h" - -namespace COLLADAMaya -{ - - /** Declares the implementation of the node traverser for the node traverser listener. */ - class SceneNodeTraverser : public COLLADADH::NodeTraverser - { - - private: - - /** Pointer to the current document importer. */ - DocumentImporter* mDocumentImporter; - - public: - - /** Constructor. - @param nodeContainer. A element which contains nodes. - */ - SceneNodeTraverser ( DocumentImporter* documentImporter, daeElement &nodeContainer ); - - /** Destructor. */ - virtual ~SceneNodeTraverser () {} - - /** Returns a pointer to the current document importer. */ - DocumentImporter* getDocumentImporter () { return mDocumentImporter; } - - /** Returns a pointer to the current document importer. */ - const DocumentImporter* getDocumentImporter () const { return mDocumentImporter; } - - }; -} - -#endif // __COLLADA_MAYA_SCENE_NODE_TRAVERSER_H__ \ No newline at end of file Deleted: branches/nextgen/COLLADAMaya/include/COLLADAMayaSceneTraverserListener.h =================================================================== --- branches/nextgen/COLLADAMaya/include/COLLADAMayaSceneTraverserListener.h 2009-02-05 15:00:48 UTC (rev 343) +++ branches/nextgen/COLLADAMaya/include/COLLADAMayaSceneTraverserListener.h 2009-02-06 12:50:36 UTC (rev 344) @@ -1,97 +0,0 @@ -/* - Copyright (c) 2008 NetAllied Systems GmbH - - This file is part of COLLADAMaya. - - Portions of the code are: - Copyright (c) 2005-2007 Feeling Software Inc. - Copyright (c) 2005-2007 Sony Computer Entertainment America - Copyright (c) 2004-2005 Alias Systems Corp. - - Licensed under the MIT Open Source License, - for details please see LICENSE file or the website - http://www.opensource.org/licenses/mit-license.php -*/ - -#ifndef __COLLADA_MAYA_NODE_TRAVERSER_H__ -#define __COLLADA_MAYA_NODE_TRAVERSER_H__ - -#include "COLLADAMayaStableHeaders.h" -#include "COLLADAMayaSceneNodeTraverser.h" - -#include "COLLADADHNodeTraverser.h" - -namespace COLLADAMaya -{ - - /** Declares the listener implementation of the TraverserListener */ - class SceneTraverserListener : public COLLADADH::NodeTraverser::TraverserListener - { - - private: - - /** Pointer to the node traverser. */ - SceneNodeTraverser* mTraverser; - - public: - - /** Constructor. */ - SceneTraverserListener ( SceneNodeTraverser* traverser ) : mTraverser ( traverser ) {} - - /** Destructor. */ - virtual ~SceneTraverserListener () {} - - /** Callback method when a node is found. - @par see COLLADA::NodeTraverseListener::preDetectedNode(domNode&, int&); - @param node. The found node. - @param level. The depth in the tree. - @return true if traversing is to be continued, otherwise false. - @todo: transformations!!! - */ - virtual bool preDetectedNode( domNode& node, int level ); - - /** Callback method when a node is found and all its sub elements - were detected. - @par see COLLADA::NodeTraverseListener::postDetectedNode(domNode&, int&); - @param node. The found node. - @param level. The depth in the tree. - @return true if traversing is to be continued, otherwise false. - */ - virtual bool postDetectedNode( domNode& node, int level ); - - /** Callback method when an instance_node is found. - @param instance. The found node. - @param level. The depth in the tree. - @return true if traversing is to be continued, otherwise false. - */ - virtual bool detectedInstanceNode(domInstance_node& instance, int level); - - /** Callback method when an instance_node is found. - @par see COLLADA::NodeTraverseListener::domInstance_geometry(domNode&, int&); - @param node. The found node. - @param level. The depth in the tree. - @return true if traversing is to be continued, otherwise false. - @todo: for uniqueEntityId: getScopeId for parent hierarchy of node(s) - */ - virtual bool detectedInstanceGeometry( domInstance_geometry& instance, int level ); - - /** Callback method when an instance_light is found. - empty implementation. - */ - virtual bool detectedInstanceLight( domInstance_light& instance, int level ); - - /** Callback method when an instance_camera is found. - empty implementation. - */ - virtual bool detectedInstanceCamera( domInstance_camera& instance, int level ); - - /** Callback method when an extra within a node is found. - @param extra. The found extra. - @param level. The depth in the tree. - @return true if traversing is to be continued, otherwise false. - */ - virtual bool detectedNodeExtra(domExtra& extra, int level); - }; -} - -#endif // __COLLADA_MAYA_NODE_TRAVERSER_H__ \ No newline at end of file Modified: branches/nextgen/COLLADAMaya/include/COLLADAMayaVisualSceneImporter.h =================================================================== --- branches/nextgen/COLLADAMaya/include/COLLADAMayaVisualSceneImporter.h 2009-02-05 15:00:48 UTC (rev 343) +++ branches/nextgen/COLLADAMaya/include/COLLADAMayaVisualSceneImporter.h 2009-02-06 12:50:36 UTC (rev 344) @@ -207,6 +207,7 @@ */ MayaDM::Transform* createNode ( const COLLADAFW::Node* node, + const String& nodeName, const String& parentNodeName ); /** Modified: branches/nextgen/COLLADAMaya/scripts/COLLADAMaya.vcproj =================================================================== --- branches/nextgen/COLLADAMaya/scripts/COLLADAMaya.vcproj 2009-02-05 15:00:48 UTC (rev 343) +++ branches/nextgen/COLLADAMaya/scripts/COLLADAMaya.vcproj 2009-02-06 12:50:36 UTC (rev 344) @@ -1055,7 +1055,7 @@ Optimization="2" InlineFunctionExpansion="1" AdditionalIncludeDirectories="..\include;"$(MAYA_PATH2009)\include";"$(MAYA_PATH2009)\devkit\plug-ins";"$(BOOST_ROOT)";..\..\COLLADABaseUtils\include;..\..\COLLADAStreamWriter\include;..\..\Externals\Cg\include;..\..\COLLADASaxFrameworkLoader\include;..\..\COLLADAFramework\include;..\..\Externals\MayaDataModel\include;..\..\GeneratedSaxParser\include;..\..\Externals\LibXML\include" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_AFXDLL;_MBCS;NT_PLUGIN;REQUIRE_IOSTREAM;CM_EXPORTS;GLUT_NO_LIB_PRAGMA;GLUT_NO_WARNING_DISABLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;$(NOINHERIT)" + PreprocessorDefinitions="CREATE_IMPORT_PLUGIN;WIN32;NDEBUG;_WINDOWS;_AFXDLL;_MBCS;NT_PLUGIN;REQUIRE_IOSTREAM;CM_EXPORTS;GLUT_NO_LIB_PRAGMA;GLUT_NO_WARNING_DISABLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;$(NOINHERIT)" RuntimeLibrary="2" EnableFunctionLevelLinking="false" RuntimeTypeInfo="true" @@ -2739,7 +2739,6 @@ </FileConfiguration> <FileConfiguration Name="ReleasePlugin2009|Win32" - ExcludedFromBuild="true" > <Tool Name="VCCLCompilerTool" @@ -2927,7 +2926,6 @@ </FileConfiguration> <FileConfiguration Name="ReleasePlugin2009|Win32" - ExcludedFromBuild="true" > <Tool Name="VCCLCompilerTool" @@ -3279,462 +3277,6 @@ > </File> <File - RelativePath="..\src\COLLADAMayaSceneNodeTraverser.cpp" - > - <FileConfiguration - Name="DebugPlugin2008|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugPlugin2008|x64" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleasePlugin2008|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleasePlugin2008|x64" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugConsole2008|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugConsole2008|x64" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleaseConsole2008|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleaseConsole2008|x64" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugPlugin85|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugPlugin85|x64" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugPlugin2009|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugPlugin2009|x64" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleasePlugin2009|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleasePlugin2009|x64" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleasePlugin80|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleasePlugin80|x64" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugPlugin70|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugPlugin70|x64" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleasePlugin85|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleasePlugin85|x64" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugPlugin80|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugPlugin80|x64" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleasePlugin70|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleasePlugin70|x64" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugConsole2009|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugConsole2009|x64" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleaseConsole2009|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleaseConsole2009|x64" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - </File> - <File - RelativePath="..\src\COLLADAMayaSceneTraverserListener.cpp" - > - <FileConfiguration - Name="DebugPlugin2008|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugPlugin2008|x64" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleasePlugin2008|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleasePlugin2008|x64" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugConsole2008|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugConsole2008|x64" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleaseConsole2008|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleaseConsole2008|x64" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugPlugin85|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugPlugin85|x64" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugPlugin2009|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugPlugin2009|x64" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleasePlugin2009|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleasePlugin2009|x64" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleasePlugin80|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleasePlugin80|x64" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugPlugin70|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugPlugin70|x64" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleasePlugin85|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleasePlugin85|x64" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugPlugin80|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugPlugin80|x64" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleasePlugin70|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleasePlugin70|x64" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugConsole2009|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugConsole2009|x64" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleaseConsole2009|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleaseConsole2009|x64" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - </File> - <File RelativePath="..\src\COLLADAMayaVisualSceneImporter.cpp" > <FileConfiguration @@ -3803,7 +3345,6 @@ </FileConfiguration> <FileConfiguration Name="ReleasePlugin2009|Win32" - ExcludedFromBuild="true" > <Tool Name="VCCLCompilerTool" @@ -4232,7 +3773,6 @@ </FileConfiguration> <FileConfiguration Name="ReleasePlugin2009|Win32" - ExcludedFromBuild="true" > <Tool Name="VCCustomBuildTool" @@ -4683,7 +4223,6 @@ </FileConfiguration> <FileConfiguration Name="ReleasePlugin2009|Win32" - ExcludedFromBuild="true" > <Tool Name="VCCustomBuildTool" @@ -4906,7 +4445,6 @@ </FileConfiguration> <FileConfiguration Name="ReleasePlugin2009|Win32" - ExcludedFromBuild="true" > <Tool Name="VCCustomBuildTool" @@ -5265,462 +4803,6 @@ > </File> <File - RelativePath="..\include\COLLADAMayaSceneNodeTraverser.h" - > - <FileConfiguration - Name="DebugPlugin2008|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCustomBuildTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugPlugin2008|x64" - ExcludedFromBuild="true" - > - <Tool - Name="VCCustomBuildTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleasePlugin2008|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCustomBuildTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleasePlugin2008|x64" - ExcludedFromBuild="true" - > - <Tool - Name="VCCustomBuildTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugConsole2008|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCustomBuildTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugConsole2008|x64" - ExcludedFromBuild="true" - > - <Tool - Name="VCCustomBuildTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleaseConsole2008|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCustomBuildTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleaseConsole2008|x64" - ExcludedFromBuild="true" - > - <Tool - Name="VCCustomBuildTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugPlugin85|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCustomBuildTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugPlugin85|x64" - ExcludedFromBuild="true" - > - <Tool - Name="VCCustomBuildTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugPlugin2009|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCustomBuildTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugPlugin2009|x64" - ExcludedFromBuild="true" - > - <Tool - Name="VCCustomBuildTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleasePlugin2009|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCustomBuildTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleasePlugin2009|x64" - ExcludedFromBuild="true" - > - <Tool - Name="VCCustomBuildTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleasePlugin80|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCustomBuildTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleasePlugin80|x64" - ExcludedFromBuild="true" - > - <Tool - Name="VCCustomBuildTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugPlugin70|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCustomBuildTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugPlugin70|x64" - ExcludedFromBuild="true" - > - <Tool - Name="VCCustomBuildTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleasePlugin85|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCustomBuildTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleasePlugin85|x64" - ExcludedFromBuild="true" - > - <Tool - Name="VCCustomBuildTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugPlugin80|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCustomBuildTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugPlugin80|x64" - ExcludedFromBuild="true" - > - <Tool - Name="VCCustomBuildTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleasePlugin70|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCustomBuildTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleasePlugin70|x64" - ExcludedFromBuild="true" - > - <Tool - Name="VCCustomBuildTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugConsole2009|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCustomBuildTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugConsole2009|x64" - ExcludedFromBuild="true" - > - <Tool - Name="VCCustomBuildTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleaseConsole2009|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCustomBuildTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleaseConsole2009|x64" - ExcludedFromBuild="true" - > - <Tool - Name="VCCustomBuildTool" - /> - </FileConfiguration> - </File> - <File - RelativePath="..\include\COLLADAMayaSceneTraverserListener.h" - > - <FileConfiguration - Name="DebugPlugin2008|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCustomBuildTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugPlugin2008|x64" - ExcludedFromBuild="true" - > - <Tool - Name="VCCustomBuildTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleasePlugin2008|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCustomBuildTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleasePlugin2008|x64" - ExcludedFromBuild="true" - > - <Tool - Name="VCCustomBuildTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugConsole2008|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCustomBuildTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugConsole2008|x64" - ExcludedFromBuild="true" - > - <Tool - Name="VCCustomBuildTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleaseConsole2008|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCustomBuildTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleaseConsole2008|x64" - ExcludedFromBuild="true" - > - <Tool - Name="VCCustomBuildTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugPlugin85|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCustomBuildTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugPlugin85|x64" - ExcludedFromBuild="true" - > - <Tool - Name="VCCustomBuildTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugPlugin2009|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCustomBuildTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugPlugin2009|x64" - ExcludedFromBuild="true" - > - <Tool - Name="VCCustomBuildTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleasePlugin2009|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCustomBuildTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleasePlugin2009|x64" - ExcludedFromBuild="true" - > - <Tool - Name="VCCustomBuildTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleasePlugin80|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCustomBuildTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleasePlugin80|x64" - ExcludedFromBuild="true" - > - <Tool - Name="VCCustomBuildTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugPlugin70|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCustomBuildTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugPlugin70|x64" - ExcludedFromBuild="true" - > - <Tool - Name="VCCustomBuildTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleasePlugin85|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCustomBuildTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleasePlugin85|x64" - ExcludedFromBuild="true" - > - <Tool - Name="VCCustomBuildTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugPlugin80|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCustomBuildTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugPlugin80|x64" - ExcludedFromBuild="true" - > - <Tool - Name="VCCustomBuildTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleasePlugin70|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCustomBuildTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleasePlugin70|x64" - ExcludedFromBuild="true" - > - <Tool - Name="VCCustomBuildTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugConsole2009|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCustomBuildTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugConsole2009|x64" - ExcludedFromBuild="true" - > - <Tool - Name="VCCustomBuildTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleaseConsole2009|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCustomBuildTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleaseConsole2009|x64" - ExcludedFromBuild="true" - > - <Tool - Name="VCCustomBuildTool" - /> - </FileConfiguration> - </File> - <File RelativePath="..\include\COLLADAMayaVisualSceneImporter.h" > <FileConfiguration @@ -5817,7 +4899,6 @@ </FileConfiguration> <FileConfiguration Name="ReleasePlugin2009|Win32" - ExcludedFromBuild="true" > <Tool Name="VCCustomBuildTool" Modified: branches/nextgen/COLLADAMaya/src/COLLADAMayaDocumentImporter.cpp =================================================================== --- branches/nextgen/COLLADAMaya/src/COLLADAMayaDocumentImporter.cpp 2009-02-05 15:00:48 UTC (rev 343) +++ branches/nextgen/COLLADAMaya/src/COLLADAMayaDocumentImporter.cpp 2009-02-06 12:50:36 UTC (rev 344) @@ -104,10 +104,10 @@ // TODO mMayaAsciiFileURI.set ( mColladaFileName ); mMayaAsciiFileURI.setPathExtension ( ".netallied.import.ma" ); - String mayaFileName = mMayaAsciiFileURI.getURIString (); + String mayaAsciiFileName = mMayaAsciiFileURI.getURIString (); // Check if the file already exist. - if ( std::ifstream ( mayaFileName.c_str () ) ) + if ( std::ifstream ( mayaAsciiFileName.c_str () ) ) ... [truncated message content] |
From: <rob...@us...> - 2009-02-05 15:00:53
|
Revision: 343 http://colladamaya.svn.sourceforge.net/colladamaya/?rev=343&view=rev Author: robertwuerfel Date: 2009-02-05 15:00:48 +0000 (Thu, 05 Feb 2009) Log Message: ----------- add missing files for enums in generated sax parser Added Paths: ----------- branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLColladaParserAutoGenEnums.h branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLColladaParserAutoGenPrivateEnums.cpp Added: branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLColladaParserAutoGenEnums.h =================================================================== --- branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLColladaParserAutoGenEnums.h (rev 0) +++ branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLColladaParserAutoGenEnums.h 2009-02-05 15:00:48 UTC (rev 343) @@ -0,0 +1,734 @@ +/* + Copyright (c) 2008 NetAllied Systems GmbH + + This file is part of COLLADASaxFrameworkLoader. + + Licensed under the MIT Open Source License, + for details please see LICENSE file or the website + http://www.opensource.org/licenses/mit-license.php +*/ + + + +#ifndef __COLLADASAXFWL_COLLADAPARSERAUTOGENENUMS_H__ +#define __COLLADASAXFWL_COLLADAPARSERAUTOGENENUMS_H__ + + +#include "GeneratedSaxParserTypes.h" +#include "GeneratedSaxParserUtils.h" + + +namespace COLLADASaxFWL +{ + + +typedef GeneratedSaxParser::StringHash StringHash; +typedef GeneratedSaxParser::ParserChar ParserChar; +typedef GeneratedSaxParser::ParserAttributes ParserAttributes; +typedef GeneratedSaxParser::Utils Utils; + + +enum UpAxisType +{ + UpAxisType__X_UP = 0, + UpAxisType__Y_UP = 1, + UpAxisType__Z_UP = 2, + UpAxisType__COUNT = 3, + UpAxisType__NOT_PRESENT = 4 +}; + +extern const std::pair<StringHash, UpAxisType> UpAxisTypeMap[UpAxisType__COUNT]; + + +UpAxisType toEnum_UpAxisType ( + const ParserChar** buffer, + const ParserChar* bufferEnd, + bool& failed, + const std::pair<StringHash, UpAxisType>* enumMap, + StringHash (*baseConversionFunc)( const ParserChar**, const ParserChar*, bool& ) +); + + + +enum fx_modifier_enum_common +{ + fx_modifier_enum_common__CONST = 0, + fx_modifier_enum_common__UNIFORM = 1, + fx_modifier_enum_common__VARYING = 2, + fx_modifier_enum_common__STATIC = 3, + fx_modifier_enum_common__VOLATILE = 4, + fx_modifier_enum_common__EXTERN = 5, + fx_modifier_enum_common__SHARED = 6, + fx_modifier_enum_common__COUNT = 7, + fx_modifier_enum_common__NOT_PRESENT = 8 +}; + +extern const std::pair<StringHash, fx_modifier_enum_common> fx_modifier_enum_commonMap[fx_modifier_enum_common__COUNT]; + + +fx_modifier_enum_common toEnum_fx_modifier_enum_common ( + const ParserChar** buffer, + const ParserChar* bufferEnd, + bool& failed, + const std::pair<StringHash, fx_modifier_enum_common>* enumMap, + StringHash (*baseConversionFunc)( const ParserChar**, const ParserChar*, bool& ) +); + + + +enum fx_surface_type_enum +{ + fx_surface_type_enum__UNTYPED = 0, + fx_surface_type_enum__1D = 1, + fx_surface_type_enum__2D = 2, + fx_surface_type_enum__3D = 3, + fx_surface_type_enum__RECT = 4, + fx_surface_type_enum__CUBE = 5, + fx_surface_type_enum__DEPTH = 6, + fx_surface_type_enum__COUNT = 7, + fx_surface_type_enum__NOT_PRESENT = 8 +}; + +extern const std::pair<StringHash, fx_surface_type_enum> fx_surface_type_enumMap[fx_surface_type_enum__COUNT]; + + +fx_surface_type_enum toEnum_fx_surface_type_enum ( + const ParserChar** buffer, + const ParserChar* bufferEnd, + bool& failed, + const std::pair<StringHash, fx_surface_type_enum>* enumMap, + StringHash (*baseConversionFunc)( const ParserChar**, const ParserChar*, bool& ) +); + + + +enum fx_surface_face_enum +{ + fx_surface_face_enum__POSITIVE_X = 0, + fx_surface_face_enum__NEGATIVE_X = 1, + fx_surface_face_enum__POSITIVE_Y = 2, + fx_surface_face_enum__NEGATIVE_Y = 3, + fx_surface_face_enum__POSITIVE_Z = 4, + fx_surface_face_enum__NEGATIVE_Z = 5, + fx_surface_face_enum__COUNT = 6, + fx_surface_face_enum__NOT_PRESENT = 7 +}; + +extern const std::pair<StringHash, fx_surface_face_enum> fx_surface_face_enumMap[fx_surface_face_enum__COUNT]; + + +fx_surface_face_enum toEnum_fx_surface_face_enum ( + const ParserChar** buffer, + const ParserChar* bufferEnd, + bool& failed, + const std::pair<StringHash, fx_surface_face_enum>* enumMap, + StringHash (*baseConversionFunc)( const ParserChar**, const ParserChar*, bool& ) +); + + + +enum fx_surface_format_hint_channels_enum +{ + fx_surface_format_hint_channels_enum__RGB = 0, + fx_surface_format_hint_channels_enum__RGBA = 1, + fx_surface_format_hint_channels_enum__L = 2, + fx_surface_format_hint_channels_enum__LA = 3, + fx_surface_format_hint_channels_enum__D = 4, + fx_surface_format_hint_channels_enum__XYZ = 5, + fx_surface_format_hint_channels_enum__XYZW = 6, + fx_surface_format_hint_channels_enum__COUNT = 7, + fx_surface_format_hint_channels_enum__NOT_PRESENT = 8 +}; + +extern const std::pair<StringHash, fx_surface_format_hint_channels_enum> fx_surface_format_hint_channels_enumMap[fx_surface_format_hint_channels_enum__COUNT]; + + +fx_surface_format_hint_channels_enum toEnum_fx_surface_format_hint_channels_enum ( + const ParserChar** buffer, + const ParserChar* bufferEnd, + bool& failed, + const std::pair<StringHash, fx_surface_format_hint_channels_enum>* enumMap, + StringHash (*baseConversionFunc)( const ParserChar**, const ParserChar*, bool& ) +); + + + +enum fx_surface_format_hint_range_enum +{ + fx_surface_format_hint_range_enum__SNORM = 0, + fx_surface_format_hint_range_enum__UNORM = 1, + fx_surface_format_hint_range_enum__SINT = 2, + fx_surface_format_hint_range_enum__UINT = 3, + fx_surface_format_hint_range_enum__FLOAT = 4, + fx_surface_format_hint_range_enum__COUNT = 5, + fx_surface_format_hint_range_enum__NOT_PRESENT = 6 +}; + +extern const std::pair<StringHash, fx_surface_format_hint_range_enum> fx_surface_format_hint_range_enumMap[fx_surface_format_hint_range_enum__COUNT]; + + +fx_surface_format_hint_range_enum toEnum_fx_surface_format_hint_range_enum ( + const ParserChar** buffer, + const ParserChar* bufferEnd, + bool& failed, + const std::pair<StringHash, fx_surface_format_hint_range_enum>* enumMap, + StringHash (*baseConversionFunc)( const ParserChar**, const ParserChar*, bool& ) +); + + + +enum fx_surface_format_hint_precision_enum +{ + fx_surface_format_hint_precision_enum__LOW = 0, + fx_surface_format_hint_precision_enum__MID = 1, + fx_surface_format_hint_precision_enum__HIGH = 2, + fx_surface_format_hint_precision_enum__COUNT = 3, + fx_surface_format_hint_precision_enum__NOT_PRESENT = 4 +}; + +extern const std::pair<StringHash, fx_surface_format_hint_precision_enum> fx_surface_format_hint_precision_enumMap[fx_surface_format_hint_precision_enum__COUNT]; + + +fx_surface_format_hint_precision_enum toEnum_fx_surface_format_hint_precision_enum ( + const ParserChar** buffer, + const ParserChar* bufferEnd, + bool& failed, + const std::pair<StringHash, fx_surface_format_hint_precision_enum>* enumMap, + StringHash (*baseConversionFunc)( const ParserChar**, const ParserChar*, bool& ) +); + + + +enum fx_surface_format_hint_option_enum +{ + fx_surface_format_hint_option_enum__SRGB_GAMMA = 0, + fx_surface_format_hint_option_enum__NORMALIZED3 = 1, + fx_surface_format_hint_option_enum__NORMALIZED4 = 2, + fx_surface_format_hint_option_enum__COMPRESSABLE = 3, + fx_surface_format_hint_option_enum__COUNT = 4, + fx_surface_format_hint_option_enum__NOT_PRESENT = 5 +}; + +extern const std::pair<StringHash, fx_surface_format_hint_option_enum> fx_surface_format_hint_option_enumMap[fx_surface_format_hint_option_enum__COUNT]; + + +fx_surface_format_hint_option_enum toEnum_fx_surface_format_hint_option_enum ( + const ParserChar** buffer, + const ParserChar* bufferEnd, + bool& failed, + const std::pair<StringHash, fx_surface_format_hint_option_enum>* enumMap, + StringHash (*baseConversionFunc)( const ParserChar**, const ParserChar*, bool& ) +); + + + +enum gles_texcombiner_operatorRGB_enums +{ + gles_texcombiner_operatorRGB_enums__REPLACE = 0, + gles_texcombiner_operatorRGB_enums__MODULATE = 1, + gles_texcombiner_operatorRGB_enums__ADD = 2, + gles_texcombiner_operatorRGB_enums__ADD_SIGNED = 3, + gles_texcombiner_operatorRGB_enums__INTERPOLATE = 4, + gles_texcombiner_operatorRGB_enums__SUBTRACT = 5, + gles_texcombiner_operatorRGB_enums__DOT3_RGB = 6, + gles_texcombiner_operatorRGB_enums__DOT3_RGBA = 7, + gles_texcombiner_operatorRGB_enums__COUNT = 8, + gles_texcombiner_operatorRGB_enums__NOT_PRESENT = 9 +}; + +extern const std::pair<StringHash, gles_texcombiner_operatorRGB_enums> gles_texcombiner_operatorRGB_enumsMap[gles_texcombiner_operatorRGB_enums__COUNT]; + + +gles_texcombiner_operatorRGB_enums toEnum_gles_texcombiner_operatorRGB_enums ( + const ParserChar** buffer, + const ParserChar* bufferEnd, + bool& failed, + const std::pair<StringHash, gles_texcombiner_operatorRGB_enums>* enumMap, + StringHash (*baseConversionFunc)( const ParserChar**, const ParserChar*, bool& ) +); + + + +enum gles_texcombiner_source_enums +{ + gles_texcombiner_source_enums__TEXTURE = 0, + gles_texcombiner_source_enums__CONSTANT = 1, + gles_texcombiner_source_enums__PRIMARY = 2, + gles_texcombiner_source_enums__PREVIOUS = 3, + gles_texcombiner_source_enums__COUNT = 4, + gles_texcombiner_source_enums__NOT_PRESENT = 5 +}; + +extern const std::pair<StringHash, gles_texcombiner_source_enums> gles_texcombiner_source_enumsMap[gles_texcombiner_source_enums__COUNT]; + + +gles_texcombiner_source_enums toEnum_gles_texcombiner_source_enums ( + const ParserChar** buffer, + const ParserChar* bufferEnd, + bool& failed, + const std::pair<StringHash, gles_texcombiner_source_enums>* enumMap, + StringHash (*baseConversionFunc)( const ParserChar**, const ParserChar*, bool& ) +); + + + +enum gles_texcombiner_operandRGB_enums +{ + gles_texcombiner_operandRGB_enums__SRC_COLOR = 0, + gles_texcombiner_operandRGB_enums__ONE_MINUS_SRC_COLOR = 1, + gles_texcombiner_operandRGB_enums__SRC_ALPHA = 2, + gles_texcombiner_operandRGB_enums__ONE_MINUS_SRC_ALPHA = 3, + gles_texcombiner_operandRGB_enums__COUNT = 4, + gles_texcombiner_operandRGB_enums__NOT_PRESENT = 5 +}; + +extern const std::pair<StringHash, gles_texcombiner_operandRGB_enums> gles_texcombiner_operandRGB_enumsMap[gles_texcombiner_operandRGB_enums__COUNT]; + + +gles_texcombiner_operandRGB_enums toEnum_gles_texcombiner_operandRGB_enums ( + const ParserChar** buffer, + const ParserChar* bufferEnd, + bool& failed, + const std::pair<StringHash, gles_texcombiner_operandRGB_enums>* enumMap, + StringHash (*baseConversionFunc)( const ParserChar**, const ParserChar*, bool& ) +); + + + +enum gles_texcombiner_operatorAlpha_enums +{ + gles_texcombiner_operatorAlpha_enums__REPLACE = 0, + gles_texcombiner_operatorAlpha_enums__MODULATE = 1, + gles_texcombiner_operatorAlpha_enums__ADD = 2, + gles_texcombiner_operatorAlpha_enums__ADD_SIGNED = 3, + gles_texcombiner_operatorAlpha_enums__INTERPOLATE = 4, + gles_texcombiner_operatorAlpha_enums__SUBTRACT = 5, + gles_texcombiner_operatorAlpha_enums__COUNT = 6, + gles_texcombiner_operatorAlpha_enums__NOT_PRESENT = 7 +}; + +extern const std::pair<StringHash, gles_texcombiner_operatorAlpha_enums> gles_texcombiner_operatorAlpha_enumsMap[gles_texcombiner_operatorAlpha_enums__COUNT]; + + +gles_texcombiner_operatorAlpha_enums toEnum_gles_texcombiner_operatorAlpha_enums ( + const ParserChar** buffer, + const ParserChar* bufferEnd, + bool& failed, + const std::pair<StringHash, gles_texcombiner_operatorAlpha_enums>* enumMap, + StringHash (*baseConversionFunc)( const ParserChar**, const ParserChar*, bool& ) +); + + + +enum gles_texcombiner_operandAlpha_enums +{ + gles_texcombiner_operandAlpha_enums__SRC_ALPHA = 0, + gles_texcombiner_operandAlpha_enums__ONE_MINUS_SRC_ALPHA = 1, + gles_texcombiner_operandAlpha_enums__COUNT = 2, + gles_texcombiner_operandAlpha_enums__NOT_PRESENT = 3 +}; + +extern const std::pair<StringHash, gles_texcombiner_operandAlpha_enums> gles_texcombiner_operandAlpha_enumsMap[gles_texcombiner_operandAlpha_enums__COUNT]; + + +gles_texcombiner_operandAlpha_enums toEnum_gles_texcombiner_operandAlpha_enums ( + const ParserChar** buffer, + const ParserChar* bufferEnd, + bool& failed, + const std::pair<StringHash, gles_texcombiner_operandAlpha_enums>* enumMap, + StringHash (*baseConversionFunc)( const ParserChar**, const ParserChar*, bool& ) +); + + + +enum gles_texenv_mode_enums +{ + gles_texenv_mode_enums__REPLACE = 0, + gles_texenv_mode_enums__MODULATE = 1, + gles_texenv_mode_enums__DECAL = 2, + gles_texenv_mode_enums__BLEND = 3, + gles_texenv_mode_enums__ADD = 4, + gles_texenv_mode_enums__COUNT = 5, + gles_texenv_mode_enums__NOT_PRESENT = 6 +}; + +extern const std::pair<StringHash, gles_texenv_mode_enums> gles_texenv_mode_enumsMap[gles_texenv_mode_enums__COUNT]; + + +gles_texenv_mode_enums toEnum_gles_texenv_mode_enums ( + const ParserChar** buffer, + const ParserChar* bufferEnd, + bool& failed, + const std::pair<StringHash, gles_texenv_mode_enums>* enumMap, + StringHash (*baseConversionFunc)( const ParserChar**, const ParserChar*, bool& ) +); + + + +enum gles_sampler_wrap +{ + gles_sampler_wrap__REPEAT = 0, + gles_sampler_wrap__CLAMP = 1, + gles_sampler_wrap__CLAMP_TO_EDGE = 2, + gles_sampler_wrap__MIRRORED_REPEAT = 3, + gles_sampler_wrap__COUNT = 4, + gles_sampler_wrap__NOT_PRESENT = 5 +}; + +extern const std::pair<StringHash, gles_sampler_wrap> gles_sampler_wrapMap[gles_sampler_wrap__COUNT]; + + +gles_sampler_wrap toEnum_gles_sampler_wrap ( + const ParserChar** buffer, + const ParserChar* bufferEnd, + bool& failed, + const std::pair<StringHash, gles_sampler_wrap>* enumMap, + StringHash (*baseConversionFunc)( const ParserChar**, const ParserChar*, bool& ) +); + + + +enum fx_sampler_filter_common +{ + fx_sampler_filter_common__NONE = 0, + fx_sampler_filter_common__NEAREST = 1, + fx_sampler_filter_common__LINEAR = 2, + fx_sampler_filter_common__NEAREST_MIPMAP_NEAREST = 3, + fx_sampler_filter_common__LINEAR_MIPMAP_NEAREST = 4, + fx_sampler_filter_common__NEAREST_MIPMAP_LINEAR = 5, + fx_sampler_filter_common__LINEAR_MIPMAP_LINEAR = 6, + fx_sampler_filter_common__COUNT = 7, + fx_sampler_filter_common__NOT_PRESENT = 8 +}; + +extern const std::pair<StringHash, fx_sampler_filter_common> fx_sampler_filter_commonMap[fx_sampler_filter_common__COUNT]; + + +fx_sampler_filter_common toEnum_fx_sampler_filter_common ( + const ParserChar** buffer, + const ParserChar* bufferEnd, + bool& failed, + const std::pair<StringHash, fx_sampler_filter_common>* enumMap, + StringHash (*baseConversionFunc)( const ParserChar**, const ParserChar*, bool& ) +); + + + +enum gl_func_type +{ + gl_func_type__NEVER = 0, + gl_func_type__LESS = 1, + gl_func_type__LEQUAL = 2, + gl_func_type__EQUAL = 3, + gl_func_type__GREATER = 4, + gl_func_type__NOTEQUAL = 5, + gl_func_type__GEQUAL = 6, + gl_func_type__ALWAYS = 7, + gl_func_type__COUNT = 8, + gl_func_type__NOT_PRESENT = 9 +}; + +extern const std::pair<StringHash, gl_func_type> gl_func_typeMap[gl_func_type__COUNT]; + + +gl_func_type toEnum_gl_func_type ( + const ParserChar** buffer, + const ParserChar* bufferEnd, + bool& failed, + const std::pair<StringHash, gl_func_type>* enumMap, + StringHash (*baseConversionFunc)( const ParserChar**, const ParserChar*, bool& ) +); + + + +enum gl_blend_type +{ + gl_blend_type__ZERO = 0, + gl_blend_type__ONE = 1, + gl_blend_type__SRC_COLOR = 2, + gl_blend_type__ONE_MINUS_SRC_COLOR = 3, + gl_blend_type__DEST_COLOR = 4, + gl_blend_type__ONE_MINUS_DEST_COLOR = 5, + gl_blend_type__SRC_ALPHA = 6, + gl_blend_type__ONE_MINUS_SRC_ALPHA = 7, + gl_blend_type__DST_ALPHA = 8, + gl_blend_type__ONE_MINUS_DST_ALPHA = 9, + gl_blend_type__CONSTANT_COLOR = 10, + gl_blend_type__ONE_MINUS_CONSTANT_COLOR = 11, + gl_blend_type__CONSTANT_ALPHA = 12, + gl_blend_type__ONE_MINUS_CONSTANT_ALPHA = 13, + gl_blend_type__SRC_ALPHA_SATURATE = 14, + gl_blend_type__COUNT = 15, + gl_blend_type__NOT_PRESENT = 16 +}; + +extern const std::pair<StringHash, gl_blend_type> gl_blend_typeMap[gl_blend_type__COUNT]; + + +gl_blend_type toEnum_gl_blend_type ( + const ParserChar** buffer, + const ParserChar* bufferEnd, + bool& failed, + const std::pair<StringHash, gl_blend_type>* enumMap, + StringHash (*baseConversionFunc)( const ParserChar**, const ParserChar*, bool& ) +); + + + +enum gl_face_type +{ + gl_face_type__FRONT = 0, + gl_face_type__BACK = 1, + gl_face_type__FRONT_AND_BACK = 2, + gl_face_type__COUNT = 3, + gl_face_type__NOT_PRESENT = 4 +}; + +extern const std::pair<StringHash, gl_face_type> gl_face_typeMap[gl_face_type__COUNT]; + + +gl_face_type toEnum_gl_face_type ( + const ParserChar** buffer, + const ParserChar* bufferEnd, + bool& failed, + const std::pair<StringHash, gl_face_type>* enumMap, + StringHash (*baseConversionFunc)( const ParserChar**, const ParserChar*, bool& ) +); + + + +enum gl_fog_type +{ + gl_fog_type__LINEAR = 0, + gl_fog_type__EXP = 1, + gl_fog_type__EXP2 = 2, + gl_fog_type__COUNT = 3, + gl_fog_type__NOT_PRESENT = 4 +}; + +extern const std::pair<StringHash, gl_fog_type> gl_fog_typeMap[gl_fog_type__COUNT]; + + +gl_fog_type toEnum_gl_fog_type ( + const ParserChar** buffer, + const ParserChar* bufferEnd, + bool& failed, + const std::pair<StringHash, gl_fog_type>* enumMap, + StringHash (*baseConversionFunc)( const ParserChar**, const ParserChar*, bool& ) +); + + + +enum gl_front_face_type +{ + gl_front_face_type__CW = 0, + gl_front_face_type__CCW = 1, + gl_front_face_type__COUNT = 2, + gl_front_face_type__NOT_PRESENT = 3 +}; + +extern const std::pair<StringHash, gl_front_face_type> gl_front_face_typeMap[gl_front_face_type__COUNT]; + + +gl_front_face_type toEnum_gl_front_face_type ( + const ParserChar** buffer, + const ParserChar* bufferEnd, + bool& failed, + const std::pair<StringHash, gl_front_face_type>* enumMap, + StringHash (*baseConversionFunc)( const ParserChar**, const ParserChar*, bool& ) +); + + + +enum gl_logic_op_type +{ + gl_logic_op_type__CLEAR = 0, + gl_logic_op_type__AND = 1, + gl_logic_op_type__AND_REVERSE = 2, + gl_logic_op_type__COPY = 3, + gl_logic_op_type__AND_INVERTED = 4, + gl_logic_op_type__NOOP = 5, + gl_logic_op_type__XOR = 6, + gl_logic_op_type__OR = 7, + gl_logic_op_type__NOR = 8, + gl_logic_op_type__EQUIV = 9, + gl_logic_op_type__INVERT = 10, + gl_logic_op_type__OR_REVERSE = 11, + gl_logic_op_type__COPY_INVERTED = 12, + gl_logic_op_type__NAND = 13, + gl_logic_op_type__SET = 14, + gl_logic_op_type__COUNT = 15, + gl_logic_op_type__NOT_PRESENT = 16 +}; + +extern const std::pair<StringHash, gl_logic_op_type> gl_logic_op_typeMap[gl_logic_op_type__COUNT]; + + +gl_logic_op_type toEnum_gl_logic_op_type ( + const ParserChar** buffer, + const ParserChar* bufferEnd, + bool& failed, + const std::pair<StringHash, gl_logic_op_type>* enumMap, + StringHash (*baseConversionFunc)( const ParserChar**, const ParserChar*, bool& ) +); + + + +enum gl_shade_model_type +{ + gl_shade_model_type__FLAT = 0, + gl_shade_model_type__SMOOTH = 1, + gl_shade_model_type__COUNT = 2, + gl_shade_model_type__NOT_PRESENT = 3 +}; + +extern const std::pair<StringHash, gl_shade_model_type> gl_shade_model_typeMap[gl_shade_model_type__COUNT]; + + +gl_shade_model_type toEnum_gl_shade_model_type ( + const ParserChar** buffer, + const ParserChar* bufferEnd, + bool& failed, + const std::pair<StringHash, gl_shade_model_type>* enumMap, + StringHash (*baseConversionFunc)( const ParserChar**, const ParserChar*, bool& ) +); + + + +enum gles_stencil_op_type +{ + gles_stencil_op_type__KEEP = 0, + gles_stencil_op_type__ZERO = 1, + gles_stencil_op_type__REPLACE = 2, + gles_stencil_op_type__INCR = 3, + gles_stencil_op_type__DECR = 4, + gles_stencil_op_type__INVERT = 5, + gles_stencil_op_type__COUNT = 6, + gles_stencil_op_type__NOT_PRESENT = 7 +}; + +extern const std::pair<StringHash, gles_stencil_op_type> gles_stencil_op_typeMap[gles_stencil_op_type__COUNT]; + + +gles_stencil_op_type toEnum_gles_stencil_op_type ( + const ParserChar** buffer, + const ParserChar* bufferEnd, + bool& failed, + const std::pair<StringHash, gles_stencil_op_type>* enumMap, + StringHash (*baseConversionFunc)( const ParserChar**, const ParserChar*, bool& ) +); + + + +enum VersionType +{ + VersionType__1_4_0 = 0, + VersionType__1_4_1 = 1, + VersionType__COUNT = 2, + VersionType__NOT_PRESENT = 3 +}; + +extern const std::pair<StringHash, VersionType> VersionTypeMap[VersionType__COUNT]; + + +VersionType toEnum_VersionType ( + const ParserChar** buffer, + const ParserChar* bufferEnd, + bool& failed, + const std::pair<StringHash, VersionType>* enumMap, + StringHash (*baseConversionFunc)( const ParserChar**, const ParserChar*, bool& ) +); + + + +enum MorphMethodType +{ + MorphMethodType__NORMALIZED = 0, + MorphMethodType__RELATIVE = 1, + MorphMethodType__COUNT = 2, + MorphMethodType__NOT_PRESENT = 3 +}; + +extern const std::pair<StringHash, MorphMethodType> MorphMethodTypeMap[MorphMethodType__COUNT]; + + +MorphMethodType toEnum_MorphMethodType ( + const ParserChar** buffer, + const ParserChar* bufferEnd, + bool& failed, + const std::pair<StringHash, MorphMethodType>* enumMap, + StringHash (*baseConversionFunc)( const ParserChar**, const ParserChar*, bool& ) +); + + + +enum fx_sampler_wrap_common +{ + fx_sampler_wrap_common__NONE = 0, + fx_sampler_wrap_common__WRAP = 1, + fx_sampler_wrap_common__MIRROR = 2, + fx_sampler_wrap_common__CLAMP = 3, + fx_sampler_wrap_common__BORDER = 4, + fx_sampler_wrap_common__COUNT = 5, + fx_sampler_wrap_common__NOT_PRESENT = 6 +}; + +extern const std::pair<StringHash, fx_sampler_wrap_common> fx_sampler_wrap_commonMap[fx_sampler_wrap_common__COUNT]; + + +fx_sampler_wrap_common toEnum_fx_sampler_wrap_common ( + const ParserChar** buffer, + const ParserChar* bufferEnd, + bool& failed, + const std::pair<StringHash, fx_sampler_wrap_common>* enumMap, + StringHash (*baseConversionFunc)( const ParserChar**, const ParserChar*, bool& ) +); + + + +enum NodeType +{ + NodeType__JOINT = 0, + NodeType__NODE = 1, + NodeType__COUNT = 2, + NodeType__NOT_PRESENT = 3 +}; + +extern const std::pair<StringHash, NodeType> NodeTypeMap[NodeType__COUNT]; + + +NodeType toEnum_NodeType ( + const ParserChar** buffer, + const ParserChar* bufferEnd, + bool& failed, + const std::pair<StringHash, NodeType>* enumMap, + StringHash (*baseConversionFunc)( const ParserChar**, const ParserChar*, bool& ) +); + + + +enum fx_opaque_enum +{ + fx_opaque_enum__A_ONE = 0, + fx_opaque_enum__RGB_ZERO = 1, + fx_opaque_enum__COUNT = 2, + fx_opaque_enum__NOT_PRESENT = 3 +}; + +extern const std::pair<StringHash, fx_opaque_enum> fx_opaque_enumMap[fx_opaque_enum__COUNT]; + + +fx_opaque_enum toEnum_fx_opaque_enum ( + const ParserChar** buffer, + const ParserChar* bufferEnd, + bool& failed, + const std::pair<StringHash, fx_opaque_enum>* enumMap, + StringHash (*baseConversionFunc)( const ParserChar**, const ParserChar*, bool& ) +); + + + + + +} +#endif Added: branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLColladaParserAutoGenPrivateEnums.cpp =================================================================== --- branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLColladaParserAutoGenPrivateEnums.cpp (rev 0) +++ branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLColladaParserAutoGenPrivateEnums.cpp 2009-02-05 15:00:48 UTC (rev 343) @@ -0,0 +1,691 @@ +/* + Copyright (c) 2008 NetAllied Systems GmbH + + This file is part of COLLADASaxFrameworkLoader. + + Licensed under the MIT Open Source License, + for details please see LICENSE file or the website + http://www.opensource.org/licenses/mit-license.php +*/ + +#include "COLLADASaxFWLStableHeaders.h" +#include "COLLADASaxFWLColladaParserAutoGenEnums.h" +#include "GeneratedSaxParserUtils.h" + + +namespace COLLADASaxFWL +{ + + +//--------------------------------------------------------------------- +const std::pair<StringHash, UpAxisType> UpAxisTypeMap[UpAxisType__COUNT] = +{ + std::pair<StringHash, UpAxisType>(386208, UpAxisType__X_UP), + std::pair<StringHash, UpAxisType>(390304, UpAxisType__Y_UP), + std::pair<StringHash, UpAxisType>(394400, UpAxisType__Z_UP) +}; + +//--------------------------------------------------------------------- +UpAxisType toEnum_UpAxisType ( + const ParserChar** buffer, + const ParserChar* bufferEnd, + bool& failed, + const std::pair<StringHash, UpAxisType>* enumMap, + StringHash (*baseConversionFunc)( const ParserChar**, const ParserChar*, bool& ) +) +{ + return Utils::toEnum<UpAxisType, StringHash, UpAxisType__COUNT>(buffer, bufferEnd, failed, enumMap, baseConversionFunc); +} + + +//--------------------------------------------------------------------- +const std::pair<StringHash, fx_modifier_enum_common> fx_modifier_enum_commonMap[fx_modifier_enum_common__COUNT] = +{ + std::pair<StringHash, fx_modifier_enum_common>(4735876, fx_modifier_enum_common__CONST), + std::pair<StringHash, fx_modifier_enum_common>(78482030, fx_modifier_enum_common__EXTERN), + std::pair<StringHash, fx_modifier_enum_common>(92038804, fx_modifier_enum_common__SHARED), + std::pair<StringHash, fx_modifier_enum_common>(92825811, fx_modifier_enum_common__STATIC), + std::pair<StringHash, fx_modifier_enum_common>(170767421, fx_modifier_enum_common__UNIFORM), + std::pair<StringHash, fx_modifier_enum_common>(174579319, fx_modifier_enum_common__VARYING), + std::pair<StringHash, fx_modifier_enum_common>(67537333, fx_modifier_enum_common__VOLATILE) +}; + +//--------------------------------------------------------------------- +fx_modifier_enum_common toEnum_fx_modifier_enum_common ( + const ParserChar** buffer, + const ParserChar* bufferEnd, + bool& failed, + const std::pair<StringHash, fx_modifier_enum_common>* enumMap, + StringHash (*baseConversionFunc)( const ParserChar**, const ParserChar*, bool& ) +) +{ + return Utils::toEnum<fx_modifier_enum_common, StringHash, fx_modifier_enum_common__COUNT>(buffer, bufferEnd, failed, enumMap, baseConversionFunc); +} + + +//--------------------------------------------------------------------- +const std::pair<StringHash, fx_surface_type_enum> fx_surface_type_enumMap[fx_surface_type_enum__COUNT] = +{ + std::pair<StringHash, fx_surface_type_enum>(852, fx_surface_type_enum__1D), + std::pair<StringHash, fx_surface_type_enum>(868, fx_surface_type_enum__2D), + std::pair<StringHash, fx_surface_type_enum>(884, fx_surface_type_enum__3D), + std::pair<StringHash, fx_surface_type_enum>(297317, fx_surface_type_enum__CUBE), + std::pair<StringHash, fx_surface_type_enum>(4760968, fx_surface_type_enum__DEPTH), + std::pair<StringHash, fx_surface_type_enum>(354692, fx_surface_type_enum__RECT), + std::pair<StringHash, fx_surface_type_enum>(171566276, fx_surface_type_enum__UNTYPED) +}; + +//--------------------------------------------------------------------- +fx_surface_type_enum toEnum_fx_surface_type_enum ( + const ParserChar** buffer, + const ParserChar* bufferEnd, + bool& failed, + const std::pair<StringHash, fx_surface_type_enum>* enumMap, + StringHash (*baseConversionFunc)( const ParserChar**, const ParserChar*, bool& ) +) +{ + return Utils::toEnum<fx_surface_type_enum, StringHash, fx_surface_type_enum__COUNT>(buffer, bufferEnd, failed, enumMap, baseConversionFunc); +} + + +//--------------------------------------------------------------------- +const std::pair<StringHash, fx_surface_face_enum> fx_surface_face_enumMap[fx_surface_face_enum__COUNT] = +{ + std::pair<StringHash, fx_surface_face_enum>(109806840, fx_surface_face_enum__NEGATIVE_X), + std::pair<StringHash, fx_surface_face_enum>(109806841, fx_surface_face_enum__NEGATIVE_Y), + std::pair<StringHash, fx_surface_face_enum>(109806842, fx_surface_face_enum__NEGATIVE_Z), + std::pair<StringHash, fx_surface_face_enum>(244055864, fx_surface_face_enum__POSITIVE_X), + std::pair<StringHash, fx_surface_face_enum>(244055865, fx_surface_face_enum__POSITIVE_Y), + std::pair<StringHash, fx_surface_face_enum>(244055866, fx_surface_face_enum__POSITIVE_Z) +}; + +//--------------------------------------------------------------------- +fx_surface_face_enum toEnum_fx_surface_face_enum ( + const ParserChar** buffer, + const ParserChar* bufferEnd, + bool& failed, + const std::pair<StringHash, fx_surface_face_enum>* enumMap, + StringHash (*baseConversionFunc)( const ParserChar**, const ParserChar*, bool& ) +) +{ + return Utils::toEnum<fx_surface_face_enum, StringHash, fx_surface_face_enum__COUNT>(buffer, bufferEnd, failed, enumMap, baseConversionFunc); +} + + +//--------------------------------------------------------------------- +const std::pair<StringHash, fx_surface_format_hint_channels_enum> fx_surface_format_hint_channels_enumMap[fx_surface_format_hint_channels_enum__COUNT] = +{ + std::pair<StringHash, fx_surface_format_hint_channels_enum>(68, fx_surface_format_hint_channels_enum__D), + std::pair<StringHash, fx_surface_format_hint_channels_enum>(76, fx_surface_format_hint_channels_enum__L), + std::pair<StringHash, fx_surface_format_hint_channels_enum>(1281, fx_surface_format_hint_channels_enum__LA), + std::pair<StringHash, fx_surface_format_hint_channels_enum>(22194, fx_surface_format_hint_channels_enum__RGB), + std::pair<StringHash, fx_surface_format_hint_channels_enum>(355169, fx_surface_format_hint_channels_enum__RGBA), + std::pair<StringHash, fx_surface_format_hint_channels_enum>(24042, fx_surface_format_hint_channels_enum__XYZ), + std::pair<StringHash, fx_surface_format_hint_channels_enum>(384759, fx_surface_format_hint_channels_enum__XYZW) +}; + +//--------------------------------------------------------------------- +fx_surface_format_hint_channels_enum toEnum_fx_surface_format_hint_channels_enum ( + const ParserChar** buffer, + const ParserChar* bufferEnd, + bool& failed, + const std::pair<StringHash, fx_surface_format_hint_channels_enum>* enumMap, + StringHash (*baseConversionFunc)( const ParserChar**, const ParserChar*, bool& ) +) +{ + return Utils::toEnum<fx_surface_format_hint_channels_enum, StringHash, fx_surface_format_hint_channels_enum__COUNT>(buffer, bufferEnd, failed, enumMap, baseConversionFunc); +} + + +//--------------------------------------------------------------------- +const std::pair<StringHash, fx_surface_format_hint_range_enum> fx_surface_format_hint_range_enumMap[fx_surface_format_hint_range_enum__COUNT] = +{ + std::pair<StringHash, fx_surface_format_hint_range_enum>(4920164, fx_surface_format_hint_range_enum__FLOAT), + std::pair<StringHash, fx_surface_format_hint_range_enum>(359988, fx_surface_format_hint_range_enum__SINT), + std::pair<StringHash, fx_surface_format_hint_range_enum>(5780589, fx_surface_format_hint_range_enum__SNORM), + std::pair<StringHash, fx_surface_format_hint_range_enum>(368180, fx_surface_format_hint_range_enum__UINT), + std::pair<StringHash, fx_surface_format_hint_range_enum>(5911661, fx_surface_format_hint_range_enum__UNORM) +}; + +//--------------------------------------------------------------------- +fx_surface_format_hint_range_enum toEnum_fx_surface_format_hint_range_enum ( + const ParserChar** buffer, + const ParserChar* bufferEnd, + bool& failed, + const std::pair<StringHash, fx_surface_format_hint_range_enum>* enumMap, + StringHash (*baseConversionFunc)( const ParserChar**, const ParserChar*, bool& ) +) +{ + return Utils::toEnum<fx_surface_format_hint_range_enum, StringHash, fx_surface_format_hint_range_enum__COUNT>(buffer, bufferEnd, failed, enumMap, baseConversionFunc); +} + + +//--------------------------------------------------------------------- +const std::pair<StringHash, fx_surface_format_hint_precision_enum> fx_surface_format_hint_precision_enumMap[fx_surface_format_hint_precision_enum__COUNT] = +{ + std::pair<StringHash, fx_surface_format_hint_precision_enum>(314808, fx_surface_format_hint_precision_enum__HIGH), + std::pair<StringHash, fx_surface_format_hint_precision_enum>(20807, fx_surface_format_hint_precision_enum__LOW), + std::pair<StringHash, fx_surface_format_hint_precision_enum>(20948, fx_surface_format_hint_precision_enum__MID) +}; + +//--------------------------------------------------------------------- +fx_surface_format_hint_precision_enum toEnum_fx_surface_format_hint_precision_enum ( + const ParserChar** buffer, + const ParserChar* bufferEnd, + bool& failed, + const std::pair<StringHash, fx_surface_format_hint_precision_enum>* enumMap, + StringHash (*baseConversionFunc)( const ParserChar**, const ParserChar*, bool& ) +) +{ + return Utils::toEnum<fx_surface_format_hint_precision_enum, StringHash, fx_surface_format_hint_precision_enum__COUNT>(buffer, bufferEnd, failed, enumMap, baseConversionFunc); +} + + +//--------------------------------------------------------------------- +const std::pair<StringHash, fx_surface_format_hint_option_enum> fx_surface_format_hint_option_enumMap[fx_surface_format_hint_option_enum__COUNT] = +{ + std::pair<StringHash, fx_surface_format_hint_option_enum>(235107429, fx_surface_format_hint_option_enum__COMPRESSABLE), + std::pair<StringHash, fx_surface_format_hint_option_enum>(106802787, fx_surface_format_hint_option_enum__NORMALIZED3), + std::pair<StringHash, fx_surface_format_hint_option_enum>(106802788, fx_surface_format_hint_option_enum__NORMALIZED4), + std::pair<StringHash, fx_surface_format_hint_option_enum>(138340513, fx_surface_format_hint_option_enum__SRGB_GAMMA) +}; + +//--------------------------------------------------------------------- +fx_surface_format_hint_option_enum toEnum_fx_surface_format_hint_option_enum ( + const ParserChar** buffer, + const ParserChar* bufferEnd, + bool& failed, + const std::pair<StringHash, fx_surface_format_hint_option_enum>* enumMap, + StringHash (*baseConversionFunc)( const ParserChar**, const ParserChar*, bool& ) +) +{ + return Utils::toEnum<fx_surface_format_hint_option_enum, StringHash, fx_surface_format_hint_option_enum__COUNT>(buffer, bufferEnd, failed, enumMap, baseConversionFunc); +} + + +//--------------------------------------------------------------------- +const std::pair<StringHash, gles_texcombiner_operatorRGB_enums> gles_texcombiner_operatorRGB_enumsMap[gles_texcombiner_operatorRGB_enums__COUNT] = +{ + std::pair<StringHash, gles_texcombiner_operatorRGB_enums>(17796, gles_texcombiner_operatorRGB_enums__ADD), + std::pair<StringHash, gles_texcombiner_operatorRGB_enums>(75102772, gles_texcombiner_operatorRGB_enums__ADD_SIGNED), + std::pair<StringHash, gles_texcombiner_operatorRGB_enums>(75055650, gles_texcombiner_operatorRGB_enums__DOT3_RGB), + std::pair<StringHash, gles_texcombiner_operatorRGB_enums>(127148577, gles_texcombiner_operatorRGB_enums__DOT3_RGBA), + std::pair<StringHash, gles_texcombiner_operatorRGB_enums>(119422501, gles_texcombiner_operatorRGB_enums__INTERPOLATE), + std::pair<StringHash, gles_texcombiner_operatorRGB_enums>(60425125, gles_texcombiner_operatorRGB_enums__MODULATE), + std::pair<StringHash, gles_texcombiner_operatorRGB_enums>(111478053, gles_texcombiner_operatorRGB_enums__REPLACE), + std::pair<StringHash, gles_texcombiner_operatorRGB_enums>(158949380, gles_texcombiner_operatorRGB_enums__SUBTRACT) +}; + +//--------------------------------------------------------------------- +gles_texcombiner_operatorRGB_enums toEnum_gles_texcombiner_operatorRGB_enums ( + const ParserChar** buffer, + const ParserChar* bufferEnd, + bool& failed, + const std::pair<StringHash, gles_texcombiner_operatorRGB_enums>* enumMap, + StringHash (*baseConversionFunc)( const ParserChar**, const ParserChar*, bool& ) +) +{ + return Utils::toEnum<gles_texcombiner_operatorRGB_enums, StringHash, gles_texcombiner_operatorRGB_enums__COUNT>(buffer, bufferEnd, failed, enumMap, baseConversionFunc); +} + + +//--------------------------------------------------------------------- +const std::pair<StringHash, gles_texcombiner_source_enums> gles_texcombiner_source_enumsMap[gles_texcombiner_source_enums__COUNT] = +{ + std::pair<StringHash, gles_texcombiner_source_enums>(70812340, gles_texcombiner_source_enums__CONSTANT), + std::pair<StringHash, gles_texcombiner_source_enums>(111862259, gles_texcombiner_source_enums__PREVIOUS), + std::pair<StringHash, gles_texcombiner_source_enums>(91100713, gles_texcombiner_source_enums__PRIMARY), + std::pair<StringHash, gles_texcombiner_source_enums>(145594933, gles_texcombiner_source_enums__TEXTURE) +}; + +//--------------------------------------------------------------------- +gles_texcombiner_source_enums toEnum_gles_texcombiner_source_enums ( + const ParserChar** buffer, + const ParserChar* bufferEnd, + bool& failed, + const std::pair<StringHash, gles_texcombiner_source_enums>* enumMap, + StringHash (*baseConversionFunc)( const ParserChar**, const ParserChar*, bool& ) +) +{ + return Utils::toEnum<gles_texcombiner_source_enums, StringHash, gles_texcombiner_source_enums__COUNT>(buffer, bufferEnd, failed, enumMap, baseConversionFunc); +} + + +//--------------------------------------------------------------------- +const std::pair<StringHash, gles_texcombiner_operandRGB_enums> gles_texcombiner_operandRGB_enumsMap[gles_texcombiner_operandRGB_enums__COUNT] = +{ + std::pair<StringHash, gles_texcombiner_operandRGB_enums>(11673281, gles_texcombiner_operandRGB_enums__ONE_MINUS_SRC_ALPHA), + std::pair<StringHash, gles_texcombiner_operandRGB_enums>(11815746, gles_texcombiner_operandRGB_enums__ONE_MINUS_SRC_COLOR), + std::pair<StringHash, gles_texcombiner_operandRGB_enums>(154553505, gles_texcombiner_operandRGB_enums__SRC_ALPHA), + std::pair<StringHash, gles_texcombiner_operandRGB_enums>(154695970, gles_texcombiner_operandRGB_enums__SRC_COLOR) +}; + +//--------------------------------------------------------------------- +gles_texcombiner_operandRGB_enums toEnum_gles_texcombiner_operandRGB_enums ( + const ParserChar** buffer, + const ParserChar* bufferEnd, + bool& failed, + const std::pair<StringHash, gles_texcombiner_operandRGB_enums>* enumMap, + StringHash (*baseConversionFunc)( const ParserChar**, const ParserChar*, bool& ) +) +{ + return Utils::toEnum<gles_texcombiner_operandRGB_enums, StringHash, gles_texcombiner_operandRGB_enums__COUNT>(buffer, bufferEnd, failed, enumMap, baseConversionFunc); +} + + +//--------------------------------------------------------------------- +const std::pair<StringHash, gles_texcombiner_operatorAlpha_enums> gles_texcombiner_operatorAlpha_enumsMap[gles_texcombiner_operatorAlpha_enums__COUNT] = +{ + std::pair<StringHash, gles_texcombiner_operatorAlpha_enums>(17796, gles_texcombiner_operatorAlpha_enums__ADD), + std::pair<StringHash, gles_texcombiner_operatorAlpha_enums>(75102772, gles_texcombiner_operatorAlpha_enums__ADD_SIGNED), + std::pair<StringHash, gles_texcombiner_operatorAlpha_enums>(119422501, gles_texcombiner_operatorAlpha_enums__INTERPOLATE), + std::pair<StringHash, gles_texcombiner_operatorAlpha_enums>(60425125, gles_texcombiner_operatorAlpha_enums__MODULATE), + std::pair<StringHash, gles_texcombiner_operatorAlpha_enums>(111478053, gles_texcombiner_operatorAlpha_enums__REPLACE), + std::pair<StringHash, gles_texcombiner_operatorAlpha_enums>(158949380, gles_texcombiner_operatorAlpha_enums__SUBTRACT) +}; + +//--------------------------------------------------------------------- +gles_texcombiner_operatorAlpha_enums toEnum_gles_texcombiner_operatorAlpha_enums ( + const ParserChar** buffer, + const ParserChar* bufferEnd, + bool& failed, + const std::pair<StringHash, gles_texcombiner_operatorAlpha_enums>* enumMap, + StringHash (*baseConversionFunc)( const ParserChar**, const ParserChar*, bool& ) +) +{ + return Utils::toEnum<gles_texcombiner_operatorAlpha_enums, StringHash, gles_texcombiner_operatorAlpha_enums__COUNT>(buffer, bufferEnd, failed, enumMap, baseConversionFunc); +} + + +//--------------------------------------------------------------------- +const std::pair<StringHash, gles_texcombiner_operandAlpha_enums> gles_texcombiner_operandAlpha_enumsMap[gles_texcombiner_operandAlpha_enums__COUNT] = +{ + std::pair<StringHash, gles_texcombiner_operandAlpha_enums>(11673281, gles_texcombiner_operandAlpha_enums__ONE_MINUS_SRC_ALPHA), + std::pair<StringHash, gles_texcombiner_operandAlpha_enums>(154553505, gles_texcombiner_operandAlpha_enums__SRC_ALPHA) +}; + +//--------------------------------------------------------------------- +gles_texcombiner_operandAlpha_enums toEnum_gles_texcombiner_operandAlpha_enums ( + const ParserChar** buffer, + const ParserChar* bufferEnd, + bool& failed, + const std::pair<StringHash, gles_texcombiner_operandAlpha_enums>* enumMap, + StringHash (*baseConversionFunc)( const ParserChar**, const ParserChar*, bool& ) +) +{ + return Utils::toEnum<gles_texcombiner_operandAlpha_enums, StringHash, gles_texcombiner_operandAlpha_enums__COUNT>(buffer, bufferEnd, failed, enumMap, baseConversionFunc); +} + + +//--------------------------------------------------------------------- +const std::pair<StringHash, gles_texenv_mode_enums> gles_texenv_mode_enumsMap[gles_texenv_mode_enums__COUNT] = +{ + std::pair<StringHash, gles_texenv_mode_enums>(17796, gles_texenv_mode_enums__ADD), + std::pair<StringHash, gles_texenv_mode_enums>(4655652, gles_texenv_mode_enums__BLEND), + std::pair<StringHash, gles_texenv_mode_enums>(4757340, gles_texenv_mode_enums__DECAL), + std::pair<StringHash, gles_texenv_mode_enums>(60425125, gles_texenv_mode_enums__MODULATE), + std::pair<StringHash, gles_texenv_mode_enums>(111478053, gles_texenv_mode_enums__REPLACE) +}; + +//--------------------------------------------------------------------- +gles_texenv_mode_enums toEnum_gles_texenv_mode_enums ( + const ParserChar** buffer, + const ParserChar* bufferEnd, + bool& failed, + const std::pair<StringHash, gles_texenv_mode_enums>* enumMap, + StringHash (*baseConversionFunc)( const ParserChar**, const ParserChar*, bool& ) +) +{ + return Utils::toEnum<gles_texenv_mode_enums, StringHash, gles_texenv_mode_enums__COUNT>(buffer, bufferEnd, failed, enumMap, baseConversionFunc); +} + + +//--------------------------------------------------------------------- +const std::pair<StringHash, gles_sampler_wrap> gles_sampler_wrapMap[gles_sampler_wrap__COUNT] = +{ + std::pair<StringHash, gles_sampler_wrap>(4720160, gles_sampler_wrap__CLAMP), + std::pair<StringHash, gles_sampler_wrap>(22396597, gles_sampler_wrap__CLAMP_TO_EDGE), + std::pair<StringHash, gles_sampler_wrap>(52326884, gles_sampler_wrap__MIRRORED_REPEAT), + std::pair<StringHash, gles_sampler_wrap>(90851684, gles_sampler_wrap__REPEAT) +}; + +//--------------------------------------------------------------------- +gles_sampler_wrap toEnum_gles_sampler_wrap ( + const ParserChar** buffer, + const ParserChar* bufferEnd, + bool& failed, + const std::pair<StringHash, gles_sampler_wrap>* enumMap, + StringHash (*baseConversionFunc)( const ParserChar**, const ParserChar*, bool& ) +) +{ + return Utils::toEnum<gles_sampler_wrap, StringHash, gles_sampler_wrap__COUNT>(buffer, bufferEnd, failed, enumMap, baseConversionFunc); +} + + +//--------------------------------------------------------------------- +const std::pair<StringHash, fx_sampler_filter_common> fx_sampler_filter_commonMap[fx_sampler_filter_common__COUNT] = +{ + std::pair<StringHash, fx_sampler_filter_common>(84814178, fx_sampler_filter_common__LINEAR), + std::pair<StringHash, fx_sampler_filter_common>(230972482, fx_sampler_filter_common__LINEAR_MIPMAP_LINEAR), + std::pair<StringHash, fx_sampler_filter_common>(242301012, fx_sampler_filter_common__LINEAR_MIPMAP_NEAREST), + std::pair<StringHash, fx_sampler_filter_common>(43412180, fx_sampler_filter_common__NEAREST), + std::pair<StringHash, fx_sampler_filter_common>(92529554, fx_sampler_filter_common__NEAREST_MIPMAP_LINEAR), + std::pair<StringHash, fx_sampler_filter_common>(174769620, fx_sampler_filter_common__NEAREST_MIPMAP_NEAREST), + std::pair<StringHash, fx_sampler_filter_common>(341029, fx_sampler_filter_common__NONE) +}; + +//--------------------------------------------------------------------- +fx_sampler_filter_common toEnum_fx_sampler_filter_common ( + const ParserChar** buffer, + const ParserChar* bufferEnd, + bool& failed, + const std::pair<StringHash, fx_sampler_filter_common>* enumMap, + StringHash (*baseConversionFunc)( const ParserChar**, const ParserChar*, bool& ) +) +{ + return Utils::toEnum<fx_sampler_filter_common, StringHash, fx_sampler_filter_common__COUNT>(buffer, bufferEnd, failed, enumMap, baseConversionFunc); +} + + +//--------------------------------------------------------------------- +const std::pair<StringHash, gl_func_type> gl_func_typeMap[gl_func_type__COUNT] = +{ + std::pair<StringHash, gl_func_type>(73512675, gl_func_type__ALWAYS), + std::pair<StringHash, gl_func_type>(4876636, gl_func_type__EQUAL), + std::pair<StringHash, gl_func_type>(79325532, gl_func_type__GEQUAL), + std::pair<StringHash, gl_func_type>(208234722, gl_func_type__GREATER), + std::pair<StringHash, gl_func_type>(84568412, gl_func_type__LEQUAL), + std::pair<StringHash, gl_func_type>(330371, gl_func_type__LESS), + std::pair<StringHash, gl_func_type>(5417634, gl_func_type__NEVER), + std::pair<StringHash, gl_func_type>(76180588, gl_func_type__NOTEQUAL) +}; + +//--------------------------------------------------------------------- +gl_func_type toEnum_gl_func_type ( + const ParserChar** buffer, + const ParserChar* bufferEnd, + bool& failed, + const std::pair<StringHash, gl_func_type>* enumMap, + StringHash (*baseConversionFunc)( const ParserChar**, const ParserChar*, bool& ) +) +{ + return Utils::toEnum<gl_func_type, StringHash, gl_func_type__COUNT>(buffer, bufferEnd, failed, enumMap, baseConversionFunc); +} + + +//--------------------------------------------------------------------- +const std::pair<StringHash, gl_blend_type> gl_blend_typeMap[gl_blend_type__COUNT] = +{ + std::pair<StringHash, gl_blend_type>(235837041, gl_blend_type__CONSTANT_ALPHA), + std::pair<StringHash, gl_blend_type>(235979762, gl_blend_type__CONSTANT_COLOR), + std::pair<StringHash, gl_blend_type>(171232194, gl_blend_type__DEST_COLOR), + std::pair<StringHash, gl_blend_type>(171334977, gl_blend_type__DST_ALPHA), + std::pair<StringHash, gl_blend_type>(21541, gl_blend_type__ONE), + std::pair<StringHash, gl_blend_type>(58120065, gl_blend_type__ONE_MINUS_CONSTANT_ALPHA), + std::pair<StringHash, gl_blend_type>(58262530, gl_blend_type__ONE_MINUS_CONSTANT_COLOR), + std::pair<StringHash, gl_blend_type>(41006258, gl_blend_type__ONE_MINUS_DEST_COLOR), + std::pair<StringHash, gl_blend_type>(263351505, gl_blend_type__ONE_MINUS_DST_ALPHA), + std::pair<StringHash, gl_blend_type>(11673281, gl_blend_type__ONE_MINUS_SRC_ALPHA), + std::pair<StringHash, gl_blend_type>(11815746, gl_blend_type__ONE_MINUS_SRC_COLOR), + std::pair<StringHash, gl_blend_type>(154553505, gl_blend_type__SRC_ALPHA), + std::pair<StringHash, gl_blend_type>(38887829, gl_blend_type__SRC_ALPHA_SATURATE), + std::pair<StringHash, gl_blend_type>(154695970, gl_blend_type__SRC_COLOR), + std::pair<StringHash, gl_blend_type>(387695, gl_blend_type__ZERO) +}; + +//--------------------------------------------------------------------- +gl_blend_type toEnum_gl_blend_type ( + const ParserChar** buffer, + const ParserChar* bufferEnd, + bool& failed, + const std::pair<StringHash, gl_blend_type>* enumMap, + StringHash (*baseConversionFunc)( const ParserChar**, const ParserChar*, bool& ) +) +{ + return Utils::toEnum<gl_blend_type, StringHash, gl_blend_type__COUNT>(buffer, bufferEnd, failed, enumMap, baseConversionFunc); +} + + +//--------------------------------------------------------------------- +const std::pair<StringHash, gl_face_type> gl_face_typeMap[gl_face_type__COUNT] = +{ + std::pair<StringHash, gl_face_type>(288123, gl_face_type__BACK), + std::pair<StringHash, gl_face_type>(4944948, gl_face_type__FRONT), + std::pair<StringHash, gl_face_type>(98615947, gl_face_type__FRONT_AND_BACK) +}; + +//--------------------------------------------------------------------- +gl_face_type toEnum_gl_face_type ( + const ParserChar** buffer, + const ParserChar* bufferEnd, + bool& failed, + const std::pair<StringHash, gl_face_type>* enumMap, + StringHash (*baseConversionFunc)( const ParserChar**, const ParserChar*, bool& ) +) +{ + return Utils::toEnum<gl_face_type, StringHash, gl_face_type__COUNT>(buffer, bufferEnd, failed, enumMap, baseConversionFunc); +} + + +//--------------------------------------------------------------------- +const std::pair<StringHash, gl_fog_type> gl_fog_typeMap[gl_fog_type__COUNT] = +{ + std::pair<StringHash, gl_fog_type>(19152, gl_fog_type__EXP), + std::pair<StringHash, gl_fog_type>(306482, gl_fog_type__EXP2), + std::pair<StringHash, gl_fog_type>(84814178, gl_fog_type__LINEAR) +}; + +//--------------------------------------------------------------------- +gl_fog_type toEnum_gl_fog_type ( + const ParserChar** buffer, + const ParserChar* bufferEnd, + bool& failed, + const std::pair<StringHash, gl_fog_type>* enumMap, + StringHash (*baseConversionFunc)( const ParserChar**, const ParserChar*, bool& ) +) +{ + return Utils::toEnum<gl_fog_type, StringHash, gl_fog_type__COUNT>(buffer, bufferEnd, failed, enumMap, baseConversionFunc); +} + + +//--------------------------------------------------------------------- +const std::pair<StringHash, gl_front_face_type> gl_front_face_typeMap[gl_front_face_type__COUNT] = +{ + std::pair<StringHash, gl_front_face_type>(18311, gl_front_face_type__CCW), + std::pair<StringHash, gl_front_face_type>(1159, gl_front_face_type__CW) +}; + +//--------------------------------------------------------------------- +gl_front_face_type toEnum_gl_front_face_type ( + const ParserChar** buffer, + const ParserChar* bufferEnd, + bool& failed, + const std::pair<StringHash, gl_front_face_type>* enumMap, + StringHash (*baseConversionFunc)( const ParserChar**, const ParserChar*, bool& ) +) +{ + return Utils::toEnum<gl_front_face_type, StringHash, gl_front_face_type__COUNT>(buffer, bufferEnd, failed, enumMap, baseConversionFunc); +} + + +//--------------------------------------------------------------------- +const std::pair<StringHash, gl_logic_op_type> gl_logic_op_typeMap[gl_logic_op_type__COUNT] = +{ + std::pair<StringHash, gl_logic_op_type>(17956, gl_logic_op_type__AND), + std::pair<StringHash, gl_logic_op_type>(130603892, gl_logic_op_type__AND_INVERTED), + std::pair<StringHash, gl_logic_op_type>(116165941, gl_logic_op_type__AND_REVERSE), + std::pair<StringHash, gl_logic_op_type>(4720994, gl_logic_op_type__CLEAR), + std::pair<StringHash, gl_logic_op_type>(296025, gl_logic_op_type__COPY), + std::pair<StringHash, gl_logic_op_type>(200248116, gl_logic_op_type__COPY_INVERTED), + std::pair<StringHash, gl_logic_op_type>(4876774, gl_logic_op_type__EQUIV), + std::pair<StringHash, gl_logic_op_type>(82029172, gl_logic_op_type__INVERT), + std::pair<StringHash, gl_logic_op_type>(337444, gl_logic_op_type__NAND), + std::pair<StringHash, gl_logic_op_type>(341056, gl_logic_op_type__NOOP), + std::pair<StringHash, gl_logic_op_type>(21314, gl_logic_op_type__NOR), + std::pair<StringHash, gl_logic_op_type>(1346, gl_logic_op_type__OR), + std::pair<StringHash, gl_logic_op_type>(112193333, gl_logic_op_type__OR_REVERSE), + std::pair<StringHash, gl_logic_op_type>(22436, gl_logic_op_type__SET), + std::pair<StringHash, gl_logic_op_type>(23874, gl_logic_op_type__XOR) +}; + +//--------------------------------------------------------------------- +gl_logic_op_type toEnum_gl_logic_op_type ( + const ParserChar** buffer, + const ParserChar* bufferEnd, + bool& failed, + const std::pair<StringHash, gl_logic_op_type>* enumMap, + StringHash (*baseConversionFunc)( const ParserChar**, const ParserChar*, bool& ) +) +{ + return Utils::toEnum<gl_logic_op_type, StringHash, gl_logic_op_type__COUNT>(buffer, bufferEnd, failed, enumMap, baseConversionFunc); +} + + +//--------------------------------------------------------------------- +const std::pair<StringHash, gl_shade_model_type> gl_shade_model_typeMap[gl_shade_model_type__COUNT] = +{ + std::pair<StringHash, gl_shade_model_type>(307300, gl_shade_model_type__FLAT), + std::pair<StringHash, gl_shade_model_type>(92423304, gl_shade_model_type__SMOOTH) +}; + +//--------------------------------------------------------------------- +gl_shade_model_type toEnum_gl_shade_model_type ( + const ParserChar** buffer, + const ParserChar* bufferEnd, + bool& failed, + const std::pair<StringHash, gl_shade_model_type>* enumMap, + StringHash (*baseConversionFunc)( const ParserChar**, const ParserChar*, bool& ) +) +{ + return Utils::toEnum<gl_shade_model_type, StringHash, gl_shade_model_type__COUNT>(buffer, bufferEnd, failed, enumMap, baseConversionFunc); +} + + +//--------------------------------------------------------------------- +const std::pair<StringHash, gles_stencil_op_type> gles_stencil_op_typeMap[gles_stencil_op_type__COUNT] = +{ + std::pair<StringHash, gles_stencil_op_type>(297346, gles_stencil_op_type__DECR), + std::pair<StringHash, gles_stencil_op_type>(320130, gles_stencil_op_type__INCR), + std::pair<StringHash, gles_stencil_op_type>(82029172, gles_stencil_op_type__INVERT), + std::pair<StringHash, gles_stencil_op_type>(326048, gles_stencil_op_type__KEEP), + std::pair<StringHash, gles_stencil_op_type>(111478053, gles_stencil_op_type__REPLACE), + std::pair<StringHash, gles_stencil_op_type>(387695, gles_stencil_op_type__ZERO) +}; + +//--------------------------------------------------------------------- +gles_stencil_op_type toEnum_gles_stencil_op_type ( + const ParserChar** buffer, + const ParserChar* bufferEnd, + bool& failed, + const std::pair<StringHash, gles_stencil_op_type>* enumMap, + StringHash (*baseConversionFunc)( const ParserChar**, const ParserChar*, bool& ) +) +{ + return Utils::toEnum<gles_stencil_op_type, StringHash, gles_stencil_op_type__COUNT>(buffer, bufferEnd, failed, enumMap, baseConversionFunc); +} + + +//--------------------------------------------------------------------- +const std::pair<StringHash, VersionType> VersionTypeMap[VersionType__COUNT] = +{ + std::pair<StringHash, VersionType>(3413776, VersionType__1_4_0), + std::pair<StringHash, VersionType>(3413777, VersionType__1_4_1) +}; + +//--------------------------------------------------------------------- +VersionType toEnum_VersionType ( + const ParserChar** buffer, + const ParserChar* bufferEnd, + bool& failed, + const std::pair<StringHash, VersionType>* enumMap, + StringHash (*baseConversionFunc)( const ParserChar**, const ParserChar*, bool& ) +) +{ + return Utils::toEnum<VersionType, StringHash, VersionType__COUNT>(buffer, bufferEnd, failed, enumMap, baseConversionFunc); +} + + +//--------------------------------------------------------------------- +const std::pair<StringHash, MorphMethodType> MorphMethodTypeMap[MorphMethodType__COUNT] = +{ + std::pair<StringHash, MorphMethodType>(23452388, MorphMethodType__NORMALIZED), + std::pair<StringHash, MorphMethodType>(168201157, MorphMethodType__RELATIVE) +}; + +//--------------------------------------------------------------------- +MorphMethodType toEnum_MorphMethodType ( + const ParserChar** buffer, + const ParserChar* bufferEnd, + bool& failed, + const std::pair<StringHash, MorphMethodType>* enumMap, + StringHash (*baseConversionFunc)( const ParserChar**, const ParserChar*, bool& ) +) +{ + return Utils::toEnum<MorphMethodType, StringHash, MorphMethodType__COUNT>(buffer, bufferEnd, failed, enumMap, baseConversionFunc); +} + + +//--------------------------------------------------------------------- +const std::pair<StringHash, fx_sampler_wrap_common> fx_sampler_wrap_commonMap[fx_sampler_wrap_common__COUNT] = +{ + std::pair<StringHash, fx_sampler_wrap_common>(74737826, fx_sampler_wrap_common__BORDER), + std::pair<StringHash, fx_sampler_wrap_common>(4720160, fx_sampler_wrap_common__CLAMP), + std::pair<StringHash, fx_sampler_wrap_common>(85882690, fx_sampler_wrap_common__MIRROR), + std::pair<StringHash, fx_sampler_wrap_common>(341029, fx_sampler_wrap_common__NONE), + std::pair<StringHash, fx_sampler_wrap_common>(378464, fx_sampler_wrap_common__WRAP) +}; + +//--------------------------------------------------------------------- +fx_sampler_wrap_common toEnum_fx_sampler_wrap_common ( + const ParserChar** buffer, + const ParserChar* bufferEnd, + bool& failed, + const std::pair<StringHash, fx_sampler_wrap_common>* enumMap, + StringHash (*baseConversionFunc)( const ParserChar**, const ParserChar*, bool& ) +) +{ + return Utils::toEnum<fx_sampler_wrap_common, StringHash, fx_sampler_wrap_common__COUNT>(buffer, bufferEnd, failed, enumMap, baseConversionFunc); +} + + +//--------------------------------------------------------------------- +const std::pair<StringHash, NodeType> NodeTypeMap[NodeType__COUNT] = +{ + std::pair<StringHash, NodeType>(5193268, NodeType__JOINT), + std::pair<StringHash, NodeType>(340869, NodeType__NODE) +}; + +//--------------------------------------------------------------------- +NodeType toEnum_NodeType ( + const ParserChar** buffer, + const ParserChar* bufferEnd, + bool& failed, + const std::pair<StringHash, NodeType>* enumMap, + StringHash (*baseConversionFunc)( const ParserChar**, const ParserChar*, bool& ) +) +{ + return Utils::toEnum<NodeType, StringHash, NodeType__COUNT>(buffer, bufferEnd, failed, enumMap, baseConversionFunc); +} + + +//--------------------------------------------------------------------- +const std::pair<StringHash, fx_opaque_enum> fx_opaque_enumMap[fx_opaque_enum__COUNT] = +{ + std::pair<StringHash, fx_opaque_enum>(4670501, fx_opaque_enum__A_ONE), + std::pair<StringHash, fx_opaque_enum>(193261327, fx_opaque_enum__RGB_ZERO) +}; + +//--------------------------------------------------------------------- +fx_opaque_enum toEnum_fx_opaque_enum ( + const ParserChar** buffer, + const ParserChar* bufferEnd, + bool& failed, + const std::pair<StringHash, fx_opaque_enum>* enumMap, + StringHash (*baseConversionFunc)( const ParserChar**, const ParserChar*, bool& ) +) +{ + return Utils::toEnum<fx_opaque_enum, StringHash, fx_opaque_enum__COUNT>(buffer, bufferEnd, failed, enumMap, baseConversionFunc); +} + + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rob...@us...> - 2009-02-05 14:36:35
|
Revision: 342 http://colladamaya.svn.sourceforge.net/colladamaya/?rev=342&view=rev Author: robertwuerfel Date: 2009-02-05 14:36:30 +0000 (Thu, 05 Feb 2009) Log Message: ----------- update generated sax Parser - now supports enums - attributes with list type Modified Paths: -------------- branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLColladaParserAutoGen.h branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLColladaParserAutoGenAttributes.h branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLColladaParserAutoGenPrivate.h branches/nextgen/COLLADASaxFrameworkLoader/scripts/COLLADASaxFrameworkLoader.vcproj branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLColladaParserAutoGenPrivate.cpp branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLColladaParserAutoGenPrivateFunctionMap.cpp branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLColladaParserAutoGenPrivateNameMap.cpp branches/nextgen/GeneratedSaxParser/include/GeneratedSaxParserLibxmlSaxParser.h branches/nextgen/GeneratedSaxParser/include/GeneratedSaxParserParser.h branches/nextgen/GeneratedSaxParser/include/GeneratedSaxParserParserTemplate.h branches/nextgen/GeneratedSaxParser/include/GeneratedSaxParserParserTemplateBase.h branches/nextgen/GeneratedSaxParser/include/GeneratedSaxParserPrerequisites.h branches/nextgen/GeneratedSaxParser/include/GeneratedSaxParserTypes.h branches/nextgen/GeneratedSaxParser/include/GeneratedSaxParserUtils.h branches/nextgen/GeneratedSaxParser/src/GeneratedSaxParserCoutErrorHandler.cpp branches/nextgen/GeneratedSaxParser/src/GeneratedSaxParserLibxmlSaxParser.cpp branches/nextgen/GeneratedSaxParser/src/GeneratedSaxParserUtils.cpp Modified: branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLColladaParserAutoGen.h =================================================================== --- branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLColladaParserAutoGen.h 2009-02-05 14:27:55 UTC (rev 341) +++ branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLColladaParserAutoGen.h 2009-02-05 14:36:30 UTC (rev 342) @@ -28,11 +28,11 @@ virtual ~ColladaParserAutoGen(){} -virtual bool begin__COLLADA( const COLLADA__AttributeData& attributeData ){return true;} -virtual bool end__COLLADA(){return true;} +virtual bool begin__profile_GLES( const profile_GLES__AttributeData& attributeData ){return true;} +virtual bool end__profile_GLES(){return true;} -virtual bool begin__COLLADA__asset(){return true;} -virtual bool end__COLLADA__asset(){return true;} +virtual bool begin__profile_GLES__asset(){return true;} +virtual bool end__profile_GLES__asset(){return true;} virtual bool begin__contributor(){return true;} virtual bool end__contributor(){return true;} @@ -86,8 +86,856 @@ virtual bool begin__up_axis(){return true;} virtual bool end__up_axis(){return true;} -virtual bool data__up_axis( const ParserChar* value, size_t length ){return true;} +virtual bool data__up_axis( const UpAxisType value ){return true;} +virtual bool begin__profile_GLES__image( const image__AttributeData& attributeData ){return true;} +virtual bool end__profile_GLES__image(){return true;} + +virtual bool begin__image__asset(){return true;} +virtual bool end__image__asset(){return true;} + +virtual bool begin__data(){return true;} +virtual bool end__data(){return true;} +virtual bool data__data( const ParserChar* value, size_t length ){return true;} + +virtual bool begin__image__init_from(){return true;} +virtual bool end__image__init_from(){return true;} +virtual bool data__image__init_from( const ParserChar* value, size_t length ){return true;} + +virtual bool begin__image__extra( const extra__AttributeData& attributeData ){return true;} +virtual bool end__image__extra(){return true;} + +virtual bool begin__extra__asset(){return true;} +virtual bool end__extra__asset(){return true;} + +virtual bool begin__extra__technique( const extra__technique__AttributeData& attributeData ){return true;} +virtual bool end__extra__technique(){return true;} + +virtual bool begin__profile_GLES__newparam( const profile_GLES__newparam__AttributeData& attributeData ){return true;} +virtual bool end__profile_GLES__newparam(){return true;} + +virtual bool begin__newparam__annotate( const annotate__AttributeData& attributeData ){return true;} +virtual bool end__newparam__annotate(){return true;} + +virtual bool begin__annotate__bool(){return true;} +virtual bool end__annotate__bool(){return true;} +virtual bool data__annotate__bool( bool value ){return true;} + +virtual bool begin__annotate__bool2(){return true;} +virtual bool end__annotate__bool2(){return true;} +virtual bool data__annotate__bool2( const bool* value, size_t length ){return true;} + +virtual bool begin__annotate__bool3(){return true;} +virtual bool end__annotate__bool3(){return true;} +virtual bool data__annotate__bool3( const bool* value, size_t length ){return true;} + +virtual bool begin__annotate__bool4(){return true;} +virtual bool end__annotate__bool4(){return true;} +virtual bool data__annotate__bool4( const bool* value, size_t length ){return true;} + +virtual bool begin__annotate__int(){return true;} +virtual bool end__annotate__int(){return true;} +virtual bool data__annotate__int( long value ){return true;} + +virtual bool begin__annotate__int2(){return true;} +virtual bool end__annotate__int2(){return true;} +virtual bool data__annotate__int2( const long* value, size_t length ){return true;} + +virtual bool begin__annotate__int3(){return true;} +virtual bool end__annotate__int3(){return true;} +virtual bool data__annotate__int3( const long* value, size_t length ){return true;} + +virtual bool begin__annotate__int4(){return true;} +virtual bool end__annotate__int4(){return true;} +virtual bool data__annotate__int4( const long* value, size_t length ){return true;} + +virtual bool begin__annotate__float(){return true;} +virtual bool end__annotate__float(){return true;} +virtual bool data__annotate__float( double value ){return true;} + +virtual bool begin__annotate__float2(){return true;} +virtual bool end__annotate__float2(){return true;} +virtual bool data__annotate__float2( const double* value, size_t length ){return true;} + +virtual bool begin__annotate__float3(){return true;} +virtual bool end__annotate__float3(){return true;} +virtual bool data__annotate__float3( const double* value, size_t length ){return true;} + +virtual bool begin__annotate__float4(){return true;} +virtual bool end__annotate__float4(){return true;} +virtual bool data__annotate__float4( const double* value, size_t length ){return true;} + +virtual bool begin__annotate__float2x2(){return true;} +virtual bool end__annotate__float2x2(){return true;} +virtual bool data__annotate__float2x2( const double* value, size_t length ){return true;} + +virtual bool begin__annotate__float3x3(){return true;} +virtual bool end__annotate__float3x3(){return true;} +virtual bool data__annotate__float3x3( const double* value, size_t length ){return true;} + +virtual bool begin__annotate__float4x4(){return true;} +virtual bool end__annotate__float4x4(){return true;} +virtual bool data__annotate__float4x4( const double* value, size_t length ){return true;} + +virtual bool begin__annotate__string(){return true;} +virtual bool end__annotate__string(){return true;} +virtual bool data__annotate__string( const ParserChar* value, size_t length ){return true;} + +virtual bool begin__semantic(){return true;} +virtual bool end__semantic(){return true;} +virtual bool data__semantic( const ParserChar* value, size_t length ){return true;} + +virtual bool begin__modifier(){return true;} +virtual bool end__modifier(){return true;} +virtual bool data__modifier( const fx_modifier_enum_common value ){return true;} + +virtual bool begin__newparam__bool(){return true;} +virtual bool end__newparam__bool(){return true;} +virtual bool data__newparam__bool( bool value ){return true;} + +virtual bool begin__newparam__bool2(){return true;} +virtual bool end__newparam__bool2(){return true;} +virtual bool data__newparam__bool2( const bool* value, size_t length ){return true;} + +virtual bool begin__newparam__bool3(){return true;} +virtual bool end__newparam__bool3(){return true;} +virtual bool data__newparam__bool3( const bool* value, size_t length ){return true;} + +virtual bool begin__newparam__bool4(){return true;} +virtual bool end__newparam__bool4(){return true;} +virtual bool data__newparam__bool4( const bool* value, size_t length ){return true;} + +virtual bool begin__newparam__int(){return true;} +virtual bool end__newparam__int(){return true;} +virtual bool data__newparam__int( long value ){return true;} + +virtual bool begin__newparam__int2(){return true;} +virtual bool end__newparam__int2(){return true;} +virtual bool data__newparam__int2( const long* value, size_t length ){return true;} + +virtual bool begin__newparam__int3(){return true;} +virtual bool end__newparam__int3(){return true;} +virtual bool data__newparam__int3( const long* value, size_t length ){return true;} + +virtual bool begin__newparam__int4(){return true;} +virtual bool end__newparam__int4(){return true;} +virtual bool data__newparam__int4( const long* value, size_t length ){return true;} + +virtual bool begin__newparam__float(){return true;} +virtual bool end__newparam__float(){return true;} +virtual bool data__newparam__float( double value ){return true;} + +virtual bool begin__newparam__float2(){return true;} +virtual bool end__newparam__float2(){return true;} +virtual bool data__newparam__float2( const double* value, size_t length ){return true;} + +virtual bool begin__newparam__float3(){return true;} +virtual bool end__newparam__float3(){return true;} +virtual bool data__newparam__float3( const double* value, size_t length ){return true;} + +virtual bool begin__newparam__float4(){return true;} +virtual bool end__newparam__float4(){return true;} +virtual bool data__newparam__float4( const double* value, size_t length ){return true;} + +virtual bool begin__newparam__float1x1(){return true;} +virtual bool end__newparam__float1x1(){return true;} +virtual bool data__newparam__float1x1( double value ){return true;} + +virtual bool begin__newparam__float1x2(){return true;} +virtual bool end__newparam__float1x2(){return true;} +virtual bool data__newparam__float1x2( const double* value, size_t length ){return true;} + +virtual bool begin__newparam__float1x3(){return true;} +virtual bool end__newparam__float1x3(){return true;} +virtual bool data__newparam__float1x3( const double* value, size_t length ){return true;} + +virtual bool begin__newparam__float1x4(){return true;} +virtual bool end__newparam__float1x4(){return true;} +virtual bool data__newparam__float1x4( const double* value, size_t length ){return true;} + +virtual bool begin__newparam__float2x1(){return true;} +virtual bool end__newparam__float2x1(){return true;} +virtual bool data__newparam__float2x1( const double* value, size_t length ){return true;} + +virtual bool begin__newparam__float2x2(){return true;} +virtual bool end__newparam__float2x2(){return true;} +virtual bool data__newparam__float2x2( const double* value, size_t length ){return true;} + +virtual bool begin__newparam__float2x3(){return true;} +virtual bool end__newparam__float2x3(){return true;} +virtual bool data__newparam__float2x3( const double* value, size_t length ){return true;} + +virtual bool begin__newparam__float2x4(){return true;} +virtual bool end__newparam__float2x4(){return true;} +virtual bool data__newparam__float2x4( const double* value, size_t length ){return true;} + +virtual bool begin__newparam__float3x1(){return true;} +virtual bool end__newparam__float3x1(){return true;} +virtual bool data__newparam__float3x1( const double* value, size_t length ){return true;} + +virtual bool begin__newparam__float3x2(){return true;} +virtual bool end__newparam__float3x2(){return true;} +virtual bool data__newparam__float3x2( const double* value, size_t length ){return true;} + +virtual bool begin__newparam__float3x3(){return true;} +virtual bool end__newparam__float3x3(){return true;} +virtual bool data__newparam__float3x3( const double* value, size_t length ){return true;} + +virtual bool begin__newparam__float3x4(){return true;} +virtual bool end__newparam__float3x4(){return true;} +virtual bool data__newparam__float3x4( const double* value, size_t length ){return true;} + +virtual bool begin__newparam__float4x1(){return true;} +virtual bool end__newparam__float4x1(){return true;} +virtual bool data__newparam__float4x1( const double* value, size_t length ){return true;} + +virtual bool begin__newparam__float4x2(){return true;} +virtual bool end__newparam__float4x2(){return true;} +virtual bool data__newparam__float4x2( const double* value, size_t length ){return true;} + +virtual bool begin__newparam__float4x3(){return true;} +virtual bool end__newparam__float4x3(){return true;} +virtual bool data__newparam__float4x3( const double* value, size_t length ){return true;} + +virtual bool begin__newparam__float4x4(){return true;} +virtual bool end__newparam__float4x4(){return true;} +virtual bool data__newparam__float4x4( const double* value, size_t length ){return true;} + +virtual bool begin__newparam__surface( const newparam__surface__AttributeData& attributeData ){return true;} +virtual bool end__newparam__surface(){return true;} + +virtual bool begin__init_as_null(){return true;} +virtual bool end__init_as_null(){return true;} +virtual bool data__init_as_null( const ParserChar* value, size_t length ){return true;} + +virtual bool begin__init_as_target(){return true;} +virtual bool end__init_as_target(){return true;} +virtual bool data__init_as_target( const ParserChar* value, size_t length ){return true;} + +virtual bool begin__init_cube(){return true;} +virtual bool end__init_cube(){return true;} + +virtual bool begin__init_cube__all( const init_cube__all__AttributeData& attributeData ){return true;} +virtual bool end__init_cube__all(){return true;} + +virtual bool begin__init_cube__primary( const init_cube__primary__AttributeData& attributeData ){return true;} +virtual bool end__init_cube__primary(){return true;} + +virtual bool begin__order(){return true;} +virtual bool end__order(){return true;} +virtual bool data__order( const fx_surface_face_enum value ){return true;} + +virtual bool begin__init_cube__face( const init_cube__face__AttributeData& attributeData ){return true;} +virtual bool end__init_cube__face(){return true;} + +virtual bool begin__init_volume(){return true;} +virtual bool end__init_volume(){return true;} + +virtual bool begin__init_volume__all( const init_volume__all__AttributeData& attributeData ){return true;} +virtual bool end__init_volume__all(){return true;} + +virtual bool begin__init_volume__primary( const init_volume__primary__AttributeData& attributeData ){return true;} +virtual bool end__init_volume__primary(){return true;} + +virtual bool begin__init_planar(){return true;} +virtual bool end__init_planar(){return true;} + +virtual bool begin__init_planar__all( const init_planar__all__AttributeData& attributeData ){return true;} +virtual bool end__init_planar__all(){return true;} + +virtual bool begin__surface__init_from( const surface__init_from__AttributeData& attributeData ){return true;} +virtual bool end__surface__init_from(){return true;} +virtual bool data__surface__init_from( const ParserChar* value, size_t length ){return true;} + +virtual bool begin__format(){return true;} +virtual bool end__format(){return true;} +virtual bool data__format( const ParserChar* value, size_t length ){return true;} + +virtual bool begin__format_hint(){return true;} +virtual bool end__format_hint(){return true;} + +virtual bool begin__channels(){return true;} +virtual bool end__channels(){return true;} +virtual bool data__channels( const fx_surface_format_hint_channels_enum value ){return true;} + +virtual bool begin__range(){return true;} +virtual bool end__range(){return true;} +virtual bool data__range( const fx_surface_format_hint_range_enum value ){return true;} + +virtual bool begin__precision(){return true;} +virtual bool end__precision(){return true;} +virtual bool data__precision( const fx_surface_format_hint_precision_enum value ){return true;} + +virtual bool begin__option(){return true;} +virtual bool end__option(){return true;} +virtual bool data__option( const fx_surface_format_hint_option_enum value ){return true;} + +virtual bool begin__format_hint__extra( const extra__AttributeData& attributeData ){return true;} +virtual bool end__format_hint__extra(){return true;} + +virtual bool begin__surface__size(){return true;} +virtual bool end__surface__size(){return true;} +virtual bool data__surface__size( const long* value, size_t length ){return true;} + +virtual bool begin__viewport_ratio(){return true;} +virtual bool end__viewport_ratio(){return true;} +virtual bool data__viewport_ratio( const double* value, size_t length ){return true;} + +virtual bool begin__mip_levels(){return true;} +virtual bool end__mip_levels(){return true;} +virtual bool data__mip_levels( unsigned long value ){return true;} + +virtual bool begin__mipmap_generate(){return true;} +virtual bool end__mipmap_generate(){return true;} +virtual bool data__mipmap_generate( bool value ){return true;} + +virtual bool begin__surface__extra( const extra__AttributeData& attributeData ){return true;} +virtual bool end__surface__extra(){return true;} + +virtual bool begin__newparam__texture_pipeline( const newparam__texture_pipeline__AttributeData& attributeData ){return true;} +virtual bool end__newparam__texture_pipeline(){return true;} + +virtual bool begin__texture_pipeline__texcombiner(){return true;} +virtual bool end__texture_pipeline__texcombiner(){return true;} + +virtual bool begin__texcombiner__constant( const texcombiner__constant__AttributeData& attributeData ){return true;} +virtual bool end__texcombiner__constant(){return true;} + +virtual bool begin__RGB( const RGB__AttributeData& attributeData ){return true;} +virtual bool end__RGB(){return true;} + +virtual bool begin__RGB__argument( const RGB__argument__AttributeData& attributeData ){return true;} +virtual bool end__RGB__argument(){return true;} + +virtual bool begin__texcombiner__alpha( const texcombiner__alpha__AttributeData& attributeData ){return true;} +virtual bool end__texcombiner__alpha(){return true;} + +virtual bool begin__alpha__argument( const alpha__argument__AttributeData& attributeData ){return true;} +virtual bool end__alpha__argument(){return true;} + +virtual bool begin__texture_pipeline__texenv( const texenv__AttributeData& attributeData ){return true;} +virtual bool end__texture_pipeline__texenv(){return true;} + +virtual bool begin__texenv__constant( const texenv__constant__AttributeData& attributeData ){return true;} +virtual bool end__texenv__constant(){return true;} + +virtual bool begin__texture_pipeline__extra( const extra__AttributeData& attributeData ){return true;} +virtual bool end__texture_pipeline__extra(){return true;} + +virtual bool begin__newparam__sampler_state( const newparam__sampler_state__AttributeData& attributeData ){return true;} +virtual bool end__newparam__sampler_state(){return true;} + +virtual bool begin__sampler_state__wrap_s(){return true;} +virtual bool end__sampler_state__wrap_s(){return true;} +virtual bool data__sampler_state__wrap_s( const gles_sampler_wrap value ){return true;} + +virtual bool begin__sampler_state__wrap_t(){return true;} +virtual bool end__sampler_state__wrap_t(){return true;} +virtual bool data__sampler_state__wrap_t( const gles_sampler_wrap value ){return true;} + +virtual bool begin__sampler_state__minfilter(){return true;} +virtual bool end__sampler_state__minfilter(){return true;} +virtual bool data__sampler_state__minfilter( const fx_sampler_filter_common value ){return true;} + +virtual bool begin__sampler_state__magfilter(){return true;} +virtual bool end__sampler_state__magfilter(){return true;} +virtual bool data__sampler_state__magfilter( const fx_sampler_filter_common value ){return true;} + +virtual bool begin__sampler_state__mipfilter(){return true;} +virtual bool end__sampler_state__mipfilter(){return true;} +virtual bool data__sampler_state__mipfilter( const fx_sampler_filter_common value ){return true;} + +virtual bool begin__sampler_state__mipmap_maxlevel(){return true;} +virtual bool end__sampler_state__mipmap_maxlevel(){return true;} +virtual bool data__sampler_state__mipmap_maxlevel( unsigned short value ){return true;} + +virtual bool begin__sampler_state__mipmap_bias(){return true;} +virtual bool end__sampler_state__mipmap_bias(){return true;} +virtual bool data__sampler_state__mipmap_bias( double value ){return true;} + +virtual bool begin__sampler_state__extra( const extra__AttributeData& attributeData ){return true;} +virtual bool end__sampler_state__extra(){return true;} + +virtual bool begin__newparam__texture_unit( const texture_unit__AttributeData& attributeData ){return true;} +virtual bool end__newparam__texture_unit(){return true;} + +virtual bool begin__texture_unit__surface(){return true;} +virtual bool end__texture_unit__surface(){return true;} +virtual bool data__texture_unit__surface( const ParserChar* value, size_t length ){return true;} + +virtual bool begin__texture_unit__sampler_state(){return true;} +virtual bool end__texture_unit__sampler_state(){return true;} +virtual bool data__texture_unit__sampler_state( const ParserChar* value, size_t length ){return true;} + +virtual bool begin__texcoord( const texcoord__AttributeData& attributeData ){return true;} +virtual bool end__texcoord(){return true;} + +virtual bool begin__texture_unit__extra( const extra__AttributeData& attributeData ){return true;} +virtual bool end__texture_unit__extra(){return true;} + +virtual bool begin__newparam__enum(){return true;} +virtual bool end__newparam__enum(){return true;} +virtual bool data__newparam__enum( const ParserChar* value, size_t length ){return true;} + +virtual bool begin__profile_GLES__technique( const profile_GLES__technique__AttributeData& attributeData ){return true;} +virtual bool end__profile_GLES__technique(){return true;} + +virtual bool begin__technique__asset(){return true;} +virtual bool end__technique__asset(){return true;} + +virtual bool begin__technique__annotate( const annotate__AttributeData& attributeData ){return true;} +virtual bool end__technique__annotate(){return true;} + +virtual bool begin__technique__image( const image__AttributeData& attributeData ){return true;} +virtual bool end__technique__image(){return true;} + +virtual bool begin__technique__newparam( const technique__newparam__AttributeData& attributeData ){return true;} +virtual bool end__technique__newparam(){return true;} + +virtual bool begin__technique__setparam( const technique__setparam__AttributeData& attributeData ){return true;} +virtual bool end__technique__setparam(){return true;} + +virtual bool begin__setparam__annotate( const annotate__AttributeData& attributeData ){return true;} +virtual bool end__setparam__annotate(){return true;} + +virtual bool begin__setparam__bool(){return true;} +virtual bool end__setparam__bool(){return true;} +virtual bool data__setparam__bool( bool value ){return true;} + +virtual bool begin__setparam__bool2(){return true;} +virtual bool end__setparam__bool2(){return true;} +virtual bool data__setparam__bool2( const bool* value, size_t length ){return true;} + +virtual bool begin__setparam__bool3(){return true;} +virtual bool end__setparam__bool3(){return true;} +virtual bool data__setparam__bool3( const bool* value, size_t length ){return true;} + +virtual bool begin__setparam__bool4(){return true;} +virtual bool end__setparam__bool4(){return true;} +virtual bool data__setparam__bool4( const bool* value, size_t length ){return true;} + +virtual bool begin__setparam__int(){return true;} +virtual bool end__setparam__int(){return true;} +virtual bool data__setparam__int( long value ){return true;} + +virtual bool begin__setparam__int2(){return true;} +virtual bool end__setparam__int2(){return true;} +virtual bool data__setparam__int2( const long* value, size_t length ){return true;} + +virtual bool begin__setparam__int3(){return true;} +virtual bool end__setparam__int3(){return true;} +virtual bool data__setparam__int3( const long* value, size_t length ){return true;} + +virtual bool begin__setparam__int4(){return true;} +virtual bool end__setparam__int4(){return true;} +virtual bool data__setparam__int4( const long* value, size_t length ){return true;} + +virtual bool begin__setparam__float(){return true;} +virtual bool end__setparam__float(){return true;} +virtual bool data__setparam__float( double value ){return true;} + +virtual bool begin__setparam__float2(){return true;} +virtual bool end__setparam__float2(){return true;} +virtual bool data__setparam__float2( const double* value, size_t length ){return true;} + +virtual bool begin__setparam__float3(){return true;} +virtual bool end__setparam__float3(){return true;} +virtual bool data__setparam__float3( const double* value, size_t length ){return true;} + +virtual bool begin__setparam__float4(){return true;} +virtual bool end__setparam__float4(){return true;} +virtual bool data__setparam__float4( const double* value, size_t length ){return true;} + +virtual bool begin__setparam__float1x1(){return true;} +virtual bool end__setparam__float1x1(){return true;} +virtual bool data__setparam__float1x1( double value ){return true;} + +virtual bool begin__setparam__float1x2(){return true;} +virtual bool end__setparam__float1x2(){return true;} +virtual bool data__setparam__float1x2( const double* value, size_t length ){return true;} + +virtual bool begin__setparam__float1x3(){return true;} +virtual bool end__setparam__float1x3(){return true;} +virtual bool data__setparam__float1x3( const double* value, size_t length ){return true;} + +virtual bool begin__setparam__float1x4(){return true;} +virtual bool end__setparam__float1x4(){return true;} +virtual bool data__setparam__float1x4( const double* value, size_t length ){return true;} + +virtual bool begin__setparam__float2x1(){return true;} +virtual bool end__setparam__float2x1(){return true;} +virtual bool data__setparam__float2x1( const double* value, size_t length ){return true;} + +virtual bool begin__setparam__float2x2(){return true;} +virtual bool end__setparam__float2x2(){return true;} +virtual bool data__setparam__float2x2( const double* value, size_t length ){return true;} + +virtual bool begin__setparam__float2x3(){return true;} +virtual bool end__setparam__float2x3(){return true;} +virtual bool data__setparam__float2x3( const double* value, size_t length ){return true;} + +virtual bool begin__setparam__float2x4(){return true;} +virtual bool end__setparam__float2x4(){return true;} +virtual bool data__setparam__float2x4( const double* value, size_t length ){return true;} + +virtual bool begin__setparam__float3x1(){return true;} +virtual bool end__setparam__float3x1(){return true;} +virtual bool data__setparam__float3x1( const double* value, size_t length ){return true;} + +virtual bool begin__setparam__float3x2(){return true;} +virtual bool end__setparam__float3x2(){return true;} +virtual bool data__setparam__float3x2( const double* value, size_t length ){return true;} + +virtual bool begin__setparam__float3x3(){return true;} +virtual bool end__setparam__float3x3(){return true;} +virtual bool data__setparam__float3x3( const double* value, size_t length ){return true;} + +virtual bool begin__setparam__float3x4(){return true;} +virtual bool end__setparam__float3x4(){return true;} +virtual bool data__setparam__float3x4( const double* value, size_t length ){return true;} + +virtual bool begin__setparam__float4x1(){return true;} +virtual bool end__setparam__float4x1(){return true;} +virtual bool data__setparam__float4x1( const double* value, size_t length ){return true;} + +virtual bool begin__setparam__float4x2(){return true;} +virtual bool end__setparam__float4x2(){return true;} +virtual bool data__setparam__float4x2( const double* value, size_t length ){return true;} + +virtual bool begin__setparam__float4x3(){return true;} +virtual bool end__setparam__float4x3(){return true;} +virtual bool data__setparam__float4x3( const double* value, size_t length ){return true;} + +virtual bool begin__setparam__float4x4(){return true;} +virtual bool end__setparam__float4x4(){return true;} +virtual bool data__setparam__float4x4( const double* value, size_t length ){return true;} + +virtual bool begin__setparam__surface( const setparam__surface__AttributeData& attributeData ){return true;} +virtual bool end__setparam__surface(){return true;} + +virtual bool begin__setparam__texture_pipeline( const setparam__texture_pipeline__AttributeData& attributeData ){return true;} +virtual bool end__setparam__texture_pipeline(){return true;} + +virtual bool begin__setparam__sampler_state( const setparam__sampler_state__AttributeData& attributeData ){return true;} +virtual bool end__setparam__sampler_state(){return true;} + +virtual bool begin__setparam__texture_unit( const texture_unit__AttributeData& attributeData ){return true;} +virtual bool end__setparam__texture_unit(){return true;} + +virtual bool begin__setparam__enum(){return true;} +virtual bool end__setparam__enum(){return true;} +virtual bool data__setparam__enum( const ParserChar* value, size_t length ){return true;} + +virtual bool begin__pass( const pass__AttributeData& attributeData ){return true;} +virtual bool end__pass(){return true;} + +virtual bool begin__pass__annotate( const annotate__AttributeData& attributeData ){return true;} +virtual bool end__pass__annotate(){return true;} + +virtual bool begin__color_target(){return true;} +virtual bool end__color_target(){return true;} +virtual bool data__color_target( const ParserChar* value, size_t length ){return true;} + +virtual bool begin__depth_target(){return true;} +virtual bool end__depth_target(){return true;} +virtual bool data__depth_target( const ParserChar* value, size_t length ){return true;} + +virtual bool begin__stencil_target(){return true;} +virtual bool end__stencil_target(){return true;} +virtual bool data__stencil_target( const ParserChar* value, size_t length ){return true;} + +virtual bool begin__color_clear(){return true;} +virtual bool end__color_clear(){return true;} +virtual bool data__color_clear( const double* value, size_t length ){return true;} + +virtual bool begin__depth_clear(){return true;} +virtual bool end__depth_clear(){return true;} +virtual bool data__depth_clear( double value ){return true;} + +virtual bool begin__stencil_clear(){return true;} +virtual bool end__stencil_clear(){return true;} +virtual bool data__stencil_clear( short value ){return true;} + +virtual bool begin__draw(){return true;} +virtual bool end__draw(){return true;} +virtual bool data__draw( const ParserChar* value, size_t length ){return true;} + +virtual bool begin__alpha_func(){return true;} +virtual bool end__alpha_func(){return true;} + +virtual bool begin__alpha_func__func( const alpha_func__func__AttributeData& attributeData ){return true;} +virtual bool end__alpha_func__func(){return true;} + +virtual bool begin__alpha_func__value( const alpha_func__value__AttributeData& attributeData ){return true;} +virtual bool end__alpha_func__value(){return true;} + +virtual bool begin__blend_func(){return true;} +virtual bool end__blend_func(){return true;} + +virtual bool begin__src( const src__AttributeData& attributeData ){return true;} +virtual bool end__src(){return true;} + +virtual bool begin__dest( const dest__AttributeData& attributeData ){return true;} +virtual bool end__dest(){return true;} + +virtual bool begin__clear_color( const clear_color__AttributeData& attributeData ){return true;} +virtual bool end__clear_color(){return true;} + +virtual bool begin__clear_stencil( const clear_stencil__AttributeData& attributeData ){return true;} +virtual bool end__clear_stencil(){return true;} + +virtual bool begin__clear_depth( const clear_depth__AttributeData& attributeData ){return true;} +virtual bool end__clear_depth(){return true;} + +virtual bool begin__clip_plane( const clip_plane__AttributeData& attributeData ){return true;} +virtual bool end__clip_plane(){return true;} + +virtual bool begin__color_mask( const color_mask__AttributeData& attributeData ){return true;} +virtual bool end__color_mask(){return true;} + +virtual bool begin__cull_face( const cull_face__AttributeData& attributeData ){return true;} +virtual bool end__cull_face(){return true;} + +virtual bool begin__depth_func( const depth_func__AttributeData& attributeData ){return true;} +virtual bool end__depth_func(){return true;} + +virtual bool begin__depth_mask( const depth_mask__AttributeData& attributeData ){return true;} +virtual bool end__depth_mask(){return true;} + +virtual bool begin__depth_range( const depth_range__AttributeData& attributeData ){return true;} +virtual bool end__depth_range(){return true;} + +virtual bool begin__fog_color( const fog_color__AttributeData& attributeData ){return true;} +virtual bool end__fog_color(){return true;} + +virtual bool begin__fog_density( const fog_density__AttributeData& attributeData ){return true;} +virtual bool end__fog_density(){return true;} + +virtual bool begin__fog_mode( const fog_mode__AttributeData& attributeData ){return true;} +virtual bool end__fog_mode(){return true;} + +virtual bool begin__fog_start( const fog_start__AttributeData& attributeData ){return true;} +virtual bool end__fog_start(){return true;} + +virtual bool begin__fog_end( const fog_end__AttributeData& attributeData ){return true;} +virtual bool end__fog_end(){return true;} + +virtual bool begin__front_face( const front_face__AttributeData& attributeData ){return true;} +virtual bool end__front_face(){return true;} + +virtual bool begin__pass__texture_pipeline( const pass__texture_pipeline__AttributeData& attributeData ){return true;} +virtual bool end__pass__texture_pipeline(){return true;} + +virtual bool begin__texture_pipeline__value( const texture_pipeline__value__AttributeData& attributeData ){return true;} +virtual bool end__texture_pipeline__value(){return true;} + +virtual bool begin__value__texcombiner(){return true;} +virtual bool end__value__texcombiner(){return true;} + +virtual bool begin__value__texenv( const texenv__AttributeData& attributeData ){return true;} +virtual bool end__value__texenv(){return true;} + +virtual bool begin__value__extra( const extra__AttributeData& attributeData ){return true;} +virtual bool end__value__extra(){return true;} + +virtual bool begin__logic_op( const logic_op__AttributeData& attributeData ){return true;} +virtual bool end__logic_op(){return true;} + +virtual bool begin__light_ambient( const light_ambient__AttributeData& attributeData ){return true;} +virtual bool end__light_ambient(){return true;} + +virtual bool begin__light_diffuse( const light_diffuse__AttributeData& attributeData ){return true;} +virtual bool end__light_diffuse(){return true;} + +virtual bool begin__light_specular( const light_specular__AttributeData& attributeData ){return true;} +virtual bool end__light_specular(){return true;} + +virtual bool begin__light_position( const light_position__AttributeData& attributeData ){return true;} +virtual bool end__light_position(){return true;} + +virtual bool begin__light_constant_attenuation( const light_constant_attenuation__AttributeData& attributeData ){return true;} +virtual bool end__light_constant_attenuation(){return true;} + +virtual bool begin__light_linear_attenutation( const light_linear_attenutation__AttributeData& attributeData ){return true;} +virtual bool end__light_linear_attenutation(){return true;} + +virtual bool begin__light_quadratic_attenuation( const light_quadratic_attenuation__AttributeData& attributeData ){return true;} +virtual bool end__light_quadratic_attenuation(){return true;} + +virtual bool begin__light_spot_cutoff( const light_spot_cutoff__AttributeData& attributeData ){return true;} +virtual bool end__light_spot_cutoff(){return true;} + +virtual bool begin__light_spot_direction( const light_spot_direction__AttributeData& attributeData ){return true;} +virtual bool end__light_spot_direction(){return true;} + +virtual bool begin__light_spot_exponent( const light_spot_exponent__AttributeData& attributeData ){return true;} +virtual bool end__light_spot_exponent(){return true;} + +virtual bool begin__light_model_ambient( const light_model_ambient__AttributeData& attributeData ){return true;} +virtual bool end__light_model_ambient(){return true;} + +virtual bool begin__line_width( const line_width__AttributeData& attributeData ){return true;} +virtual bool end__line_width(){return true;} + +virtual bool begin__material_ambient( const material_ambient__AttributeData& attributeData ){return true;} +virtual bool end__material_ambient(){return true;} + +virtual bool begin__material_diffuse( const material_diffuse__AttributeData& attributeData ){return true;} +virtual bool end__material_diffuse(){return true;} + +virtual bool begin__material_emission( const material_emission__AttributeData& attributeData ){return true;} +virtual bool end__material_emission(){return true;} + +virtual bool begin__material_shininess( const material_shininess__AttributeData& attributeData ){return true;} +virtual bool end__material_shininess(){return true;} + +virtual bool begin__material_specular( const material_specular__AttributeData& attributeData ){return true;} +virtual bool end__material_specular(){return true;} + +virtual bool begin__model_view_matrix( const model_view_matrix__AttributeData& attributeData ){return true;} +virtual bool end__model_view_matrix(){return true;} + +virtual bool begin__point_distance_attenuation( const point_distance_attenuation__AttributeData& attributeData ){return true;} +virtual bool end__point_distance_attenuation(){return true;} + +virtual bool begin__point_fade_threshold_size( const point_fade_threshold_size__AttributeData& attributeData ){return true;} +virtual bool end__point_fade_threshold_size(){return true;} + +virtual bool begin__point_size( const point_size__AttributeData& attributeData ){return true;} +virtual bool end__point_size(){return true;} + +virtual bool begin__point_size_min( const point_size_min__AttributeData& attributeData ){return true;} +virtual bool end__point_size_min(){return true;} + +virtual bool begin__point_size_max( const point_size_max__AttributeData& attributeData ){return true;} +virtual bool end__point_size_max(){return true;} + +virtual bool begin__polygon_offset( const polygon_offset__AttributeData& attributeData ){return true;} +virtual bool end__polygon_offset(){return true;} + +virtual bool begin__projection_matrix( const projection_matrix__AttributeData& attributeData ){return true;} +virtual bool end__projection_matrix(){return true;} + +virtual bool begin__scissor( const scissor__AttributeData& attributeData ){return true;} +virtual bool end__scissor(){return true;} + +virtual bool begin__shade_model( const shade_model__AttributeData& attributeData ){return true;} +virtual bool end__shade_model(){return true;} + +virtual bool begin__stencil_func(){return true;} +virtual bool end__stencil_func(){return true;} + +virtual bool begin__stencil_func__func( const stencil_func__func__AttributeData& attributeData ){return true;} +virtual bool end__stencil_func__func(){return true;} + +virtual bool begin__stencil_func__ref( const stencil_func__ref__AttributeData& attributeData ){return true;} +virtual bool end__stencil_func__ref(){return true;} + +virtual bool begin__stencil_func__mask( const stencil_func__mask__AttributeData& attributeData ){return true;} +virtual bool end__stencil_func__mask(){return true;} + +virtual bool begin__stencil_mask( const stencil_mask__AttributeData& attributeData ){return true;} +virtual bool end__stencil_mask(){return true;} + +virtual bool begin__stencil_op(){return true;} +virtual bool end__stencil_op(){return true;} + +virtual bool begin__stencil_op__fail( const stencil_op__fail__AttributeData& attributeData ){return true;} +virtual bool end__stencil_op__fail(){return true;} + +virtual bool begin__stencil_op__zfail( const stencil_op__zfail__AttributeData& attributeData ){return true;} +virtual bool end__stencil_op__zfail(){return true;} + +virtual bool begin__stencil_op__zpass( const stencil_op__zpass__AttributeData& attributeData ){return true;} +virtual bool end__stencil_op__zpass(){return true;} + +virtual bool begin__alpha_test_enable( const alpha_test_enable__AttributeData& attributeData ){return true;} +virtual bool end__alpha_test_enable(){return true;} + +virtual bool begin__blend_enable( const blend_enable__AttributeData& attributeData ){return true;} +virtual bool end__blend_enable(){return true;} + +virtual bool begin__clip_plane_enable( const clip_plane_enable__AttributeData& attributeData ){return true;} +virtual bool end__clip_plane_enable(){return true;} + +virtual bool begin__color_logic_op_enable( const color_logic_op_enable__AttributeData& attributeData ){return true;} +virtual bool end__color_logic_op_enable(){return true;} + +virtual bool begin__color_material_enable( const color_material_enable__AttributeData& attributeData ){return true;} +virtual bool end__color_material_enable(){return true;} + +virtual bool begin__cull_face_enable( const cull_face_enable__AttributeData& attributeData ){return true;} +virtual bool end__cull_face_enable(){return true;} + +virtual bool begin__depth_test_enable( const depth_test_enable__AttributeData& attributeData ){return true;} +virtual bool end__depth_test_enable(){return true;} + +virtual bool begin__dither_enable( const dither_enable__AttributeData& attributeData ){return true;} +virtual bool end__dither_enable(){return true;} + +virtual bool begin__fog_enable( const fog_enable__AttributeData& attributeData ){return true;} +virtual bool end__fog_enable(){return true;} + +virtual bool begin__texture_pipeline_enable( const texture_pipeline_enable__AttributeData& attributeData ){return true;} +virtual bool end__texture_pipeline_enable(){return true;} + +virtual bool begin__light_enable( const light_enable__AttributeData& attributeData ){return true;} +virtual bool end__light_enable(){return true;} + +virtual bool begin__lighting_enable( const lighting_enable__AttributeData& attributeData ){return true;} +virtual bool end__lighting_enable(){return true;} + +virtual bool begin__light_model_two_side_enable( const light_model_two_side_enable__AttributeData& attributeData ){return true;} +virtual bool end__light_model_two_side_enable(){return true;} + +virtual bool begin__line_smooth_enable( const line_smooth_enable__AttributeData& attributeData ){return true;} +virtual bool end__line_smooth_enable(){return true;} + +virtual bool begin__multisample_enable( const multisample_enable__AttributeData& attributeData ){return true;} +virtual bool end__multisample_enable(){return true;} + +virtual bool begin__normalize_enable( const normalize_enable__AttributeData& attributeData ){return true;} +virtual bool end__normalize_enable(){return true;} + +virtual bool begin__point_smooth_enable( const point_smooth_enable__AttributeData& attributeData ){return true;} +virtual bool end__point_smooth_enable(){return true;} + +virtual bool begin__polygon_offset_fill_enable( const polygon_offset_fill_enable__AttributeData& attributeData ){return true;} +virtual bool end__polygon_offset_fill_enable(){return true;} + +virtual bool begin__rescale_normal_enable( const rescale_normal_enable__AttributeData& attributeData ){return true;} +virtual bool end__rescale_normal_enable(){return true;} + +virtual bool begin__sample_alpha_to_coverage_enable( const sample_alpha_to_coverage_enable__AttributeData& attributeData ){return true;} +virtual bool end__sample_alpha_to_coverage_enable(){return true;} + +virtual bool begin__sample_alpha_to_one_enable( const sample_alpha_to_one_enable__AttributeData& attributeData ){return true;} +virtual bool end__sample_alpha_to_one_enable(){return true;} + +virtual bool begin__sample_coverage_enable( const sample_coverage_enable__AttributeData& attributeData ){return true;} +virtual bool end__sample_coverage_enable(){return true;} + +virtual bool begin__scissor_test_enable( const scissor_test_enable__AttributeData& attributeData ){return true;} +virtual bool end__scissor_test_enable(){return true;} + +virtual bool begin__stencil_test_enable( const stencil_test_enable__AttributeData& attributeData ){return true;} +virtual bool end__stencil_test_enable(){return true;} + +virtual bool begin__pass__extra( const extra__AttributeData& attributeData ){return true;} +virtual bool end__pass__extra(){return true;} + +virtual bool begin__technique__extra( const extra__AttributeData& attributeData ){return true;} +virtual bool end__technique__extra(){return true;} + +virtual bool begin__profile_GLES__extra( const extra__AttributeData& attributeData ){return true;} +virtual bool end__profile_GLES__extra(){return true;} + +virtual bool begin__COLLADA( const COLLADA__AttributeData& attributeData ){return true;} +virtual bool end__COLLADA(){return true;} + +virtual bool begin__COLLADA__asset(){return true;} +virtual bool end__COLLADA__asset(){return true;} + virtual bool begin__library_animations( const library_animations__AttributeData& attributeData ){return true;} virtual bool end__library_animations(){return true;} @@ -154,12 +1002,6 @@ virtual bool begin__animation__extra( const extra__AttributeData& attributeData ){return true;} virtual bool end__animation__extra(){return true;} -virtual bool begin__extra__asset(){return true;} -virtual bool end__extra__asset(){return true;} - -virtual bool begin__extra__technique( const extra__technique__AttributeData& attributeData ){return true;} -virtual bool end__extra__technique(){return true;} - virtual bool begin__library_animations__extra( const extra__AttributeData& attributeData ){return true;} virtual bool end__library_animations__extra(){return true;} @@ -555,304 +1397,12 @@ virtual bool begin__effect__annotate( const annotate__AttributeData& attributeData ){return true;} virtual bool end__effect__annotate(){return true;} -virtual bool begin__annotate__bool(){return true;} -virtual bool end__annotate__bool(){return true;} -virtual bool data__annotate__bool( bool value ){return true;} - -virtual bool begin__annotate__bool2(){return true;} -virtual bool end__annotate__bool2(){return true;} -virtual bool data__annotate__bool2( const bool* value, size_t length ){return true;} - -virtual bool begin__annotate__bool3(){return true;} -virtual bool end__annotate__bool3(){return true;} -virtual bool data__annotate__bool3( const bool* value, size_t length ){return true;} - -virtual bool begin__annotate__bool4(){return true;} -virtual bool end__annotate__bool4(){return true;} -virtual bool data__annotate__bool4( const bool* value, size_t length ){return true;} - -virtual bool begin__annotate__int(){return true;} -virtual bool end__annotate__int(){return true;} -virtual bool data__annotate__int( long value ){return true;} - -virtual bool begin__annotate__int2(){return true;} -virtual bool end__annotate__int2(){return true;} -virtual bool data__annotate__int2( const long* value, size_t length ){return true;} - -virtual bool begin__annotate__int3(){return true;} -virtual bool end__annotate__int3(){return true;} -virtual bool data__annotate__int3( const long* value, size_t length ){return true;} - -virtual bool begin__annotate__int4(){return true;} -virtual bool end__annotate__int4(){return true;} -virtual bool data__annotate__int4( const long* value, size_t length ){return true;} - -virtual bool begin__annotate__float(){return true;} -virtual bool end__annotate__float(){return true;} -virtual bool data__annotate__float( double value ){return true;} - -virtual bool begin__annotate__float2(){return true;} -virtual bool end__annotate__float2(){return true;} -virtual bool data__annotate__float2( const double* value, size_t length ){return true;} - -virtual bool begin__annotate__float3(){return true;} -virtual bool end__annotate__float3(){return true;} -virtual bool data__annotate__float3( const double* value, size_t length ){return true;} - -virtual bool begin__annotate__float4(){return true;} -virtual bool end__annotate__float4(){return true;} -virtual bool data__annotate__float4( const double* value, size_t length ){return true;} - -virtual bool begin__annotate__float2x2(){return true;} -virtual bool end__annotate__float2x2(){return true;} -virtual bool data__annotate__float2x2( const double* value, size_t length ){return true;} - -virtual bool begin__annotate__float3x3(){return true;} -virtual bool end__annotate__float3x3(){return true;} -virtual bool data__annotate__float3x3( const double* value, size_t length ){return true;} - -virtual bool begin__annotate__float4x4(){return true;} -virtual bool end__annotate__float4x4(){return true;} -virtual bool data__annotate__float4x4( const double* value, size_t length ){return true;} - -virtual bool begin__annotate__string(){return true;} -virtual bool end__annotate__string(){return true;} -virtual bool data__annotate__string( const ParserChar* value, size_t length ){return true;} - virtual bool begin__effect__image( const image__AttributeData& attributeData ){return true;} virtual bool end__effect__image(){return true;} -virtual bool begin__image__asset(){return true;} -virtual bool end__image__asset(){return true;} - -virtual bool begin__data(){return true;} -virtual bool end__data(){return true;} -virtual bool data__data( const ParserChar* value, size_t length ){return true;} - -virtual bool begin__image__init_from(){return true;} -virtual bool end__image__init_from(){return true;} -virtual bool data__image__init_from( const ParserChar* value, size_t length ){return true;} - -virtual bool begin__image__extra( const extra__AttributeData& attributeData ){return true;} -virtual bool end__image__extra(){return true;} - virtual bool begin__effect__newparam( const effect__newparam__AttributeData& attributeData ){return true;} virtual bool end__effect__newparam(){return true;} -virtual bool begin__newparam__annotate( const annotate__AttributeData& attributeData ){return true;} -virtual bool end__newparam__annotate(){return true;} - -virtual bool begin__semantic(){return true;} -virtual bool end__semantic(){return true;} -virtual bool data__semantic( const ParserChar* value, size_t length ){return true;} - -virtual bool begin__modifier(){return true;} -virtual bool end__modifier(){return true;} -virtual bool data__modifier( const ParserChar* value, size_t length ){return true;} - -virtual bool begin__newparam__bool(){return true;} -virtual bool end__newparam__bool(){return true;} -virtual bool data__newparam__bool( bool value ){return true;} - -virtual bool begin__newparam__bool2(){return true;} -virtual bool end__newparam__bool2(){return true;} -virtual bool data__newparam__bool2( const bool* value, size_t length ){return true;} - -virtual bool begin__newparam__bool3(){return true;} -virtual bool end__newparam__bool3(){return true;} -virtual bool data__newparam__bool3( const bool* value, size_t length ){return true;} - -virtual bool begin__newparam__bool4(){return true;} -virtual bool end__newparam__bool4(){return true;} -virtual bool data__newparam__bool4( const bool* value, size_t length ){return true;} - -virtual bool begin__newparam__int(){return true;} -virtual bool end__newparam__int(){return true;} -virtual bool data__newparam__int( long value ){return true;} - -virtual bool begin__newparam__int2(){return true;} -virtual bool end__newparam__int2(){return true;} -virtual bool data__newparam__int2( const long* value, size_t length ){return true;} - -virtual bool begin__newparam__int3(){return true;} -virtual bool end__newparam__int3(){return true;} -virtual bool data__newparam__int3( const long* value, size_t length ){return true;} - -virtual bool begin__newparam__int4(){return true;} -virtual bool end__newparam__int4(){return true;} -virtual bool data__newparam__int4( const long* value, size_t length ){return true;} - -virtual bool begin__newparam__float(){return true;} -virtual bool end__newparam__float(){return true;} -virtual bool data__newparam__float( double value ){return true;} - -virtual bool begin__newparam__float2(){return true;} -virtual bool end__newparam__float2(){return true;} -virtual bool data__newparam__float2( const double* value, size_t length ){return true;} - -virtual bool begin__newparam__float3(){return true;} -virtual bool end__newparam__float3(){return true;} -virtual bool data__newparam__float3( const double* value, size_t length ){return true;} - -virtual bool begin__newparam__float4(){return true;} -virtual bool end__newparam__float4(){return true;} -virtual bool data__newparam__float4( const double* value, size_t length ){return true;} - -virtual bool begin__newparam__float1x1(){return true;} -virtual bool end__newparam__float1x1(){return true;} -virtual bool data__newparam__float1x1( double value ){return true;} - -virtual bool begin__newparam__float1x2(){return true;} -virtual bool end__newparam__float1x2(){return true;} -virtual bool data__newparam__float1x2( const double* value, size_t length ){return true;} - -virtual bool begin__newparam__float1x3(){return true;} -virtual bool end__newparam__float1x3(){return true;} -virtual bool data__newparam__float1x3( const double* value, size_t length ){return true;} - -virtual bool begin__newparam__float1x4(){return true;} -virtual bool end__newparam__float1x4(){return true;} -virtual bool data__newparam__float1x4( const double* value, size_t length ){return true;} - -virtual bool begin__newparam__float2x1(){return true;} -virtual bool end__newparam__float2x1(){return true;} -virtual bool data__newparam__float2x1( const double* value, size_t length ){return true;} - -virtual bool begin__newparam__float2x2(){return true;} -virtual bool end__newparam__float2x2(){return true;} -virtual bool data__newparam__float2x2( const double* value, size_t length ){return true;} - -virtual bool begin__newparam__float2x3(){return true;} -virtual bool end__newparam__float2x3(){return true;} -virtual bool data__newparam__float2x3( const double* value, size_t length ){return true;} - -virtual bool begin__newparam__float2x4(){return true;} -virtual bool end__newparam__float2x4(){return true;} -virtual bool data__newparam__float2x4( const double* value, size_t length ){return true;} - -virtual bool begin__newparam__float3x1(){return true;} -virtual bool end__newparam__float3x1(){return true;} -virtual bool data__newparam__float3x1( const double* value, size_t length ){return true;} - -virtual bool begin__newparam__float3x2(){return true;} -virtual bool end__newparam__float3x2(){return true;} -virtual bool data__newparam__float3x2( const double* value, size_t length ){return true;} - -virtual bool begin__newparam__float3x3(){return true;} -virtual bool end__newparam__float3x3(){return true;} -virtual bool data__newparam__float3x3( const double* value, size_t length ){return true;} - -virtual bool begin__newparam__float3x4(){return true;} -virtual bool end__newparam__float3x4(){return true;} -virtual bool data__newparam__float3x4( const double* value, size_t length ){return true;} - -virtual bool begin__newparam__float4x1(){return true;} -virtual bool end__newparam__float4x1(){return true;} -virtual bool data__newparam__float4x1( const double* value, size_t length ){return true;} - -virtual bool begin__newparam__float4x2(){return true;} -virtual bool end__newparam__float4x2(){return true;} -virtual bool data__newparam__float4x2( const double* value, size_t length ){return true;} - -virtual bool begin__newparam__float4x3(){return true;} -virtual bool end__newparam__float4x3(){return true;} -virtual bool data__newparam__float4x3( const double* value, size_t length ){return true;} - -virtual bool begin__newparam__float4x4(){return true;} -virtual bool end__newparam__float4x4(){return true;} -virtual bool data__newparam__float4x4( const double* value, size_t length ){return true;} - -virtual bool begin__newparam__surface( const newparam__surface__AttributeData& attributeData ){return true;} -virtual bool end__newparam__surface(){return true;} - -virtual bool begin__init_as_null(){return true;} -virtual bool end__init_as_null(){return true;} -virtual bool data__init_as_null( const ParserChar* value, size_t length ){return true;} - -virtual bool begin__init_as_target(){return true;} -virtual bool end__init_as_target(){return true;} -virtual bool data__init_as_target( const ParserChar* value, size_t length ){return true;} - -virtual bool begin__init_cube(){return true;} -virtual bool end__init_cube(){return true;} - -virtual bool begin__init_cube__all( const init_cube__all__AttributeData& attributeData ){return true;} -virtual bool end__init_cube__all(){return true;} - -virtual bool begin__init_cube__primary( const init_cube__primary__AttributeData& attributeData ){return true;} -virtual bool end__init_cube__primary(){return true;} - -virtual bool begin__order(){return true;} -virtual bool end__order(){return true;} -virtual bool data__order( const ParserChar* value, size_t length ){return true;} - -virtual bool begin__init_cube__face( const init_cube__face__AttributeData& attributeData ){return true;} -virtual bool end__init_cube__face(){return true;} - -virtual bool begin__init_volume(){return true;} -virtual bool end__init_volume(){return true;} - -virtual bool begin__init_volume__all( const init_volume__all__AttributeData& attributeData ){return true;} -virtual bool end__init_volume__all(){return true;} - -virtual bool begin__init_volume__primary( const init_volume__primary__AttributeData& attributeData ){return true;} -virtual bool end__init_volume__primary(){return true;} - -virtual bool begin__init_planar(){return true;} -virtual bool end__init_planar(){return true;} - -virtual bool begin__init_planar__all( const init_planar__all__AttributeData& attributeData ){return true;} -virtual bool end__init_planar__all(){return true;} - -virtual bool begin__surface__init_from( const surface__init_from__AttributeData& attributeData ){return true;} -virtual bool end__surface__init_from(){return true;} -virtual bool data__surface__init_from( const ParserChar* value, size_t length ){return true;} - -virtual bool begin__format(){return true;} -virtual bool end__format(){return true;} -virtual bool data__format( const ParserChar* value, size_t length ){return true;} - -virtual bool begin__format_hint(){return true;} -virtual bool end__format_hint(){return true;} - -virtual bool begin__channels(){return true;} -virtual bool end__channels(){return true;} -virtual bool data__channels( const ParserChar* value, size_t length ){return true;} - -virtual bool begin__range(){return true;} -virtual bool end__range(){return true;} -virtual bool data__range( const ParserChar* value, size_t length ){return true;} - -virtual bool begin__precision(){return true;} -virtual bool end__precision(){return true;} -virtual bool data__precision( const ParserChar* value, size_t length ){return true;} - -virtual bool begin__option(){return true;} -virtual bool end__option(){return true;} -virtual bool data__option( const ParserChar* value, size_t length ){return true;} - -virtual bool begin__format_hint__extra( const extra__AttributeData& attributeData ){return true;} -virtual bool end__format_hint__extra(){return true;} - -virtual bool begin__surface__size(){return true;} -virtual bool end__surface__size(){return true;} -virtual bool data__surface__size( const long* value, size_t length ){return true;} - -virtual bool begin__viewport_ratio(){return true;} -virtual bool end__viewport_ratio(){return true;} -virtual bool data__viewport_ratio( const double* value, size_t length ){return true;} - -virtual bool begin__mip_levels(){return true;} -virtual bool end__mip_levels(){return true;} -virtual bool data__mip_levels( unsigned long value ){return true;} - -virtual bool begin__mipmap_generate(){return true;} -virtual bool end__mipmap_generate(){return true;} -virtual bool data__mipmap_generate( bool value ){return true;} - -virtual bool begin__surface__extra( const extra__AttributeData& attributeData ){return true;} -virtual bool end__surface__extra(){return true;} - virtual bool begin__newparam__samp... [truncated message content] |
From: <rob...@us...> - 2009-02-05 14:28:05
|
Revision: 341 http://colladamaya.svn.sourceforge.net/colladamaya/?rev=341&view=rev Author: robertwuerfel Date: 2009-02-05 14:27:55 +0000 (Thu, 05 Feb 2009) Log Message: ----------- give elements without id a uniqueId Modified Paths: -------------- branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLIFilePartLoader.h branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLIFilePartLoader.cpp Modified: branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLIFilePartLoader.h =================================================================== --- branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLIFilePartLoader.h 2009-02-05 13:26:07 UTC (rev 340) +++ branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLIFilePartLoader.h 2009-02-05 14:27:55 UTC (rev 341) @@ -65,7 +65,7 @@ @param id The collada id of the element to get the COLLADAFW::UniqueId for @param classId The COLLADAFW::ClassId of the object that will be created for @a element. @return The elements COLLADAFW::UniqueId */ - const COLLADAFW::UniqueId& getUniqueIdFromId( const ParserChar* colladaId, COLLADAFW::ClassId classId ); + COLLADAFW::UniqueId getUniqueIdFromId( const ParserChar* colladaId, COLLADAFW::ClassId classId ); /** Returns the COLLADAFW::UniqueId of the element referenced by the url @a url. If the has been passed to this method before, the same COLLADAFW::UniqueId will be returned, if not, Modified: branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLIFilePartLoader.cpp =================================================================== --- branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLIFilePartLoader.cpp 2009-02-05 13:26:07 UTC (rev 340) +++ branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLIFilePartLoader.cpp 2009-02-05 14:27:55 UTC (rev 341) @@ -46,11 +46,14 @@ } //----------------------------- - const COLLADAFW::UniqueId& IFilePartLoader::getUniqueIdFromId( const ParserChar* colladaId, COLLADAFW::ClassId classId ) + COLLADAFW::UniqueId IFilePartLoader::getUniqueIdFromId( const ParserChar* colladaId, COLLADAFW::ClassId classId ) { - if ( !getColladaLoader() || !colladaId || !(*colladaId) ) + if ( !getColladaLoader() ) return COLLADAFW::UniqueId::INVALID; + if ( !colladaId || !(*colladaId) ) + return getUniqueId(classId); + COLLADABU::URI uri(getFileUri(), String("#") + String((const char *)colladaId)); return getColladaLoader()->getUniqueId(uri, classId); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rob...@us...> - 2009-02-05 13:26:19
|
Revision: 340 http://colladamaya.svn.sourceforge.net/colladamaya/?rev=340&view=rev Author: robertwuerfel Date: 2009-02-05 13:26:07 +0000 (Thu, 05 Feb 2009) Log Message: ----------- material support for framework loader and max plug-in basic effect support (very rudimentary) Modified Paths: -------------- branches/nextgen/COLLADAFramework/include/COLLADAFWEffect.h branches/nextgen/COLLADAFramework/include/COLLADAFWIWriter.h branches/nextgen/COLLADAFramework/include/COLLADAFWMaterial.h branches/nextgen/COLLADAFramework/include/COLLADAFWNode.h branches/nextgen/COLLADAFramework/include/COLLADAFWObject.h branches/nextgen/COLLADAFramework/include/COLLADAFWPrerequisites.h branches/nextgen/COLLADAFramework/src/COLLADAFWEffect.cpp branches/nextgen/COLLADAFramework/src/COLLADAFWMaterial.cpp branches/nextgen/COLLADAMax/include/COLLADAMaxDocumentImporter.h branches/nextgen/COLLADAMax/include/COLLADAMaxImporterBase.h branches/nextgen/COLLADAMax/scripts/COLLADAMax.vcproj branches/nextgen/COLLADAMax/src/COLLADAMaxDocumentImporter.cpp branches/nextgen/COLLADAMax/src/COLLADAMaxImporterBase.cpp branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLFileLoader.h branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLIFilePartLoader.h branches/nextgen/COLLADASaxFrameworkLoader/scripts/COLLADASaxFrameworkLoader.vcproj branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLFileLoader.cpp branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLIFilePartLoader.cpp branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLMeshLoader.cpp branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLNodeLoader.cpp Added Paths: ----------- branches/nextgen/COLLADAMax/include/COLLADAMaxMaterialImporter.h branches/nextgen/COLLADAMax/src/COLLADAMaxMaterialImporter.cpp branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLLibraryEffectsLoader.h branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLLibraryMaterialsLoader.h branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLLibraryEffectsLoader.cpp branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLLibraryMaterialsLoader.cpp Modified: branches/nextgen/COLLADAFramework/include/COLLADAFWEffect.h =================================================================== --- branches/nextgen/COLLADAFramework/include/COLLADAFWEffect.h 2009-02-04 16:50:23 UTC (rev 339) +++ branches/nextgen/COLLADAFramework/include/COLLADAFWEffect.h 2009-02-05 13:26:07 UTC (rev 340) @@ -13,7 +13,10 @@ #include "COLLADAFWPrerequisites.h" +#include "COLLADAFWObject.h" +#include "COLLADAFWColor.h" + namespace COLLADAFW { @@ -37,13 +40,10 @@ <effect> scope provides a handy way to parameterize many profiles and techniques with a single parameter. */ - class Effect + class Effect : public ObjectTemplate<COLLADA_TYPE::EFFECT> { private: - /** Global identifier for this object. Required. */ - String mId; - /** Pretty-print name for this effect. Optional. */ String mName; @@ -59,22 +59,16 @@ // Profile* mProfile; // TODO Implementation of a minimized standard material! - //Color mStandardColor; + Color mStandardColor; public: /** Constructor. */ - Effect(); + Effect( ObjectId objectId ); /** Destructor. */ virtual ~Effect(); - /** Global identifier for this object. Required. */ - const String getId () const { return mId; } - - /** Global identifier for this object. Required. */ - void setId ( const String Id ) { mId = Id; } - /** Pretty-print name for this effect. Optional. */ const String getName () const { return mName; } @@ -83,11 +77,11 @@ private: - /** Disable default copy ctor. */ - Effect( const Effect& pre ); + /** TODO Implement copy constructor if necessary. */ +// Effect( const Effect& pre ); - /** Disable default assignment operator. */ - const Effect& operator= ( const Effect& pre ); + /** TODO Implement assignment operator if necessary */ +// const Effect& operator= ( const Effect& pre ); }; Modified: branches/nextgen/COLLADAFramework/include/COLLADAFWIWriter.h =================================================================== --- branches/nextgen/COLLADAFramework/include/COLLADAFWIWriter.h 2009-02-04 16:50:23 UTC (rev 339) +++ branches/nextgen/COLLADAFramework/include/COLLADAFWIWriter.h 2009-02-05 13:26:07 UTC (rev 340) @@ -20,6 +20,8 @@ class VisualScene; class Geometry; class LibraryNodes; + class Material; + class Effect; /** Class that needs to be implemented by a writer. @@ -65,7 +67,14 @@ @return The writer should return true, if writing succeeded, false otherwise.*/ virtual bool writeGeometry ( const Geometry* geometry ) = 0; + /** When this method is called, the writer must write the material. + @return The writer should return true, if writing succeeded, false otherwise.*/ + virtual bool writeMaterial( const Material* material ) = 0; + /** When this method is called, the writer must write the effect. + @return The writer should return true, if writing succeeded, false otherwise.*/ + virtual bool writeEffect( const Effect* effect ) = 0; + private: /** Disable default copy ctor. */ Modified: branches/nextgen/COLLADAFramework/include/COLLADAFWMaterial.h =================================================================== --- branches/nextgen/COLLADAFramework/include/COLLADAFWMaterial.h 2009-02-04 16:50:23 UTC (rev 339) +++ branches/nextgen/COLLADAFramework/include/COLLADAFWMaterial.h 2009-02-05 13:26:07 UTC (rev 340) @@ -13,16 +13,21 @@ #include "COLLADAFWPrerequisites.h" #include "COLLADAFWObject.h" +#include "COLLADAFWUniqueId.h" namespace COLLADAFW { - /** TODO Documentation */ + /** Represents a material. Material instantiate effects and have the ability to overwrite certain + parameters of the instantiated effect.*/ class Material : public ObjectTemplate<COLLADA_TYPE::MATERIAL> { private: + /** The unique id of the effect instantiated in this material.*/ + UniqueId mInstantiatedEffect; + /** The text string name of this element. Optional. */ String mName; @@ -40,13 +45,19 @@ /** The text string name of this element. Optional. */ void setName ( const String& Name ) { mName = Name; } + /** Return the unique id of the referenced effect.*/ + const UniqueId& getInstantiatedEffect() const { return mInstantiatedEffect; } + + /** Sets the unique id of the referenced effect.*/ + void setInstantiatedEffect( const UniqueId& val) { mInstantiatedEffect = val; } + private: /** Disable default copy ctor. */ - Material( const Material& pre ); +// Material( const Material& pre ); /** Disable default assignment operator. */ - const Material& operator= ( const Material& pre ); +// const Material& operator= ( const Material& pre ); }; Modified: branches/nextgen/COLLADAFramework/include/COLLADAFWNode.h =================================================================== --- branches/nextgen/COLLADAFramework/include/COLLADAFWNode.h 2009-02-04 16:50:23 UTC (rev 339) +++ branches/nextgen/COLLADAFramework/include/COLLADAFWNode.h 2009-02-05 13:26:07 UTC (rev 340) @@ -137,7 +137,7 @@ COLLADABU::Math::Matrix4 getTransformationMatrix() const; /** Creates a clone of the node and returns a pointer to it.*/ - Node* clone() const { return NEW Node(*this); } + Node* clone() const { return FW_NEW Node(*this); } }; Modified: branches/nextgen/COLLADAFramework/include/COLLADAFWObject.h =================================================================== --- branches/nextgen/COLLADAFramework/include/COLLADAFWObject.h 2009-02-04 16:50:23 UTC (rev 339) +++ branches/nextgen/COLLADAFramework/include/COLLADAFWObject.h 2009-02-05 13:26:07 UTC (rev 340) @@ -42,7 +42,7 @@ /** Disable default copy ctor. */ // Object( const Object& pre ); /** Disable default assignment operator. */ - const Object& operator= ( const Object& pre ); +// const Object& operator= ( const Object& pre ); }; @@ -75,7 +75,7 @@ /** Disable default copy ctor. */ // ObjectTemplate( const ObjectTemplate& pre ); /** Disable default assignment operator. */ - const ObjectTemplate& operator= ( const ObjectTemplate& pre ); + // const ObjectTemplate& operator= ( const ObjectTemplate& pre ); }; Modified: branches/nextgen/COLLADAFramework/include/COLLADAFWPrerequisites.h =================================================================== --- branches/nextgen/COLLADAFramework/include/COLLADAFWPrerequisites.h 2009-02-04 16:50:23 UTC (rev 339) +++ branches/nextgen/COLLADAFramework/include/COLLADAFWPrerequisites.h 2009-02-05 13:26:07 UTC (rev 340) @@ -18,7 +18,8 @@ typedef std::string String; } -#define NEW new +#define FW_NEW new +#define FW_DELETE delete #endif //__COLLADAFW_PREREQUISITES_H__ Modified: branches/nextgen/COLLADAFramework/src/COLLADAFWEffect.cpp =================================================================== --- branches/nextgen/COLLADAFramework/src/COLLADAFWEffect.cpp 2009-02-04 16:50:23 UTC (rev 339) +++ branches/nextgen/COLLADAFramework/src/COLLADAFWEffect.cpp 2009-02-05 13:26:07 UTC (rev 340) @@ -15,11 +15,11 @@ namespace COLLADAFW { - //------------------------------ - Effect::Effect() + Effect::Effect( ObjectId objectId ) + : ObjectTemplate<COLLADA_TYPE::EFFECT> ( objectId ) { } - + //------------------------------ Effect::~Effect() { Modified: branches/nextgen/COLLADAFramework/src/COLLADAFWMaterial.cpp =================================================================== --- branches/nextgen/COLLADAFramework/src/COLLADAFWMaterial.cpp 2009-02-04 16:50:23 UTC (rev 339) +++ branches/nextgen/COLLADAFramework/src/COLLADAFWMaterial.cpp 2009-02-05 13:26:07 UTC (rev 340) @@ -16,7 +16,8 @@ { //------------------------------ - Material::Material ( ObjectId objectId ) : ObjectTemplate<COLLADA_TYPE::MATERIAL> ( objectId ) + Material::Material ( ObjectId objectId ) + : ObjectTemplate<COLLADA_TYPE::MATERIAL> ( objectId ) { } Modified: branches/nextgen/COLLADAMax/include/COLLADAMaxDocumentImporter.h =================================================================== --- branches/nextgen/COLLADAMax/include/COLLADAMaxDocumentImporter.h 2009-02-04 16:50:23 UTC (rev 339) +++ branches/nextgen/COLLADAMax/include/COLLADAMaxDocumentImporter.h 2009-02-05 13:26:07 UTC (rev 340) @@ -21,6 +21,8 @@ #include "COLLADAMaxPrerequisites.h" #include "COLLADAFWIWriter.h" +#include "COLLADAFWMaterial.h" +#include "COLLADAFWEffect.h" #include <list> //#include "dummy.h" @@ -65,6 +67,12 @@ /** Maps Unique id to framework nodes.*/ typedef std::map<COLLADAFW::UniqueId, const COLLADAFW::Node*> UniqueIdFWNodeMap; + /** Maps unique ids of framework materials to the corresponding framework material.*/ + typedef std::map<COLLADAFW::UniqueId, COLLADAFW::Material> UniqueIdFWMaterialMap; + + /** Maps unique ids of framework effects to the corresponding framework material.*/ + typedef std::map<COLLADAFW::UniqueId, COLLADAFW::Effect> UniqueIdFWEffectMap; + private: /** Max interface.*/ Interface* mMaxInterface; @@ -109,6 +117,12 @@ /** This vector contains all library nodes already received by the importer.*/ LibraryNodesList mLibraryNodesList; + /** Maps unique ids of framework materials to the corresponding framework material.*/ + UniqueIdFWMaterialMap mUniqueIdFWMaterialMap; + + /** Maps unique ids of framework effects to the corresponding framework material.*/ + UniqueIdFWEffectMap mUniqueIdFWEffectMap; + public: /** Constructor . @param maxInterface The max interface. @@ -154,6 +168,14 @@ @return True on succeeded, false otherwise.*/ virtual bool writeGeometry ( const COLLADAFW::Geometry* geometry ); + /** Writes the material. + @return True on succeeded, false otherwise.*/ + virtual bool writeMaterial( const COLLADAFW::Material* material ); + + /** Writes the effect. + @return True on succeeded, false otherwise.*/ + virtual bool writeEffect( const COLLADAFW::Effect* effect ); + private: /** Disable default copy ctor. */ @@ -185,6 +207,13 @@ /** Returns the list of library nodes.*/ LibraryNodesList& getLibraryNodesList(){ return mLibraryNodesList; } + /** Returns the UniqueIdFWMaterialMap.*/ + UniqueIdFWMaterialMap& getUniqueIdFWMaterialMap() { return mUniqueIdFWMaterialMap; } + + /** Returns the UniqueIdFWEffectMap.*/ + UniqueIdFWEffectMap& getUniqueIdFWEffectMap() { return mUniqueIdFWEffectMap; } + + friend class ImporterBase; }; Modified: branches/nextgen/COLLADAMax/include/COLLADAMaxImporterBase.h =================================================================== --- branches/nextgen/COLLADAMax/include/COLLADAMaxImporterBase.h 2009-02-04 16:50:23 UTC (rev 339) +++ branches/nextgen/COLLADAMax/include/COLLADAMaxImporterBase.h 2009-02-05 13:26:07 UTC (rev 340) @@ -31,6 +31,8 @@ class UniqueId; class LibraryNodes; class Node; + class Material; + class Effect; } namespace COLLADAMax @@ -107,6 +109,14 @@ this method should be called. This is required for instance node handling of nodes in a library nodes.*/ void addUniqueIdFWNodePair( const COLLADAFW::UniqueId& uniqueId, const COLLADAFW::Node* node ); + /** Adds UniqueId frame work material pair to the UniqueIdFWMaterialMap. + For every received material that is in a library materials this method should be called. */ + void addUniqueIdFWMaterialPair( const COLLADAFW::UniqueId& uniqueId, const COLLADAFW::Material& material ); + + /** Adds UniqueId frame work effect pair to the UniqueIdFWEffectMap. + For every received effect that is in a library effect this method should be called. */ + void addUniqueIdFWEffectPair( const COLLADAFW::UniqueId& uniqueId, const COLLADAFW::Effect& effect ); + /** Adds @a libraryNodes to the list of library nodes.*/ void addLibraryNodes( const COLLADAFW::LibraryNodes* libraryNodes ); @@ -126,7 +136,15 @@ received library nodes, null otherwise.*/ const COLLADAFW::Node* getFWNodeByUniqueId( const COLLADAFW::UniqueId& uniqueId ); + /** Returns the frame work material with unique id @a uniqueId, if this node is in an already + received material, null otherwise.*/ + const COLLADAFW::Material* getFWMaterialByUniqueId( const COLLADAFW::UniqueId& uniqueId ); + /** Returns the frame work effect with unique id @a uniqueId, if this node is in an already + received effect, null otherwise.*/ + const COLLADAFW::Effect* getFWEffectByUniqueId( const COLLADAFW::UniqueId& uniqueId ); + + private: /** Disable default copy ctor. */ Added: branches/nextgen/COLLADAMax/include/COLLADAMaxMaterialImporter.h =================================================================== --- branches/nextgen/COLLADAMax/include/COLLADAMaxMaterialImporter.h (rev 0) +++ branches/nextgen/COLLADAMax/include/COLLADAMaxMaterialImporter.h 2009-02-05 13:26:07 UTC (rev 340) @@ -0,0 +1,65 @@ +/* +Copyright (c) 2008 NetAllied Systems GmbH + +This file is part of COLLADAMax. + +Portions of the code are: +Copyright (c) 2005-2007 Feeling Software Inc. +Copyright (c) 2005-2007 Sony Computer Entertainment America + +Based on the 3dsMax COLLADASW Tools: +Copyright (c) 2005-2006 Autodesk Media Entertainment + +Licensed under the MIT Open Source License, +for details please see LICENSE file or the website +http://www.opensource.org/licenses/mit-license.php +*/ + +#ifndef __COLLADAMAX_MATERIALIMPORTER_H__ +#define __COLLADAMAX_MATERIALIMPORTER_H__ + +#include "COLLADAMaxPrerequisites.h" +#include "COLLADAMaxImporterBase.h" + + +namespace COLLADAFW +{ + class Material; +}; + + +namespace COLLADAMax +{ + + + /** Imports one material */ + class MaterialImporter : public ImporterBase + { + private: + /** The material to import.*/ + const COLLADAFW::Material* mMaterial; + + public: + /** Constructor. */ + MaterialImporter( DocumentImporter* documentImporter, const COLLADAFW::Material* material ); + + /** Destructor. */ + virtual ~MaterialImporter(); + + /** Performs the import of the material. + @return True on success, false otherwise.*/ + bool import(); + + private: + + /** Disable default copy ctor. */ + MaterialImporter( const MaterialImporter& pre ); + + /** Disable default assignment operator. */ + const MaterialImporter& operator= ( const MaterialImporter& pre ); + + }; + +} // namespace COLLADAMAX + +#endif // __COLLADAMAX_MATERIALIMPORTER_H__ Modified: branches/nextgen/COLLADAMax/scripts/COLLADAMax.vcproj =================================================================== --- branches/nextgen/COLLADAMax/scripts/COLLADAMax.vcproj 2009-02-04 16:50:23 UTC (rev 339) +++ branches/nextgen/COLLADAMax/scripts/COLLADAMax.vcproj 2009-02-05 13:26:07 UTC (rev 340) @@ -2067,6 +2067,10 @@ > </File> <File + RelativePath="..\src\COLLADAMaxMaterialImporter.cpp" + > + </File> + <File RelativePath="..\src\COLLADAMaxNodeImporter.cpp" > </File> @@ -2237,6 +2241,10 @@ > </File> <File + RelativePath="..\include\COLLADAMaxMaterialImporter.h" + > + </File> + <File RelativePath="..\include\COLLADAMaxNodeImporter.h" > </File> Modified: branches/nextgen/COLLADAMax/src/COLLADAMaxDocumentImporter.cpp =================================================================== --- branches/nextgen/COLLADAMax/src/COLLADAMaxDocumentImporter.cpp 2009-02-04 16:50:23 UTC (rev 339) +++ branches/nextgen/COLLADAMax/src/COLLADAMaxDocumentImporter.cpp 2009-02-05 13:26:07 UTC (rev 340) @@ -20,6 +20,7 @@ #include "COLLADAMaxVisualSceneImporter.h" #include "COLLADAMaxLibraryNodesImporter.h" #include "COLLADAMaxGeometryImporter.h" +#include "COLLADAMaxMaterialImporter.h" #include "COLLADAMaxFWLErrorHandler.h" #include "COLLADAFWLibraryNodes.h" @@ -81,4 +82,16 @@ return geometryImporter.import(); } + //--------------------------------------------------------------- + bool DocumentImporter::writeMaterial( const COLLADAFW::Material* material ) + { + MaterialImporter materialImporter(this, material); + return materialImporter.import(); + } + + //--------------------------------------------------------------- + bool DocumentImporter::writeEffect( const COLLADAFW::Effect* effect ) + { + return true; + } } // namespace COLLADAMax Modified: branches/nextgen/COLLADAMax/src/COLLADAMaxImporterBase.cpp =================================================================== --- branches/nextgen/COLLADAMax/src/COLLADAMaxImporterBase.cpp 2009-02-04 16:50:23 UTC (rev 339) +++ branches/nextgen/COLLADAMax/src/COLLADAMaxImporterBase.cpp 2009-02-05 13:26:07 UTC (rev 340) @@ -134,6 +134,19 @@ } //------------------------------ + void ImporterBase::addUniqueIdFWMaterialPair( const COLLADAFW::UniqueId& uniqueId, const COLLADAFW::Material& material ) + { + mDocumentImporter->getUniqueIdFWMaterialMap().insert(std::pair<COLLADAFW::UniqueId, COLLADAFW::Material>(uniqueId, material)); + } + + //------------------------------ + void ImporterBase::addUniqueIdFWEffectPair( const COLLADAFW::UniqueId& uniqueId, const COLLADAFW::Effect& effect ) + { + mDocumentImporter->getUniqueIdFWEffectMap().insert(std::pair<COLLADAFW::UniqueId, COLLADAFW::Effect>(uniqueId, effect));; + } + + + //------------------------------ void ImporterBase::addLibraryNodes( const COLLADAFW::LibraryNodes* libraryNodes ) { mDocumentImporter->getLibraryNodesList().push_back(libraryNodes); @@ -184,5 +197,26 @@ return it->second; } + //------------------------------ + const COLLADAFW::Material* ImporterBase::getFWMaterialByUniqueId( const COLLADAFW::UniqueId& uniqueId ) + { + const DocumentImporter::UniqueIdFWMaterialMap& uniqueIdFWMaterialMap = mDocumentImporter->getUniqueIdFWMaterialMap(); + DocumentImporter::UniqueIdFWMaterialMap::const_iterator it = uniqueIdFWMaterialMap.find(uniqueId); + if ( it == uniqueIdFWMaterialMap.end() ) + return 0; + else + return &it->second; + } + //------------------------------ + const COLLADAFW::Effect* ImporterBase::getFWEffectByUniqueId( const COLLADAFW::UniqueId& uniqueId ) + { + const DocumentImporter::UniqueIdFWEffectMap& uniqueIdFWEffectMap = mDocumentImporter->getUniqueIdFWEffectMap(); + DocumentImporter::UniqueIdFWEffectMap::const_iterator it = uniqueIdFWEffectMap.find(uniqueId); + if ( it == uniqueIdFWEffectMap.end() ) + return 0; + else + return &it->second; + } + } // namespace COLLADAMax Added: branches/nextgen/COLLADAMax/src/COLLADAMaxMaterialImporter.cpp =================================================================== --- branches/nextgen/COLLADAMax/src/COLLADAMaxMaterialImporter.cpp (rev 0) +++ branches/nextgen/COLLADAMax/src/COLLADAMaxMaterialImporter.cpp 2009-02-05 13:26:07 UTC (rev 340) @@ -0,0 +1,46 @@ +/* +Copyright (c) 2008 NetAllied Systems GmbH + +This file is part of COLLADAMax. + +Portions of the code are: +Copyright (c) 2005-2007 Feeling Software Inc. +Copyright (c) 2005-2007 Sony Computer Entertainment America + +Based on the 3dsMax COLLADASW Tools: +Copyright (c) 2005-2006 Autodesk Media Entertainment + +Licensed under the MIT Open Source License, +for details please see LICENSE file or the website +http://www.opensource.org/licenses/mit-license.php +*/ + +#include "COLLADAMaxStableHeaders.h" +#include "COLLADAMaxMaterialImporter.h" + +#include "COLLADAFWMaterial.h" + + +namespace COLLADAMax +{ + + MaterialImporter::MaterialImporter( DocumentImporter* documentImporter, const COLLADAFW::Material* material ) + : ImporterBase(documentImporter) + , mMaterial(material) + { + + } + + //------------------------------ + MaterialImporter::~MaterialImporter() + { + } + + bool MaterialImporter::import() + { + const COLLADAFW::UniqueId& materialUniqueId = mMaterial->getUniqueId(); + if ( materialUniqueId.isValid() ) + addUniqueIdFWMaterialPair(materialUniqueId, *mMaterial); + return true; + } +} // namespace COLLADAMax Modified: branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLFileLoader.h =================================================================== --- branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLFileLoader.h 2009-02-04 16:50:23 UTC (rev 339) +++ branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLFileLoader.h 2009-02-05 13:26:07 UTC (rev 340) @@ -95,8 +95,13 @@ /** Starts loading a library nodes.*/ virtual bool begin__library_nodes( const library_nodes__AttributeData& attributeData ); + /** Starts loading a library materials.*/ + virtual bool begin__library_materials( const library_materials__AttributeData& attributeData ); + /** Starts loading a library effects.*/ + virtual bool begin__library_effects( const library_effects__AttributeData& attributeData ); + private: /** Disable default copy ctor. */ Modified: branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLIFilePartLoader.h =================================================================== --- branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLIFilePartLoader.h 2009-02-04 16:50:23 UTC (rev 339) +++ branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLIFilePartLoader.h 2009-02-05 13:26:07 UTC (rev 340) @@ -59,6 +59,22 @@ @return The elements COLLADAFW::UniqueId */ const COLLADAFW::UniqueId& getUniqueId(const String& uriString, COLLADAFW::ClassId classId); + /** Returns the COLLADAFW::UniqueId of the element with id @a colladaId in the current file. + If the id within this file has been passed to this method before, the same COLLADAFW::UniqueId + will be returned, if not, a new one is created. + @param id The collada id of the element to get the COLLADAFW::UniqueId for + @param classId The COLLADAFW::ClassId of the object that will be created for @a element. + @return The elements COLLADAFW::UniqueId */ + const COLLADAFW::UniqueId& getUniqueIdFromId( const ParserChar* colladaId, COLLADAFW::ClassId classId ); + + /** Returns the COLLADAFW::UniqueId of the element referenced by the url @a url. If the has + been passed to this method before, the same COLLADAFW::UniqueId will be returned, if not, + a new one is created. + @param url The url of the element to get the COLLADAFW::UniqueId for + @param classId The COLLADAFW::ClassId of the object that will be created for @a element. + @return The elements COLLADAFW::UniqueId */ + const COLLADAFW::UniqueId& getUniqueIdFromUrl( const ParserChar* url, COLLADAFW::ClassId classId ); + /** Returns the COLLADAFW::UniqueId of an element with no uri. At each call a new COLLADAFW::UniqueId will be created and returned. Use this member for collada elements that do not have an id. Added: branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLLibraryEffectsLoader.h =================================================================== --- branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLLibraryEffectsLoader.h (rev 0) +++ branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLLibraryEffectsLoader.h 2009-02-05 13:26:07 UTC (rev 340) @@ -0,0 +1,79 @@ +/* + Copyright (c) 2008 NetAllied Systems GmbH + + This file is part of COLLADASaxFrameworkLoader. + + Licensed under the MIT Open Source License, + for details please see LICENSE file or the website + http://www.opensource.org/licenses/mit-license.php +*/ + +#ifndef __COLLADASAXFWL_LIBRARYEFFECTSSLOADER_H__ +#define __COLLADASAXFWL_LIBRARYEFFECTSSLOADER_H__ + +#include "COLLADASaxFWLPrerequisites.h" +#include "COLLADASaxFWLFilePartLoader.h" + +namespace COLLADAFW +{ + class Effect; +} + + + +namespace COLLADASaxFWL +{ + + /** TODO Documentation */ + class LibraryEffectsLoader : public FilePartLoader + { + private: + enum Profile + { + PROFILE_BRIDGE, + PROFILE_CG, + PROFILE_GLES, + PROFILE_GLES2, + PROFILE_GLSL, + PROFILE_COMMON, + PROFILE_UNKNOWN + }; + + private: + /** The effect currently being imported.*/ + COLLADAFW::Effect* mCurrentEffect; + + /** The current profile.*/ + Profile mCurrentProfile; + + public: + + /** Constructor. */ + LibraryEffectsLoader( IFilePartLoader* callingFilePartLoader ); + + /** Destructor. */ + virtual ~LibraryEffectsLoader(); + + /** Creates a new current effect.*/ + virtual bool begin__effect( const effect__AttributeData& attributeData ); + + /** Sends current material to the writer an deletes it afterwards.*/ + virtual bool end__effect(); + + /** Finishes loading a library effects.*/ + virtual bool end__library_effects(); + + + private: + + /** Disable default copy ctor. */ + LibraryEffectsLoader( const LibraryEffectsLoader& pre ); + + /** Disable default assignment operator. */ + const LibraryEffectsLoader& operator= ( const LibraryEffectsLoader& pre ); + + }; + +} // namespace COLLADASAXFWL + +#endif // __COLLADASAXFWL_LIBRARYEFFECTSSLOADER_H__ Added: branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLLibraryMaterialsLoader.h =================================================================== --- branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLLibraryMaterialsLoader.h (rev 0) +++ branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLLibraryMaterialsLoader.h 2009-02-05 13:26:07 UTC (rev 340) @@ -0,0 +1,69 @@ +/* + Copyright (c) 2008 NetAllied Systems GmbH + + This file is part of COLLADASaxFrameworkLoader. + + Licensed under the MIT Open Source License, + for details please see LICENSE file or the website + http://www.opensource.org/licenses/mit-license.php +*/ + +#ifndef __COLLADASAXFWL_LIBRARYMATERIALSLOADER_H__ +#define __COLLADASAXFWL_LIBRARYMATERIALSLOADER_H__ + +#include "COLLADASaxFWLPrerequisites.h" +#include "COLLADASaxFWLFilePartLoader.h" + + +namespace COLLADAFW +{ + class Material; +} + + +namespace COLLADASaxFWL +{ + + /** TODO Documentation */ + class LibraryMaterialsLoader : public FilePartLoader + { + private: + /** The material currently being parsed.*/ + COLLADAFW::Material* mCurrentMaterial; + + public: + + /** Constructor. */ + LibraryMaterialsLoader( IFilePartLoader* callingFilePartLoader ); + + /** Destructor. */ + virtual ~LibraryMaterialsLoader(); + + /** Create new current material.*/ + virtual bool begin__material( const material__AttributeData& attributeData ); + + /** Sends current material to the writer an deletes it afterwards.*/ + virtual bool end__material(); + + /** Set the referenced effect in the current material.*/ + virtual bool begin__material__instance_effect( const instance_effect__AttributeData& attributeData ); + + /** We don't need to do anything here.*/ + virtual bool end__material__instance_effect(){return true;} + + /** Finishes the material loader.*/ + virtual bool end__library_materials(); + + private: + + /** Disable default copy ctor. */ + LibraryMaterialsLoader( const LibraryMaterialsLoader& pre ); + + /** Disable default assignment operator. */ + const LibraryMaterialsLoader& operator= ( const LibraryMaterialsLoader& pre ); + + }; + +} // namespace COLLADASAXFWL + +#endif // __COLLADASAXFWL_LIBRARYMATERIALSLOADER_H__ Modified: branches/nextgen/COLLADASaxFrameworkLoader/scripts/COLLADASaxFrameworkLoader.vcproj =================================================================== --- branches/nextgen/COLLADASaxFrameworkLoader/scripts/COLLADASaxFrameworkLoader.vcproj 2009-02-04 16:50:23 UTC (rev 339) +++ branches/nextgen/COLLADASaxFrameworkLoader/scripts/COLLADASaxFrameworkLoader.vcproj 2009-02-05 13:26:07 UTC (rev 340) @@ -344,6 +344,14 @@ > </File> <File + RelativePath="..\src\COLLADASaxFWLLibraryEffectsLoader.cpp" + > + </File> + <File + RelativePath="..\src\COLLADASaxFWLLibraryMaterialsLoader.cpp" + > + </File> + <File RelativePath="..\src\COLLADASaxFWLLibraryNodesLoader.cpp" > </File> @@ -450,6 +458,14 @@ > </File> <File + RelativePath="..\include\COLLADASaxFWLLibraryEffectsLoader.h" + > + </File> + <File + RelativePath="..\include\COLLADASaxFWLLibraryMaterialsLoader.h" + > + </File> + <File RelativePath="..\include\COLLADASaxFWLLibraryNodesLoader.h" > </File> Modified: branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLFileLoader.cpp =================================================================== --- branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLFileLoader.cpp 2009-02-04 16:50:23 UTC (rev 339) +++ branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLFileLoader.cpp 2009-02-05 13:26:07 UTC (rev 340) @@ -14,6 +14,8 @@ #include "COLLADASaxFWLAssetLoader.h" #include "COLLADASaxFWLVisualSceneLoader.h" #include "COLLADASaxFWLLibraryNodesLoader.h" +#include "COLLADASaxFWLLibraryMaterialsLoader.h" +#include "COLLADASaxFWLLibraryEffectsLoader.h" #include "COLLADASaxFWLMeshLoader.h" #include "COLLADASaxFWLGeometryLoader.h" #include "COLLADASaxFWLSaxParserErrorHandler.h" @@ -92,12 +94,6 @@ deleteFilePartLoader(); LibraryNodesLoader* libraryNodesLoader = new LibraryNodesLoader(this); -/* if ( attributeData.id ) - libraryNodesLoader->setGeometryId((const char *) attributeData.id); - - if ( attributeData.name ) - libraryNodesLoader->setGeometryName((const char *) attributeData.name); -*/ setPartLoader(libraryNodesLoader); setParser(libraryNodesLoader); return true; @@ -115,4 +111,24 @@ setCallbackObject(parserToBeSet); } + //----------------------------- + bool FileLoader::begin__library_materials( const library_materials__AttributeData& attributeData ) + { + deleteFilePartLoader(); + LibraryMaterialsLoader* libraryMaterialsLoader = new LibraryMaterialsLoader(this); + + setPartLoader(libraryMaterialsLoader); + setParser(libraryMaterialsLoader); + return true; + } + + bool FileLoader::begin__library_effects( const library_effects__AttributeData& attributeData ) + { + deleteFilePartLoader(); + LibraryEffectsLoader* libraryEffectsLoader = new LibraryEffectsLoader(this); + + setPartLoader(libraryEffectsLoader); + setParser(libraryEffectsLoader); + return true; + } } // namespace COLLADASaxFWL Modified: branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLIFilePartLoader.cpp =================================================================== --- branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLIFilePartLoader.cpp 2009-02-04 16:50:23 UTC (rev 339) +++ branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLIFilePartLoader.cpp 2009-02-05 13:26:07 UTC (rev 340) @@ -46,6 +46,30 @@ } //----------------------------- + const COLLADAFW::UniqueId& IFilePartLoader::getUniqueIdFromId( const ParserChar* colladaId, COLLADAFW::ClassId classId ) + { + if ( !getColladaLoader() || !colladaId || !(*colladaId) ) + return COLLADAFW::UniqueId::INVALID; + + COLLADABU::URI uri(getFileUri(), String("#") + String((const char *)colladaId)); + + return getColladaLoader()->getUniqueId(uri, classId); + } + + + //----------------------------- + const COLLADAFW::UniqueId& IFilePartLoader::getUniqueIdFromUrl( const ParserChar* url, COLLADAFW::ClassId classId ) + { + if ( !getColladaLoader() || !url || !(*url) ) + return COLLADAFW::UniqueId::INVALID; + + COLLADABU::URI uri(getFileUri(), String((const char *)url)); + + return getColladaLoader()->getUniqueId(uri, classId); + } + + + //----------------------------- COLLADAFW::UniqueId IFilePartLoader::getUniqueId( COLLADAFW::ClassId classId ) { if ( !getColladaLoader() ) Added: branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLLibraryEffectsLoader.cpp =================================================================== --- branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLLibraryEffectsLoader.cpp (rev 0) +++ branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLLibraryEffectsLoader.cpp 2009-02-05 13:26:07 UTC (rev 340) @@ -0,0 +1,60 @@ +/* + Copyright (c) 2008 NetAllied Systems GmbH + + This file is part of COLLADASaxFrameworkLoader. + + Licensed under the MIT Open Source License, + for details please see LICENSE file or the website + http://www.opensource.org/licenses/mit-license.php +*/ + +#include "COLLADASaxFWLStableHeaders.h" +#include "COLLADASaxFWLLibraryEffectsLoader.h" + +#include "COLLADAFWIWriter.h" +#include "COLLADAFWEffect.h" + +namespace COLLADASaxFWL +{ + + //------------------------------ + LibraryEffectsLoader::LibraryEffectsLoader( IFilePartLoader* callingFilePartLoader ) + : FilePartLoader(callingFilePartLoader) + , mCurrentEffect(0) + , mCurrentProfile(PROFILE_UNKNOWN) + + { + } + + //------------------------------ + LibraryEffectsLoader::~LibraryEffectsLoader() + { + } + + + //------------------------------ + bool LibraryEffectsLoader::begin__effect( const effect__AttributeData& attributeData ) + { + mCurrentEffect = FW_NEW COLLADAFW::Effect(getUniqueIdFromId(attributeData.id, COLLADAFW::Effect::ID()).getObjectId()); + if ( attributeData.name ) + mCurrentEffect->setName((const char*)attributeData.name); + return true; + } + + //------------------------------ + bool LibraryEffectsLoader::end__effect() + { + bool success = writer()->writeEffect(mCurrentEffect); + FW_DELETE mCurrentEffect; + mCurrentEffect = 0; + return success; + } + + //------------------------------ + bool LibraryEffectsLoader::end__library_effects() + { + finish(); + return true; + } + +} // namespace COLLADASaxFWL Added: branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLLibraryMaterialsLoader.cpp =================================================================== --- branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLLibraryMaterialsLoader.cpp (rev 0) +++ branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLLibraryMaterialsLoader.cpp 2009-02-05 13:26:07 UTC (rev 340) @@ -0,0 +1,66 @@ +/* + Copyright (c) 2008 NetAllied Systems GmbH + + This file is part of COLLADASaxFrameworkLoader. + + Licensed under the MIT Open Source License, + for details please see LICENSE file or the website + http://www.opensource.org/licenses/mit-license.php +*/ + +#include "COLLADASaxFWLStableHeaders.h" +#include "COLLADASaxFWLLibraryMaterialsLoader.h" + +#include "COLLADAFWIWriter.h" +#include "COLLADAFWMaterial.h" +#include "COLLADAFWEffect.h" + +namespace COLLADASaxFWL +{ + + LibraryMaterialsLoader::LibraryMaterialsLoader( IFilePartLoader* callingFilePartLoader ) + : FilePartLoader(callingFilePartLoader) + , mCurrentMaterial(0) + { + + } + + //------------------------------ + LibraryMaterialsLoader::~LibraryMaterialsLoader() + { + } + + bool LibraryMaterialsLoader::begin__material( const material__AttributeData& attributeData ) + { + mCurrentMaterial = FW_NEW COLLADAFW::Material(getUniqueIdFromId(attributeData.id, COLLADAFW::Material::ID()).getObjectId()); + if ( attributeData.name ) + mCurrentMaterial->setName((const char*)attributeData.name); + return true; + } + + + //------------------------------ + bool LibraryMaterialsLoader::end__material() + { + bool success = writer()->writeMaterial(mCurrentMaterial); + FW_DELETE mCurrentMaterial; + mCurrentMaterial = 0; + return success; + } + + bool LibraryMaterialsLoader::begin__material__instance_effect( const instance_effect__AttributeData& attributeData ) + { + mCurrentMaterial->setInstantiatedEffect(getUniqueIdFromUrl(attributeData.url, COLLADAFW::Effect::ID())); + return true; + } + + + //------------------------------ + bool LibraryMaterialsLoader::end__library_materials() + { + finish(); + return true; + } + + +} // namespace COLLADASaxFWL Modified: branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLMeshLoader.cpp =================================================================== --- branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLMeshLoader.cpp 2009-02-04 16:50:23 UTC (rev 339) +++ branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLMeshLoader.cpp 2009-02-05 13:26:07 UTC (rev 340) @@ -27,7 +27,7 @@ MeshLoader::MeshLoader( IFilePartLoader* callingFilePartLoader, const String& geometryId, const String& geometryName ) : SourceArrayLoader (callingFilePartLoader ) - , mMeshUniqueId(getUniqueId('#' + geometryId, COLLADAFW::Geometry::ID())) + , mMeshUniqueId(getUniqueIdFromId((ParserChar*)geometryId.c_str(), COLLADAFW::Geometry::ID())) , mMesh ( new COLLADAFW::Mesh(mMeshUniqueId.getObjectId()) ) , mMaterialIdInfo(getMeshMaterialIdInfo(mMeshUniqueId)) , mCurrentMeshPrimitive(0) Modified: branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLNodeLoader.cpp =================================================================== --- branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLNodeLoader.cpp 2009-02-04 16:50:23 UTC (rev 339) +++ branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLNodeLoader.cpp 2009-02-05 13:26:07 UTC (rev 340) @@ -43,15 +43,7 @@ //------------------------------ bool NodeLoader::beginNode( const node__AttributeData& attributeData ) { - COLLADAFW::Node* newNode; - if ( attributeData.id ) - { - newNode = new COLLADAFW::Node(getUniqueId(String("#") + (const char*)attributeData.id, COLLADAFW::Node::ID()).getObjectId()); - } - else - { - newNode = new COLLADAFW::Node(getUniqueId(COLLADAFW::Node::ID()).getObjectId()); - } + COLLADAFW::Node* newNode = new COLLADAFW::Node(getUniqueIdFromId(attributeData.id, COLLADAFW::Node::ID()).getObjectId()); if ( attributeData.name ) newNode->setName((const char*)attributeData.name); @@ -342,7 +334,7 @@ { COLLADAFW::Node* currentNode = mNodeStack.top(); - COLLADAFW::UniqueId instantiatedGeometryUniqueId = getUniqueId((const char*)attributeData.url, COLLADAFW::Geometry::ID()); + COLLADAFW::UniqueId instantiatedGeometryUniqueId = getUniqueIdFromUrl( attributeData.url, COLLADAFW::Geometry::ID()); mCurrentMaterialInfo = &getMeshMaterialIdInfo(instantiatedGeometryUniqueId); @@ -381,7 +373,7 @@ bool NodeLoader::begin__instance_material( const instance_material__AttributeData& attributeData ) { COLLADAFW::MaterialId materialId = attributeData.symbol ? mCurrentMaterialInfo->getMaterialId((const char*)attributeData.symbol) : 0; - COLLADAFW::InstanceGeometry::MaterialBinding materialBinding(materialId, getUniqueId((const char*)attributeData.target, COLLADAFW::Material::ID())); + COLLADAFW::InstanceGeometry::MaterialBinding materialBinding(materialId, getUniqueIdFromUrl(attributeData.target, COLLADAFW::Material::ID())); mCurrentMaterialBindings.insert(materialBinding); return true; } @@ -393,7 +385,7 @@ { COLLADAFW::Node* currentNode = mNodeStack.top(); - COLLADAFW::UniqueId instantiatedNodeUniqueId = getUniqueId((const char*)attributeData.url, COLLADAFW::Node::ID()); + COLLADAFW::UniqueId instantiatedNodeUniqueId = getUniqueIdFromUrl( attributeData.url, COLLADAFW::Node::ID() ); COLLADAFW::InstanceNode* instanceNode = new COLLADAFW::InstanceNode(instantiatedNodeUniqueId); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jud...@us...> - 2009-02-04 16:50:29
|
Revision: 339 http://colladamaya.svn.sourceforge.net/colladamaya/?rev=339&view=rev Author: judithschenk Date: 2009-02-04 16:50:23 +0000 (Wed, 04 Feb 2009) Log Message: ----------- bugfix on maya transformations (SPT and RPT) Modified Paths: -------------- branches/nextgen/COLLADAMaya/include/COLLADAMayaDocumentImporter.h branches/nextgen/COLLADAMaya/include/COLLADAMayaVisualSceneImporter.h branches/nextgen/COLLADAMaya/scripts/COLLADAMaya.vcproj branches/nextgen/COLLADAMaya/src/COLLADAMayaDocumentImporter.cpp branches/nextgen/COLLADAMaya/src/COLLADAMayaFileTranslator.cpp branches/nextgen/COLLADAMaya/src/COLLADAMayaGeometryImporter.cpp branches/nextgen/COLLADAMaya/src/COLLADAMayaVisualSceneImporter.cpp branches/nextgen/COLLADAStreamWriter/src/COLLADASWStreamWriter.cpp Modified: branches/nextgen/COLLADAMaya/include/COLLADAMayaDocumentImporter.h =================================================================== --- branches/nextgen/COLLADAMaya/include/COLLADAMayaDocumentImporter.h 2009-02-04 15:38:17 UTC (rev 338) +++ branches/nextgen/COLLADAMaya/include/COLLADAMayaDocumentImporter.h 2009-02-04 16:50:23 UTC (rev 339) @@ -55,6 +55,9 @@ /** The current maya ascii file to import the data. */ FILE* mFile; + /** The LC_NUMERIC locale that was set before the Streamwriter was instantiated. */ + String mLocale; + bool mAssetWritten; bool mSceneGraphWritten; bool mGeometryWritten; @@ -87,7 +90,8 @@ void readColladaDocument (); /** Create the maya ascii file (where with which name???) */ - bool createFile (); + bool createMayaAsciiFile (); + void closeMayaAsciiFile (); /** * Returns the name of the current collada file to export. Modified: branches/nextgen/COLLADAMaya/include/COLLADAMayaVisualSceneImporter.h =================================================================== --- branches/nextgen/COLLADAMaya/include/COLLADAMayaVisualSceneImporter.h 2009-02-04 15:38:17 UTC (rev 338) +++ branches/nextgen/COLLADAMaya/include/COLLADAMayaVisualSceneImporter.h 2009-02-04 16:50:23 UTC (rev 339) @@ -68,9 +68,16 @@ MayaTransformation () : phase (0) , translate1 ( 0,0,0 ) + , translate1Vec (0) + , numTranslate1 (0) , translate2 ( 0,0,0 ) + , translate2Vec (0) + , numTranslate2 (0) , translate3 ( 0,0,0 ) + , translate3Vec (0) + , numTranslate3 (0) , scale ( 1,1,1 ) + , skew ( 0,0,0 ) {} virtual ~MayaTransformation () {} @@ -81,11 +88,22 @@ static const size_t PHASE_TRANS3 = 5; MVector translate1; // = 0,0,0 + std::vector<MVector> translate1Vec; + size_t numTranslate1; + MQuaternion rotation; // = 1,0,0,0 + MVector translate2; // = 0,0,0 + std::vector<MVector> translate2Vec; + size_t numTranslate2; + + MVector skew; // = 0,0,0 MVector scale; // = 1,1,1 + MVector translate3; // = 0,0,0 - MVector skew; + std::vector<MVector> translate3Vec; + size_t numTranslate3; + // 5 phases size_t phase; @@ -163,14 +181,18 @@ */ bool isValidMayaTransform ( const COLLADAFW::Node* rootNode, - MayaTransformation& mayaTransform ); + MayaTransformation& mayaTransform, + bool& hasRotatePivot, + bool& hasScalePivot ); /** * Set the transform values. */ void importDecomposedTransform ( const MayaTransformation &mayaTransform, - MayaDM::Transform* transformNode ); + MayaDM::Transform* transformNode, + const bool hasRotatePivot, + const bool hasScalePivot ); /** * Imports the transform values from a transform matrix. Modified: branches/nextgen/COLLADAMaya/scripts/COLLADAMaya.vcproj =================================================================== --- branches/nextgen/COLLADAMaya/scripts/COLLADAMaya.vcproj 2009-02-04 15:38:17 UTC (rev 338) +++ branches/nextgen/COLLADAMaya/scripts/COLLADAMaya.vcproj 2009-02-04 16:50:23 UTC (rev 339) @@ -885,7 +885,7 @@ Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="..\include;"$(MAYA_PATH2009)\include";"$(MAYA_PATH2009)\devkit\plug-ins";"$(BOOST_ROOT)";..\..\COLLADABaseUtils\include;..\..\COLLADAStreamWriter\include;..\..\Externals\Cg\include;..\..\COLLADASaxFrameworkLoader\include;..\..\COLLADAFramework\include;..\..\Externals\MayaDataModel\include;..\..\GeneratedSaxParser\include;..\..\Externals\LibXML\include" - PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_AFXDLL;_MBCS;NT_PLUGIN;REQUIRE_IOSTREAM;CM_EXPORTS;GLUT_NO_LIB_PRAGMA;GLUT_NO_WARNING_DISABLE;_CRT_NONSTDC_NO_DEPRECATE;$(NOINHERIT)" + PreprocessorDefinitions="CREATE_IMPORT_PLUGIN;WIN32;_DEBUG;_WINDOWS;_AFXDLL;_MBCS;NT_PLUGIN;REQUIRE_IOSTREAM;CM_EXPORTS;GLUT_NO_LIB_PRAGMA;GLUT_NO_WARNING_DISABLE;_CRT_NONSTDC_NO_DEPRECATE;$(NOINHERIT)" BasicRuntimeChecks="3" RuntimeLibrary="3" RuntimeTypeInfo="true" Modified: branches/nextgen/COLLADAMaya/src/COLLADAMayaDocumentImporter.cpp =================================================================== --- branches/nextgen/COLLADAMaya/src/COLLADAMayaDocumentImporter.cpp 2009-02-04 15:38:17 UTC (rev 338) +++ branches/nextgen/COLLADAMaya/src/COLLADAMayaDocumentImporter.cpp 2009-02-04 16:50:23 UTC (rev 339) @@ -56,6 +56,9 @@ DocumentImporter::~DocumentImporter() { releaseLibraries(); + + // Close the maya ascii file + closeMayaAsciiFile (); } //--------------------------------- @@ -90,14 +93,17 @@ // Load the collada document into the collada framework. readColladaDocument(); + + // Close the maya file. + closeMayaAsciiFile (); } //----------------------------- - bool DocumentImporter::createFile() + bool DocumentImporter::createMayaAsciiFile () { // TODO mMayaAsciiFileURI.set ( mColladaFileName ); - mMayaAsciiFileURI.setPathExtension ( ".netallied.ma" ); + mMayaAsciiFileURI.setPathExtension ( ".netallied.import.ma" ); String mayaFileName = mMayaAsciiFileURI.getURIString (); // Check if the file already exist. @@ -107,6 +113,10 @@ std::cerr << "File already exists!"; } + // Get the current locale value + mLocale = setlocale ( LC_NUMERIC, 0 ); + setlocale ( LC_NUMERIC, "C" ); + errno_t err = fopen_s ( &mFile, mayaFileName.c_str (), "w+" ); if ( err != 0 ) { @@ -117,6 +127,18 @@ return true; } + //----------------------------- + void DocumentImporter::closeMayaAsciiFile () + { + if ( mFile ) + { + fclose ( mFile ); + mFile = 0; + + setlocale ( LC_NUMERIC, mLocale.c_str() ); + } + } + //--------------------------------- const String& DocumentImporter::getColladaFilename() const { @@ -133,7 +155,7 @@ void DocumentImporter::start () { // Create the maya file. - assert ( createFile() ); + assert ( createMayaAsciiFile() ); } //----------------------------- Modified: branches/nextgen/COLLADAMaya/src/COLLADAMayaFileTranslator.cpp =================================================================== --- branches/nextgen/COLLADAMaya/src/COLLADAMayaFileTranslator.cpp 2009-02-04 15:38:17 UTC (rev 338) +++ branches/nextgen/COLLADAMaya/src/COLLADAMayaFileTranslator.cpp 2009-02-04 16:50:23 UTC (rev 339) @@ -33,6 +33,7 @@ #include <maya/MItDependencyNodes.h> #include <maya/MFnDependencyNode.h> #include <maya/MGlobal.h> +#include <maya/MFileIO.h> #if MAYA_API_VERSION >= 700 #include <maya/MHWShaderSwatchGenerator.h> #endif @@ -373,7 +374,6 @@ { MStatus status = MS::kSuccess; - // Get the time clock_t startClock, endClock; startClock = clock(); @@ -389,6 +389,21 @@ MString message( stream.str().c_str() ); MGlobal::displayInfo ( message ); + // Open the maya ascii file in the maya instance + COLLADABU::URI mayaAsciiFileURI = documentImporter.getMayaAsciiFileURI (); + + String mayaFileName = mayaAsciiFileURI.getURIString (); + MFileIO::importFile ( mayaFileName.c_str () ); + // MFileIO::open ( mayaFileName.c_str () ); + // MFileIO::setCurrentFile ( mayaFileName.c_str () ); + MGlobal::displayInfo ( "Maya ascii file opened."); + +// mayaAsciiFileURI.setPathExtension ( ".netallied.import.mb" ); +// mayaFileName = mayaAsciiFileURI.getURIString (); +// MFileIO::saveAs ( mayaFileName.c_str () ); +// MGlobal::displayInfo ( "File saved as maya binary: " ); +// MGlobal::displayInfo ( mayaFileName.c_str () + return status; } Modified: branches/nextgen/COLLADAMaya/src/COLLADAMayaGeometryImporter.cpp =================================================================== --- branches/nextgen/COLLADAMaya/src/COLLADAMayaGeometryImporter.cpp 2009-02-04 15:38:17 UTC (rev 338) +++ branches/nextgen/COLLADAMaya/src/COLLADAMayaGeometryImporter.cpp 2009-02-04 16:50:23 UTC (rev 339) @@ -474,7 +474,7 @@ { for ( size_t j=0; j<stride; ++j ) { - meshNode.appendColorSetPoints ( (*values)[initialIndex+i+j] ); + meshNode.appendColorSetPoints ( ( float ) (*values)[initialIndex+i+j] ); } } meshNode.endColorSetPoints (); Modified: branches/nextgen/COLLADAMaya/src/COLLADAMayaVisualSceneImporter.cpp =================================================================== --- branches/nextgen/COLLADAMaya/src/COLLADAMayaVisualSceneImporter.cpp 2009-02-04 15:38:17 UTC (rev 338) +++ branches/nextgen/COLLADAMaya/src/COLLADAMayaVisualSceneImporter.cpp 2009-02-04 16:50:23 UTC (rev 339) @@ -188,11 +188,15 @@ // with matrix transformation is no animation possible). MayaTransformation mayaTransform; - bool validMayaTransform = isValidMayaTransform ( rootNode, mayaTransform ); + bool hasRotatePivot = false; + bool hasScalePivot = false; + + bool validMayaTransform = + isValidMayaTransform ( rootNode, mayaTransform, hasRotatePivot, hasScalePivot ); if ( validMayaTransform ) { // Set the transform values. - importDecomposedTransform ( mayaTransform, transformNode ); + importDecomposedTransform ( mayaTransform, transformNode, hasRotatePivot, hasScalePivot ); } else { @@ -213,7 +217,9 @@ else outputMatrix[1][0] = inputMatrix[0][1]; if (COLLADABU::Math::Utils::equalsZero(inputMatrix[0][2])) outputMatrix[2][0] = 0.0; else outputMatrix[2][0] = inputMatrix[0][2]; - outputMatrix[3][0] = 0; + if (COLLADABU::Math::Utils::equalsZero(inputMatrix[0][3])) outputMatrix[3][0] = 0.0; + else outputMatrix[3][0] = inputMatrix[0][3]; +// outputMatrix[3][0] = 0; if (COLLADABU::Math::Utils::equalsZero(inputMatrix[1][0])) outputMatrix[0][1] = 0.0; else outputMatrix[0][1] = inputMatrix[1][0]; @@ -221,7 +227,9 @@ else outputMatrix[1][1] = inputMatrix[1][1]; if (COLLADABU::Math::Utils::equalsZero(inputMatrix[1][2])) outputMatrix[2][1] = 0.0; else outputMatrix[2][1] = inputMatrix[1][2]; - outputMatrix[3][1] = 0; + if (COLLADABU::Math::Utils::equalsZero(inputMatrix[1][3])) outputMatrix[3][1] = 0.0; + else outputMatrix[3][1] = inputMatrix[1][3]; +// outputMatrix[3][1] = 0; if (COLLADABU::Math::Utils::equalsZero(inputMatrix[2][0])) outputMatrix[0][2] = 0.0; else outputMatrix[0][2] = inputMatrix[2][0]; @@ -229,7 +237,9 @@ else outputMatrix[1][2] = inputMatrix[2][1]; if (COLLADABU::Math::Utils::equalsZero(inputMatrix[2][2])) outputMatrix[2][2] = 0.0; else outputMatrix[2][2] = inputMatrix[2][2]; - outputMatrix[3][2] = 0; + if (COLLADABU::Math::Utils::equalsZero(inputMatrix[2][3])) outputMatrix[3][2] = 0.0; + else outputMatrix[3][2] = inputMatrix[2][3]; +// outputMatrix[3][2] = 0; if (COLLADABU::Math::Utils::equalsZero(inputMatrix[3][0])) outputMatrix[0][3] = 0.0; else outputMatrix[0][3] = inputMatrix[3][0]; @@ -237,7 +247,9 @@ else outputMatrix[1][3] = inputMatrix[3][1]; if (COLLADABU::Math::Utils::equalsZero(inputMatrix[3][2])) outputMatrix[2][3] = 0.0; else outputMatrix[2][3] = inputMatrix[3][2]; - outputMatrix[3][3] = 1; + if (COLLADABU::Math::Utils::equalsZero(inputMatrix[3][3])) outputMatrix[3][3] = 0.0; + else outputMatrix[3][3] = inputMatrix[3][3]; +// outputMatrix[3][3] = 1; } // ----------------------------------- @@ -259,15 +271,18 @@ double rotation[3]; MTransformationMatrix::RotationOrder order; tm.getRotation ( rotation, order, MSpace::kTransform ); - transformNode->setRotate ( MayaDM::double3 ( rotation[0], rotation[1], rotation[2] ) ); + if ( ! ( MVector (0,0,0) == MVector ( rotation ) ) ) + transformNode->setRotate ( MayaDM::double3 ( rotation[0], rotation[1], rotation[2] ) ); double scale[3]; tm.getScale ( scale, MSpace::kTransform ); - transformNode->setScale ( MayaDM::double3 ( scale[0], scale[1], scale[2] ) ); + if ( ! ( MVector (1,1,1) == MVector ( scale ) ) ) + transformNode->setScale ( MayaDM::double3 ( scale[0], scale[1], scale[2] ) ); double shear[3]; tm.getShear ( shear, MSpace::kTransform ); - transformNode->setShear ( MayaDM::double3 ( shear[0], shear[1], shear[2] ) ); + if ( ! ( MVector (0,0,0) == MVector ( shear ) ) ) + transformNode->setShear ( MayaDM::double3 ( shear[0], shear[1], shear[2] ) ); } // ----------------------------------- @@ -312,54 +327,11 @@ } // ----------------------------------- - void VisualSceneImporter::importDecomposedTransform ( - const MayaTransformation &mayaTransform, - MayaDM::Transform* transformNode ) - { - // Write the transformations directly into the maya file. - MVector translate3 = mayaTransform.translate3; - MVector inverseScalePivot ( translate3 [0], translate3 [1], translate3 [2] ); - MVector scalePivot = inverseScalePivot * (-1); - - MVector translate2 = mayaTransform.translate2; - MVector inverseRotatePivot = translate2 - translate3; - MVector rotatePivot = inverseRotatePivot * (-1); - - MVector translate1 = mayaTransform.translate1; - MVector translate = translate1 - rotatePivot; - MVector tester = translate1 + translate2 + translate3; - - MQuaternion mayaRotate = mayaTransform.rotation; - MEulerRotation eulerRotation = mayaRotate.asEulerRotation (); - MEulerRotation::RotationOrder order = eulerRotation.order; - MVector rotation = eulerRotation.asVector (); - - MVector scale = mayaTransform.scale; - MVector skew = mayaTransform.skew; - - if ( translate != MVector (0, 0, 0) ) - transformNode->setTranslate ( MayaDM::double3 ( translate.x, translate.y, translate.z ) ); - if ( rotation != MVector (0, 0, 0) ) - transformNode->setRotate ( MayaDM::double3 ( COLLADABU::Math::Utils::radToDeg(rotation.x), COLLADABU::Math::Utils::radToDeg(rotation.y), COLLADABU::Math::Utils::radToDeg(rotation.z) ) ); - if ( scale != MVector (1, 1, 1) ) - transformNode->setScale ( MayaDM::double3 ( scale[0], scale[1], scale[2] ) ); - - if ( skew != MVector (0, 0, 0)) - transformNode->setShear ( MayaDM::double3 ( skew.x, skew.y, skew.z ) ); - - if ( rotatePivot != MVector (0, 0, 0) ) - transformNode->setRotatePivot ( MayaDM::double3 ( rotatePivot.x, rotatePivot.y, rotatePivot.z ) ); - if ( scalePivot != MVector (0, 0, 0) ) - transformNode->setScalePivot ( MayaDM::double3 ( scalePivot.x, scalePivot.y, scalePivot.z ) ); - - if ( order != MEulerRotation::kXYZ ) - transformNode->setRotateOrder ( order ); - } - - // ----------------------------------- bool VisualSceneImporter::isValidMayaTransform ( const COLLADAFW::Node* rootNode, - MayaTransformation& mayaTransform ) + MayaTransformation& mayaTransform, + bool& hasRotatePivot, + bool& hasScalePivot ) { bool validMayaTransform = true; @@ -393,10 +365,13 @@ // TODO Do anything with this values! assert ("Lookat not implemented!"); + + validMayaTransform = false; break; } case COLLADAFW::Transformation::MATRIX: // Nothing to do, the matrix will be read automatically. + validMayaTransform = false; break; case COLLADAFW::Transformation::ROTATE: { @@ -461,16 +436,22 @@ COLLADABU::Math::Vector3 translation = translate->getTranslation (); if ( mayaTransform.phase == MayaTransformation::PHASE_TRANS1 ) { + mayaTransform.translate1Vec.push_back ( MVector (translation[0],translation[1],translation[2] ) ); + ++mayaTransform.numTranslate1; for ( unsigned int j=0; j<3; ++j ) mayaTransform.translate1[j] += translation [j]; } else if ( mayaTransform.phase == MayaTransformation::PHASE_TRANS2 ) { + mayaTransform.translate2Vec.push_back ( MVector (translation[0],translation[1],translation[2] ) ); + ++mayaTransform.numTranslate2; for ( unsigned int j=0; j<3; ++j ) mayaTransform.translate2[j] += translation [j]; } else if ( mayaTransform.phase == MayaTransformation::PHASE_TRANS3 ) { + mayaTransform.translate3Vec.push_back ( MVector (translation[0],translation[1],translation[2] ) ); + ++mayaTransform.numTranslate3; for ( unsigned int j=0; j<3; ++j ) mayaTransform.translate3[j] += translation [j]; } @@ -483,10 +464,218 @@ } } + if ( validMayaTransform ) + { + // Get the number of vectors + size_t numTranslate1Vec = mayaTransform.translate1Vec.size (); + size_t numTranslate2Vec = mayaTransform.translate2Vec.size (); + size_t numTranslate3Vec = mayaTransform.translate3Vec.size (); + + // Just one translate3Vec is allowed. + if ( numTranslate3Vec > 1 ) + { + validMayaTransform = false; + return validMayaTransform; + } + + // If we have one translate3, which is the scalePivotInverse, + // the last Vector of the translate2 has to be the scalePivot. + if ( numTranslate3Vec == 1 ) + { + // The first translate3 vector has to be the scalePivotInverse. + MVector scalePivotInverse = mayaTransform.translate3Vec[0]; + + // If we have a scalePivotInverse, we need minimum one translate2 vector. + // The last translate2 vector has to be the scalePivot. + MVector scalePivot (0,0,0); + if ( numTranslate2Vec > 0 ) + { + // The last translate2 vector has to be the scalePivot. + scalePivot = mayaTransform.translate2Vec[numTranslate2Vec-1]; + } + else + { + // Except we don't have a rotation... + // Then the scalePivot is the last translate1 vector. + // The last translate2 vector has to be the scalePivot. + scalePivot = mayaTransform.translate1Vec[numTranslate1Vec-1]; + } + + // Check, if the vectors are inverse. + if ( ( scalePivot * (-1) ) != scalePivotInverse ) + { + validMayaTransform = false; + return validMayaTransform; + } + + // We have a valid scalePivot. + hasScalePivot = true; + } + + + // Without a translate1 vector, we can't have a rotatePivot + if ( numTranslate1Vec > 0 ) + { + // We also need minimum one translate2 vector, + // respectively minimum two translate2 vectors, if we have a scalePivot. + if ( numTranslate2Vec > 0 || ( hasScalePivot && numTranslate2Vec > 1 ) ) + { + // Check if we have a rotatePivotInverse at the beginning of the translate2 vectors + // and the rotatePivot at the end of the translate1 vectors. + + // The first translate2 vector has to be the rotatePivotInverse. + MVector rotatePivotInverse = mayaTransform.translate2Vec[0]; + + // The last translate1 vector has to be the rotatePivot. + MVector rotatePivot = mayaTransform.translate1Vec[numTranslate1Vec-1]; + + // Check, if the vectors are inverse. + if ( ( rotatePivot * (-1) ) != rotatePivotInverse ) + { + validMayaTransform = false; + return validMayaTransform; + } + hasRotatePivot = true; + } + } + } + return validMayaTransform; } // ----------------------------------- + void VisualSceneImporter::importDecomposedTransform ( + const MayaTransformation &mayaTransform, + MayaDM::Transform* transformNode, + const bool hasRotatePivot, + const bool hasScalePivot ) + { + // This is the order of the transforms: + // + // matrix = [SP-1 * S * SH * SP * ST] * [RP-1 * RA * R * JO * RP * RT] * T + // [ scale ] * [ rotation ] * translation + // + // Where SP is scale pivot translation, S is scale, SH is shear, ST is scale pivot translation + // RP is rotation pivot, RA is rotation axis, R is rotation, RP is rotation pivot, + // RT is rotation pivot translation, T is translation, JO is joint orientation + + // T1 = T + RP + RPT + // R = R + // T2 = RP-1 + SPT + SP + // S = S + // T3 = SP-1 + // ==> T = T1 + T2 + T3 - SPT - RPT + + // In the following calculation the RPT and SPT values are absent, + // so the calculation is wrong! + { +// MVector translate3 = mayaTransform.translate3; +// MVector inverseScalePivot ( translate3 [0], translate3 [1], translate3 [2] ); +// MVector scalePivot = inverseScalePivot * (-1); +// +// MVector translate2 = mayaTransform.translate2; +// MVector inverseRotatePivot = scalePivot - translate2; +// MVector rotatePivot = inverseRotatePivot * (-1); +// +// MVector translate1 = mayaTransform.translate1; +// MVector translate = translate1 - rotatePivot; +// MVector tester = translate1 + translate2 + translate3; +// +// MQuaternion mayaRotate = mayaTransform.rotation; +// MEulerRotation eulerRotation = mayaRotate.asEulerRotation (); +// MEulerRotation::RotationOrder order = eulerRotation.order; +// MVector rotation = eulerRotation.asVector (); + } + + // Get the number of vectors + size_t numTranslate1Vec = mayaTransform.translate1Vec.size (); + size_t numTranslate2Vec = mayaTransform.translate2Vec.size (); + size_t numTranslate3Vec = mayaTransform.translate3Vec.size (); + + MVector scalePivot (0,0,0); + MVector scalePivotTranslate (0,0,0); + + MVector rotatePivot (0,0,0); + MVector rotatePivotTranslate (0,0,0); + + bool hasScalePivotTranslate = false; + + if ( hasScalePivot ) + { + // Get the scalePivot + scalePivot = mayaTransform.translate3Vec[0] * (-1); + + // Check for a scalePivotTranslate + if ( hasRotatePivot ) + { + if ( numTranslate2Vec == 3 ) + { + scalePivotTranslate = mayaTransform.translate2Vec[numTranslate2Vec-2]; + hasScalePivotTranslate = true; + } + } + else + { + if ( numTranslate2Vec == 2 ) + { + scalePivotTranslate = mayaTransform.translate2Vec[0]; + hasScalePivotTranslate = true; + } + } + } + + if ( hasRotatePivot ) + { + // The last translate1 vector has to be the rotatePivot. + rotatePivot = mayaTransform.translate1Vec[numTranslate1Vec-1]; + + if ( hasScalePivot ) + { + if ( numTranslate2Vec == 3 ) + rotatePivotTranslate = mayaTransform.translate1Vec[1]; + } + } + + // T = T1 + T2 + T3 - SPT - RPT + MVector translate1 = mayaTransform.translate1; + MVector translate2 = mayaTransform.translate2; + MVector translate3 = mayaTransform.translate3; + MVector translate = translate1 + translate2 + translate3 - scalePivotTranslate - rotatePivotTranslate; + + MQuaternion mayaRotate = mayaTransform.rotation; + MEulerRotation eulerRotation = mayaRotate.asEulerRotation (); + MEulerRotation::RotationOrder order = eulerRotation.order; + MVector rotation = eulerRotation.asVector (); + + MVector scale = mayaTransform.scale; + MVector skew = mayaTransform.skew; + + // Write the transformations directly into the maya file. + if ( translate != MVector (0, 0, 0) ) + transformNode->setTranslate ( MayaDM::double3 ( translate.x, translate.y, translate.z ) ); + if ( rotation != MVector (0, 0, 0) ) + transformNode->setRotate ( MayaDM::double3 ( COLLADABU::Math::Utils::radToDeg(rotation.x), COLLADABU::Math::Utils::radToDeg(rotation.y), COLLADABU::Math::Utils::radToDeg(rotation.z) ) ); + if ( scale != MVector (1, 1, 1) ) + transformNode->setScale ( MayaDM::double3 ( scale[0], scale[1], scale[2] ) ); + + if ( skew != MVector (0, 0, 0)) + transformNode->setShear ( MayaDM::double3 ( skew.x, skew.y, skew.z ) ); + + if ( rotatePivot != MVector (0, 0, 0) ) + transformNode->setRotatePivot ( MayaDM::double3 ( rotatePivot.x, rotatePivot.y, rotatePivot.z ) ); + if ( rotatePivotTranslate != MVector (0, 0, 0) ) + transformNode->setRotatePivotTranslate ( MayaDM::double3 ( rotatePivotTranslate.x, rotatePivotTranslate.y, rotatePivotTranslate.z ) ); + + if ( scalePivot != MVector (0, 0, 0) ) + transformNode->setScalePivot ( MayaDM::double3 ( scalePivot.x, scalePivot.y, scalePivot.z ) ); + if ( scalePivotTranslate != MVector (0, 0, 0) ) + transformNode->setScalePivotTranslate ( MayaDM::double3 ( scalePivotTranslate.x, scalePivotTranslate.y, scalePivotTranslate.z ) ); + + if ( order != MEulerRotation::kXYZ ) + transformNode->setRotateOrder ( order ); + } + + // ----------------------------------- void VisualSceneImporter::skewValuesToMayaMatrix ( const COLLADAFW::Skew* skew, MMatrix& matrix ) const { Modified: branches/nextgen/COLLADAStreamWriter/src/COLLADASWStreamWriter.cpp =================================================================== --- branches/nextgen/COLLADAStreamWriter/src/COLLADASWStreamWriter.cpp 2009-02-04 15:38:17 UTC (rev 338) +++ branches/nextgen/COLLADAStreamWriter/src/COLLADASWStreamWriter.cpp 2009-02-04 16:50:23 UTC (rev 339) @@ -92,7 +92,7 @@ { mBuffer = new char[BUFFERSIZE]; #ifdef COLLADASTREAMWRITER_USE_FPRINTF_S - String mLocale = setlocale(LC_NUMERIC, 0); + mLocale = setlocale(LC_NUMERIC, 0); setlocale(LC_NUMERIC, "C"); errno_t error = fopen_s ( &mStream, fileName.c_str(), "w" ); if ( error != 0 ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rob...@us...> - 2009-02-04 15:38:20
|
Revision: 338 http://colladamaya.svn.sourceforge.net/colladamaya/?rev=338&view=rev Author: robertwuerfel Date: 2009-02-04 15:38:17 +0000 (Wed, 04 Feb 2009) Log Message: ----------- material symbol mapping in instance geometry Modified Paths: -------------- branches/nextgen/COLLADAFramework/include/COLLADAFWArray.h branches/nextgen/COLLADAFramework/include/COLLADAFWInstanceGeometry.h branches/nextgen/COLLADAFramework/include/COLLADAFWMaterial.h branches/nextgen/COLLADAFramework/src/COLLADAFWInstanceGeometry.cpp branches/nextgen/COLLADAFramework/src/COLLADAFWMeshPrimitive.cpp branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLIFilePartLoader.h branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLMeshLoader.h branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLNodeLoader.h branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLIFilePartLoader.cpp branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLMeshLoader.cpp branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLNodeLoader.cpp Modified: branches/nextgen/COLLADAFramework/include/COLLADAFWArray.h =================================================================== --- branches/nextgen/COLLADAFramework/include/COLLADAFWArray.h 2009-02-03 17:19:26 UTC (rev 337) +++ branches/nextgen/COLLADAFramework/include/COLLADAFWArray.h 2009-02-04 15:38:17 UTC (rev 338) @@ -129,7 +129,7 @@ /** The number of elements, for which is currently memory allocated. */ - size_t getCapacity () { return mCapacity; } + size_t getCapacity () const { return mCapacity; } /** The number of elements, for which is currently memory allocated. */ void setCapacity ( const size_t capacity ) { mCapacity = capacity; } @@ -149,7 +149,7 @@ Must not be called, if the memory has not been allocated by allocateMemory().*/ void releaseMemory () { - delete mData; + delete[] mData; setData ( 0, 0, 0 ); } Modified: branches/nextgen/COLLADAFramework/include/COLLADAFWInstanceGeometry.h =================================================================== --- branches/nextgen/COLLADAFramework/include/COLLADAFWInstanceGeometry.h 2009-02-03 17:19:26 UTC (rev 337) +++ branches/nextgen/COLLADAFramework/include/COLLADAFWInstanceGeometry.h 2009-02-04 15:38:17 UTC (rev 338) @@ -47,10 +47,24 @@ /** Sets the Unique id of the material that should get bind to the mesh primitives.*/ void setReferencedMaterial(const COLLADAFW::UniqueId& val) { mReferencedMaterial = val; } + + /** The comparison operator that only compares the material ids.*/ + bool operator<( const MaterialBinding& rhs) const { return mMaterialId < rhs.mMaterialId; } + + private: + friend class Array<MaterialBinding>; + MaterialBinding(){} + }; + typedef Array<MaterialBinding> MaterialBindings; + private: + /** The list of all material bindings of this instance geometry. The Material bindings must be + order according to MaterialBinding::operator<.*/ + MaterialBindings mMaterialBindings; + public: /** Constructor. Creates an instance geometry, that does not instantiate a geometry.*/ InstanceGeometry(); @@ -65,11 +79,17 @@ /** Clones the matrix.*/ InstanceGeometry* clone() const { return new InstanceGeometry(*this); } + /** Returns the list of all material bindings.*/ + MaterialBindings& getMaterialBindings() { return mMaterialBindings; } + + /** Returns the list of all material bindings.*/ + const MaterialBindings& getMaterialBindings() const { return mMaterialBindings; } + private: /** Disable default copy ctor. */ -// InstanceGeometry( const InstanceGeometry& pre ); + InstanceGeometry( const InstanceGeometry& pre ); /** Disable default assignment operator. */ -// const InstanceGeometry& operator= ( const InstanceGeometry& pre ); + //const InstanceGeometry& operator= ( const InstanceGeometry& pre ); }; typedef ArrayPrimitiveType<InstanceGeometry*> InstanceGeometryArray; Modified: branches/nextgen/COLLADAFramework/include/COLLADAFWMaterial.h =================================================================== --- branches/nextgen/COLLADAFramework/include/COLLADAFWMaterial.h 2009-02-03 17:19:26 UTC (rev 337) +++ branches/nextgen/COLLADAFramework/include/COLLADAFWMaterial.h 2009-02-04 15:38:17 UTC (rev 338) @@ -23,10 +23,6 @@ { private: - /** A text string containing the unique identifier of the element. This value must be - unique within the instance document. Optional. */ - String mId; - /** The text string name of this element. Optional. */ String mName; @@ -38,14 +34,6 @@ /** Destructor. */ virtual ~Material (); - /** A text string containing the unique identifier of the element. This value must be - unique within the instance document. Optional. */ - const String getId () const { return mId; } - - /** A text string containing the unique identifier of the element. This value must be - unique within the instance document. Optional. */ - void setId ( const String Id ) { mId = Id; } - /** The text string name of this element. Optional. */ const String& getName () const { return mName; } Modified: branches/nextgen/COLLADAFramework/src/COLLADAFWInstanceGeometry.cpp =================================================================== --- branches/nextgen/COLLADAFramework/src/COLLADAFWInstanceGeometry.cpp 2009-02-03 17:19:26 UTC (rev 337) +++ branches/nextgen/COLLADAFramework/src/COLLADAFWInstanceGeometry.cpp 2009-02-04 15:38:17 UTC (rev 338) @@ -19,12 +19,22 @@ { } + InstanceGeometry::InstanceGeometry( const InstanceGeometry& pre ) + : SceneGraphInstance(pre) + , mMaterialBindings() + { + mMaterialBindings.allocMemory(pre.mMaterialBindings.getCapacity()); + size_t count = pre.mMaterialBindings.getCount(); + mMaterialBindings.setCount(count); + for ( size_t i = 0; i < count; ++i) + mMaterialBindings[i] = pre.mMaterialBindings[i]; + } + //-------------------------------------------------------------------- InstanceGeometry::~InstanceGeometry() { } - InstanceGeometry::MaterialBinding::MaterialBinding( MaterialId materialId, UniqueId referencedMaterial ) : mMaterialId(materialId) , mReferencedMaterial(referencedMaterial) Modified: branches/nextgen/COLLADAFramework/src/COLLADAFWMeshPrimitive.cpp =================================================================== --- branches/nextgen/COLLADAFramework/src/COLLADAFWMeshPrimitive.cpp 2009-02-03 17:19:26 UTC (rev 337) +++ branches/nextgen/COLLADAFramework/src/COLLADAFWMeshPrimitive.cpp 2009-02-04 15:38:17 UTC (rev 338) @@ -21,7 +21,8 @@ //----------------------------- MeshPrimitive::MeshPrimitive() - : mPrimitiveType ( UNDEFINED_PRIMITIVE_TYPE ) + : mMaterialId(0) + , mPrimitiveType ( UNDEFINED_PRIMITIVE_TYPE ) , mPositionIndices(UIntValuesArray::OWNER) , mNormalIndices(UIntValuesArray::OWNER) , mColorIndicesArray(UIntValuesArray::OWNER) @@ -32,7 +33,8 @@ //----------------------------- MeshPrimitive::MeshPrimitive( PrimitiveType primitiveType ) - : mPrimitiveType ( primitiveType ) + : mMaterialId(0) + , mPrimitiveType ( primitiveType ) , mPositionIndices(UIntValuesArray::OWNER) , mNormalIndices(UIntValuesArray::OWNER) , mColorIndicesArray(UIntValuesArray::OWNER) Modified: branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLIFilePartLoader.h =================================================================== --- branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLIFilePartLoader.h 2009-02-03 17:19:26 UTC (rev 337) +++ branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLIFilePartLoader.h 2009-02-04 15:38:17 UTC (rev 338) @@ -30,6 +30,7 @@ namespace COLLADASaxFWL { class Loader; + class GeometryMaterialIdInfo; /** Base class for all loaders that load parts of files or entire files */ class IFilePartLoader : protected ColladaParserAutoGen @@ -68,7 +69,7 @@ /** Returns the GeometryMaterialIdInfo object of the geometry with @a uniqueId. If this method has not been called before with the same uniqueId, an empty GeometryMaterialIdInfo is created, added to the map and returned.*/ -// GeometryMaterialIdInfo& getMeshMaterialIdInfo( const COLLADAFW::UniqueId& uniqueId); + GeometryMaterialIdInfo& getMeshMaterialIdInfo( const COLLADAFW::UniqueId& uniqueId); /** After this functions, the next sax callback should be caught by this the file part loader.*/ Modified: branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLMeshLoader.h =================================================================== --- branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLMeshLoader.h 2009-02-03 17:19:26 UTC (rev 337) +++ branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLMeshLoader.h 2009-02-04 15:38:17 UTC (rev 338) @@ -61,8 +61,12 @@ COLLADAFW::Mesh* mMesh; /** The mapping of collada symbols to material ids.*/ -// GeometryMaterialIdInfo& mMaterialIdInfo; + GeometryMaterialIdInfo& mMaterialIdInfo; + /** The material symbol of the current mesh. Is only used for primitives, for which the + the framework object is not created in the begin__* method.*/ + String mCurrentMeshMaterial; + /** The mesh primitive being filled by the parser.*/ COLLADAFW::MeshPrimitive* mCurrentMeshPrimitive; Modified: branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLNodeLoader.h =================================================================== --- branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLNodeLoader.h 2009-02-03 17:19:26 UTC (rev 337) +++ branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLNodeLoader.h 2009-02-04 15:38:17 UTC (rev 338) @@ -14,8 +14,10 @@ #include "COLLADASaxFWLPrerequisites.h" #include "COLLADASaxFWLFilePartLoader.h" +#include "COLLADAFWInstanceGeometry.h" #include <stack> +#include <set> namespace COLLADAFW { @@ -34,17 +36,29 @@ /** Stack of nodes.*/ typedef std::stack<COLLADAFW::Node*> NodeStack; + /** Set of MaterialBindings*/ + typedef std::set<COLLADAFW::InstanceGeometry::MaterialBinding> MaterialBindingsSet; + /** Stack of nodes to traverse back in node hierarchy. Array and contents will be delete in destructor.*/ NodeStack mNodeStack; - /** The transformation, that is currently being pared. Null if none is being parsed.*/ + /** The transformation, that is currently being parsed. Null if none is being parsed.*/ COLLADAFW::Transformation* mCurrentTransformation; - /** The number of floats that have been received since the last begin* method + /** The number of floats that have been received since the last begin__* method by the transformation data* methods. This is used to know where the next received number must be placed in the transformation.*/ size_t mTransformationNumbersReceived; + /** Instance geometry currently being filled.*/ + COLLADAFW::InstanceGeometry* mCurrentInstanceGeometry; + + /** Set of all material bindings of the current instance geometry.*/ + MaterialBindingsSet mCurrentMaterialBindings; + + /** The material info of the geometry instantiated in the current instance geometry.*/ + GeometryMaterialIdInfo* mCurrentMaterialInfo; + public: /** Constructor. */ @@ -129,6 +143,10 @@ virtual bool end__skew(); virtual bool data__skew( const double* value, size_t length ); + virtual bool begin__lookat( const lookat__AttributeData& attributeData ); + virtual bool end__lookat(); + virtual bool data__lookat( const double* value, size_t length ); + /** Sax callback function for the beginning of an instance geometry element.*/ virtual bool begin__node__instance_geometry( const instance_geometry__AttributeData& attributeData ); @@ -136,15 +154,31 @@ virtual bool end__node__instance_geometry(); + /** We do not need to do anything here.*/ + virtual bool begin__instance_geometry__bind_material(){return true;} + + /** We do not need to do anything here.*/ + virtual bool end__instance_geometry__bind_material(){return true;} + + /** We do not need to do anything here.*/ + virtual bool begin__bind_material__technique_common(){return true;} + + /** We do not need to do anything here.*/ + virtual bool end__bind_material__technique_common(){return true;} + + /** We store all instance_material informations in a set.*/ + virtual bool begin__instance_material( const instance_material__AttributeData& attributeData ); + + /** We do not need to do anything here.*/ + virtual bool end__instance_material(){return true;} + + /** Sax callback function for the beginning of an instance node element.*/ virtual bool begin__instance_node( const instance_node__AttributeData& attributeData ); /** Sax callback function for the ending of an instance node element.*/ virtual bool end__instance_node(); - virtual bool begin__lookat( const lookat__AttributeData& attributeData ); - virtual bool end__lookat(); - virtual bool data__lookat( const double* value, size_t length ); }; Modified: branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLIFilePartLoader.cpp =================================================================== --- branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLIFilePartLoader.cpp 2009-02-03 17:19:26 UTC (rev 337) +++ branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLIFilePartLoader.cpp 2009-02-04 15:38:17 UTC (rev 338) @@ -70,6 +70,11 @@ setParser(this); } + GeometryMaterialIdInfo& IFilePartLoader::getMeshMaterialIdInfo( const COLLADAFW::UniqueId& uniqueId ) + { + assert(getColladaLoader()); + return getColladaLoader()->getMeshMaterialIdInfo(uniqueId); + } } // namespace COLLADASaxFWL Modified: branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLMeshLoader.cpp =================================================================== --- branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLMeshLoader.cpp 2009-02-03 17:19:26 UTC (rev 337) +++ branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLMeshLoader.cpp 2009-02-04 15:38:17 UTC (rev 338) @@ -10,6 +10,7 @@ #include "COLLADASaxFWLStableHeaders.h" #include "COLLADASaxFWLMeshLoader.h" +#include "COLLADASaxFWLGeometryMaterialIdInfo.h" #include "COLLADAFWTriangles.h" #include "COLLADAFWTristrips.h" @@ -28,7 +29,7 @@ : SourceArrayLoader (callingFilePartLoader ) , mMeshUniqueId(getUniqueId('#' + geometryId, COLLADAFW::Geometry::ID())) , mMesh ( new COLLADAFW::Mesh(mMeshUniqueId.getObjectId()) ) -// , mMaterialIdInfo(get) + , mMaterialIdInfo(getMeshMaterialIdInfo(mMeshUniqueId)) , mCurrentMeshPrimitive(0) , mCurrentVertexInput(0) , mMeshPrimitiveInputs(mVerticesInputs) @@ -920,6 +921,7 @@ mCurrentMeshPrimitive = 0; mCurrentFaceCount = 0; mCurrentPhHasEmptyP = true; + mCurrentMeshMaterial.clear(); } @@ -979,6 +981,8 @@ //------------------------------ bool MeshLoader::begin__mesh__triangles( const triangles__AttributeData& attributeData ) { + if ( attributeData.material ) + mCurrentMeshMaterial = (const char *)attributeData.material; return true; } @@ -1018,6 +1022,7 @@ loadSourceElements(mMeshPrimitiveInputs); initializeOffsets(); mCurrentMeshPrimitive = new COLLADAFW::Triangles(); + mCurrentMeshPrimitive->setMaterialId(mMaterialIdInfo.getMaterialId(mCurrentMeshMaterial)); return true; } @@ -1051,6 +1056,8 @@ COLLADAFW::Polygons* polygons = new COLLADAFW::Polygons(); polygons->getGroupedVerticesVertexCountArray().allocMemory((size_t)attributeData.count); mCurrentMeshPrimitive = polygons; + if ( attributeData.material ) + mCurrentMeshPrimitive->setMaterialId(mMaterialIdInfo.getMaterialId( (const char*)attributeData.material )); return true; } @@ -1143,6 +1150,8 @@ // The actual size might be bigger, but its a lower bound polygons->getGroupedVerticesVertexCountArray().allocMemory((size_t)attributeData.count); mCurrentMeshPrimitive = polygons; + if ( attributeData.material ) + mCurrentMeshPrimitive->setMaterialId(mMaterialIdInfo.getMaterialId( (const char*)attributeData.material )); return true; } @@ -1287,6 +1296,8 @@ // The actual size might be bigger, but its a lower bound tristrips->getGroupedVerticesVertexCountArray().allocMemory((size_t)attributeData.count); mCurrentMeshPrimitive = tristrips; + if ( attributeData.material ) + mCurrentMeshPrimitive->setMaterialId(mMaterialIdInfo.getMaterialId( (const char*)attributeData.material )); return true; } @@ -1375,6 +1386,8 @@ // The actual size might be bigger, but its a lower bound trifans->getGroupedVerticesVertexCountArray().allocMemory((size_t)attributeData.count); mCurrentMeshPrimitive = trifans; + if ( attributeData.material ) + mCurrentMeshPrimitive->setMaterialId(mMaterialIdInfo.getMaterialId( (const char*)attributeData.material )); return true; } Modified: branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLNodeLoader.cpp =================================================================== --- branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLNodeLoader.cpp 2009-02-03 17:19:26 UTC (rev 337) +++ branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLNodeLoader.cpp 2009-02-04 15:38:17 UTC (rev 338) @@ -10,6 +10,8 @@ #include "COLLADASaxFWLStableHeaders.h" #include "COLLADASaxFWLNodeLoader.h" +#include "COLLADASaxFWLGeometryMaterialIdInfo.h" + #include "COLLADAFWNode.h" #include "COLLADAFWTranslate.h" #include "COLLADAFWRotate.h" @@ -18,6 +20,7 @@ #include "COLLADAFWLookat.h" #include "COLLADAFWMatrix.h" #include "COLLADAFWGeometry.h" +#include "COLLADAFWMaterial.h" namespace COLLADASaxFWL @@ -26,7 +29,9 @@ NodeLoader::NodeLoader( IFilePartLoader* callingFilePartLoader ) : FilePartLoader(callingFilePartLoader), mCurrentTransformation(0), - mTransformationNumbersReceived(0) + mTransformationNumbersReceived(0), + mCurrentInstanceGeometry(0), + mCurrentMaterialInfo(0) { } @@ -278,6 +283,60 @@ return true; } + //------------------------------ + bool NodeLoader::begin__lookat ( const lookat__AttributeData& attributeData ) + { + return beginTransformation<COLLADAFW::Lookat>(); + } + + //------------------------------ + bool NodeLoader::end__lookat () + { + return endTransformation(); + } + + //------------------------------ + bool NodeLoader::data__lookat ( const double* data, size_t length ) + { + COLLADAFW::Lookat* lookat = 0; + + if (mCurrentTransformation->getTransformationType() == COLLADAFW::Transformation::LOOKAT) + lookat = (COLLADAFW::Lookat*)(mCurrentTransformation); + + assert(lookat); + + COLLADABU::Math::Vector3& eyePosition = lookat->getEyePosition (); + COLLADABU::Math::Vector3& interestPosition = lookat->getInterestPosition (); + COLLADABU::Math::Vector3& upPosition = lookat->getUpPosition (); + + size_t i = 0; + if ( i < length && mTransformationNumbersReceived < 3 ) + { + for ( size_t j=0; j<3 && i<length; ++j, ++i ) + { + eyePosition[j] = data[i]; + mTransformationNumbersReceived++; + } + } + if ( i < length && mTransformationNumbersReceived >= 3 && mTransformationNumbersReceived < 6 ) + { + for ( size_t j=0; j<3 && i<length; ++j, ++i ) + { + interestPosition[j] = data[i]; + mTransformationNumbersReceived++; + } + } + if ( i < length && mTransformationNumbersReceived >= 6 ) + { + for ( size_t j=0; j<3 && i<length; ++j, ++i ) + { + upPosition[j] = data[i]; + mTransformationNumbersReceived++; + } + } + return true; + } + //------------------------------ bool NodeLoader::begin__node__instance_geometry( const instance_geometry__AttributeData& attributeData ) { @@ -285,20 +344,51 @@ COLLADAFW::UniqueId instantiatedGeometryUniqueId = getUniqueId((const char*)attributeData.url, COLLADAFW::Geometry::ID()); - COLLADAFW::InstanceGeometry* instanceGeometry = new COLLADAFW::InstanceGeometry(instantiatedGeometryUniqueId); + mCurrentMaterialInfo = &getMeshMaterialIdInfo(instantiatedGeometryUniqueId); - currentNode->getInstanceGeometries().append(instanceGeometry); + mCurrentInstanceGeometry = new COLLADAFW::InstanceGeometry(instantiatedGeometryUniqueId); + currentNode->getInstanceGeometries().append(mCurrentInstanceGeometry); + return true; } //------------------------------ bool NodeLoader::end__node__instance_geometry() { + size_t materialBindingsCount = mCurrentMaterialBindings.size(); + if ( materialBindingsCount > 0 ) + { + COLLADAFW::InstanceGeometry::MaterialBindings& materialBindings = mCurrentInstanceGeometry->getMaterialBindings(); + materialBindings.allocMemory( materialBindingsCount); + MaterialBindingsSet::const_iterator it = mCurrentMaterialBindings.begin(); + size_t index = 0; + for (; it != mCurrentMaterialBindings.end(); ++it, ++index) + { + materialBindings[index] = *it; + } + materialBindings.setCount(materialBindingsCount); + } + + mCurrentInstanceGeometry = 0; + mCurrentMaterialInfo = 0; + mCurrentMaterialBindings.clear(); return true; } + //------------------------------ + bool NodeLoader::begin__instance_material( const instance_material__AttributeData& attributeData ) + { + COLLADAFW::MaterialId materialId = attributeData.symbol ? mCurrentMaterialInfo->getMaterialId((const char*)attributeData.symbol) : 0; + COLLADAFW::InstanceGeometry::MaterialBinding materialBinding(materialId, getUniqueId((const char*)attributeData.target, COLLADAFW::Material::ID())); + mCurrentMaterialBindings.insert(materialBinding); + return true; + } + + + + //------------------------------ bool NodeLoader::begin__instance_node( const instance_node__AttributeData& attributeData ) { COLLADAFW::Node* currentNode = mNodeStack.top(); @@ -318,58 +408,5 @@ return true; } - //------------------------------ - bool NodeLoader::begin__lookat ( const lookat__AttributeData& attributeData ) - { - return beginTransformation<COLLADAFW::Lookat>(); - } - //------------------------------ - bool NodeLoader::end__lookat () - { - return endTransformation(); - } - - //------------------------------ - bool NodeLoader::data__lookat ( const double* data, size_t length ) - { - COLLADAFW::Lookat* lookat = 0; - - if (mCurrentTransformation->getTransformationType() == COLLADAFW::Transformation::LOOKAT) - lookat = (COLLADAFW::Lookat*)(mCurrentTransformation); - - assert(lookat); - - COLLADABU::Math::Vector3& eyePosition = lookat->getEyePosition (); - COLLADABU::Math::Vector3& interestPosition = lookat->getInterestPosition (); - COLLADABU::Math::Vector3& upPosition = lookat->getUpPosition (); - - size_t i = 0; - if ( i < length && mTransformationNumbersReceived < 3 ) - { - for ( size_t j=0; j<3 && i<length; ++j, ++i ) - { - eyePosition[j] = data[i]; - mTransformationNumbersReceived++; - } - } - if ( i < length && mTransformationNumbersReceived >= 3 && mTransformationNumbersReceived < 6 ) - { - for ( size_t j=0; j<3 && i<length; ++j, ++i ) - { - interestPosition[j] = data[i]; - mTransformationNumbersReceived++; - } - } - if ( i < length && mTransformationNumbersReceived >= 6 ) - { - for ( size_t j=0; j<3 && i<length; ++j, ++i ) - { - upPosition[j] = data[i]; - mTransformationNumbersReceived++; - } - } - return true; - } - } // namespace COLLADASaxFWL This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rob...@us...> - 2009-02-03 17:19:30
|
Revision: 337 http://colladamaya.svn.sourceforge.net/colladamaya/?rev=337&view=rev Author: robertwuerfel Date: 2009-02-03 17:19:26 +0000 (Tue, 03 Feb 2009) Log Message: ----------- error handler for sax framework loader start implementing material handling in instance geometry and mesh primitives Modified Paths: -------------- branches/nextgen/COLLADABaseUtils/scripts/COLLADABaseUtils.vcproj branches/nextgen/COLLADAFramework/include/COLLADAFWInstanceGeometry.h branches/nextgen/COLLADAFramework/include/COLLADAFWMesh.h branches/nextgen/COLLADAFramework/src/COLLADAFWInstanceGeometry.cpp branches/nextgen/COLLADAMax/scripts/COLLADAMax.vcproj branches/nextgen/COLLADAMax/src/COLLADAMaxDocumentImporter.cpp branches/nextgen/COLLADAMax/src/COLLADAMaxGeometryImporter.cpp branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLFileLoader.h branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLIFilePartLoader.h branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLLoader.h branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLMeshLoader.h branches/nextgen/COLLADASaxFrameworkLoader/scripts/COLLADASaxFrameworkLoader.vcproj branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLFileLoader.cpp branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLGeometryLoader.cpp branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLLoader.cpp branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLMeshLoader.cpp branches/nextgen/COLLADAStreamWriter/scripts/COLLADAStreamWriter.vcproj branches/nextgen/GeneratedSaxParser/include/GeneratedSaxParserLibxmlSaxParser.h branches/nextgen/GeneratedSaxParser/include/GeneratedSaxParserParser.h branches/nextgen/GeneratedSaxParser/include/GeneratedSaxParserParserError.h branches/nextgen/GeneratedSaxParser/include/GeneratedSaxParserParserTemplateBase.h branches/nextgen/GeneratedSaxParser/src/GeneratedSaxParserLibxmlSaxParser.cpp branches/nextgen/GeneratedSaxParser/src/GeneratedSaxParserParser.cpp branches/nextgen/GeneratedSaxParser/src/GeneratedSaxParserParserTemplateBase.cpp Added Paths: ----------- branches/nextgen/COLLADAMax/include/COLLADAMaxFWLErrorHandler.h branches/nextgen/COLLADAMax/src/COLLADAMaxFWLErrorHandler.cpp branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLGeometryMaterialIdInfo.h branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLIError.h branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLIErrorHandler.h branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLSaxParserError.h branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLSaxParserErrorHandler.h branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLGeometryMaterialIdInfo.cpp branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLIError.cpp branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLIErrorHandler.cpp branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLSaxParserError.cpp branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLSaxParserErrorHandler.cpp Modified: branches/nextgen/COLLADABaseUtils/scripts/COLLADABaseUtils.vcproj =================================================================== --- branches/nextgen/COLLADABaseUtils/scripts/COLLADABaseUtils.vcproj 2009-02-03 15:32:48 UTC (rev 336) +++ branches/nextgen/COLLADABaseUtils/scripts/COLLADABaseUtils.vcproj 2009-02-03 17:19:26 UTC (rev 337) @@ -344,6 +344,32 @@ > </File> </Filter> + <Filter + Name="UTF" + > + <File + RelativePath="..\..\Externals\UTF\src\ConvertUTF.c" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + UsePrecompiledHeader="0" + PrecompiledHeaderThrough="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + UsePrecompiledHeader="0" + PrecompiledHeaderThrough="" + /> + </FileConfiguration> + </File> + </Filter> </Filter> <Filter Name="Header Files" @@ -422,6 +448,14 @@ > </File> </Filter> + <Filter + Name="UTF" + > + <File + RelativePath="..\..\Externals\UTF\include\ConvertUTF.h" + > + </File> + </Filter> </Filter> </Files> <Globals> Modified: branches/nextgen/COLLADAFramework/include/COLLADAFWInstanceGeometry.h =================================================================== --- branches/nextgen/COLLADAFramework/include/COLLADAFWInstanceGeometry.h 2009-02-03 15:32:48 UTC (rev 336) +++ branches/nextgen/COLLADAFramework/include/COLLADAFWInstanceGeometry.h 2009-02-03 17:19:26 UTC (rev 337) @@ -23,6 +23,35 @@ class InstanceGeometry : public SceneGraphInstance { public: + /** Holds informations how to bind a material to a mesh primitive. + The material with UniqueId @a mReferencedMaterial gets bind to all mesh primitives + with material id @a mMaterialId.*/ + class MaterialBinding + { + private: + /** The MaterialId of the mesh primitives that should get bind to a material.*/ + MaterialId mMaterialId; + /** Unique id of the material that should get bind to the mesh primitives.*/ + UniqueId mReferencedMaterial; + public: + MaterialBinding(MaterialId materialId, UniqueId referencedMaterial); + + /** @return MaterialId of the mesh primitives that should get bind to a material.*/ + COLLADAFW::MaterialId getMaterialId() const { return mMaterialId; } + + /** Sets the MaterialId of the mesh primitives that should get bind to a material.*/ + void setMaterialId(COLLADAFW::MaterialId val) { mMaterialId = val; } + + /** @return Unique id of the material that should get bind to the mesh primitives.*/ + const COLLADAFW::UniqueId& getReferencedMaterial() const { return mReferencedMaterial; } + + /** Sets the Unique id of the material that should get bind to the mesh primitives.*/ + void setReferencedMaterial(const COLLADAFW::UniqueId& val) { mReferencedMaterial = val; } + }; + + private: + + public: /** Constructor. Creates an instance geometry, that does not instantiate a geometry.*/ InstanceGeometry(); Modified: branches/nextgen/COLLADAFramework/include/COLLADAFWMesh.h =================================================================== --- branches/nextgen/COLLADAFramework/include/COLLADAFWMesh.h 2009-02-03 15:32:48 UTC (rev 336) +++ branches/nextgen/COLLADAFramework/include/COLLADAFWMesh.h 2009-02-03 17:19:26 UTC (rev 337) @@ -173,7 +173,7 @@ if ( COLLADABU::Utils::equals ( name, mColors.getName ( index ) ) ) return index; } - std::cerr << "No color with name \"" << name << "\"!" << std::endl; +// std::cerr << "No color with name \"" << name << "\"!" << std::endl; assert ( COLLADABU::Utils::equals ( name, name ) ); return 0; @@ -209,7 +209,7 @@ if ( COLLADABU::Utils::equals ( name, mUVCoords.getName ( index ) ) ) return index; } - std::cerr << "No uv set with name \"" << name << "\"!" << std::endl; + // std::cerr << "No uv set with name \"" << name << "\"!" << std::endl; assert ( true ); return 0; Modified: branches/nextgen/COLLADAFramework/src/COLLADAFWInstanceGeometry.cpp =================================================================== --- branches/nextgen/COLLADAFramework/src/COLLADAFWInstanceGeometry.cpp 2009-02-03 15:32:48 UTC (rev 336) +++ branches/nextgen/COLLADAFramework/src/COLLADAFWInstanceGeometry.cpp 2009-02-03 17:19:26 UTC (rev 337) @@ -24,4 +24,10 @@ { } + + InstanceGeometry::MaterialBinding::MaterialBinding( MaterialId materialId, UniqueId referencedMaterial ) + : mMaterialId(materialId) + , mReferencedMaterial(referencedMaterial) + { + } } // namespace COLLADAFW Added: branches/nextgen/COLLADAMax/include/COLLADAMaxFWLErrorHandler.h =================================================================== --- branches/nextgen/COLLADAMax/include/COLLADAMaxFWLErrorHandler.h (rev 0) +++ branches/nextgen/COLLADAMax/include/COLLADAMaxFWLErrorHandler.h 2009-02-03 17:19:26 UTC (rev 337) @@ -0,0 +1,58 @@ +/* +Copyright (c) 2008 NetAllied Systems GmbH + +This file is part of COLLADAMax. + +Portions of the code are: +Copyright (c) 2005-2007 Feeling Software Inc. +Copyright (c) 2005-2007 Sony Computer Entertainment America + +Based on the 3dsMax COLLADASW Tools: +Copyright (c) 2005-2006 Autodesk Media Entertainment + +Licensed under the MIT Open Source License, +for details please see LICENSE file or the website +http://www.opensource.org/licenses/mit-license.php +*/ + +#ifndef __COLLADAMAX_FWLERRORHANDLER_H__ +#define __COLLADAMAX_FWLERRORHANDLER_H__ + +#include "COLLADAMaxPrerequisites.h" +#include "COLLADASaxFWLIErrorHandler.h" + + +namespace COLLADAMax +{ + + /** TODO Documentation */ + class FWLErrorHandler : public COLLADASaxFWL::IErrorHandler + { + private: + + public: + + /** Constructor. */ + FWLErrorHandler(); + + /** Destructor. */ + virtual ~FWLErrorHandler(); + + /** If this method returns true, the loader stops parsing immediately. If severity is nor CRITICAL + and this method returns true, the loader continues loading.*/ + bool virtual handleError(const COLLADASaxFWL::IError* error); + + + private: + + /** Disable default copy ctor. */ + FWLErrorHandler( const FWLErrorHandler& pre ); + + /** Disable default assignment operator. */ + const FWLErrorHandler& operator= ( const FWLErrorHandler& pre ); + + }; + +} // namespace COLLADAMAX + +#endif // __COLLADAMAX_FWLERRORHANDLER_H__ Modified: branches/nextgen/COLLADAMax/scripts/COLLADAMax.vcproj =================================================================== --- branches/nextgen/COLLADAMax/scripts/COLLADAMax.vcproj 2009-02-03 15:32:48 UTC (rev 336) +++ branches/nextgen/COLLADAMax/scripts/COLLADAMax.vcproj 2009-02-03 17:19:26 UTC (rev 337) @@ -2051,6 +2051,10 @@ > </File> <File + RelativePath="..\src\COLLADAMaxFWLErrorHandler.cpp" + > + </File> + <File RelativePath="..\src\COLLADAMaxGeometryImporter.cpp" > </File> @@ -2217,6 +2221,10 @@ > </File> <File + RelativePath="..\include\COLLADAMaxFWLErrorHandler.h" + > + </File> + <File RelativePath="..\include\COLLADAMaxGeometryImporter.h" > </File> Modified: branches/nextgen/COLLADAMax/src/COLLADAMaxDocumentImporter.cpp =================================================================== --- branches/nextgen/COLLADAMax/src/COLLADAMaxDocumentImporter.cpp 2009-02-03 15:32:48 UTC (rev 336) +++ branches/nextgen/COLLADAMax/src/COLLADAMaxDocumentImporter.cpp 2009-02-03 17:19:26 UTC (rev 337) @@ -20,6 +20,8 @@ #include "COLLADAMaxVisualSceneImporter.h" #include "COLLADAMaxLibraryNodesImporter.h" #include "COLLADAMaxGeometryImporter.h" +#include "COLLADAMaxFWLErrorHandler.h" + #include "COLLADAFWLibraryNodes.h" #include "COLLADAFWLibraryNodes.h" @@ -50,9 +52,11 @@ //--------------------------------------------------------------- bool DocumentImporter::import() { - COLLADASaxFWL::Loader loader; + FWLErrorHandler errorHandler; + COLLADASaxFWL::Loader loader(&errorHandler); COLLADAFW::Root root(&loader, this); +// return root.loadDocument("dsfsdf.dae"); return root.loadDocument(mImportFilePath); } Added: branches/nextgen/COLLADAMax/src/COLLADAMaxFWLErrorHandler.cpp =================================================================== --- branches/nextgen/COLLADAMax/src/COLLADAMaxFWLErrorHandler.cpp (rev 0) +++ branches/nextgen/COLLADAMax/src/COLLADAMaxFWLErrorHandler.cpp 2009-02-03 17:19:26 UTC (rev 337) @@ -0,0 +1,40 @@ +/* +Copyright (c) 2008 NetAllied Systems GmbH + +This file is part of COLLADAMax. + +Portions of the code are: +Copyright (c) 2005-2007 Feeling Software Inc. +Copyright (c) 2005-2007 Sony Computer Entertainment America + +Based on the 3dsMax COLLADASW Tools: +Copyright (c) 2005-2006 Autodesk Media Entertainment + +Licensed under the MIT Open Source License, +for details please see LICENSE file or the website +http://www.opensource.org/licenses/mit-license.php +*/ + +#include "COLLADAMaxStableHeaders.h" +#include "COLLADAMaxFWLErrorHandler.h" + + +namespace COLLADAMax +{ + + //------------------------------ + FWLErrorHandler::FWLErrorHandler() + { + } + + //------------------------------ + FWLErrorHandler::~FWLErrorHandler() + { + } + + bool FWLErrorHandler::handleError( const COLLADASaxFWL::IError* error ) + { + int i = 0; + return false; + } +} // namespace COLLADAMax Modified: branches/nextgen/COLLADAMax/src/COLLADAMaxGeometryImporter.cpp =================================================================== --- branches/nextgen/COLLADAMax/src/COLLADAMaxGeometryImporter.cpp 2009-02-03 15:32:48 UTC (rev 336) +++ branches/nextgen/COLLADAMax/src/COLLADAMaxGeometryImporter.cpp 2009-02-03 17:19:26 UTC (rev 337) @@ -108,15 +108,15 @@ Mesh& triangleMesh = triangleObject->GetMesh(); - const COLLADAFW::MeshPositions& meshPositions = mesh->getPositions(); + const COLLADAFW::MeshVertexData& meshPositions = mesh->getPositions(); - int positionsCount = (int)meshPositions.getPositionsCount() / 3; + int positionsCount = (int)meshPositions.getValuesCount() / 3; triangleMesh.setNumVerts(positionsCount); - if ( meshPositions.getType() == COLLADAFW::MeshPositions::DATA_TYPE_DOUBLE ) + if ( meshPositions.getType() == COLLADAFW::MeshVertexData::DATA_TYPE_DOUBLE ) { - const COLLADAFW::DoubleArray* positionsArray = meshPositions.getDoublePositions(); + const COLLADAFW::DoubleArray* positionsArray = meshPositions.getDoubleValues(); for ( int i = 0; i < positionsCount; ++i) { triangleMesh.setVert(i, (float)(*positionsArray)[3*i], (float)(*positionsArray)[3*i + 1], (float)(*positionsArray)[3*i + 2]); @@ -124,7 +124,7 @@ } else { - const COLLADAFW::FloatArray* positionsArray = meshPositions.getFloatPositions(); + const COLLADAFW::FloatArray* positionsArray = meshPositions.getFloatValues(); for ( int i = 0; i < positionsCount; i+=3) { triangleMesh.setVert(i, (*positionsArray)[i], (*positionsArray)[i + 1], (*positionsArray)[i + 2]); @@ -222,14 +222,14 @@ normalsSpecifier->SetNumFaces((int)numFaces); // fill in the normals - const COLLADAFW::MeshNormals& meshNormals = mesh->getNormals(); - int normalCount = (int)meshNormals.getNormalsCount()/3; + const COLLADAFW::MeshVertexData& meshNormals = mesh->getNormals(); + int normalCount = (int)meshNormals.getValuesCount()/3; normalsSpecifier->SetNumNormals(normalCount); - if ( meshNormals.getType() == COLLADAFW::MeshNormals::DATA_TYPE_DOUBLE ) + if ( meshNormals.getType() == COLLADAFW::MeshVertexData::DATA_TYPE_DOUBLE ) { - const COLLADAFW::DoubleArray* normalsArray = meshNormals.getDoubleNormals(); + const COLLADAFW::DoubleArray* normalsArray = meshNormals.getDoubleValues(); for ( int i = 0; i < normalCount; ++i) { Point3 normal((*normalsArray)[i*3], (*normalsArray)[i*3 + 1], (*normalsArray)[i*3 + 2]); @@ -239,7 +239,7 @@ } else { - const COLLADAFW::FloatArray* normalsArray = meshNormals.getFloatNormals(); + const COLLADAFW::FloatArray* normalsArray = meshNormals.getFloatValues(); for ( int i = 0; i < normalCount; ++i) { Point3 normal((*normalsArray)[i*3], (*normalsArray)[i*3 + 1], (*normalsArray)[i*3 + 2]); @@ -368,15 +368,15 @@ MNMesh& polgonMesh = polygonObject->GetMesh(); - const COLLADAFW::MeshPositions& meshPositions = mesh->getPositions(); + const COLLADAFW::MeshVertexData& meshPositions = mesh->getPositions(); - int positionsCount = (int)meshPositions.getPositionsCount() / 3; + int positionsCount = (int)meshPositions.getValuesCount() / 3; polgonMesh.setNumVerts(positionsCount); - if ( meshPositions.getType() == COLLADAFW::MeshPositions::DATA_TYPE_DOUBLE ) + if ( meshPositions.getType() == COLLADAFW::MeshVertexData::DATA_TYPE_DOUBLE ) { - const COLLADAFW::DoubleArray* positionsArray = meshPositions.getDoublePositions(); + const COLLADAFW::DoubleArray* positionsArray = meshPositions.getDoubleValues(); for ( int i = 0; i < positionsCount; ++i) { MNVert* vertex = polgonMesh.V(i); @@ -385,7 +385,7 @@ } else { - const COLLADAFW::FloatArray* positionsArray = meshPositions.getFloatPositions(); + const COLLADAFW::FloatArray* positionsArray = meshPositions.getFloatValues(); for ( int i = 0; i < positionsCount; i+=3) { MNVert* vertex = polgonMesh.V(i); @@ -505,14 +505,14 @@ normalsSpecifier->SetNumFaces((int)numFaces); // fill in the normals - const COLLADAFW::MeshNormals& meshNormals = mesh->getNormals(); - int normalCount = (int)meshNormals.getNormalsCount()/3; + const COLLADAFW::MeshVertexData& meshNormals = mesh->getNormals(); + int normalCount = (int)meshNormals.getValuesCount()/3; normalsSpecifier->SetNumNormals(normalCount); - if ( meshNormals.getType() == COLLADAFW::MeshNormals::DATA_TYPE_DOUBLE ) + if ( meshNormals.getType() == COLLADAFW::MeshVertexData::DATA_TYPE_DOUBLE ) { - const COLLADAFW::DoubleArray* normalsArray = meshNormals.getDoubleNormals(); + const COLLADAFW::DoubleArray* normalsArray = meshNormals.getDoubleValues(); for ( int i = 0; i < normalCount; ++i) { Point3 normal((*normalsArray)[i*3], (*normalsArray)[i*3 + 1], (*normalsArray)[i*3 + 2]); @@ -522,7 +522,7 @@ } else { - const COLLADAFW::FloatArray* normalsArray = meshNormals.getFloatNormals(); + const COLLADAFW::FloatArray* normalsArray = meshNormals.getFloatValues(); for ( int i = 0; i < normalCount; ++i) { Point3 normal((*normalsArray)[i*3], (*normalsArray)[i*3 + 1], (*normalsArray)[i*3 + 2]); Modified: branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLFileLoader.h =================================================================== --- branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLFileLoader.h 2009-02-03 15:32:48 UTC (rev 336) +++ branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLFileLoader.h 2009-02-03 17:19:26 UTC (rev 337) @@ -35,6 +35,7 @@ { class Loader; class FilePartLoader; + class SaxParserErrorHandler; /** Loader to a COLLADA document. Referenced documents are not loaded.*/ class FileLoader : public IFilePartLoader, public ColladaParserAutoGenPrivate @@ -59,7 +60,7 @@ @param colladaLoader The collada loader this file loader is being used by. Used to retrieve document global properties. @param fileURI The name of the file to be loaded.*/ - FileLoader ( Loader* colladaLoader, const COLLADABU::URI& fileURI ); + FileLoader ( Loader* colladaLoader, const COLLADABU::URI& fileURI, SaxParserErrorHandler* saxParserErrorHandler = 0 ); /** Destructor. */ virtual ~FileLoader(); Added: branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLGeometryMaterialIdInfo.h =================================================================== --- branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLGeometryMaterialIdInfo.h (rev 0) +++ branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLGeometryMaterialIdInfo.h 2009-02-03 17:19:26 UTC (rev 337) @@ -0,0 +1,51 @@ +/* + Copyright (c) 2008 NetAllied Systems GmbH + + This file is part of COLLADASaxFrameworkLoader. + + Licensed under the MIT Open Source License, + for details please see LICENSE file or the website + http://www.opensource.org/licenses/mit-license.php +*/ + +#ifndef __COLLADASAXFWL_GEOMETRYMATERIALIDINFO_H__ +#define __COLLADASAXFWL_GEOMETRYMATERIALIDINFO_H__ + +#include "COLLADASaxFWLPrerequisites.h" + +#include "COLLADAFWTypes.h" +#include "COLLADAFWUniqueId.h" + +#include <map> + +namespace COLLADASaxFWL +{ + + /** Hold information about the relation of collada symbols and material ids used in the framework.*/ + class GeometryMaterialIdInfo + { + public: + /** Maps the collada symbol (used to bind materials) to the MaterialId used in the framework.*/ + typedef std::map<String, COLLADAFW::MaterialId> ColladaSymbolMaterialIdMap; + + + private: + /** The highest material id already used for the mesh.*/ + COLLADAFW::MaterialId mHighestMaterialId; + /** The map that maps collada symbols to material ids for the mesh.*/ + ColladaSymbolMaterialIdMap mColladaSymbolMaterialIdMap; + + public: + /** Creates an empty GeometryMaterialIdInfo.*/ + GeometryMaterialIdInfo(); + + /** Returns the material id the is used in the framework instead of the symbol name. If this member has + been called with the same symbol earlier, the same material id as on the first call is returned. If not, a + new material is returned. + If the symbol is empty, always 0 is returned.*/ + COLLADAFW::MaterialId getMaterialId( const String& symbol); + }; + +} // namespace COLLADASAXFWL + +#endif // __COLLADASAXFWL_GEOMETRYMATERIALIDINFO_H__ Added: branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLIError.h =================================================================== --- branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLIError.h (rev 0) +++ branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLIError.h 2009-02-03 17:19:26 UTC (rev 337) @@ -0,0 +1,59 @@ +/* + Copyright (c) 2008 NetAllied Systems GmbH + + This file is part of COLLADASaxFrameworkLoader. + + Licensed under the MIT Open Source License, + for details please see LICENSE file or the website + http://www.opensource.org/licenses/mit-license.php +*/ + +#ifndef __COLLADASAXFWL_IERROR_H__ +#define __COLLADASAXFWL_IERROR_H__ + +#include "COLLADASaxFWLPrerequisites.h" + + +namespace COLLADASaxFWL +{ + + /** Interface for error that can occur while loading a document. */ + class IError + { + public: + enum Severity + { + SEVERITY_ERROR, + SEVERITY_CRITICAL, + }; + + enum ErrorType + { + ERROR_SAXPARSER // SaxParserError + }; + public: + /** Constructor. */ + IError(){} + + /** Destructor. */ + virtual ~IError(); + + /** Returns the type of the error.*/ + ErrorType virtual getErrorType() const=0; + + /** Returns the severity of the error.*/ + Severity virtual getSeverity() const=0; + + private: + + /** Disable default copy ctor. */ + IError( const IError& pre ); + + /** Disable default assignment operator. */ + const IError& operator= ( const IError& pre ); + + }; + +} // namespace COLLADASAXFWL + +#endif // __COLLADASAXFWL_IERROR_H__ Added: branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLIErrorHandler.h =================================================================== --- branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLIErrorHandler.h (rev 0) +++ branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLIErrorHandler.h 2009-02-03 17:19:26 UTC (rev 337) @@ -0,0 +1,50 @@ +/* + Copyright (c) 2008 NetAllied Systems GmbH + + This file is part of COLLADASaxFrameworkLoader. + + Licensed under the MIT Open Source License, + for details please see LICENSE file or the website + http://www.opensource.org/licenses/mit-license.php +*/ + +#ifndef __COLLADASAXFWL_IERRORHANDLER_H__ +#define __COLLADASAXFWL_IERRORHANDLER_H__ + +#include "COLLADASaxFWLPrerequisites.h" + + +namespace COLLADASaxFWL +{ + class IError; + + /** Interface to handle errors that occur while parsing a collada file*/ + class IErrorHandler + { + public: + + public: + + /** Constructor. */ + IErrorHandler(); + + /** Destructor. */ + virtual ~IErrorHandler(); + + /** If this method returns true, the loader stops parsing immediately. If severity is nor CRITICAL + and this method returns true, the loader continues loading.*/ + bool virtual handleError(const IError* error) = 0; + + private: + + /** Disable default copy ctor. */ + IErrorHandler( const IErrorHandler& pre ); + + /** Disable default assignment operator. */ + const IErrorHandler& operator= ( const IErrorHandler& pre ); + + }; + +} // namespace COLLADASAXFWL + +#endif // __COLLADASAXFWL_IERRORHANDLER_H__ Modified: branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLIFilePartLoader.h =================================================================== --- branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLIFilePartLoader.h 2009-02-03 15:32:48 UTC (rev 336) +++ branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLIFilePartLoader.h 2009-02-03 17:19:26 UTC (rev 337) @@ -65,6 +65,12 @@ @return The elements COLLADAFW::UniqueId */ COLLADAFW::UniqueId getUniqueId(COLLADAFW::ClassId classId); + /** Returns the GeometryMaterialIdInfo object of the geometry with @a uniqueId. If this method has + not been called before with the same uniqueId, an empty GeometryMaterialIdInfo is created, added to + the map and returned.*/ +// GeometryMaterialIdInfo& getMeshMaterialIdInfo( const COLLADAFW::UniqueId& uniqueId); + + /** After this functions, the next sax callback should be caught by this the file part loader.*/ void setMeAsParser(); Modified: branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLLoader.h =================================================================== --- branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLLoader.h 2009-02-03 15:32:48 UTC (rev 336) +++ branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLLoader.h 2009-02-03 17:19:26 UTC (rev 337) @@ -12,14 +12,15 @@ #define __COLLADA_LOADER_H__ #include "COLLADASaxFWLPrerequisites.h" +#include "COLLADASaxFWLGeometryMaterialIdInfo.h" #include "COLLADAFWILoader.h" #include "COLLADAFWLoaderUtils.h" #include "COLLADAFWUniqueId.h" +#include "COLLADAFWTypes.h" #include "COLLADABUHashMap.h" #include "COLLADABUHashFunctions.h" - #include "COLLADABUURI.h" @@ -30,9 +31,17 @@ namespace COLLADASaxFWL { + + class IErrorHandler; + + /** Loader to a COLLADA document and all the documents that are referenced it.*/ class Loader : public COLLADAFW::ILoader { + public: + /** Maps the unique id of each geometry to the corresponding ColladaSymbolMaterialIdMap.*/ + typedef std::map<COLLADAFW::UniqueId, GeometryMaterialIdInfo> UniqueIdMeshMaterialIdInfoMap; + private: typedef COLLADABU::HashMap<COLLADABU::URI, COLLADAFW::UniqueId, unsigned long, COLLADABU::calculateHash> URIUniqueIdMap; @@ -45,11 +54,17 @@ /** Maps each already processed dae element to its COLLADAFW::UniqueId. */ URIUniqueIdMap mURIUniqueIdMap; + + /** Maps the unique id of each geometry to the corresponding GeometryMaterialIdInfo.*/ + UniqueIdMeshMaterialIdInfoMap mGeometryMeshMaterialIdInfoMapMap; + + /** The error handler to pass the errors to.*/ + IErrorHandler* mErrorHandler; public: /** Constructor. */ - Loader(); + Loader(IErrorHandler* errorHandler = 0); /** Destructor. */ virtual ~Loader(); @@ -76,6 +91,11 @@ @return The elements COLLADAFW::UniqueId */ COLLADAFW::UniqueId getUniqueId(COLLADAFW::ClassId classId); + /** Returns the GeometryMaterialIdInfo object of the geometry with @a uniqueId. If this method has + not been called before with the same uniqueId, an empty GeometryMaterialIdInfo is created, added to + the map and returned.*/ + GeometryMaterialIdInfo& getMeshMaterialIdInfo( const COLLADAFW::UniqueId& uniqueId); + /** Returns the writer the data will be written to.*/ COLLADAFW::IWriter* writer(){ return mWriter; } Modified: branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLMeshLoader.h =================================================================== --- branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLMeshLoader.h 2009-02-03 15:32:48 UTC (rev 336) +++ branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLMeshLoader.h 2009-02-03 17:19:26 UTC (rev 337) @@ -52,11 +52,17 @@ private: + /** The unique id of the mesh.*/ + COLLADAFW::UniqueId mMeshUniqueId; + /** * The framework mesh element, to load the data. */ COLLADAFW::Mesh* mMesh; + /** The mapping of collada symbols to material ids.*/ +// GeometryMaterialIdInfo& mMaterialIdInfo; + /** The mesh primitive being filled by the parser.*/ COLLADAFW::MeshPrimitive* mCurrentMeshPrimitive; Added: branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLSaxParserError.h =================================================================== --- branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLSaxParserError.h (rev 0) +++ branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLSaxParserError.h 2009-02-03 17:19:26 UTC (rev 337) @@ -0,0 +1,58 @@ +/* + Copyright (c) 2008 NetAllied Systems GmbH + + This file is part of COLLADASaxFrameworkLoader. + + Licensed under the MIT Open Source License, + for details please see LICENSE file or the website + http://www.opensource.org/licenses/mit-license.php +*/ + +#ifndef __COLLADASAXFWL_SAXPARSERERROR_H__ +#define __COLLADASAXFWL_SAXPARSERERROR_H__ + +#include "COLLADASaxFWLPrerequisites.h" +#include "COLLADASaxFWLIError.h" + +namespace GeneratedSaxParser +{ + class ParserError; +} + + +namespace COLLADASaxFWL +{ + + /** Error reported by the generated sax parser. These are mainly validation errors. */ + class SaxParserError : public IError + { + private: + const GeneratedSaxParser::ParserError& mError; + + public: + + /** Constructor. */ + SaxParserError( const GeneratedSaxParser::ParserError& error); + + /** Destructor. */ + virtual ~SaxParserError(); + + /** Returns the type of the error.*/ + ErrorType getErrorType() const { return IError::ERROR_SAXPARSER; } + + /** Returns the severity of the error.*/ + Severity getSeverity() const; + + private: + + /** Disable default copy ctor. */ + SaxParserError( const SaxParserError& pre ); + + /** Disable default assignment operator. */ + const SaxParserError& operator= ( const SaxParserError& pre ); + + }; + +} // namespace COLLADASAXFWL + +#endif // __COLLADASAXFWL_SAXPARSERERROR_H__ Added: branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLSaxParserErrorHandler.h =================================================================== --- branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLSaxParserErrorHandler.h (rev 0) +++ branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLSaxParserErrorHandler.h 2009-02-03 17:19:26 UTC (rev 337) @@ -0,0 +1,88 @@ +/* +Copyright (c) 2008 NetAllied Systems GmbH + +This file is part of COLLADASaxFrameworkLoader. + +Licensed under the MIT Open Source License, +for details please see LICENSE file or the website +http://www.opensource.org/licenses/mit-license.php +*/ + +#ifndef __COLLADASAXFWL_SAXPARSERERRORHANDLER_H__ +#define __COLLADASAXFWL_SAXPARSERERRORHANDLER_H__ + +#include "COLLADASaxFWLPrerequisites.h" +#include "GeneratedSaxParserIErrorHandler.h" + + +namespace GeneratedSaxParser +{ + class ParserError; +} + +namespace COLLADASaxFWL +{ + class IErrorHandler; + + /** TODO Documentation */ + class SaxParserErrorHandler : public GeneratedSaxParser::IErrorHandler + { + private: + + + private: + /** The error handler to pass the errors to.*/ + COLLADASaxFWL::IErrorHandler* mErrorHandler; + bool mHasErrors; + bool mHasCriticalError; + + public: + /** Constructor. */ + SaxParserErrorHandler(COLLADASaxFWL::IErrorHandler* mErrorHandler); + + /** Destructor. */ + virtual ~SaxParserErrorHandler(); + + /** Notification of a parser error + @param error The error object with specific information. + @returns If true is returned, the parse stops parsing immediately, if false is returned and + the severity of the error is not ERROR_CRITICAL, the parser will continue. + */ + bool handleError( const GeneratedSaxParser::ParserError& error ); + + /** Notification sent before starting the problem detection process. + Typically, this would tell a problem collector to clear previously recorded problems. + */ + void beginReporting(){} + + /** Notification sent after having completed problem detection process. + Typically, this would tell a problem collector that no more problems should be expected in this + iteration. + */ + void endReporting(){} + + /** Signals that one or more errors have been accepted. + @return boolean - <code>true</code> if errors have been accepted, otherwise <code>false</code> + */ + bool hasErrors() const { return mHasErrors; }; + + /** Signals that a has been accepted. + @return boolean - <code>true</code> if a critical error has been accepted, otherwise <code>false</code> + */ + bool hasCriticalError() const { return mHasCriticalError; }; + + + + private: + + /** Disable default copy ctor. */ + SaxParserErrorHandler( const SaxParserErrorHandler& pre ); + + /** Disable default assignment operator. */ + const SaxParserErrorHandler& operator= ( const SaxParserErrorHandler& pre ); + + }; + +} // namespace COLLADASAXFWL + +#endif // __COLLADASAXFWL_SAXPARSERERRORHANDLER_H__ Modified: branches/nextgen/COLLADASaxFrameworkLoader/scripts/COLLADASaxFrameworkLoader.vcproj =================================================================== --- branches/nextgen/COLLADASaxFrameworkLoader/scripts/COLLADASaxFrameworkLoader.vcproj 2009-02-03 15:32:48 UTC (rev 336) +++ branches/nextgen/COLLADASaxFrameworkLoader/scripts/COLLADASaxFrameworkLoader.vcproj 2009-02-03 17:19:26 UTC (rev 337) @@ -324,6 +324,18 @@ > </File> <File + RelativePath="..\src\COLLADASaxFWLGeometryMaterialIdInfo.cpp" + > + </File> + <File + RelativePath="..\src\COLLADASaxFWLIError.cpp" + > + </File> + <File + RelativePath="..\src\COLLADASaxFWLIErrorHandler.cpp" + > + </File> + <File RelativePath="..\src\COLLADASaxFWLIFilePartLoader.cpp" > </File> @@ -352,6 +364,14 @@ > </File> <File + RelativePath="..\src\COLLADASaxFWLSaxParserError.cpp" + > + </File> + <File + RelativePath="..\src\COLLADASaxFWLSaxParserErrorHandler.cpp" + > + </File> + <File RelativePath="..\src\COLLADASaxFWLSourceArrayLoader.cpp" > </File> @@ -406,6 +426,18 @@ > </File> <File + RelativePath="..\include\COLLADASaxFWLGeometryMaterialIdInfo.h" + > + </File> + <File + RelativePath="..\include\COLLADASaxFWLIError.h" + > + </File> + <File + RelativePath="..\include\COLLADASaxFWLIErrorHandler.h" + > + </File> + <File RelativePath="..\include\COLLADASaxFWLIFilePartLoader.h" > </File> @@ -454,6 +486,14 @@ > </File> <File + RelativePath="..\include\COLLADASaxFWLSaxParserError.h" + > + </File> + <File + RelativePath="..\include\COLLADASaxFWLSaxParserErrorHandler.h" + > + </File> + <File RelativePath="..\include\COLLADASaxFWLSource.h" > </File> Modified: branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLFileLoader.cpp =================================================================== --- branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLFileLoader.cpp 2009-02-03 15:32:48 UTC (rev 336) +++ branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLFileLoader.cpp 2009-02-03 17:19:26 UTC (rev 337) @@ -16,6 +16,7 @@ #include "COLLADASaxFWLLibraryNodesLoader.h" #include "COLLADASaxFWLMeshLoader.h" #include "COLLADASaxFWLGeometryLoader.h" +#include "COLLADASaxFWLSaxParserErrorHandler.h" #include "COLLADAFWObject.h" @@ -26,8 +27,8 @@ { //----------------------------- - FileLoader::FileLoader ( Loader* colladaLoader, const COLLADABU::URI& fileURI) - : ColladaParserAutoGenPrivate(0), + FileLoader::FileLoader ( Loader* colladaLoader, const COLLADABU::URI& fileURI, SaxParserErrorHandler* saxParserErrorHandler) + : ColladaParserAutoGenPrivate(0, saxParserErrorHandler), mColladaLoader(colladaLoader), mFileURI(fileURI), mLibxmlSaxParse(this) @@ -51,7 +52,7 @@ //----------------------------- bool FileLoader::begin__COLLADA__asset () { - deleteFilePartLoader(); + deleteFilePartLoader(); AssetLoader* assetLoader = new AssetLoader(this); setPartLoader(assetLoader); setParser(assetLoader); Modified: branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLGeometryLoader.cpp =================================================================== --- branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLGeometryLoader.cpp 2009-02-03 15:32:48 UTC (rev 336) +++ branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLGeometryLoader.cpp 2009-02-03 17:19:26 UTC (rev 337) @@ -28,7 +28,7 @@ //------------------------------ bool GeometryLoader::begin__mesh() { - MeshLoader* meshLoader = new MeshLoader(this, mGeometryId, mGeometryId); + MeshLoader* meshLoader = new MeshLoader(this, mGeometryId, mGeometryName); setPartLoader(meshLoader); setParser(meshLoader); return true; Added: branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLGeometryMaterialIdInfo.cpp =================================================================== --- branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLGeometryMaterialIdInfo.cpp (rev 0) +++ branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLGeometryMaterialIdInfo.cpp 2009-02-03 17:19:26 UTC (rev 337) @@ -0,0 +1,45 @@ +/* + Copyright (c) 2008 NetAllied Systems GmbH + + This file is part of COLLADASaxFrameworkLoader. + + Licensed under the MIT Open Source License, + for details please see LICENSE file or the website + http://www.opensource.org/licenses/mit-license.php +*/ + +#include "COLLADASaxFWLStableHeaders.h" +#include "COLLADASaxFWLGeometryMaterialIdInfo.h" + + +namespace COLLADASaxFWL +{ + + //--------------------------------- + GeometryMaterialIdInfo::GeometryMaterialIdInfo() + : mHighestMaterialId(0) + , mColladaSymbolMaterialIdMap() + { + } + + //--------------------------------- + COLLADAFW::MaterialId GeometryMaterialIdInfo::getMaterialId( const String& symbol ) + { + if ( symbol.empty() ) + return 0; + + ColladaSymbolMaterialIdMap::const_iterator it = mColladaSymbolMaterialIdMap.find(symbol); + if ( it == mColladaSymbolMaterialIdMap.end()) + { + mHighestMaterialId++; + mColladaSymbolMaterialIdMap[symbol] = mHighestMaterialId; + return mHighestMaterialId; + } + else + { + return it->second; + } + + } + +} // namespace COLLADASaxFWL Added: branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLIError.cpp =================================================================== --- branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLIError.cpp (rev 0) +++ branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLIError.cpp 2009-02-03 17:19:26 UTC (rev 337) @@ -0,0 +1,23 @@ +/* + Copyright (c) 2008 NetAllied Systems GmbH + + This file is part of COLLADASaxFrameworkLoader. + + Licensed under the MIT Open Source License, + for details please see LICENSE file or the website + http://www.opensource.org/licenses/mit-license.php +*/ + +#include "COLLADASaxFWLStableHeaders.h" +#include "COLLADASaxFWLIError.h" + + +namespace COLLADASaxFWL +{ + + //------------------------------ + IError::~IError() + { + } + +} // namespace COLLADASaxFWL Added: branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLIErrorHandler.cpp =================================================================== --- branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLIErrorHandler.cpp (rev 0) +++ branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLIErrorHandler.cpp 2009-02-03 17:19:26 UTC (rev 337) @@ -0,0 +1,28 @@ +/* + Copyright (c) 2008 NetAllied Systems GmbH + + This file is part of COLLADASaxFrameworkLoader. + + Licensed under the MIT Open Source License, + for details please see LICENSE file or the website + http://www.opensource.org/licenses/mit-license.php +*/ + +#include "COLLADASaxFWLStableHeaders.h" +#include "COLLADASaxFWLIErrorHandler.h" + + +namespace COLLADASaxFWL +{ + + //------------------------------ + IErrorHandler::IErrorHandler() + { + } + + //------------------------------ + IErrorHandler::~IErrorHandler() + { + } + +} // namespace COLLADASaxFWL Modified: branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLLoader.cpp =================================================================== --- branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLLoader.cpp 2009-02-03 15:32:48 UTC (rev 336) +++ branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLLoader.cpp 2009-02-03 17:19:26 UTC (rev 337) @@ -11,6 +11,7 @@ #include "COLLADASaxFWLStableHeaders.h" #include "COLLADASaxFWLLoader.h" #include "COLLADASaxFWLFileLoader.h" +#include "COLLADASaxFWLSaxParserErrorHandler.h" #include "COLLADABUURI.h" @@ -23,12 +24,13 @@ namespace COLLADASaxFWL { - //--------------------------------- - Loader::Loader() + + Loader::Loader( IErrorHandler* errorHandler ) + : mErrorHandler(errorHandler) { } - //--------------------------------- + //--------------------------------- Loader::~Loader() { } @@ -62,13 +64,16 @@ if ( !writer ) return false; mWriter = writer; + + SaxParserErrorHandler saxParserErrorHandler(mErrorHandler); + #pragma warning(disable: 4996) _timeb startTimeBuffer; _ftime( &startTimeBuffer ); double startTime = (double)startTimeBuffer.time + (double)startTimeBuffer.millitm / 1000; - FileLoader fileLoader(this, COLLADABU::URI::URI(COLLADABU::URI::nativePathToUri(fileName))); + FileLoader fileLoader(this, COLLADABU::URI::URI(COLLADABU::URI::nativePathToUri(fileName)), &saxParserErrorHandler); fileLoader.load(); _timeb endTimeBuffer; @@ -84,4 +89,10 @@ return true; } + //--------------------------------- + GeometryMaterialIdInfo& Loader::getMeshMaterialIdInfo( const COLLADAFW::UniqueId& uniqueId ) + { + return mGeometryMeshMaterialIdInfoMapMap[uniqueId]; + } + } // namespace COLLADA Modified: branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLMeshLoader.cpp =================================================================== --- branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLMeshLoader.cpp 2009-02-03 15:32:48 UTC (rev 336) +++ branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLMeshLoader.cpp 2009-02-03 17:19:26 UTC (rev 337) @@ -26,7 +26,9 @@ MeshLoader::MeshLoader( IFilePartLoader* callingFilePartLoader, const String& geometryId, const String& geometryName ) : SourceArrayLoader (callingFilePartLoader ) - , mMesh ( new COLLADAFW::Mesh(getUniqueId('#' + geometryId, COLLADAFW::Geometry::ID()).getObjectId()) ) + , mMeshUniqueId(getUniqueId('#' + geometryId, COLLADAFW::Geometry::ID())) + , mMesh ( new COLLADAFW::Mesh(mMeshUniqueId.getObjectId()) ) +// , mMaterialIdInfo(get) , mCurrentMeshPrimitive(0) , mCurrentVertexInput(0) , mMeshPrimitiveInputs(mVerticesInputs) Added: branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLSaxParserError.cpp =================================================================== --- branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLSaxParserError.cpp (rev 0) +++ branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLSaxParserError.cpp 2009-02-03 17:19:26 UTC (rev 337) @@ -0,0 +1,36 @@ +/* + Copyright (c) 2008 NetAllied Systems GmbH + + This file is part of COLLADASaxFrameworkLoader. + + Licensed under the MIT Open Source License, + for details please see LICENSE file or the website + http://www.opensource.org/licenses/mit-license.php +*/ + +#include "COLLADASaxFWLStableHeaders.h" +#include "COLLADASaxFWLSaxParserError.h" + +#include "GeneratedSaxParserParserError.h" + + +namespace COLLADASaxFWL +{ + + + SaxParserError::SaxParserError( const GeneratedSaxParser::ParserError& error ) + : mError(error) + { + } + + //------------------------------ + SaxParserError::~SaxParserError() + { + } + + IError::Severity SaxParserError::getSeverity() const + { + bool isCritical = mError.getSeverity()== GeneratedSaxParser::ParserError::SEVERITY_CRITICAL; + return isCritical ? IError::SEVERITY_CRITICAL : IError::SEVERITY_ERROR; + } +} // namespace COLLADASaxFWL Added: branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLSaxParserErrorHandler.cpp =================================================================== --- branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLSaxParserErrorHandler.cpp (rev 0) +++ branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLSaxParserErrorHandler.cpp 2009-02-03 17:19:26 UTC (rev 337) @@ -0,0 +1,41 @@ +/* + Copyright (c) 2008 NetAllied Systems GmbH + + This file is part of COLLADASaxFrameworkLoader. + + Licensed under the MIT Open Source License, + for details please see LICENSE file or the website + http://www.opensource.org/licenses/mit-license.php +*/ + +#include "COLLADASaxFWLStableHeaders.h" +#include "COLLADASaxFWLSaxParserErrorHandler.h" +#include "COLLADASaxFWLSaxParserError.h" + +#include "COLLADASaxFWLIErrorHandler.h" + + +namespace COLLADASaxFWL +{ + + + SaxParserErrorHandler::SaxParserErrorHandler( COLLADASaxFWL::IErrorHandler* errorHandler ) + : mErrorHandler(errorHandler) + { + } + + //------------------------------ + SaxParserErrorHandler::~SaxParserErrorHandler() + { + } + + bool SaxParserErrorHandler::handleError( const GeneratedSaxParser::ParserError& error ) + { + SaxParserError saxParserError(error); + + if ( mErrorHandler) + return mErrorHandler->handleError(&saxParserError); + else + return false; + } +} // namespace COLLADASaxFWL Modified: branches/nextgen/COLLADAStreamWriter/scripts/COLLADAStreamWriter.vcproj =================================================================== --- branches/nextgen/COLLADAStreamWriter/scripts/COLLADAStreamWriter.vcproj 2009-02-03 15:32:48 UTC (rev 336) +++ branches/nextgen/COLLADAStreamWriter/scripts/COLLADAStreamWriter.vcproj 2009-02-03 17:19:26 UTC (rev 337) @@ -761,14 +761,6 @@ RelativePath="..\src\COLLADASWVertices.cpp" > </File> - <Filter - Name="UTF" - > - <File - RelativePath="..\..\Externals\UTF\src\ConvertUTF.c" - > - </File> - </Filter> </Filter> <Filter Name="Header Files" @@ -1019,14 +1011,6 @@ RelativePath="..\include\COLLADASWVertices.h" > </File> - <Filter - Name="UTF" - > - <File - RelativePath="..\..\Externals\UTF\include\ConvertUTF.h" - > - </File> - </Filter> </Filter> </Files> <Globals> Modified: branches/nextgen/GeneratedSaxParser/include/GeneratedSaxParserLibxmlSaxParser.h =================================================================== --- branches/nextgen/GeneratedSaxParser/include/GeneratedSaxParserLibxmlSaxParser.h 2009-02-03 15:32:48 UTC (rev 336) +++ branches/nextgen/GeneratedSaxParser/include/GeneratedSaxParserLibxmlSaxParser.h 2009-02-03 17:19:26 UTC (rev 337) @@ -48,6 +48,8 @@ static void characters( void* user_data, const xmlChar* name, int length ); + static void errorFunction (void *ctx, const char *msg, ...); + void initializeParserContext(); void abortParsing(); Modified: branches/nextgen/GeneratedSaxParser/include/GeneratedSaxParserParser.h =================================================================== --- branches/nextgen/GeneratedSaxParser/include/GeneratedSaxParserParser.h 2009-02-03 15:32:48 UTC (rev 336) +++ branches/nextgen/GeneratedSaxParser/include/GeneratedSaxParserParser.h 2009-02-03 17:19:26 UTC (rev 337) @@ -18,13 +18,16 @@ { class SaxParser; + class IErrorHandler; class Parser { private: SaxParser* mSaxParser; + IErrorHandler* mErrorHandler; + public: - Parser(); + Parser(IErrorHandler* errorHandler); virtual ~Parser(); virtual bool elementBegin(const ParserChar* elementName, const ParserAttributes& attributes )=0; @@ -33,10 +36,14 @@ virtual bool textData(const ParserChar* text, size_t textLength)=0; + IErrorHandler* getErrorHandler() { return mErrorHandler; } + + protected: size_t getLineNumber()const; size_t getColumnNumber()const; + private: /** Disable default copy ctor. */ Parser( const Parser& pre ); Modified: branches/nextgen/GeneratedSaxParser/include/GeneratedSaxParserParserError.h =================================================================== --- branches/nextgen/GeneratedSaxParser/include/GeneratedSaxParserParserError.h 2009-02-03 15:32:48 UTC (rev 336) +++ branches/nextgen/GeneratedSaxParser/include/GeneratedSaxParserParserError.h 2009-02-03 17:19:26 UTC (rev 337) @@ -29,6 +29,8 @@ enum ErrorType { + ERROR_COULD_NOT_OPEN_FILE, + ERROR_XML_PERSER_ERROR, ERROR_UNKNOWN_ELEMENT, ERROR_UNEXPECTED_ELEMENT, ERROR_ELEMENT_MUST_BE_ROOT, Modified: branches/nextgen/GeneratedSaxParser/include/GeneratedSaxParserParserTemplateBase.h =================================================================== --- branches/nextgen/GeneratedSaxParser/include/GeneratedSaxParserParserTemplateBase.h 2009-02-03 15:32:48 UTC (rev 336) +++ branches/nextgen/GeneratedSaxParser/include/GeneratedSaxParserParserTemplateBase.h 2009-02-03 17:19:26 UTC (rev 337) @@ -71,14 +71,12 @@ ElementNameMap mHashNameMap; - private: - IErrorHandler* mErrorHandler; public: ParserTemplateBase(IErrorHandler* errorHandler) - : mStackMemoryManager(STACKSIZE), - mLastIncompleteFragmentInCharacterData(0), - mErrorHandler(errorHandler){} + : Parser(errorHandler), + mStackMemoryManager(STACKSIZE), + mLastIncompleteFragmentInCharacterData(0){} virtual ~ParserTemplateBase(){}; /** Returns the element or attribute name that corresponds to @a hash. Null is returned, Modified: branches/nextgen/GeneratedSaxParser/src/GeneratedSaxParserLibxmlSaxParser.cpp =================================================================== --- branches/nextgen/GeneratedSaxParser/src/GeneratedSaxParserLibxmlSaxParser.cpp 2009-02-03 15:32:48 UTC (rev 336) +++ branches/nextgen/GeneratedSaxParser/src/GeneratedSaxParserLibxmlSaxParser.cpp 2009-02-03 17:19:26 UTC (rev 337) @@ -10,6 +10,7 @@ #include "GeneratedSaxParserLibxmlSaxParser.h" #include "GeneratedSaxParserParser.h" +#include "GeneratedSaxParserIErrorHandler.h" #include <libxml/parserInternals.h> // for xmlCreateFileParserCtxt @@ -41,8 +42,8 @@ 0, //processingInstructionSAXFunc processingInstruction; 0, //commentSAXFunc comment; 0, //warningSAXFunc warning; - 0, //errorSAXFunc error; - 0 //fatalErrorSAXFunc fatalError; + &LibxmlSaxParser::errorFunction, //errorSAXFunc error; + &LibxmlSaxParser::errorFunction //fatalErrorSAXFunc fatalError; }; @@ -66,7 +67,16 @@ mParserContext = xmlCreateFileParserCtxt(fileName); if ( !mParserContext ) + { + getParser()->getErrorHandler()->handleError(ParserError(ParserError::SEVERITY_CRITICAL, + ParserError::ERROR_COULD_NOT_OPEN_FILE, + 0, + 0, + 0, + 0, + fileName)); return false; + } xmlSAXHandlerPtr oldSaxContext = mParserContext->sax; mParserContext->sax = &SAXHANDLER; @@ -128,4 +138,16 @@ return (size_t)xmlSAX2GetColumnNumber(mParserContext); } + void LibxmlSaxParser::errorFunction( void *ctx, const char *msg, ... ) + { + xmlParserCtxtPtr context = (xmlParserCtxtPtr)ctx; + LibxmlSaxParser* thisObject = (LibxmlSaxParser*)(context->userData); + thisObject->getParser()->getErrorHandler()->handleError(ParserError(ParserError::SEVERITY_CRITICAL, + ParserError::ERROR_XML_PERSER_ERROR, + 0, + 0, + 0, + 0, + msg)); + } } // namespace GeneratedSaxParser Modified: branches/nextgen/GeneratedSaxParser/src/GeneratedSaxParserParser.cpp =================================================================== --- branches/nextgen/GeneratedSaxParser/src/GeneratedSaxParserParser.cpp 2009-02-03 15:32:48 UTC (rev 336) +++ branches/nextgen/GeneratedSaxParser/src/GeneratedSaxParserParser.cpp 2009-02-03 17:19:26 UTC (rev 337) @@ -19,8 +19,9 @@ //-------------------------------------------------------------------- - Parser::Parser() + Parser::Parser(IErrorHandler* errorHandler) :mSaxParser(0) + , mErrorHandler(errorHandler) { } Modified: branches/nextgen/GeneratedSaxParser/src/GeneratedSaxParserParserTemplateBase.cpp =================================================================== --- branches/nextgen/GeneratedSaxParser/src/GeneratedSaxParserParserTemplateBase.cpp 2009-02-03 15:32:48 UTC (rev 336) +++ branches/nextgen/GeneratedSaxParser/src/GeneratedSaxParserParserTemplateBase.cpp 2009-02-03 17:19:26 UTC (rev 337) @@ -144,10 +144,11 @@ StringHash attributeHash, const ParserChar* additionalText /*= ""*/ ) { - if ( !mErrorHandler ) + IErrorHandler* errorHandler = getErrorHandler(); + if ( !errorHandler ) return (severity == ParserError::SEVERITY_CRITICAL) ? true : false; - bool handlerWantsToAbort = mErrorHandler->handleError(ParserError(severity, + bool handlerWantsToAbort = errorHandler->handleError(ParserError(severity, errorType, getNameByStringHash(elementHash), getNameByStringHash(attributeHash), This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jud...@us...> - 2009-02-03 15:32:59
|
Revision: 336 http://colladamaya.svn.sourceforge.net/colladamaya/?rev=336&view=rev Author: judithschenk Date: 2009-02-03 15:32:48 +0000 (Tue, 03 Feb 2009) Log Message: ----------- multiple color sets (framework and maya plug-in implementation) Modified Paths: -------------- branches/nextgen/COLLADAFramework/include/COLLADAFWIndexList.h branches/nextgen/COLLADAFramework/include/COLLADAFWMesh.h branches/nextgen/COLLADAFramework/include/COLLADAFWMeshPrimitive.h branches/nextgen/COLLADAFramework/scripts/COLLADAFramework.vcproj branches/nextgen/COLLADAFramework/src/COLLADAFWMesh.cpp branches/nextgen/COLLADAFramework/src/COLLADAFWMeshPrimitive.cpp branches/nextgen/COLLADAMaya/include/COLLADAMayaGeometryImporter.h branches/nextgen/COLLADAMaya/src/COLLADAMayaGeometryImporter.cpp branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLMeshLoader.h branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLMeshPrimitiveInputList.h branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLMeshLoader.cpp branches/nextgen/Externals/MayaDataModel/include/MayaDMControlPoint.h Added Paths: ----------- branches/nextgen/COLLADAFramework/include/COLLADAFWMeshVertexData.h Removed Paths: ------------- branches/nextgen/COLLADAFramework/include/COLLADAFWMeshColors.h branches/nextgen/COLLADAFramework/include/COLLADAFWMeshFDInputs.h branches/nextgen/COLLADAFramework/include/COLLADAFWMeshNormals.h branches/nextgen/COLLADAFramework/include/COLLADAFWMeshPositions.h branches/nextgen/COLLADAFramework/include/COLLADAFWMeshUVCoords.h Modified: branches/nextgen/COLLADAFramework/include/COLLADAFWIndexList.h =================================================================== --- branches/nextgen/COLLADAFramework/include/COLLADAFWIndexList.h 2009-02-03 10:09:27 UTC (rev 335) +++ branches/nextgen/COLLADAFramework/include/COLLADAFWIndexList.h 2009-02-03 15:32:48 UTC (rev 336) @@ -21,43 +21,43 @@ class IndexList { private: - size_t mInputSetIndex; - String mInputSetName; - UIntValuesArray mUVCoordIndices; + String mName; + UIntValuesArray mIndices; size_t mStride; + size_t mSetIndex; size_t mInitialIndex; public: IndexList () - : mInputSetIndex (0) - , mInputSetName ("") - , mUVCoordIndices (0) + : mSetIndex (0) + , mName ("") + , mIndices (0) , mStride (0) , mInitialIndex (0) {} - IndexList ( size_t inputSet, size_t stride, UIntValuesArray& uvCoordIndices ) - : mInputSetIndex (inputSet) - , mInputSetName ("") - , mUVCoordIndices (uvCoordIndices) + IndexList ( size_t setIndex, size_t stride, UIntValuesArray& indices ) + : mSetIndex (setIndex) + , mName ("") + , mIndices (indices) , mStride (stride) , mInitialIndex (0) {} virtual ~IndexList () {} - UIntValuesArray& getIndices () { return mUVCoordIndices; } - unsigned int getIndex ( size_t index ) const { return mUVCoordIndices [index]; } - unsigned int getIndex ( size_t index ) { return mUVCoordIndices [index]; } - size_t getIndicesCount () const { return mUVCoordIndices.getCount (); } - size_t getIndicesCount () { return mUVCoordIndices.getCount (); } + UIntValuesArray& getIndices () { return mIndices; } + unsigned int getIndex ( size_t index ) const { return mIndices [index]; } + unsigned int getIndex ( size_t index ) { return mIndices [index]; } + size_t getIndicesCount () const { return mIndices.getCount (); } + size_t getIndicesCount () { return mIndices.getCount (); } - void setInputSetIndex ( size_t inputSet ) { mInputSetIndex = inputSet; } - size_t getInputSetIndex () { return mInputSetIndex; } + void setSetIndex ( size_t inputSet ) { mSetIndex = inputSet; } + size_t getSetIndex () { return mSetIndex; } void setStride ( size_t stride ) { mStride = stride; } size_t getStride () { return mStride; } - const COLLADAFW::String& getInputSetName () const { return mInputSetName; } - void setInputSetName ( const COLLADAFW::String& val ) { mInputSetName = val; } + const COLLADAFW::String& getName () const { return mName; } + void setName ( const COLLADAFW::String& val ) { mName = val; } const size_t getInitialIndex () const { return mInitialIndex; } void setInitialIndex ( const size_t val ) { mInitialIndex = val; } Modified: branches/nextgen/COLLADAFramework/include/COLLADAFWMesh.h =================================================================== --- branches/nextgen/COLLADAFramework/include/COLLADAFWMesh.h 2009-02-03 10:09:27 UTC (rev 335) +++ branches/nextgen/COLLADAFramework/include/COLLADAFWMesh.h 2009-02-03 15:32:48 UTC (rev 336) @@ -13,10 +13,7 @@ #include "COLLADAFWPrerequisites.h" #include "COLLADAFWGeometry.h" -#include "COLLADAFWMeshPositions.h" -#include "COLLADAFWMeshNormals.h" -#include "COLLADAFWMeshColors.h" -#include "COLLADAFWMeshUVCoords.h" +#include "COLLADAFWMeshVertexData.h" #include "COLLADAFWMeshPrimitive.h" #include "COLLADABUUtils.h" @@ -47,34 +44,32 @@ private: /** - * The positions array. - * Positions can be stored as float or double values. + * The positions array. Positions can be stored as float or double values. * Positions have always a stride of three (XYZ parameters). We don't need to store * this information. */ - MeshPositions mPositions; + MeshVertexData mPositions; /** - * The normals array. - * Normals can be stored as float or double values. + * The normals array. Normals can be stored as float or double values. * Normals have always a stride of three (XYZ parameters). We don't need to store this * information. */ - MeshNormals mNormals; + MeshVertexData mNormals; /** - * The colors array. - * Colors can be stored as float or double values. - * Colors can have different strides (RGB or RGBA parameters). We need to store this - * information! + * The colors array. Colors can be stored as float or double values. + * Colors can have different strides (RGB or RGBA parameters). We have to store this + * information. */ - MeshColors mColors; + MeshVertexData mColors; /** - * The 2 dimensional uv coordinates array. - * UV coordinates can be stored as float or double values. + * The uv coordinates array. UV coordinates can be stored as float or double values. + * UV corrdinates can have different strides (2d, 3d, 4d). We have to store this + * information. */ - MeshUVCoords mUVCoords; + MeshVertexData mUVCoords; /** * Geometric primitives, which assemble values from the inputs into vertex attribute data. @@ -98,7 +93,7 @@ * Positions have always a stride of three (X, Y and Z parameter). So we don't need to * store this information. */ - const MeshPositions& getPositions () const { return mPositions; } + const MeshVertexData& getPositions () const { return mPositions; } /** * The positions array. @@ -106,7 +101,7 @@ * Positions have always a stride of three (X, Y and Z parameter). So we don't need to * store this information. */ - MeshPositions& getPositions () { return mPositions; } + MeshVertexData& getPositions () { return mPositions; } /** * The positions array. @@ -114,7 +109,7 @@ * Positions have always a stride of three (X, Y and Z parameter). So we don't need to * store this information. */ - void setPositions ( MeshPositions& positions ) { mPositions = positions; } + void setPositions ( MeshVertexData& positions ) { mPositions = positions; } /** * The normals array. @@ -122,7 +117,7 @@ * Normals have always a stride of three (X, Y and Z parameter). We don't need to store * this information. */ - const MeshNormals& getNormals () const { return mNormals; } + const MeshVertexData& getNormals () const { return mNormals; } /** * The normals array. @@ -130,7 +125,7 @@ * Normals have always a stride of three (X, Y and Z parameter). We don't need to store * this information. */ - MeshNormals& getNormals () { return mNormals; } + MeshVertexData& getNormals () { return mNormals; } /** * The normals array. @@ -138,7 +133,7 @@ * Normals have always a stride of three (X, Y and Z parameter). We don't need to store * this information. */ - void setNormals ( MeshNormals& Normals ) { mNormals = Normals; } + void setNormals ( MeshVertexData& Normals ) { mNormals = Normals; } /** * Checks, if the mesh has normals. @@ -157,7 +152,7 @@ * Colors have always a stride of three (X, Y and Z parameter). We don't need to store * this information. */ - const MeshColors& getColors () const { return mColors; } + const MeshVertexData& getColors () const { return mColors; } /** * The colors array. @@ -165,36 +160,53 @@ * Colors have always a stride of three (X, Y and Z parameter). We don't need to store * this information. */ - MeshColors& getColors () { return mColors; } + MeshVertexData& getColors () { return mColors; } + /** + * Returns the color with the name. + */ + size_t getColorIndexByName ( const String& name ) const + { + String currentName; + for ( size_t index=0; index<mColors.getValuesCount (); ++index ) + { + if ( COLLADABU::Utils::equals ( name, mColors.getName ( index ) ) ) + return index; + } + std::cerr << "No color with name \"" << name << "\"!" << std::endl; + assert ( COLLADABU::Utils::equals ( name, name ) ); + + return 0; + } + /** * The colors array. * Colors can be stored as float or double values. * Colors have always a stride of three (X, Y and Z parameter). We don't need to store * this information. */ - void setColors ( MeshColors& Colors ) { mColors = Colors; } + void setColors ( MeshVertexData& Colors ) { mColors = Colors; } /** * The 2 dimensional uv coordinates array. * UV coordinates can be stored as float or double values. */ - const MeshUVCoords& getUVCoords () const { return mUVCoords; } + const MeshVertexData& getUVCoords () const { return mUVCoords; } /** * The 2 dimensional uv coordinates array. * UV coordinates can be stored as float or double values. */ - MeshUVCoords& getUVCoords () { return mUVCoords; } + MeshVertexData& getUVCoords () { return mUVCoords; } /** * Returns the uv set with the name. */ size_t getUVSetIndexByName ( const String& name ) const { - for ( size_t index=0; index<mUVCoords.getUVCoordsCount (); ++index ) + for ( size_t index=0; index<mUVCoords.getValuesCount (); ++index ) { - if ( COLLADABU::Utils::equals ( name, mUVCoords.getUVSetName ( index ) ) ) + if ( COLLADABU::Utils::equals ( name, mUVCoords.getName ( index ) ) ) return index; } std::cerr << "No uv set with name \"" << name << "\"!" << std::endl; Deleted: branches/nextgen/COLLADAFramework/include/COLLADAFWMeshColors.h =================================================================== --- branches/nextgen/COLLADAFramework/include/COLLADAFWMeshColors.h 2009-02-03 10:09:27 UTC (rev 335) +++ branches/nextgen/COLLADAFramework/include/COLLADAFWMeshColors.h 2009-02-03 15:32:48 UTC (rev 336) @@ -1,95 +0,0 @@ -/* - Copyright (c) 2008 NetAllied Systems GmbH - - This file is part of COLLADAFramework. - - Licensed under the MIT Open Source License, - for details please see LICENSE file or the website - http://www.opensource.org/licenses/mit-license.php -*/ - -#ifndef __COLLADAFW_MESHCOLORS_H__ -#define __COLLADAFW_MESHCOLORS_H__ - -#include "COLLADAFWPrerequisites.h" - - -namespace COLLADAFW -{ - - /** TODO Documentation */ - class MeshColors : public MeshFloatDoubleInputs - { - private: - - /** - * The number of values that are to be considered a unit during each access to the array. - * The default is 1, indicating that a single value is accessed. Optional. - */ - unsigned long long mStride; - - public: - - /** Constructor. */ - MeshColors () : MeshFloatDoubleInputs () {} - - /** Constructor. */ - MeshColors ( DataType type ) : MeshFloatDoubleInputs ( type ) {} - - /** Destructor. */ - virtual ~MeshColors() {} - - /** Returns the count of stored elements in the array. */ - const size_t getColorsCount () const - { - return getElementsCount (); - } - - /** - * The number of values that are to be considered a unit during each access to the array. - * The default is 1, indicating that a single value is accessed. Optional. - */ - unsigned long long getStride () const { return mStride; } - - /** - * The number of values that are to be considered a unit during each access to the array. - * The default is 1, indicating that a single value is accessed. Optional. - */ - void setStride ( unsigned long long Stride ) { mStride = Stride; } - - /** Returns the position values array as a template array. */ - template <class T> - ArrayPrimitiveType<T>* getColors () - { - return getValues (); - } - - /** Returns the position values array as a float array. */ - ArrayPrimitiveType<float>* getFloatColors () - { - return getFloatValues (); - } - - /** Returns the position values array as a double array. */ - ArrayPrimitiveType<double>* getDoubleColors () - { - return getDoubleValues (); - } - - /** Returns the position values array as a float array. */ - const ArrayPrimitiveType<float>* getFloatColors () const - { - return getFloatValues (); - } - - /** Returns the position values array as a double array. */ - const ArrayPrimitiveType<double>* getDoubleColors () const - { - return getDoubleValues (); - } - - }; - -} // namespace COLLADAFW - -#endif // __COLLADAFW_MESHCOLORS_H__ Deleted: branches/nextgen/COLLADAFramework/include/COLLADAFWMeshFDInputs.h =================================================================== --- branches/nextgen/COLLADAFramework/include/COLLADAFWMeshFDInputs.h 2009-02-03 10:09:27 UTC (rev 335) +++ branches/nextgen/COLLADAFramework/include/COLLADAFWMeshFDInputs.h 2009-02-03 15:32:48 UTC (rev 336) @@ -1,183 +0,0 @@ -/* - Copyright (c) 2008 NetAllied Systems GmbH - - This file is part of COLLADAFramework. - - Licensed under the MIT Open Source License, - for details please see LICENSE file or the website - http://www.opensource.org/licenses/mit-license.php -*/ - -#ifndef __COLLADAFW_MESHINPUTS_H__ -#define __COLLADAFW_MESHINPUTS_H__ - -#include "COLLADAFWPrerequisites.h" -#include "COLLADAFWArrayPrimitiveType.h" - - -namespace COLLADAFW -{ - - /** Base class for mesh input elements, like positions, normals, colors, texcoord, ... */ - class MeshFloatDoubleInputs - { - public: - - /** Positions can be stored as float or double values. */ - enum DataType - { - DATA_TYPE_FLOAT, - DATA_TYPE_DOUBLE, - DATA_TYPE_UNKNOWN - }; - - protected: - - /** The data type of the stored position values. */ - DataType mType; - - /** The position values. */ - FloatArray mValuesF; - DoubleArray mValuesD; - - public: - - /** Constructor. */ - MeshFloatDoubleInputs () - : mType ( DATA_TYPE_UNKNOWN ), - mValuesF(FloatArray::OWNER), - mValuesD(DoubleArray::OWNER) - {} - - /** Constructor. */ - MeshFloatDoubleInputs ( DataType type ) - : mType ( type ), - mValuesF(FloatArray::OWNER), - mValuesD(DoubleArray::OWNER) - {} - - /** Destructor. */ - virtual ~MeshFloatDoubleInputs() - { - } - - /** The data type of the stored position values. */ - const COLLADAFW::MeshFloatDoubleInputs::DataType getType () const { return mType; } - - /** The data type of the stored position values. */ - void setType ( const COLLADAFW::MeshFloatDoubleInputs::DataType Type ) { mType = Type; } - - /** Returns the count of stored elements in the array. */ - const size_t getElementsCount () const - { - if ( mType == DATA_TYPE_FLOAT ) return mValuesF.getCount (); - if ( mType == DATA_TYPE_DOUBLE ) return mValuesD.getCount (); - return 0; - } - - /** Returns the position values array as a template array. */ - template <class T> - ArrayPrimitiveType<T>& getValues () - { - if ( mType == DATA_TYPE_FLOAT ) return mValuesF; - if ( mType == DATA_TYPE_DOUBLE ) return mValuesD; - return 0; - } - - /** Returns the position values array as a float array. */ - const FloatArray* getFloatValues () const - { - if ( mType == DATA_TYPE_FLOAT ) - return ( ArrayPrimitiveType<float>* ) &mValuesF; - return 0; - } - - /** Returns the position values array as a double array. */ - const DoubleArray* getDoubleValues () const - { - if ( mType == DATA_TYPE_DOUBLE ) - return ( ArrayPrimitiveType<double>* ) &mValuesD; - return 0; - } - - /** Returns the position values array as a float array. */ - FloatArray* getFloatValues () - { - if ( mType == DATA_TYPE_FLOAT ) - return ( ArrayPrimitiveType<float>* ) &mValuesF; - return 0; - } - - /** Returns the position values array as a double array. */ - DoubleArray* getDoubleValues () - { - if ( mType == DATA_TYPE_DOUBLE ) - return ( ArrayPrimitiveType<double>* ) &mValuesD; - return 0; - } - -// /** Appends the values of the input array to the end of values array. -// The programmer must ensure, that the memory allocated, -// was large enough to hold another element. No new memory is allocated.*/ -// template <class Type> -// bool appendValues ( const ArrayPrimitiveType <Type>& valuesArray ) const -// { -// if ( mType == DATA_TYPE_DOUBLE ) -// { -// mValuesD->appendValues ( valuesArray ); -// return true; -// } -// else if ( mType == DATA_TYPE_FLOAT ) -// { -// mValuesF->appendValues ( valuesArray ); -// return true; -// } -// -// return false; -// } - - /** Set the C-style data array.*/ - void setData ( float* data, const size_t count ) - { - if ( mType == DATA_TYPE_FLOAT ) mValuesF.setData ( data, count ); - } - - /** Set the C-style data array.*/ - void setData ( double* data, const size_t count ) - { - if ( mType == DATA_TYPE_DOUBLE ) mValuesD.setData ( data, count ); - } - - /** Appends the values of the input array to the end of values array. - The programmer must ensure, that the memory allocated, - was large enough to hold another element. No new memory is allocated.*/ - bool appendValues ( const FloatArray& valuesArray ) - { - if ( mType == DATA_TYPE_FLOAT ) - { - mValuesF.appendValues ( valuesArray ); - return true; - } - - return false; - } - - /** Appends the values of the input array to the end of values array. - The programmer must ensure, that the memory allocated, - was large enough to hold another element. No new memory is allocated.*/ - bool appendValues ( const DoubleArray& valuesArray ) - { - if ( mType == DATA_TYPE_DOUBLE ) - { - mValuesD.appendValues ( valuesArray ); - return true; - } - - return false; - } - - }; - -} // namespace COLLADAFW - -#endif // __COLLADAFW_MESHINPUTS_H__ Deleted: branches/nextgen/COLLADAFramework/include/COLLADAFWMeshNormals.h =================================================================== --- branches/nextgen/COLLADAFramework/include/COLLADAFWMeshNormals.h 2009-02-03 10:09:27 UTC (rev 335) +++ branches/nextgen/COLLADAFramework/include/COLLADAFWMeshNormals.h 2009-02-03 15:32:48 UTC (rev 336) @@ -1,77 +0,0 @@ -/* - Copyright (c) 2008 NetAllied Systems GmbH - - This file is part of COLLADAFramework. - - Licensed under the MIT Open Source License, - for details please see LICENSE file or the website - http://www.opensource.org/licenses/mit-license.php -*/ - -#ifndef __COLLADAFW_NORMALINPUTS_H__ -#define __COLLADAFW_NORMALINPUTS_H__ - -#include "COLLADAFWPrerequisites.h" -#include "COLLADAFWMeshFDInputs.h" - - -namespace COLLADAFW -{ - - /** TODO Documentation */ - class MeshNormals : public MeshFloatDoubleInputs - { - private: - - public: - - /** Constructor. */ - MeshNormals () : MeshFloatDoubleInputs () {} - - /** Constructor. */ - MeshNormals ( DataType type ) : MeshFloatDoubleInputs ( type ) {} - - /** Destructor. */ - virtual ~MeshNormals() {} - - /** Returns the count of stored elements in the array. */ - const size_t getNormalsCount () const - { - return getElementsCount (); - } - - /** Returns the position values array as a template array. */ - template <class T> - ArrayPrimitiveType<T>* getNormals () - { - return getValues (); - } - - /** Returns the position values array as a float array. */ - ArrayPrimitiveType<float>* getFloatNormals () - { - return getFloatValues (); - } - - /** Returns the position values array as a double array. */ - ArrayPrimitiveType<double>* getDoubleNormals () - { - return getDoubleValues (); - } - - /** Returns the position values array as a float array. */ - const ArrayPrimitiveType<float>* getFloatNormals () const - { - return getFloatValues (); - } - - /** Returns the position values array as a double array. */ - const ArrayPrimitiveType<double>* getDoubleNormals () const - { - return getDoubleValues (); - } - }; - -} // namespace COLLADAFW - -#endif // __COLLADAFW_NORMALINPUTS_H__ Deleted: branches/nextgen/COLLADAFramework/include/COLLADAFWMeshPositions.h =================================================================== --- branches/nextgen/COLLADAFramework/include/COLLADAFWMeshPositions.h 2009-02-03 10:09:27 UTC (rev 335) +++ branches/nextgen/COLLADAFramework/include/COLLADAFWMeshPositions.h 2009-02-03 15:32:48 UTC (rev 336) @@ -1,84 +0,0 @@ -/* - Copyright (c) 2008 NetAllied Systems GmbH - - This file is part of COLLADAFramework. - - Licensed under the MIT Open Source License, - for details please see LICENSE file or the website - http://www.opensource.org/licenses/mit-license.php -*/ - -#ifndef __COLLADAFW_POSITIONS_H__ -#define __COLLADAFW_POSITIONS_H__ - -#include "COLLADAFWPrerequisites.h" -#include "COLLADAFWMeshFDInputs.h" - - -namespace COLLADAFW -{ - - /** - * The positions array. - * Positions can be stored as float or double values. - * Positions have always a stride of three (X, Y and Z parameter). So we don't need to - * store this information. - */ - class MeshPositions : public MeshFloatDoubleInputs - { - - private: - - public: - - /** Constructor. */ - MeshPositions () : MeshFloatDoubleInputs () {} - - /** Constructor. */ - MeshPositions ( DataType type ) : MeshFloatDoubleInputs ( type ) {} - - /** Destructor. */ - virtual ~MeshPositions() {} - - /** Returns the position values array as a template array. */ - template <class T> - ArrayPrimitiveType<T>* getPositions () - { - return getValues (); - } - - /** Returns the position values array as a float array. */ - const ArrayPrimitiveType<float>* getFloatPositions () const - { - return getFloatValues (); - } - - /** Returns the position values array as a double array. */ - const ArrayPrimitiveType<double>* getDoublePositions () const - { - return getDoubleValues (); - } - - /** Returns the position values array as a float array. */ - ArrayPrimitiveType<float>* getFloatPositions () - { - return getFloatValues (); - } - - /** Returns the position values array as a double array. */ - ArrayPrimitiveType<double>* getDoublePositions () - { - return getDoubleValues (); - } - - /** Returns the count of stored elements in the array. */ - const size_t getPositionsCount () const - { - return getElementsCount (); - } - - }; - -} // namespace COLLADAFW - -#endif // __COLLADAFW_POSITIONS_H__ Modified: branches/nextgen/COLLADAFramework/include/COLLADAFWMeshPrimitive.h =================================================================== --- branches/nextgen/COLLADAFramework/include/COLLADAFWMeshPrimitive.h 2009-02-03 10:09:27 UTC (rev 335) +++ branches/nextgen/COLLADAFramework/include/COLLADAFWMeshPrimitive.h 2009-02-03 15:32:48 UTC (rev 336) @@ -107,10 +107,10 @@ */ UIntValuesArray mNormalIndices; - /** TODO support multiple color sets - * The index list of the colors array. + /** + * The index list of the colors array (support of multiple colors). */ - UIntValuesArray mColorIndices; + IndexListArray mColorIndicesArray; /** * The index list of the uv coordinates array (support of multiple uv sets). @@ -199,14 +199,37 @@ /** * The index list of the colors array. */ - COLLADAFW::UIntValuesArray& getColorIndices () { return mColorIndices; } + IndexList* getColorIndices ( size_t index ) + { + assert ( mColorIndicesArray.getCount () > index ); + return mColorIndicesArray [ index ]; + } /** * The index list of the colors array. */ - void setColorIndices ( const COLLADAFW::UIntValuesArray& ColorIndices ) { mColorIndices = ColorIndices; } + const IndexList* getColorIndices ( size_t index ) const + { + assert ( mColorIndicesArray.getCount () > index ); + return mColorIndicesArray [ index ]; + } /** + * The index list of the colors array. + */ + IndexListArray& getColorIndicesArray () { return mColorIndicesArray; } + + /** + * The index list of the colors array. + */ + const IndexListArray& getColorIndicesArray () const { return mColorIndicesArray; } + + /** + * The index list of the colors array. + */ + void appendColorIndices ( IndexList* colorIndices ) { mColorIndicesArray.append ( colorIndices ); } + + /** * The index list of the uv coordinates array. */ IndexListArray& getUVCoordIndicesArray () { return mUVCoordIndicesArray; } @@ -221,6 +244,7 @@ */ IndexList* getUVCoordIndices ( size_t index ) { + assert ( mUVCoordIndicesArray.getCount () > index ); return mUVCoordIndicesArray [ index ]; } @@ -229,6 +253,7 @@ */ const IndexList* getUVCoordIndices ( size_t index ) const { + assert ( mUVCoordIndicesArray.getCount () > index ); return mUVCoordIndicesArray [ index ]; } Deleted: branches/nextgen/COLLADAFramework/include/COLLADAFWMeshUVCoords.h =================================================================== --- branches/nextgen/COLLADAFramework/include/COLLADAFWMeshUVCoords.h 2009-02-03 10:09:27 UTC (rev 335) +++ branches/nextgen/COLLADAFramework/include/COLLADAFWMeshUVCoords.h 2009-02-03 15:32:48 UTC (rev 336) @@ -1,163 +0,0 @@ -/* - Copyright (c) 2008 NetAllied Systems GmbH - - This file is part of COLLADAFramework. - - Licensed under the MIT Open Source License, - for details please see LICENSE file or the website - http://www.opensource.org/licenses/mit-license.php -*/ - -#ifndef __COLLADAFW_MESHUVCOORDS_H__ -#define __COLLADAFW_MESHUVCOORDS_H__ - -#include "COLLADAFWPrerequisites.h" -#include <assert.h> - - -namespace COLLADAFW -{ - - /** TODO Documentation */ - class MeshUVCoords : public MeshFloatDoubleInputs - { - public: - - struct UVSetInfo - { - String mName; - size_t mStride; - size_t mLength; - }; - - private: - - /** Array with the UVSetInfos. */ - ArrayPrimitiveType<UVSetInfo*> mUVSetInfos; - - public: - - /** Constructor. */ - MeshUVCoords () - : MeshFloatDoubleInputs () - , mUVSetInfos (0) - {} - - /** Constructor. */ - MeshUVCoords ( DataType type ) - : MeshFloatDoubleInputs ( type ) - , mUVSetInfos (0) - {} - - /** Destructor. */ - virtual ~MeshUVCoords() {} - - /** - * Returns the number of uv sets. - */ - size_t getNumUVSets () const { return mUVSetInfos.getCount (); } - - /** - * Appends the values in the array on the list of values and stores the information - * of the current input. - * @param const FloatArray& valuesArray The list of values. - * @param const String& name The name of the current element. - * @param const size_t stride The data stride. - */ - void appendUVSet ( const FloatArray& valuesArray, const String& name, const size_t stride ) - { - setType ( DATA_TYPE_FLOAT ); - appendValues ( valuesArray ); - - UVSetInfo* uvSetInfo = new UVSetInfo(); - uvSetInfo->mLength = valuesArray.getCount (); - uvSetInfo->mName = name; - uvSetInfo->mStride = stride; - - mUVSetInfos.append ( uvSetInfo ); - } - - /** - * Appends the values in the array on the list of values and stores the information - * of the current input. - * @param const FloatArray& valuesArray The list of values. - * @param const String& name The name of the current element. - * @param const size_t stride The data stride. - */ - void appendUVSet ( const DoubleArray& valuesArray, const String& name, const size_t stride ) - { - setType ( DATA_TYPE_DOUBLE ); - appendValues ( valuesArray ); - - UVSetInfo* uvSetInfo = new UVSetInfo(); - uvSetInfo->mLength = valuesArray.getCount (); - uvSetInfo->mName = name; - uvSetInfo->mStride = stride; - -// if ( mUVSetInfos.getCount() <= 0 ) mUVSetInfos.setData ( uvSetInfo, ); - mUVSetInfos.append ( uvSetInfo ); - } - - /** The stride at the specified index. */ - String getUVSetName ( size_t index ) const - { - assert ( index <= mUVSetInfos.getCount() ); - return mUVSetInfos[index]->mName; - } - - /** The stride at the specified index. */ - size_t getStride ( size_t index ) const - { - assert ( index <= mUVSetInfos.getCount() ); - return mUVSetInfos[index]->mStride; - } - - /** The stride can differ, so we have to set. */ - size_t getLength ( size_t index ) const - { - assert ( index <= mUVSetInfos.getCount() ); - return mUVSetInfos[index]->mLength; - } - - /** Returns the position values array as a template array. */ - template <class T> - ArrayPrimitiveType<T>* getUVCoords () - { - return getValues (); - } - - /** Returns the position values array as a float array. */ - ArrayPrimitiveType<float>* getFloatUVCoords () - { - return getFloatValues (); - } - - /** Returns the position values array as a double array. */ - ArrayPrimitiveType<double>* getDoubleUVCoords () - { - return getDoubleValues (); - } - - /** Returns the position values array as a float array. */ - const ArrayPrimitiveType<float>* getFloatUVCoords () const - { - return getFloatValues (); - } - - /** Returns the position values array as a double array. */ - const ArrayPrimitiveType<double>* getDoubleUVCoords () const - { - return getDoubleValues (); - } - - /** Returns the count of stored elements in the array. */ - const size_t getUVCoordsCount () const - { - return getElementsCount (); - } - - }; - -} // namespace COLLADAFW - -#endif // __COLLADAFW_MESHUVCOORDS_H__ Added: branches/nextgen/COLLADAFramework/include/COLLADAFWMeshVertexData.h =================================================================== --- branches/nextgen/COLLADAFramework/include/COLLADAFWMeshVertexData.h (rev 0) +++ branches/nextgen/COLLADAFramework/include/COLLADAFWMeshVertexData.h 2009-02-03 15:32:48 UTC (rev 336) @@ -0,0 +1,274 @@ +/* + Copyright (c) 2008 NetAllied Systems GmbH + + This file is part of COLLADAFramework. + + Licensed under the MIT Open Source License, + for details please see LICENSE file or the website + http://www.opensource.org/licenses/mit-license.php +*/ + +#ifndef __COLLADAFW_MESHINPUTS_H__ +#define __COLLADAFW_MESHINPUTS_H__ + +#include "COLLADAFWPrerequisites.h" +#include "COLLADAFWArrayPrimitiveType.h" + +#include <assert.h> + + +namespace COLLADAFW +{ + + /** Base class for mesh input elements, like positions, normals, colors, texcoord, ... */ + class MeshVertexData + { + public: + + /** Values can be stored as float or double values. */ + enum DataType + { + DATA_TYPE_FLOAT, + DATA_TYPE_DOUBLE, + DATA_TYPE_UNKNOWN + }; + + /** + * Additional informations about multiple inputs. + */ + struct InputInfos + { + String mName; + size_t mStride; + size_t mLength; + }; + typedef ArrayPrimitiveType<InputInfos*> InputInfosArray; + + private: + + /** Array with additional informations about multiple input elements. */ + InputInfosArray mInputInfosArray; + + protected: + + /** The data type of the stored position values. */ + DataType mType; + + /** The position values. */ + FloatArray mValuesF; + DoubleArray mValuesD; + + public: + + /** Constructor. */ + MeshVertexData () + : mType ( DATA_TYPE_UNKNOWN ) + , mValuesF(FloatArray::OWNER) + , mValuesD(DoubleArray::OWNER) + , mInputInfosArray (0) + {} + + /** Constructor. */ + MeshVertexData ( DataType type ) + : mType ( type ) + , mValuesF(FloatArray::OWNER) + , mValuesD(DoubleArray::OWNER) + , mInputInfosArray (0) + {} + + /** Destructor. */ + virtual ~MeshVertexData() + { + for ( size_t i=0; i<mInputInfosArray.getCount(); ++i ) + { + delete mInputInfosArray [i]; + } + mInputInfosArray.releaseMemory (); + } + + /** The data type of the stored position values. */ + const COLLADAFW::MeshVertexData::DataType getType () const { return mType; } + + /** The data type of the stored position values. */ + void setType ( const COLLADAFW::MeshVertexData::DataType Type ) { mType = Type; } + + /** Returns the count of stored elements in the array. */ + const size_t getValuesCount () const + { + if ( mType == DATA_TYPE_FLOAT ) return mValuesF.getCount (); + if ( mType == DATA_TYPE_DOUBLE ) return mValuesD.getCount (); + return 0; + } + + /** + * Returns the number of uv sets. + */ + size_t getNumInputInfos () const { return mInputInfosArray.getCount (); } + + /** + * Appends the values in the array on the list of values and stores the information + * of the current input. + * @param const FloatArray& valuesArray The list of values. + * @param const String& name The name of the current element. + * @param const size_t stride The data stride. + */ + void appendValues ( const FloatArray& valuesArray, const String& name, const size_t stride ) + { + setType ( DATA_TYPE_FLOAT ); + appendValues ( valuesArray ); + + InputInfos* info = new InputInfos(); + info->mLength = valuesArray.getCount (); + info->mName = name; + info->mStride = stride; + + mInputInfosArray.append ( info ); + } + + /** + * Appends the values in the array on the list of values and stores the information + * of the current input. + * @param const FloatArray& valuesArray The list of values. + * @param const String& name The name of the current element. + * @param const size_t stride The data stride. + */ + void appendValues ( const DoubleArray& valuesArray, const String& name, const size_t stride ) + { + setType ( DATA_TYPE_DOUBLE ); + appendValues ( valuesArray ); + + InputInfos* info = new InputInfos(); + info->mLength = valuesArray.getCount (); + info->mName = name; + info->mStride = stride; + + mInputInfosArray.append ( info ); + } + + /** The stride at the specified index. */ + String getName ( size_t index ) const + { + assert ( index <= mInputInfosArray.getCount() ); + return mInputInfosArray[index]->mName; + } + + /** The stride at the specified index. */ + size_t getStride ( size_t index ) const + { + assert ( index <= mInputInfosArray.getCount() ); + return mInputInfosArray[index]->mStride; + } + + /** The stride can differ, so we have to set. */ + size_t getLength ( size_t index ) const + { + assert ( index <= mInputInfosArray.getCount() ); + return mInputInfosArray[index]->mLength; + } + + /** Returns the position values array as a template array. */ + template <class T> + ArrayPrimitiveType<T>& getValues () + { + if ( mType == DATA_TYPE_FLOAT ) return mValuesF; + if ( mType == DATA_TYPE_DOUBLE ) return mValuesD; + return 0; + } + + /** Returns the position values array as a float array. */ + const FloatArray* getFloatValues () const + { + if ( mType == DATA_TYPE_FLOAT ) + return ( ArrayPrimitiveType<float>* ) &mValuesF; + return 0; + } + + /** Returns the position values array as a double array. */ + const DoubleArray* getDoubleValues () const + { + if ( mType == DATA_TYPE_DOUBLE ) + return ( ArrayPrimitiveType<double>* ) &mValuesD; + return 0; + } + + /** Returns the position values array as a float array. */ + FloatArray* getFloatValues () + { + if ( mType == DATA_TYPE_FLOAT ) + return ( ArrayPrimitiveType<float>* ) &mValuesF; + return 0; + } + + /** Returns the position values array as a double array. */ + DoubleArray* getDoubleValues () + { + if ( mType == DATA_TYPE_DOUBLE ) + return ( ArrayPrimitiveType<double>* ) &mValuesD; + return 0; + } + +// /** Appends the values of the input array to the end of values array. +// The programmer must ensure, that the memory allocated, +// was large enough to hold another element. No new memory is allocated.*/ +// template <class Type> +// bool appendValues ( const ArrayPrimitiveType <Type>& valuesArray ) const +// { +// if ( mType == DATA_TYPE_DOUBLE ) +// { +// mValuesD->appendValues ( valuesArray ); +// return true; +// } +// else if ( mType == DATA_TYPE_FLOAT ) +// { +// mValuesF->appendValues ( valuesArray ); +// return true; +// } +// +// return false; +// } + + /** Set the C-style data array.*/ + void setData ( float* data, const size_t count ) + { + if ( mType == DATA_TYPE_FLOAT ) mValuesF.setData ( data, count ); + } + + /** Set the C-style data array.*/ + void setData ( double* data, const size_t count ) + { + if ( mType == DATA_TYPE_DOUBLE ) mValuesD.setData ( data, count ); + } + + /** Appends the values of the input array to the end of values array. + The programmer must ensure, that the memory allocated, + was large enough to hold another element. No new memory is allocated.*/ + bool appendValues ( const FloatArray& valuesArray ) + { + if ( mType == DATA_TYPE_FLOAT ) + { + mValuesF.appendValues ( valuesArray ); + return true; + } + + return false; + } + + /** Appends the values of the input array to the end of values array. + The programmer must ensure, that the memory allocated, + was large enough to hold another element. No new memory is allocated.*/ + bool appendValues ( const DoubleArray& valuesArray ) + { + if ( mType == DATA_TYPE_DOUBLE ) + { + mValuesD.appendValues ( valuesArray ); + return true; + } + + return false; + } + + }; + +} // namespace COLLADAFW + +#endif // __COLLADAFW_MESHINPUTS_H__ Modified: branches/nextgen/COLLADAFramework/scripts/COLLADAFramework.vcproj =================================================================== --- branches/nextgen/COLLADAFramework/scripts/COLLADAFramework.vcproj 2009-02-03 10:09:27 UTC (rev 335) +++ branches/nextgen/COLLADAFramework/scripts/COLLADAFramework.vcproj 2009-02-03 15:32:48 UTC (rev 336) @@ -538,22 +538,6 @@ > </File> <File - RelativePath="..\include\COLLADAFWMeshColors.h" - > - </File> - <File - RelativePath="..\include\COLLADAFWMeshFDInputs.h" - > - </File> - <File - RelativePath="..\include\COLLADAFWMeshNormals.h" - > - </File> - <File - RelativePath="..\include\COLLADAFWMeshPositions.h" - > - </File> - <File RelativePath="..\include\COLLADAFWMeshPrimitive.h" > </File> @@ -562,7 +546,7 @@ > </File> <File - RelativePath="..\include\COLLADAFWMeshUVCoords.h" + RelativePath="..\include\COLLADAFWMeshVertexData.h" > </File> <File Modified: branches/nextgen/COLLADAFramework/src/COLLADAFWMesh.cpp =================================================================== --- branches/nextgen/COLLADAFramework/src/COLLADAFWMesh.cpp 2009-02-03 10:09:27 UTC (rev 335) +++ branches/nextgen/COLLADAFramework/src/COLLADAFWMesh.cpp 2009-02-03 15:32:48 UTC (rev 336) @@ -79,7 +79,7 @@ case MeshPrimitive::TRIANGLE_FANS: { - //TODO not implemented + // TODO not implemented //Tristrips* tristrips = (Tristrips*)primitive; //primitiveCount += tristrips->getTristripCount(); } @@ -147,7 +147,7 @@ //---------------------------------- bool Mesh::hasNormals( )const { - return getNormals().getNormalsCount() != 0; + return getNormals().getValuesCount() != 0; } //---------------------------------- Modified: branches/nextgen/COLLADAFramework/src/COLLADAFWMeshPrimitive.cpp =================================================================== --- branches/nextgen/COLLADAFramework/src/COLLADAFWMeshPrimitive.cpp 2009-02-03 10:09:27 UTC (rev 335) +++ branches/nextgen/COLLADAFramework/src/COLLADAFWMeshPrimitive.cpp 2009-02-03 15:32:48 UTC (rev 336) @@ -24,7 +24,7 @@ : mPrimitiveType ( UNDEFINED_PRIMITIVE_TYPE ) , mPositionIndices(UIntValuesArray::OWNER) , mNormalIndices(UIntValuesArray::OWNER) - , mColorIndices(UIntValuesArray::OWNER) + , mColorIndicesArray(UIntValuesArray::OWNER) , mUVCoordIndicesArray(UIntValuesArray::OWNER) , mFaceCount ( 0 ) { @@ -35,7 +35,7 @@ : mPrimitiveType ( primitiveType ) , mPositionIndices(UIntValuesArray::OWNER) , mNormalIndices(UIntValuesArray::OWNER) - , mColorIndices(UIntValuesArray::OWNER) + , mColorIndicesArray(UIntValuesArray::OWNER) , mUVCoordIndicesArray(UIntValuesArray::OWNER) , mFaceCount ( 0 ) { Modified: branches/nextgen/COLLADAMaya/include/COLLADAMayaGeometryImporter.h =================================================================== --- branches/nextgen/COLLADAMaya/include/COLLADAMayaGeometryImporter.h 2009-02-03 10:09:27 UTC (rev 335) +++ branches/nextgen/COLLADAMaya/include/COLLADAMayaGeometryImporter.h 2009-02-03 15:32:48 UTC (rev 336) @@ -143,6 +143,17 @@ size_t& uvSetIndicesIndex, const int numEdges ); + /** + * Set the color infos into the maya poly face element. + * Increments the initial value for the color indices index. + */ + void setColorInfos ( + const COLLADAFW::Mesh* mesh, + const COLLADAFW::MeshPrimitive* primitiveElement, + MayaDM::polyFaces &polyFace, + size_t& colorIndicesIndex, + const int numEdges ); + /* * Changes the orientation of a polyFace hole element. */ @@ -177,9 +188,14 @@ /* * Write the uv coordinates into the maya file. */ - bool writeUVCoords ( const COLLADAFW::Mesh* mesh, MayaDM::Mesh &meshNode ); + bool writeUVSets ( const COLLADAFW::Mesh* mesh, MayaDM::Mesh &meshNode ); /* + * Write the uv coordinates into the maya file. + */ + bool writeColorSets ( const COLLADAFW::Mesh* mesh, MayaDM::Mesh &meshNode ); + + /* * Write the normals values into the maya file. */ bool writeNormals ( const COLLADAFW::Mesh* mesh, MayaDM::Mesh &meshNode ); Modified: branches/nextgen/COLLADAMaya/src/COLLADAMayaGeometryImporter.cpp =================================================================== --- branches/nextgen/COLLADAMaya/src/COLLADAMayaGeometryImporter.cpp 2009-02-03 10:09:27 UTC (rev 335) +++ branches/nextgen/COLLADAMaya/src/COLLADAMayaGeometryImporter.cpp 2009-02-03 15:32:48 UTC (rev 336) @@ -144,8 +144,14 @@ if ( !writeNormals ( mesh, meshNode ) ) return false; // Write the uv corrdinates. - writeUVCoords ( mesh, meshNode ); + writeUVSets ( mesh, meshNode ); + // TODO Implementation: set current uv set +// writeCurrentUVSet ( mesh, meshNode ); + + // Write the uv corrdinates. + writeColorSets ( mesh, meshNode ); + // The vector of edge indices. We use it to write the list of edges into // the maya file. The vector is already sorted. std::vector<COLLADAFW::Edge> edgeIndices; @@ -205,14 +211,14 @@ // We have always a stride of three (x, y and z values) size_t stride = 3; - const COLLADAFW::MeshPositions& positions = mesh->getPositions (); - const COLLADAFW::MeshFloatDoubleInputs::DataType type = positions.getType (); + const COLLADAFW::MeshVertexData& positions = mesh->getPositions (); + const COLLADAFW::MeshVertexData::DataType type = positions.getType (); switch ( type ) { - case COLLADAFW::MeshFloatDoubleInputs::DATA_TYPE_FLOAT: + case COLLADAFW::MeshVertexData::DATA_TYPE_FLOAT: { - const COLLADAFW::ArrayPrimitiveType<float>* values = positions.getFloatPositions (); - size_t count = positions.getPositionsCount (); + const COLLADAFW::ArrayPrimitiveType<float>* values = positions.getFloatValues (); + size_t count = positions.getValuesCount (); meshNode.startVrts ( 0, (count/stride)-1 ); for ( size_t i=0, index=0; i<count; i+=stride, ++index ) { @@ -223,10 +229,10 @@ meshNode.endVrts (); } break; - case COLLADAFW::MeshFloatDoubleInputs::DATA_TYPE_DOUBLE: + case COLLADAFW::MeshVertexData::DATA_TYPE_DOUBLE: { - const COLLADAFW::ArrayPrimitiveType<double>* values = positions.getDoublePositions (); - size_t count = positions.getPositionsCount (); + const COLLADAFW::ArrayPrimitiveType<double>* values = positions.getDoubleValues (); + size_t count = positions.getValuesCount (); meshNode.startVrts ( 0, (count/stride)-1 ); for ( size_t i=0, index=0; i<count; i+=stride, ++index ) { @@ -268,7 +274,7 @@ MayaDM::Mesh &meshNode ) { // Get the mesh normals values. - const COLLADAFW::MeshNormals& normals = mesh->getNormals (); + const COLLADAFW::MeshVertexData& normals = mesh->getNormals (); size_t stride = 3; // x, y, z @@ -294,20 +300,20 @@ unsigned int pos = normalIndex * stride; // Write the normal values on the index values. - const COLLADAFW::MeshFloatDoubleInputs::DataType type = normals.getType (); + const COLLADAFW::MeshVertexData::DataType type = normals.getType (); switch ( type ) { - case COLLADAFW::MeshFloatDoubleInputs::DATA_TYPE_FLOAT: + case COLLADAFW::MeshVertexData::DATA_TYPE_FLOAT: { - const COLLADAFW::ArrayPrimitiveType<float>* values = normals.getFloatNormals (); + const COLLADAFW::ArrayPrimitiveType<float>* values = normals.getFloatValues (); meshNode.appendNormals ( (*values)[pos] ); meshNode.appendNormals ( (*values)[pos+1] ); meshNode.appendNormals ( (*values)[pos+2] ); } break; - case COLLADAFW::MeshFloatDoubleInputs::DATA_TYPE_DOUBLE: + case COLLADAFW::MeshVertexData::DATA_TYPE_DOUBLE: { - const COLLADAFW::ArrayPrimitiveType<double>* values = normals.getDoubleNormals (); + const COLLADAFW::ArrayPrimitiveType<double>* values = normals.getDoubleValues (); meshNode.appendNormals ( (float)(*values)[pos] ); meshNode.appendNormals ( (float)(*values)[pos+1] ); meshNode.appendNormals ( (float)(*values)[pos+2] ); @@ -324,29 +330,30 @@ } // -------------------------------------------- - bool GeometryImporter::writeUVCoords ( const COLLADAFW::Mesh* mesh, MayaDM::Mesh &meshNode ) + bool GeometryImporter::writeUVSets ( const COLLADAFW::Mesh* mesh, MayaDM::Mesh &meshNode ) { // Set the number of uv sets. - const COLLADAFW::MeshUVCoords& uvCoords = mesh->getUVCoords (); - size_t sumUVSetPoints = uvCoords.getNumUVSets (); + const COLLADAFW::MeshVertexData& uvCoords = mesh->getUVCoords (); + size_t sumUVSetPoints = uvCoords.getNumInputInfos (); if ( sumUVSetPoints == 0 ) return false; meshNode.setUvSize ( sumUVSetPoints ); // Write the values size_t initialIndex = 0; - const COLLADAFW::MeshFloatDoubleInputs::DataType type = uvCoords.getType (); + const COLLADAFW::MeshVertexData::DataType type = uvCoords.getType (); switch ( type ) { - case COLLADAFW::MeshFloatDoubleInputs::DATA_TYPE_FLOAT: + case COLLADAFW::MeshVertexData::DATA_TYPE_FLOAT: { - const COLLADAFW::ArrayPrimitiveType<float>* values = uvCoords.getFloatUVCoords (); + const COLLADAFW::ArrayPrimitiveType<float>* values = uvCoords.getFloatValues (); for ( size_t i=0; i<sumUVSetPoints; ++i ) { - meshNode.setUvSetName ( i, uvCoords.getUVSetName ( i ) ); + meshNode.setUvSetName ( i, uvCoords.getName ( i ) ); size_t stride = uvCoords.getStride ( i ); assert ( stride > 1 && stride <= 4 ); - if ( stride != 2 ) MGlobal::displayWarning ( "Just 2d uv set data will be imported! "); + if ( stride != 2 ) + MGlobal::displayWarning ( "Just 2d uv set data will be imported! "); size_t indicesCount = uvCoords.getLength ( i ); meshNode.startUvSetPoints ( i, 0, (indicesCount/stride)-1 ); @@ -363,16 +370,17 @@ } break; } - case COLLADAFW::MeshFloatDoubleInputs::DATA_TYPE_DOUBLE: + case COLLADAFW::MeshVertexData::DATA_TYPE_DOUBLE: { - const COLLADAFW::ArrayPrimitiveType<double>* values = uvCoords.getDoubleUVCoords (); + const COLLADAFW::ArrayPrimitiveType<double>* values = uvCoords.getDoubleValues (); for ( size_t i=0; i<sumUVSetPoints; ++i ) { - meshNode.setUvSetName ( i, uvCoords.getUVSetName ( i ) ); + meshNode.setUvSetName ( i, uvCoords.getName ( i ) ); size_t stride = uvCoords.getStride ( i ); assert ( stride > 1 && stride <= 4 ); - if ( stride != 2 ) MGlobal::displayWarning ( "Just 2d uv set data will be imported! "); + if ( stride != 2 ) + MGlobal::displayWarning ( "Just 2d uv set data will be imported! "); size_t indicesCount = uvCoords.getLength ( i ); meshNode.startUvSetPoints ( i, 0, (indicesCount/stride)-1 ); @@ -394,91 +402,92 @@ return false; } + return true; + } -// // The current uv set points list index -// size_t currentUVSetPoint = 0; -// -// // We have to go through every mesh primitive and write the list of uv values -// // for the index list in the maya document. -// const COLLADAFW::MeshPrimitiveArray& meshPrimitives = mesh->getMeshPrimitives (); -// for ( size_t i=0; i<count; ++i ) -// { -// // Get the current primitive element. -// const COLLADAFW::MeshPrimitive* meshPrimitive = meshPrimitives [ i ]; -// -// // Write the index values for every tex coord index list of the current primitive. -// const COLLADAFW::IndexListArray& uvCoordIndicesArray = meshPrimitive->getUVCoordIndicesArray (); -// size_t numPrimitiveUVCoords = uvCoordIndicesArray.getCount (); -// for ( size_t j=0; j<numPrimitiveUVCoords; ++j, ++currentUVSetPoint ) -// { -// COLLADAFW::IndexList* uvCoordIndexList = uvCoordIndicesArray [j]; -// size_t indicesCount = uvCoordIndexList->getIndicesCount (); -// size_t stride = uvCoordIndexList->getStride (); -// size_t uvSetIndex = uvCoordIndexList->getInputSetIndex (); -// String uvSetName = uvCoordIndexList->getInputSetName (); -// meshNode.setUvSetName ( currentUVSetPoint, uvSetName ); -// -// // Get the values depend on the dimension. -// const COLLADAFW::MeshUVCoords* uvCoords; -// switch ( stride ) -// { -// case 2: uvCoords = &mesh->getUVCoords2d (); break; -// case 3: -// { -// uvCoords = &mesh->getUVCoords3d (); -// MGlobal::displayWarning ( "3d uv coordinates not supported! Just 2d data will be imported! "); -// break; -// } -// case 4: -// { -// uvCoords = &mesh->getUVCoords4d (); -// MGlobal::displayWarning ( "4d uv coordinates not supported! Just 2d data will be imported! "); -// break; -// } -// default: assert ( stride < 2 || stride > 4 ); -// } -// -// // Write the values list. -// const COLLADAFW::MeshFloatDoubleInputs::DataType type = uvCoords->getType (); -// switch ( type ) -// { -// case COLLADAFW::MeshFloatDoubleInputs::DATA_TYPE_FLOAT: -// { -// const COLLADAFW::ArrayPrimitiveType<float>* values = uvCoords->getFloatUVCoords (); -// meshNode.startUvSetPoints ( currentUVSetPoint, 0, (indicesCount/2)-1 ); -// unsigned int index = 0; -// for ( size_t i=0; i<indicesCount; i+=stride ) -// { -// index = uvCoordIndexList->getIndex ( i ); -// meshNode.appendUvSetPoints ( (*values)[index] ); -// index = uvCoordIndexList->getIndex ( i+1 ); -// meshNode.appendUvSetPoints ( (*values)[index] ); -// } -// meshNode.endUvSetPoints (); -// } -// break; -// case COLLADAFW::MeshFloatDoubleInputs::DATA_TYPE_DOUBLE: -// { -// const COLLADAFW::ArrayPrimitiveType<double>* values = uvCoords->getDoubleUVCoords (); -// meshNode.startUvSetPoints ( currentUVSetPoint, 0, (indicesCount/2)-1 ); -// unsigned int index = 0; -// for ( size_t i=0; i<indicesCount; i+=stride ) -// { -// index = uvCoordIndexList->getIndex ( i ); -// meshNode.appendUvSetPoints ( (*values)[index] ); -// index = uvCoordIndexList->getIndex ( i+1 ); -// meshNode.appendUvSetPoints ( (*values)[index] ); -// } -// meshNode.endUvSetPoints (); -// } -// break; -// defa... [truncated message content] |
From: <jud...@us...> - 2009-02-03 10:09:33
|
Revision: 335 http://colladamaya.svn.sourceforge.net/colladamaya/?rev=335&view=rev Author: judithschenk Date: 2009-02-03 10:09:27 +0000 (Tue, 03 Feb 2009) Log Message: ----------- ticket #2424750 skin URL doesn't match geometry ID Modified Paths: -------------- branches/nextgen/COLLADAMaya/include/COLLADAMayaDocumentExporter.h branches/nextgen/COLLADAMaya/include/COLLADAMayaSceneElement.h branches/nextgen/COLLADAMaya/src/COLLADAMayaAnimationExporter.cpp branches/nextgen/COLLADAMaya/src/COLLADAMayaControllerExporter.cpp branches/nextgen/COLLADAMaya/src/COLLADAMayaEffectExporter.cpp branches/nextgen/COLLADAMaya/src/COLLADAMayaEffectTextureExporter.cpp branches/nextgen/COLLADAMaya/src/COLLADAMayaGeometryExporter.cpp branches/nextgen/COLLADAMaya/src/COLLADAMayaGeometryImporter.cpp branches/nextgen/COLLADAMaya/src/COLLADAMayaGeometryPolygonExporter.cpp branches/nextgen/COLLADAMaya/src/COLLADAMayaMaterialExporter.cpp branches/nextgen/COLLADAMaya/src/COLLADAMayaSceneElement.cpp branches/nextgen/COLLADAMaya/src/COLLADAMayaSceneGraph.cpp branches/nextgen/COLLADAMaya/src/COLLADAMayaVisualSceneExporter.cpp Modified: branches/nextgen/COLLADAMaya/include/COLLADAMayaDocumentExporter.h =================================================================== --- branches/nextgen/COLLADAMaya/include/COLLADAMayaDocumentExporter.h 2009-02-03 08:32:47 UTC (rev 334) +++ branches/nextgen/COLLADAMaya/include/COLLADAMayaDocumentExporter.h 2009-02-03 10:09:27 UTC (rev 335) @@ -224,7 +224,7 @@ * @param removeNamespace True, if the namespace should be removed. * @return MString Maya string with the converted string. */ - String mayaNameToColladaName ( const MString& str, bool removeNamespace=true ); + static String mayaNameToColladaName ( const MString& str, bool removeNamespace=true ); /** * Make an unique COLLADA Id from a dagPath. @@ -263,7 +263,7 @@ * @param ncName Any string. * @return COLLADAMaya::String A valid NCName. */ - String checkNCName(const String &ncName); + static String checkNCName(const String &ncName); private: Modified: branches/nextgen/COLLADAMaya/include/COLLADAMayaSceneElement.h =================================================================== --- branches/nextgen/COLLADAMaya/include/COLLADAMayaSceneElement.h 2009-02-03 08:32:47 UTC (rev 334) +++ branches/nextgen/COLLADAMaya/include/COLLADAMayaSceneElement.h 2009-02-03 10:09:27 UTC (rev 335) @@ -19,6 +19,9 @@ #include "COLLADAMayaStableHeaders.h" #include "COLLADAMayaPrerequisites.h" +#include <set> + + namespace COLLADAMaya { @@ -94,25 +97,25 @@ /** True, if the transform element has joints. */ bool mHasJoint; - /** Set the skeletonId. It indicates where a skin + /** Set the list of skeleton-Ids. It indicates where a skin controller is to start to search for the joint nodes it needs. This element is meaningless for morph controllers. */ - String mSkeletonId; + std::set<String> mSkeletonIds; public: /** Constructor. */ SceneElement ( const MDagPath _nodePath, Type _type=UNDETERMINED ); - virtual ~SceneElement(); + virtual ~SceneElement (); /** Returns the node path */ - const MDagPath getPath() const; + const MDagPath getPath () const; /** Returns the node */ - const MObject& getNode(); + const MObject& getNode (); /** Returns the type of the node*/ - const Type& getType() const; + const Type& getType () const; void setType ( const Type& _type ) { mType = _type; @@ -125,7 +128,7 @@ } /** Set the unique id of the export node to @a id*/ - const String& getNodeId ( ) const + const String& getNodeId () const { return mNodeId; } @@ -136,7 +139,7 @@ mNodeName = name; } - const String& getNodeName(); + const String& getNodeName (); /** Adds @a exportNode to its children*/ void addParentElement ( SceneElement* exportElement ) @@ -145,7 +148,7 @@ } /** Returns the number of child nodes*/ - const size_t getParentCount() const + const size_t getParentCount () const { return mParentElements.size(); } @@ -169,7 +172,7 @@ } /** Returns the number of child nodes*/ - const size_t getChildCount() const + const size_t getChildCount () const { return mChildElements.size(); } @@ -193,7 +196,7 @@ } /** Pointer to the instantiated scene element, if it exist. */ - void setInstantiatedSceneElement( SceneElement* val ) + void setInstantiatedSceneElement ( SceneElement* val ) { mInstantiatedSceneElement = val; } @@ -205,13 +208,13 @@ } /** Set the export flag on the current scene element. */ - const bool getIsExportNode() const + const bool getIsExportNode () const { return mIsExportNode; } /** false, if the node has a file reference */ - const bool getIsLocal() const { return mIsLocal; } + const bool getIsLocal () const { return mIsLocal; } /** false, if the node has a file reference */ void setIsLocal ( const bool val ) { mIsLocal = val; } @@ -235,7 +238,7 @@ } /** Set the visible flag on the current scene element. */ - const bool getIsVisible() const + const bool getIsVisible () const { return mIsVisible; } @@ -244,24 +247,29 @@ * True, if the transform element has joints. * @param hasJoint True, if the transform element has joints. */ - void setHasJoint( bool hasJoint ) { mHasJoint = hasJoint; } + void setHasJoint ( bool hasJoint ) { mHasJoint = hasJoint; } /** * True, if the transform element has joints. * @return bool True, if the transform element has joints. */ - bool getHasJoint() { return mHasJoint; } + bool getHasJoint () { return mHasJoint; } /** Set the skeletonId. It indicates where a skin controller is to start to search for the joint nodes it needs. This element is meaningless for morph controllers. */ - const String getSkeletonId() const { return mSkeletonId; } + const std::set<String>& getSkeletonIds () const { return mSkeletonIds; } /** Set the skeletonId. It indicates where a skin controller is to start to search for the joint nodes it needs. This element is meaningless for morph controllers. */ - void setSkeletonId( String& val ) { mSkeletonId = val; } + void setSkeletonIds ( const std::set<String>& val ) { mSkeletonIds = val; } + /** Set the skeletonId. It indicates where a skin + controller is to start to search for the joint nodes + it needs. This element is meaningless for morph controllers. */ + void addSkeletonId ( const String& val ) { mSkeletonIds.insert ( val ); } + private: /** Returns the type of the node*/ Modified: branches/nextgen/COLLADAMaya/src/COLLADAMayaAnimationExporter.cpp =================================================================== --- branches/nextgen/COLLADAMaya/src/COLLADAMayaAnimationExporter.cpp 2009-02-03 08:32:47 UTC (rev 334) +++ branches/nextgen/COLLADAMaya/src/COLLADAMayaAnimationExporter.cpp 2009-02-03 10:09:27 UTC (rev 335) @@ -1202,9 +1202,9 @@ String nodeId = getNodeId ( plug ); if ( nodeId.empty() ) { - return mDocumentExporter->mayaNameToColladaName ( plug.name() ); + return DocumentExporter::mayaNameToColladaName ( plug.name() ); } - return mDocumentExporter->mayaNameToColladaName ( plug.name() ) + "_" + nodeId; + return DocumentExporter::mayaNameToColladaName ( plug.name() ) + "_" + nodeId; // return mDocumentExporter->mayaNameToColladaName ( plug.name() ); /* @@ -1225,7 +1225,7 @@ { return partialPathName; } - return mDocumentExporter->mayaNameToColladaName ( fnDagNode.partialPathName(), false ); + return DocumentExporter::mayaNameToColladaName ( fnDagNode.partialPathName(), false ); } //--------------------------------------------------------------- @@ -1640,7 +1640,7 @@ if ( status != MStatus::kSuccess ) continue; // Create the corresponding COLLADA animation clip - String clipName = mDocumentExporter->mayaNameToColladaName ( clipFn.name() ); + String clipName = DocumentExporter::mayaNameToColladaName ( clipFn.name() ); float startTime = ( float ) clipFn.getSourceStart().as ( MTime::kSeconds ); float endTime = startTime + ( float ) clipFn.getSourceDuration().as ( MTime::kSeconds ); Modified: branches/nextgen/COLLADAMaya/src/COLLADAMayaControllerExporter.cpp =================================================================== --- branches/nextgen/COLLADAMaya/src/COLLADAMayaControllerExporter.cpp 2009-02-03 08:32:47 UTC (rev 334) +++ branches/nextgen/COLLADAMaya/src/COLLADAMayaControllerExporter.cpp 2009-02-03 10:09:27 UTC (rev 335) @@ -479,7 +479,7 @@ // LibraryControllers::SKIN_CONTROLLER_ID_SUFFIX; bool morphController = hasMorphController( targetDagPath.node() ); String controllerIdSuffix; - if ( hasMorphController( targetDagPath.node() ) ) + if ( morphController ) controllerIdSuffix = COLLADASW::LibraryControllers::MORPH_CONTROLLER_ID_SUFFIX + COLLADASW::LibraryControllers::SKIN_CONTROLLER_ID_SUFFIX; else controllerIdSuffix = COLLADASW::LibraryControllers::SKIN_CONTROLLER_ID_SUFFIX; @@ -488,7 +488,7 @@ if ( !sceneElement->getNodeId().empty() ) controllerId = sceneElement->getNodeId() + controllerIdSuffix; else controllerId = sceneElement->getNodeName() + controllerIdSuffix; - + // Check if the controller isn't already exported std::vector<String>::iterator controllerIter; controllerIter = find ( mExportedControllers.begin(), mExportedControllers.end(), controllerId ); @@ -518,7 +518,7 @@ // If the output shape has a morph controller, the target // is not the shape's geometry, but the morph controller. MFnDependencyNode fn ( outputShape.node() ); - String skinTarget = fn.name().asChar(); + String skinTarget = DocumentExporter::mayaNameToColladaName ( fn.name() ); if ( hasMorphController( outputShape.node() ) ) skinTarget += COLLADASW::LibraryControllers::MORPH_CONTROLLER_ID_SUFFIX; @@ -534,13 +534,14 @@ // Gather the list of joints gatherJoints( &skinController, controllerNode, weightFilters, clusterIndex ); - // Set the joint entry into the other scene element, shich use this joints. + // Set the joint entry into the other scene element, which use this joints. MDagPathArray influences = skinController.getInfluences(); - if ( influences.length() > 0 ) + unsigned int numInfluences = influences.length(); + for ( unsigned int i=0; i<numInfluences; ++i ) { - MDagPath skeletonPath = influences[0]; + MDagPath skeletonPath = influences [i]; String skeletonId = mDocumentExporter->dagPathToColladaId( skeletonPath ); - sceneElement->setSkeletonId( skeletonId ); + sceneElement->addSkeletonId ( skeletonId ); // Set the id on the other instanced nodes. bool isInstanced = targetDagPath.isInstanced (); @@ -551,14 +552,13 @@ { SceneElement* foundElement = mDocumentExporter->getSceneGraph()->findElement( pathes[i] ); if ( foundElement != NULL ) - foundElement->setSkeletonId( skeletonId ); + foundElement->addSkeletonId ( skeletonId ); } } gatherBindMatrices( &skinController, controllerNode ); // Collect the vertex weights into the collada skin controller. - uint numInfluences = skinController.getInfluences().length(); collectVertexWeights( &skinController, controllerNode, Modified: branches/nextgen/COLLADAMaya/src/COLLADAMayaEffectExporter.cpp =================================================================== --- branches/nextgen/COLLADAMaya/src/COLLADAMayaEffectExporter.cpp 2009-02-03 08:32:47 UTC (rev 334) +++ branches/nextgen/COLLADAMaya/src/COLLADAMayaEffectExporter.cpp 2009-02-03 10:09:27 UTC (rev 335) @@ -163,7 +163,7 @@ if ( status != MStatus::kSuccess ) return; // Get the name of the current material - String materialName = mDocumentExporter->mayaNameToColladaName ( shaderFn.name(), true ); + String materialName = DocumentExporter::mayaNameToColladaName ( shaderFn.name(), true ); // Have we seen this shader before? MaterialMap::iterator materialMapIter; Modified: branches/nextgen/COLLADAMaya/src/COLLADAMayaEffectTextureExporter.cpp =================================================================== --- branches/nextgen/COLLADAMaya/src/COLLADAMayaEffectTextureExporter.cpp 2009-02-03 08:32:47 UTC (rev 334) +++ branches/nextgen/COLLADAMaya/src/COLLADAMayaEffectTextureExporter.cpp 2009-02-03 10:09:27 UTC (rev 335) @@ -185,7 +185,7 @@ MPlug filenamePlug = dgFn.findPlug ( ATTR_FILE_TEXTURE_NAME ); // Convert the image name - String colladaImageId = mDocumentExporter->mayaNameToColladaName ( mayaName ); + String colladaImageId = DocumentExporter::mayaNameToColladaName ( mayaName ); // Get the maya filename with the path to the file. filenamePlug.getValue ( mayaFileName ); Modified: branches/nextgen/COLLADAMaya/src/COLLADAMayaGeometryExporter.cpp =================================================================== --- branches/nextgen/COLLADAMaya/src/COLLADAMayaGeometryExporter.cpp 2009-02-03 08:32:47 UTC (rev 334) +++ branches/nextgen/COLLADAMaya/src/COLLADAMayaGeometryExporter.cpp 2009-02-03 10:09:27 UTC (rev 335) @@ -202,8 +202,8 @@ if ( status != MStatus::kSuccess ) return false; // Create the unique ID - String meshId1 = mDocumentExporter->dagPathToColladaId( dagPath ); - String meshId = mDocumentExporter->mayaNameToColladaName ( fnMesh.name() ); +// String meshId1 = mDocumentExporter->dagPathToColladaId( dagPath ); + String meshId = DocumentExporter::mayaNameToColladaName ( fnMesh.name() ); bool isInstanced = dagPath.isInstanced(); uint instanceNumber = dagPath.instanceNumber(); Modified: branches/nextgen/COLLADAMaya/src/COLLADAMayaGeometryImporter.cpp =================================================================== --- branches/nextgen/COLLADAMaya/src/COLLADAMayaGeometryImporter.cpp 2009-02-03 08:32:47 UTC (rev 334) +++ branches/nextgen/COLLADAMaya/src/COLLADAMayaGeometryImporter.cpp 2009-02-03 10:09:27 UTC (rev 335) @@ -380,8 +380,8 @@ unsigned int index = 0; for ( size_t i=0; i<indicesCount; i+=stride ) { - meshNode.appendUvSetPoints ( (*values)[initialIndex+i] ); - meshNode.appendUvSetPoints ( (*values)[initialIndex+i+1] ); + meshNode.appendUvSetPoints ( (float) (*values)[initialIndex+i] ); + meshNode.appendUvSetPoints ( (float) (*values)[initialIndex+i+1] ); } meshNode.endUvSetPoints (); @@ -759,11 +759,11 @@ size_t index = mesh->getUVSetIndexByName ( uvSetName ); const COLLADAFW::MeshUVCoords& meshUVCoords = mesh->getUVCoords (); - polyFace.mu[i].uvSet = index; + polyFace.mu[i].uvSet = (int) index; polyFace.mu[i].faceUVCount = numEdges; polyFace.mu[i].uvIdValue = new int [numEdges]; - for ( size_t j=0; j<numEdges; ++j ) + for ( int j=0; j<numEdges; ++j ) { size_t currentIndexPosition = j + uvSetIndicesIndex; unsigned int currentIndex = indexList->getIndex ( currentIndexPosition ); Modified: branches/nextgen/COLLADAMaya/src/COLLADAMayaGeometryPolygonExporter.cpp =================================================================== --- branches/nextgen/COLLADAMaya/src/COLLADAMayaGeometryPolygonExporter.cpp 2009-02-03 08:32:47 UTC (rev 334) +++ branches/nextgen/COLLADAMaya/src/COLLADAMayaGeometryPolygonExporter.cpp 2009-02-03 10:09:27 UTC (rev 335) @@ -967,7 +967,7 @@ // Add symbolic name for the material used on this polygon set. MFnDependencyNode shaderFn ( mShaders[mShaderPosition] ); String shaderName = shaderFn.name().asChar(); - String materialName = mDocumentExporter->mayaNameToColladaName ( shaderFn.name() ); + String materialName = DocumentExporter::mayaNameToColladaName ( shaderFn.name() ); primitivesBasePoly->appendMaterial ( materialName ); } Modified: branches/nextgen/COLLADAMaya/src/COLLADAMayaMaterialExporter.cpp =================================================================== --- branches/nextgen/COLLADAMaya/src/COLLADAMayaMaterialExporter.cpp 2009-02-03 08:32:47 UTC (rev 334) +++ branches/nextgen/COLLADAMaya/src/COLLADAMayaMaterialExporter.cpp 2009-02-03 10:09:27 UTC (rev 335) @@ -197,7 +197,7 @@ if ( status != MStatus::kSuccess ) return; // Get the name of the current material - String materialId = mDocumentExporter->mayaNameToColladaName ( shaderNode.name(), true ); + String materialId = DocumentExporter::mayaNameToColladaName ( shaderNode.name(), true ); // Have we seen this shader before? MaterialMap::iterator materialMapIter; Modified: branches/nextgen/COLLADAMaya/src/COLLADAMayaSceneElement.cpp =================================================================== --- branches/nextgen/COLLADAMaya/src/COLLADAMayaSceneElement.cpp 2009-02-03 08:32:47 UTC (rev 334) +++ branches/nextgen/COLLADAMaya/src/COLLADAMayaSceneElement.cpp 2009-02-03 10:09:27 UTC (rev 335) @@ -17,6 +17,7 @@ #include "COLLADAMayaSceneElement.h" #include "COLLADAMayaExportOptions.h" #include "COLLADAMayaDagHelper.h" +#include "COLLADAMayaDocumentExporter.h" #include <maya/MFnDependencyNode.h> #include <maya/MFnDagNode.h> @@ -34,7 +35,6 @@ , mIsForced ( false ) , mIsVisible ( false ) , mInstantiatedSceneElement ( NULL ) - , mSkeletonId ( "" ) {} //--------------------------------------------------------------- @@ -76,7 +76,7 @@ // Attach a function set MFnDependencyNode fn ( _node ); - mNodeName = fn.name().asChar(); + mNodeName = DocumentExporter::mayaNameToColladaName ( fn.name() ); } return mNodeName; Modified: branches/nextgen/COLLADAMaya/src/COLLADAMayaSceneGraph.cpp =================================================================== --- branches/nextgen/COLLADAMaya/src/COLLADAMayaSceneGraph.cpp 2009-02-03 08:32:47 UTC (rev 334) +++ branches/nextgen/COLLADAMaya/src/COLLADAMayaSceneGraph.cpp 2009-02-03 10:09:27 UTC (rev 335) @@ -248,8 +248,8 @@ MFnDependencyNode fn ( dagPath.node() ); // Get the node name - String nodeName = fn.name().asChar(); - sceneElement->setNodeName ( fn.name().asChar() ); + String nodeName = DocumentExporter::mayaNameToColladaName ( fn.name() ); + sceneElement->setNodeName ( nodeName ); // Check if it's a node to export and // tell the scene node to be transformed or not. Modified: branches/nextgen/COLLADAMaya/src/COLLADAMayaVisualSceneExporter.cpp =================================================================== --- branches/nextgen/COLLADAMaya/src/COLLADAMayaVisualSceneExporter.cpp 2009-02-03 08:32:47 UTC (rev 334) +++ branches/nextgen/COLLADAMaya/src/COLLADAMayaVisualSceneExporter.cpp 2009-02-03 10:09:27 UTC (rev 335) @@ -389,7 +389,7 @@ MObject shadingEngine = shaders[shaderPosition]; MFnDependencyNode shadingEngineFn ( shadingEngine ); String shadingEngineName = shadingEngineFn.name().asChar(); - String materialName = mDocumentExporter->mayaNameToColladaName ( shadingEngineFn.name() ); + String materialName = DocumentExporter::mayaNameToColladaName ( shadingEngineFn.name() ); MStatus status; uint instanceNumber = dagPath.instanceNumber( &status ); CHECK_MSTATUS( status ); @@ -407,7 +407,7 @@ // our own function to write that material to our own data structure for later export. MObject shader = DagHelper::getSourceNodeConnectedTo ( shadingEngine, ATTR_SURFACE_SHADER ); MFnDependencyNode shaderNode ( shader ); - String materialId = mDocumentExporter->mayaNameToColladaName ( shaderNode.name(), true ); + String materialId = DocumentExporter::mayaNameToColladaName ( shaderNode.name(), true ); COLLADASW::InstanceMaterial materialInstance ( materialName, COLLADASW::URI ( "", materialId ) ); instanceMaterialList.push_back ( materialInstance ); @@ -868,10 +868,15 @@ // it needs. This element is meaningless for morph controllers. // Get the skeleton id from the element - String skeletonId = sceneElement->getSkeletonId(); - if ( !skeletonId.empty() ) + const std::set<String>& skeletonIds = sceneElement->getSkeletonIds (); + if ( skeletonIds.size () > 0 ) { - instanceController.addSkeleton( COLLADASW::URI ( "", skeletonId ) ); + std::set<String>::const_iterator it = skeletonIds.begin (); + while ( it != skeletonIds.end () ) + { + instanceController.addSkeleton ( COLLADASW::URI ( "", *it ) ); + ++it; + } } // Write all materials This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jud...@us...> - 2009-02-03 08:33:02
|
Revision: 334 http://colladamaya.svn.sourceforge.net/colladamaya/?rev=334&view=rev Author: judithschenk Date: 2009-02-03 08:32:47 +0000 (Tue, 03 Feb 2009) Log Message: ----------- ticket #2448199 references of non existing visual scenes Modified Paths: -------------- branches/nextgen/COLLADAMaya/include/COLLADAMayaVisualSceneExporter.h branches/nextgen/COLLADAMaya/src/COLLADAMayaDocumentExporter.cpp branches/nextgen/COLLADAMaya/src/COLLADAMayaVisualSceneExporter.cpp Modified: branches/nextgen/COLLADAMaya/include/COLLADAMayaVisualSceneExporter.h =================================================================== --- branches/nextgen/COLLADAMaya/include/COLLADAMayaVisualSceneExporter.h 2009-02-02 16:33:28 UTC (rev 333) +++ branches/nextgen/COLLADAMaya/include/COLLADAMayaVisualSceneExporter.h 2009-02-03 08:32:47 UTC (rev 334) @@ -98,7 +98,7 @@ virtual ~VisualSceneExporter() {}; /** Exports the visual scene with the transforms of all included elements */ - void exportVisualScenes(); + bool exportVisualScenes(); private: Modified: branches/nextgen/COLLADAMaya/src/COLLADAMayaDocumentExporter.cpp =================================================================== --- branches/nextgen/COLLADAMaya/src/COLLADAMayaDocumentExporter.cpp 2009-02-02 16:33:28 UTC (rev 333) +++ branches/nextgen/COLLADAMaya/src/COLLADAMayaDocumentExporter.cpp 2009-02-03 08:32:47 UTC (rev 334) @@ -160,7 +160,7 @@ mGeometryExporter->exportGeometries(); // Export the visual scene - mVisualSceneExporter->exportVisualScenes(); + bool visualSceneExported = mVisualSceneExporter->exportVisualScenes(); // Export the animations const AnimationClipList* animationClips = mAnimationExporter->exportAnimations(); @@ -169,7 +169,7 @@ mAnimationClipExporter->exportAnimationClips ( animationClips ); // Export the scene - exportScene(); + if ( visualSceneExported ) exportScene(); // TODO /* Modified: branches/nextgen/COLLADAMaya/src/COLLADAMayaVisualSceneExporter.cpp =================================================================== --- branches/nextgen/COLLADAMaya/src/COLLADAMayaVisualSceneExporter.cpp 2009-02-02 16:33:28 UTC (rev 333) +++ branches/nextgen/COLLADAMaya/src/COLLADAMayaVisualSceneExporter.cpp 2009-02-03 08:32:47 UTC (rev 334) @@ -70,7 +70,7 @@ // ------------------------------------------------------------ - void VisualSceneExporter::exportVisualScenes() + bool VisualSceneExporter::exportVisualScenes() { // Get the sceneID String sceneID = SceneGraph::SCENE_ID; @@ -107,6 +107,7 @@ // Setup the reference information // GetReferenceManager()->Synchronize(); + return nodeExported; } // --------------------------------------------------------------- This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jud...@us...> - 2009-02-02 16:33:36
|
Revision: 333 http://colladamaya.svn.sourceforge.net/colladamaya/?rev=333&view=rev Author: judithschenk Date: 2009-02-02 16:33:28 +0000 (Mon, 02 Feb 2009) Log Message: ----------- project properties Modified Paths: -------------- branches/nextgen/COLLADAMaya/scripts/COLLADAMaya.vcproj Modified: branches/nextgen/COLLADAMaya/scripts/COLLADAMaya.vcproj =================================================================== --- branches/nextgen/COLLADAMaya/scripts/COLLADAMaya.vcproj 2009-02-02 16:26:17 UTC (rev 332) +++ branches/nextgen/COLLADAMaya/scripts/COLLADAMaya.vcproj 2009-02-02 16:33:28 UTC (rev 333) @@ -1054,7 +1054,7 @@ Name="VCCLCompilerTool" Optimization="2" InlineFunctionExpansion="1" - AdditionalIncludeDirectories="..\include;"$(MAYA_PATH2009)\include";"$(MAYA_PATH2009)\devkit\plug-ins";..\..\COLLADAStreamWriter\include;"$(BOOST_ROOT)";..\..\Externals\Cg\include;..\..\COLLADABaseUtils\include" + AdditionalIncludeDirectories="..\include;"$(MAYA_PATH2009)\include";"$(MAYA_PATH2009)\devkit\plug-ins";"$(BOOST_ROOT)";..\..\COLLADABaseUtils\include;..\..\COLLADAStreamWriter\include;..\..\Externals\Cg\include;..\..\COLLADASaxFrameworkLoader\include;..\..\COLLADAFramework\include;..\..\Externals\MayaDataModel\include;..\..\GeneratedSaxParser\include;..\..\Externals\LibXML\include" PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_AFXDLL;_MBCS;NT_PLUGIN;REQUIRE_IOSTREAM;CM_EXPORTS;GLUT_NO_LIB_PRAGMA;GLUT_NO_WARNING_DISABLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;$(NOINHERIT)" RuntimeLibrary="2" EnableFunctionLevelLinking="false" @@ -1075,10 +1075,10 @@ <Tool Name="VCLinkerTool" AdditionalOptions="/export:initializePlugin /export:uninitializePlugin" - AdditionalDependencies="Foundation.lib OpenMaya.lib OpenMayaAnim.lib OpenMayaRender.lib OpenMayaUI.lib COLLADABaseUtils.lib COLLADAStreamWriter.lib cg.lib cgGL.lib OpenGL32.lib winmm.lib" + AdditionalDependencies="Foundation.lib OpenMaya.lib OpenMayaAnim.lib OpenMayaRender.lib OpenMayaUI.lib COLLADABaseUtils.lib COLLADAStreamWriter.lib COLLADAFramework.lib COLLADASaxFrameworkLoader.lib GeneratedSaxParser.lib cg.lib cgGL.lib OpenGL32.lib winmm.lib" OutputFile="$(OutDir)\$(ProjectName).mll" LinkIncremental="2" - AdditionalLibraryDirectories=""$(MAYA_PATH2009)\lib";"$(BOOST_LIB_PATH)";"..\..\COLLADAStreamWriter\lib\win\$(PlatformName)";"..\..\COLLADABaseUtils\lib\win\$(PlatformName)"" + AdditionalLibraryDirectories=""$(MAYA_PATH2009)\lib";"$(BOOST_LIB_PATH)";"..\..\COLLADAStreamWriter\lib\win\$(PlatformName)";"..\..\COLLADABaseUtils\lib\win\$(PlatformName)";"..\..\COLLADAFramework\lib\win\$(PlatformName)";"..\..\COLLADASaxFrameworkLoader\lib\win\$(PlatformName)";"..\..\GeneratedSaxParser\lib\win\$(PlatformName)"" GenerateManifest="true" IgnoreAllDefaultLibraries="false" IgnoreDefaultLibraryNames="" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jud...@us...> - 2009-02-02 16:26:24
|
Revision: 332 http://colladamaya.svn.sourceforge.net/colladamaya/?rev=332&view=rev Author: judithschenk Date: 2009-02-02 16:26:17 +0000 (Mon, 02 Feb 2009) Log Message: ----------- Multiple uv sets Modified Paths: -------------- branches/nextgen/COLLADAFramework/include/COLLADAFWMesh.h branches/nextgen/COLLADAFramework/include/COLLADAFWMeshPrimitive.h branches/nextgen/COLLADAFramework/include/COLLADAFWMeshUVCoords.h branches/nextgen/COLLADAFramework/include/COLLADAFWTypes.h branches/nextgen/COLLADAFramework/scripts/COLLADAFramework.vcproj branches/nextgen/COLLADAFramework/src/COLLADAFWMesh.cpp branches/nextgen/COLLADAFramework/src/COLLADAFWMeshPrimitive.cpp branches/nextgen/COLLADAMax/scripts/COLLADAMax.vcproj branches/nextgen/COLLADAMaya/include/COLLADAMayaGeometryImporter.h branches/nextgen/COLLADAMaya/include/COLLADAMayaPrerequisites.h branches/nextgen/COLLADAMaya/scripts/COLLADAMaya.vcproj branches/nextgen/COLLADAMaya/src/COLLADAMayaDocumentImporter.cpp branches/nextgen/COLLADAMaya/src/COLLADAMayaGeometryImporter.cpp branches/nextgen/COLLADAMaya/src/COLLADAMayaVisualSceneImporter.cpp branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLMeshLoader.h branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLMeshPrimitiveInputList.h branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLSource.h branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLMeshLoader.cpp branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLMeshPrimitiveInputList.cpp branches/nextgen/Externals/MayaDataModel/include/MayaDMAddMatrix.h branches/nextgen/Externals/MayaDataModel/include/MayaDMBlend.h branches/nextgen/Externals/MayaDataModel/include/MayaDMConnectables.h branches/nextgen/Externals/MayaDataModel/include/MayaDMDoubleShadingSwitch.h branches/nextgen/Externals/MayaDataModel/include/MayaDMEnvBall.h branches/nextgen/Externals/MayaDataModel/include/MayaDMFluidShape.h branches/nextgen/Externals/MayaDataModel/include/MayaDMHardenPoint.h branches/nextgen/Externals/MayaDataModel/include/MayaDMHoldMatrix.h branches/nextgen/Externals/MayaDataModel/include/MayaDMHsvToRgb.h branches/nextgen/Externals/MayaDataModel/include/MayaDMMultMatrix.h branches/nextgen/Externals/MayaDataModel/include/MayaDMParticleCloud.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPassMatrix.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyAverageVertex.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyOptUvs.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyToSubdiv.h branches/nextgen/Externals/MayaDataModel/include/MayaDMQuadShadingSwitch.h branches/nextgen/Externals/MayaDataModel/include/MayaDMRecord.h branches/nextgen/Externals/MayaDataModel/include/MayaDMRemapValue.h branches/nextgen/Externals/MayaDataModel/include/MayaDMReverse.h branches/nextgen/Externals/MayaDataModel/include/MayaDMRgbToHsv.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSampler.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSingleShadingSwitch.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSmear.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSmoothCurve.h branches/nextgen/Externals/MayaDataModel/include/MayaDMTexture2d.h branches/nextgen/Externals/MayaDataModel/include/MayaDMTexture3d.h branches/nextgen/Externals/MayaDataModel/include/MayaDMTimeFunction.h branches/nextgen/Externals/MayaDataModel/include/MayaDMTripleShadingSwitch.h branches/nextgen/Externals/MayaDataModel/include/MayaDMTypes.h branches/nextgen/Externals/MayaDataModel/include/MayaDMUnitToTimeConversion.h branches/nextgen/Externals/MayaDataModel/include/MayaDMWtAddMatrix.h branches/nextgen/GeneratedSaxParser/src/GeneratedSaxParserCoutErrorHandler.cpp Added Paths: ----------- branches/nextgen/COLLADAFramework/include/COLLADAFWIndexList.h branches/nextgen/Externals/MayaDataModel/include/MayaDMCommands.h Added: branches/nextgen/COLLADAFramework/include/COLLADAFWIndexList.h =================================================================== --- branches/nextgen/COLLADAFramework/include/COLLADAFWIndexList.h (rev 0) +++ branches/nextgen/COLLADAFramework/include/COLLADAFWIndexList.h 2009-02-02 16:26:17 UTC (rev 332) @@ -0,0 +1,81 @@ +/* + Copyright (c) 2008 NetAllied Systems GmbH + + This file is part of COLLADAFramework. + + Licensed under the MIT Open Source License, + for details please see LICENSE file or the website + http://www.opensource.org/licenses/mit-license.php +*/ + +#ifndef __COLLADAFW_INDEXLIST_H__ +#define __COLLADAFW_INDEXLIST_H__ + +#include "COLLADAFWPrerequisites.h" +#include "COLLADAFWTypes.h" + + +namespace COLLADAFW +{ + + class IndexList + { + private: + size_t mInputSetIndex; + String mInputSetName; + UIntValuesArray mUVCoordIndices; + size_t mStride; + size_t mInitialIndex; + + public: + IndexList () + : mInputSetIndex (0) + , mInputSetName ("") + , mUVCoordIndices (0) + , mStride (0) + , mInitialIndex (0) + {} + IndexList ( size_t inputSet, size_t stride, UIntValuesArray& uvCoordIndices ) + : mInputSetIndex (inputSet) + , mInputSetName ("") + , mUVCoordIndices (uvCoordIndices) + , mStride (stride) + , mInitialIndex (0) + {} + virtual ~IndexList () {} + + UIntValuesArray& getIndices () { return mUVCoordIndices; } + unsigned int getIndex ( size_t index ) const { return mUVCoordIndices [index]; } + unsigned int getIndex ( size_t index ) { return mUVCoordIndices [index]; } + size_t getIndicesCount () const { return mUVCoordIndices.getCount (); } + size_t getIndicesCount () { return mUVCoordIndices.getCount (); } + + void setInputSetIndex ( size_t inputSet ) { mInputSetIndex = inputSet; } + size_t getInputSetIndex () { return mInputSetIndex; } + + void setStride ( size_t stride ) { mStride = stride; } + size_t getStride () { return mStride; } + + const COLLADAFW::String& getInputSetName () const { return mInputSetName; } + void setInputSetName ( const COLLADAFW::String& val ) { mInputSetName = val; } + + const size_t getInitialIndex () const { return mInitialIndex; } + void setInitialIndex ( const size_t val ) { mInitialIndex = val; } + + private: + + /** Disable default copy ctor. */ + IndexList( const IndexList& pre ); + + /** Disable default assignment operator. */ + const IndexList& operator= ( const IndexList& pre ); + }; + + + typedef ArrayPrimitiveType<IndexList*> IndexListArray; + + + +} // namespace COLLADAFW + +#endif // __COLLADAFW_INDEXLIST_H__ Modified: branches/nextgen/COLLADAFramework/include/COLLADAFWMesh.h =================================================================== --- branches/nextgen/COLLADAFramework/include/COLLADAFWMesh.h 2009-01-29 10:02:52 UTC (rev 331) +++ branches/nextgen/COLLADAFramework/include/COLLADAFWMesh.h 2009-02-02 16:26:17 UTC (rev 332) @@ -19,7 +19,9 @@ #include "COLLADAFWMeshUVCoords.h" #include "COLLADAFWMeshPrimitive.h" +#include "COLLADABUUtils.h" + namespace COLLADAFW { @@ -60,7 +62,7 @@ */ MeshNormals mNormals; - /** TODO support multiple color sets + /** * The colors array. * Colors can be stored as float or double values. * Colors can have different strides (RGB or RGBA parameters). We need to store this @@ -68,11 +70,9 @@ */ MeshColors mColors; - /** TODO support multiple uv sets - * The uv coordinates array. + /** + * The 2 dimensional uv coordinates array. * UV coordinates can be stored as float or double values. - * UV coordinates can have different strides (ST, STU, STUV parameters). We need to store - * this information! */ MeshUVCoords mUVCoords; @@ -92,7 +92,6 @@ /** Destructor. */ virtual ~Mesh (); - /** * The positions array. * Positions can be stored as float or double values. @@ -176,35 +175,33 @@ */ void setColors ( MeshColors& Colors ) { mColors = Colors; } - /**Checks, if the mesh has colors.*/ - bool hasColors ( )const; - /** - * The uv coordinates array. + * The 2 dimensional uv coordinates array. * UV coordinates can be stored as float or double values. - * UV coordinates have always a stride of three (X, Y and Z parameter). We don't need to store - * this information. */ const MeshUVCoords& getUVCoords () const { return mUVCoords; } /** - * The uv coordinates array. + * The 2 dimensional uv coordinates array. * UV coordinates can be stored as float or double values. - * UV coordinates have always a stride of three (X, Y and Z parameter). We don't need to store - * this information. */ MeshUVCoords& getUVCoords () { return mUVCoords; } - /** - * The uv coordinates array. - * UV coordinates can be stored as float or double values. - * UV coordinates have always a stride of three (X, Y and Z parameter). We don't need to store - * this information. - */ - void setUVCoords ( MeshUVCoords& UVCoords ) { mUVCoords = UVCoords; } + /** + * Returns the uv set with the name. + */ + size_t getUVSetIndexByName ( const String& name ) const + { + for ( size_t index=0; index<mUVCoords.getUVCoordsCount (); ++index ) + { + if ( COLLADABU::Utils::equals ( name, mUVCoords.getUVSetName ( index ) ) ) + return index; + } + std::cerr << "No uv set with name \"" << name << "\"!" << std::endl; + assert ( true ); - /**Checks, if the mesh has UVCoords.*/ - bool hasUVCoords ( )const; + return 0; + } /** * Geometric primitives, which assemble values from the inputs into vertex attribute data. Modified: branches/nextgen/COLLADAFramework/include/COLLADAFWMeshPrimitive.h =================================================================== --- branches/nextgen/COLLADAFramework/include/COLLADAFWMeshPrimitive.h 2009-01-29 10:02:52 UTC (rev 331) +++ branches/nextgen/COLLADAFramework/include/COLLADAFWMeshPrimitive.h 2009-02-02 16:26:17 UTC (rev 332) @@ -15,6 +15,7 @@ #include "COLLADAFWConstants.h" #include "COLLADAFWTypes.h" #include "COLLADAFWEdge.h" +#include "COLLADAFWIndexList.h" #include <map> #include <vector> @@ -106,16 +107,16 @@ */ UIntValuesArray mNormalIndices; - /** + /** TODO support multiple color sets * The index list of the colors array. */ UIntValuesArray mColorIndices; /** - * The index list of the uv coordinates array. + * The index list of the uv coordinates array (support of multiple uv sets). */ - UIntValuesArray mUVCoordIndices; - + IndexListArray mUVCoordIndicesArray; + public: /** @@ -208,14 +209,34 @@ /** * The index list of the uv coordinates array. */ - COLLADAFW::UIntValuesArray& getUVCoordIndices () { return mUVCoordIndices; } + IndexListArray& getUVCoordIndicesArray () { return mUVCoordIndicesArray; } /** * The index list of the uv coordinates array. */ - void setUVCoordIndices ( const COLLADAFW::UIntValuesArray& UVCoordIndices ) { mUVCoordIndices = UVCoordIndices; } + const IndexListArray& getUVCoordIndicesArray () const { return mUVCoordIndicesArray; } + /** + * The index list of the uv coordinates array. + */ + IndexList* getUVCoordIndices ( size_t index ) + { + return mUVCoordIndicesArray [ index ]; + } + /** + * The index list of the uv coordinates array. + */ + const IndexList* getUVCoordIndices ( size_t index ) const + { + return mUVCoordIndicesArray [ index ]; + } + + /** + * The index list of the uv coordinates array. + */ + void appendUVCoordIndices ( IndexList* uvCoordIndices ) { mUVCoordIndicesArray.append ( uvCoordIndices ); } + /** @return The material id of the sub mesh. This material id is used to assign material to submeshes when the mesh gets instantiated.*/ COLLADAFW::MaterialId getMaterialId() const { return mMaterialId; } Modified: branches/nextgen/COLLADAFramework/include/COLLADAFWMeshUVCoords.h =================================================================== --- branches/nextgen/COLLADAFramework/include/COLLADAFWMeshUVCoords.h 2009-01-29 10:02:52 UTC (rev 331) +++ branches/nextgen/COLLADAFramework/include/COLLADAFWMeshUVCoords.h 2009-02-02 16:26:17 UTC (rev 332) @@ -12,6 +12,7 @@ #define __COLLADAFW_MESHUVCOORDS_H__ #include "COLLADAFWPrerequisites.h" +#include <assert.h> namespace COLLADAFW @@ -20,27 +21,103 @@ /** TODO Documentation */ class MeshUVCoords : public MeshFloatDoubleInputs { - private: + public: + + struct UVSetInfo + { + String mName; + size_t mStride; + size_t mLength; + }; + + private: - /** The stride can differ, so we have to set. */ - unsigned long long mStride; + /** Array with the UVSetInfos. */ + ArrayPrimitiveType<UVSetInfo*> mUVSetInfos; public: /** Constructor. */ - MeshUVCoords() : MeshFloatDoubleInputs () {}; + MeshUVCoords () + : MeshFloatDoubleInputs () + , mUVSetInfos (0) + {} /** Constructor. */ - MeshUVCoords ( DataType type ) : MeshFloatDoubleInputs ( type ) {} + MeshUVCoords ( DataType type ) + : MeshFloatDoubleInputs ( type ) + , mUVSetInfos (0) + {} /** Destructor. */ - virtual ~MeshUVCoords() {}; + virtual ~MeshUVCoords() {} - /** The stride can differ, so we have to set. */ - unsigned long long getStride () const { return mStride; } + /** + * Returns the number of uv sets. + */ + size_t getNumUVSets () const { return mUVSetInfos.getCount (); } + /** + * Appends the values in the array on the list of values and stores the information + * of the current input. + * @param const FloatArray& valuesArray The list of values. + * @param const String& name The name of the current element. + * @param const size_t stride The data stride. + */ + void appendUVSet ( const FloatArray& valuesArray, const String& name, const size_t stride ) + { + setType ( DATA_TYPE_FLOAT ); + appendValues ( valuesArray ); + + UVSetInfo* uvSetInfo = new UVSetInfo(); + uvSetInfo->mLength = valuesArray.getCount (); + uvSetInfo->mName = name; + uvSetInfo->mStride = stride; + + mUVSetInfos.append ( uvSetInfo ); + } + + /** + * Appends the values in the array on the list of values and stores the information + * of the current input. + * @param const FloatArray& valuesArray The list of values. + * @param const String& name The name of the current element. + * @param const size_t stride The data stride. + */ + void appendUVSet ( const DoubleArray& valuesArray, const String& name, const size_t stride ) + { + setType ( DATA_TYPE_DOUBLE ); + appendValues ( valuesArray ); + + UVSetInfo* uvSetInfo = new UVSetInfo(); + uvSetInfo->mLength = valuesArray.getCount (); + uvSetInfo->mName = name; + uvSetInfo->mStride = stride; + +// if ( mUVSetInfos.getCount() <= 0 ) mUVSetInfos.setData ( uvSetInfo, ); + mUVSetInfos.append ( uvSetInfo ); + } + + /** The stride at the specified index. */ + String getUVSetName ( size_t index ) const + { + assert ( index <= mUVSetInfos.getCount() ); + return mUVSetInfos[index]->mName; + } + + /** The stride at the specified index. */ + size_t getStride ( size_t index ) const + { + assert ( index <= mUVSetInfos.getCount() ); + return mUVSetInfos[index]->mStride; + } + /** The stride can differ, so we have to set. */ - void setStride ( unsigned long long Stride ) { mStride = Stride; } + size_t getLength ( size_t index ) const + { + assert ( index <= mUVSetInfos.getCount() ); + return mUVSetInfos[index]->mLength; + } /** Returns the position values array as a template array. */ template <class T> Modified: branches/nextgen/COLLADAFramework/include/COLLADAFWTypes.h =================================================================== --- branches/nextgen/COLLADAFramework/include/COLLADAFWTypes.h 2009-01-29 10:02:52 UTC (rev 331) +++ branches/nextgen/COLLADAFramework/include/COLLADAFWTypes.h 2009-02-02 16:26:17 UTC (rev 332) @@ -14,10 +14,10 @@ #include "COLLADAFWPrerequisites.h" #include "COLLADAFWArrayPrimitiveType.h" + namespace COLLADAFW { - - /** An array of unsigned int values. */ + /** An array of unsigned int values. */ typedef ArrayPrimitiveType<unsigned int> UIntValuesArray; typedef ArrayPrimitiveType<int> IntValuesArray; Modified: branches/nextgen/COLLADAFramework/scripts/COLLADAFramework.vcproj =================================================================== --- branches/nextgen/COLLADAFramework/scripts/COLLADAFramework.vcproj 2009-01-29 10:02:52 UTC (rev 331) +++ branches/nextgen/COLLADAFramework/scripts/COLLADAFramework.vcproj 2009-02-02 16:26:17 UTC (rev 332) @@ -490,6 +490,10 @@ > </File> <File + RelativePath="..\include\COLLADAFWIndexList.h" + > + </File> + <File RelativePath="..\include\COLLADAFWInstanceEffect.h" > </File> Modified: branches/nextgen/COLLADAFramework/src/COLLADAFWMesh.cpp =================================================================== --- branches/nextgen/COLLADAFramework/src/COLLADAFWMesh.cpp 2009-01-29 10:02:52 UTC (rev 331) +++ branches/nextgen/COLLADAFramework/src/COLLADAFWMesh.cpp 2009-02-02 16:26:17 UTC (rev 332) @@ -1,11 +1,11 @@ /* -Copyright (c) 2008 NetAllied Systems GmbH + Copyright (c) 2008 NetAllied Systems GmbH -This file is part of COLLADAFramework. + This file is part of COLLADAFramework. -Licensed under the MIT Open Source License, -for details please see LICENSE file or the website -http://www.opensource.org/licenses/mit-license.php + Licensed under the MIT Open Source License, + for details please see LICENSE file or the website + http://www.opensource.org/licenses/mit-license.php */ #include "COLLADAFWStableHeaders.h" @@ -17,8 +17,8 @@ //---------------------------------- Mesh::Mesh( ObjectId objectId ) - : Geometry ( objectId, Geometry::GEO_TYPE_MESH ), - mMeshPrimitives(MeshPrimitiveArray::OWNER) + : Geometry ( objectId, Geometry::GEO_TYPE_MESH ) + , mMeshPrimitives(MeshPrimitiveArray::OWNER) { } @@ -175,18 +175,6 @@ } //---------------------------------- - bool Mesh::hasColors( ) const - { - return getColors().getColorsCount() != 0; - } - - //---------------------------------- - bool Mesh::hasUVCoords() const - { - return getColors().getColorsCount() != 0; - } - - //---------------------------------- const size_t Mesh::getFacesCount() const { // The number of normals in the current mesh. Modified: branches/nextgen/COLLADAFramework/src/COLLADAFWMeshPrimitive.cpp =================================================================== --- branches/nextgen/COLLADAFramework/src/COLLADAFWMeshPrimitive.cpp 2009-01-29 10:02:52 UTC (rev 331) +++ branches/nextgen/COLLADAFramework/src/COLLADAFWMeshPrimitive.cpp 2009-02-02 16:26:17 UTC (rev 332) @@ -25,7 +25,7 @@ , mPositionIndices(UIntValuesArray::OWNER) , mNormalIndices(UIntValuesArray::OWNER) , mColorIndices(UIntValuesArray::OWNER) - , mUVCoordIndices(UIntValuesArray::OWNER) + , mUVCoordIndicesArray(UIntValuesArray::OWNER) , mFaceCount ( 0 ) { } @@ -36,7 +36,7 @@ , mPositionIndices(UIntValuesArray::OWNER) , mNormalIndices(UIntValuesArray::OWNER) , mColorIndices(UIntValuesArray::OWNER) - , mUVCoordIndices(UIntValuesArray::OWNER) + , mUVCoordIndicesArray(UIntValuesArray::OWNER) , mFaceCount ( 0 ) { } Modified: branches/nextgen/COLLADAMax/scripts/COLLADAMax.vcproj =================================================================== --- branches/nextgen/COLLADAMax/scripts/COLLADAMax.vcproj 2009-01-29 10:02:52 UTC (rev 331) +++ branches/nextgen/COLLADAMax/scripts/COLLADAMax.vcproj 2009-02-02 16:26:17 UTC (rev 332) @@ -2254,10 +2254,6 @@ > </File> </Filter> - <File - RelativePath="..\res\error.fx" - > - </File> </Files> <Globals> </Globals> Modified: branches/nextgen/COLLADAMaya/include/COLLADAMayaGeometryImporter.h =================================================================== --- branches/nextgen/COLLADAMaya/include/COLLADAMayaGeometryImporter.h 2009-01-29 10:02:52 UTC (rev 331) +++ branches/nextgen/COLLADAMaya/include/COLLADAMayaGeometryImporter.h 2009-02-02 16:26:17 UTC (rev 332) @@ -102,6 +102,47 @@ const std::map<COLLADAFW::Edge,size_t>& edgeIndicesMap, MayaDM::Mesh &meshNode ); + /** + * Set the face infos into the maya poly face element. + */ + void setFaceInfos ( + const COLLADAFW::Mesh* mesh, + const COLLADAFW::MeshPrimitive* primitiveElement, + const std::map<COLLADAFW::Edge,size_t>& edgeIndicesMap, + MayaDM::polyFaces &polyFace, + int &numEdges, + size_t &positionIndex, + std::vector<COLLADABU::Math::Vector3*> &polygonPoints ); + + void setFaceInfo ( + const COLLADAFW::Mesh* mesh, + const COLLADAFW::MeshPrimitive* primitiveElement, + const std::map<COLLADAFW::Edge,size_t>& edgeIndicesMap, + MayaDM::polyFaces &polyFace, + int & numEdges, + size_t & positionIndex, + std::vector<COLLADABU::Math::Vector3*> &polygonPoints ); + + void setHoleInfo ( + const COLLADAFW::Mesh* mesh, + const COLLADAFW::MeshPrimitive* primitiveElement, + const std::map<COLLADAFW::Edge,size_t>& edgeIndicesMap, + MayaDM::polyFaces &polyFace, + int &numEdges, + size_t &positionIndex, + std::vector<COLLADABU::Math::Vector3*> & polygonPoints ); + + /** + * Set the uv set infos into the maya poly face element. + * Increments the initial value for the uv set indices index. + */ + void setUVSetInfos ( + const COLLADAFW::Mesh* mesh, + const COLLADAFW::MeshPrimitive* primitiveElement, + MayaDM::polyFaces &polyFace, + size_t& uvSetIndicesIndex, + const int numEdges ); + /* * Changes the orientation of a polyFace hole element. */ Modified: branches/nextgen/COLLADAMaya/include/COLLADAMayaPrerequisites.h =================================================================== --- branches/nextgen/COLLADAMaya/include/COLLADAMayaPrerequisites.h 2009-01-29 10:02:52 UTC (rev 331) +++ branches/nextgen/COLLADAMaya/include/COLLADAMayaPrerequisites.h 2009-02-02 16:26:17 UTC (rev 332) @@ -41,7 +41,7 @@ #define CHECK_STAT(X) \ if ( (X) != MS::kSuccess) { \ - std::cout << __FILE__ << ":" << __LINE__ << std::endl; \ + std::cerr << __FILE__ << ":" << __LINE__ << std::endl; \ MGlobal::displayError ( status.errorString() ); \ return (X); \ } Modified: branches/nextgen/COLLADAMaya/scripts/COLLADAMaya.vcproj =================================================================== --- branches/nextgen/COLLADAMaya/scripts/COLLADAMaya.vcproj 2009-01-29 10:02:52 UTC (rev 331) +++ branches/nextgen/COLLADAMaya/scripts/COLLADAMaya.vcproj 2009-02-02 16:26:17 UTC (rev 332) @@ -45,7 +45,7 @@ Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="..\include;"$(MAYA_PATH2008)\include";"$(MAYA_PATH2008)\devkit\plug-ins";"$(BOOST_ROOT)";..\..\COLLADABaseUtils\include;..\..\COLLADAStreamWriter\include;..\..\Externals\Cg\include;..\..\COLLADASaxFrameworkLoader\include;..\..\COLLADAFramework\include;..\..\Externals\MayaDataModel\include;..\..\GeneratedSaxParser\include;..\..\Externals\LibXML\include" - PreprocessorDefinitions="CREATE_IMPORT_PLUGIN;WIN32;_DEBUG;_WINDOWS;_AFXDLL;_MBCS;NT_PLUGIN;REQUIRE_IOSTREAM;CM_EXPORTS;GLUT_NO_LIB_PRAGMA;GLUT_NO_WARNING_DISABLE;_CRT_NONSTDC_NO_DEPRECATE;$(NOINHERIT)" + PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_AFXDLL;_MBCS;NT_PLUGIN;REQUIRE_IOSTREAM;CM_EXPORTS;GLUT_NO_LIB_PRAGMA;GLUT_NO_WARNING_DISABLE;_CRT_NONSTDC_NO_DEPRECATE;$(NOINHERIT)" BasicRuntimeChecks="3" RuntimeLibrary="3" RuntimeTypeInfo="true" @@ -885,7 +885,7 @@ Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="..\include;"$(MAYA_PATH2009)\include";"$(MAYA_PATH2009)\devkit\plug-ins";"$(BOOST_ROOT)";..\..\COLLADABaseUtils\include;..\..\COLLADAStreamWriter\include;..\..\Externals\Cg\include;..\..\COLLADASaxFrameworkLoader\include;..\..\COLLADAFramework\include;..\..\Externals\MayaDataModel\include;..\..\GeneratedSaxParser\include;..\..\Externals\LibXML\include" - PreprocessorDefinitions="CREATE_IMPORT_PLUGIN;WIN32;_DEBUG;_WINDOWS;_AFXDLL;_MBCS;NT_PLUGIN;REQUIRE_IOSTREAM;CM_EXPORTS;GLUT_NO_LIB_PRAGMA;GLUT_NO_WARNING_DISABLE;_CRT_NONSTDC_NO_DEPRECATE;$(NOINHERIT)" + PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_AFXDLL;_MBCS;NT_PLUGIN;REQUIRE_IOSTREAM;CM_EXPORTS;GLUT_NO_LIB_PRAGMA;GLUT_NO_WARNING_DISABLE;_CRT_NONSTDC_NO_DEPRECATE;$(NOINHERIT)" BasicRuntimeChecks="3" RuntimeLibrary="3" RuntimeTypeInfo="true" @@ -2062,7 +2062,7 @@ UseUnicodeResponseFiles="true" Optimization="0" AdditionalIncludeDirectories="..\include;"$(MAYA_PATH2009)\include";"$(MAYA_PATH2009)\devkit\plug-ins";"$(BOOST_ROOT)";..\..\COLLADABaseUtils\include;..\..\COLLADAStreamWriter\include;..\..\Externals\Cg\include;..\..\COLLADASaxFrameworkLoader\include;..\..\COLLADAFramework\include;..\..\Externals\MayaDataModel\include;..\..\GeneratedSaxParser\include;..\..\Externals\LibXML\include" - PreprocessorDefinitions="CREATE_IMPORT_PLUGIN;CREATE_IMPORT_PLUGIN;WIN32;_DEBUG;_WINDOWS;_AFXDLL;_MBCS;NT_PLUGIN;REQUIRE_IOSTREAM;CM_EXPORTS;GLUT_NO_LIB_PRAGMA;GLUT_NO_WARNING_DISABLE;_CRT_NONSTDC_NO_DEPRECATE;$(NOINHERIT)" + PreprocessorDefinitions="CREATE_IMPORT_PLUGIN;WIN32;_DEBUG;_WINDOWS;_AFXDLL;_MBCS;NT_PLUGIN;REQUIRE_IOSTREAM;CM_EXPORTS;GLUT_NO_LIB_PRAGMA;GLUT_NO_WARNING_DISABLE;_CRT_NONSTDC_NO_DEPRECATE;$(NOINHERIT)" BasicRuntimeChecks="3" RuntimeLibrary="3" RuntimeTypeInfo="true" Modified: branches/nextgen/COLLADAMaya/src/COLLADAMayaDocumentImporter.cpp =================================================================== --- branches/nextgen/COLLADAMaya/src/COLLADAMayaDocumentImporter.cpp 2009-01-29 10:02:52 UTC (rev 331) +++ branches/nextgen/COLLADAMaya/src/COLLADAMayaDocumentImporter.cpp 2009-02-02 16:26:17 UTC (rev 332) @@ -153,7 +153,7 @@ // TODO String mayaVersion ( MGlobal::mayaVersion ().asChar () ); -// fprintf_s ( mFile, "//Maya ASCII %s scene\n", mayaVersion.c_str () ); + fprintf_s ( mFile, "//Maya ASCII %s scene\n", mayaVersion.c_str () ); // fprintf_s ( mFile, "//Name: %s\n", mMayaAsciiFileURI.getPathFile ().c_str () ); // std::stringstream curDate; Modified: branches/nextgen/COLLADAMaya/src/COLLADAMayaGeometryImporter.cpp =================================================================== --- branches/nextgen/COLLADAMaya/src/COLLADAMayaGeometryImporter.cpp 2009-01-29 10:02:52 UTC (rev 331) +++ branches/nextgen/COLLADAMaya/src/COLLADAMayaGeometryImporter.cpp 2009-02-02 16:26:17 UTC (rev 332) @@ -26,6 +26,7 @@ #include "MayaDMTransform.h" #include "MayaDMPolyCube.h" +#include "MayaDMCommands.h" #include "COLLADAFWPolygons.h" @@ -115,6 +116,66 @@ } // -------------------------------------------- + bool GeometryImporter::createMesh ( + const COLLADAFW::Mesh* mesh, + MayaNode* mayaTransformNode ) + { + // Create a unique name. + String meshName = mMeshNodeIdList.addId ( mesh->getName () ); + + // Create a maya node object of the current node and push it into the map. + const COLLADAFW::UniqueId& uniqueId = mesh->getUniqueId (); + MayaNode mayaMeshNode ( uniqueId, meshName, mayaTransformNode ); + mMayaMeshNodesMap [ uniqueId ] = mayaMeshNode; + + // Get the parent node name. + assert ( mayaTransformNode != NULL ); + String transformNodePath = mayaTransformNode->getNodePath (); + + // Create the current mesh node. + FILE* file = getDocumentImporter ()->getFile (); + MayaDM::Mesh meshNode ( file, mesh->getName (), transformNodePath ); + + // Write the vertex positions. + // Just write the values, they will be referenced from the edges and the faces. + if ( !writeVertexPositions ( mesh, meshNode ) ) return false; + + // Write the normals. + if ( !writeNormals ( mesh, meshNode ) ) return false; + + // Write the uv corrdinates. + writeUVCoords ( mesh, meshNode ); + + // The vector of edge indices. We use it to write the list of edges into + // the maya file. The vector is already sorted. + std::vector<COLLADAFW::Edge> edgeIndices; + + // We store the edge indices also in a sorted map. The dublicate data holding + // is reasonable, because we need the index of a given edge. The search of + // values in a map is much faster than in a vector! + std::map<COLLADAFW::Edge,size_t> edgeIndicesMap; + + // Implementation for multiple primitive elements. + const COLLADAFW::MeshPrimitiveArray& primitiveElementsArray = mesh->getMeshPrimitives (); + size_t count = primitiveElementsArray.getCount (); + for ( size_t i=0; i<count; ++i ) + { + COLLADAFW::MeshPrimitive* primitiveElement = primitiveElementsArray [ i ]; + + // Determine the edge indices (unique edges, also for multiple primitive elements). + primitiveElement->appendEdgeIndices ( edgeIndices, edgeIndicesMap ); + } + + // Write the edge indices of all primitive elements into the maya file. + writeEdges ( edgeIndices, meshNode ); + + // Write the face informations of all primitive elements into the maya file. + writeFaces ( mesh, edgeIndicesMap, meshNode ); + + return true; + } + + // -------------------------------------------- bool GeometryImporter::getEdgeIndex ( const COLLADAFW::Edge& edge, const std::map<COLLADAFW::Edge,size_t>& edgeIndicesMap, @@ -128,7 +189,7 @@ MString message ( "Edge not found: " ); message += edge[0] + ", " + edge[1]; MGlobal::displayError ( message ); std::cerr << message.asChar () << std::endl; - return false; + assert ( it != edgeIndicesMap.end() ); } edgeIndex = (int)it->second; if ( edge.isReverse() ) edgeIndex = -( edgeIndex + 1 ); @@ -265,35 +326,67 @@ // -------------------------------------------- bool GeometryImporter::writeUVCoords ( const COLLADAFW::Mesh* mesh, MayaDM::Mesh &meshNode ) { + // Set the number of uv sets. const COLLADAFW::MeshUVCoords& uvCoords = mesh->getUVCoords (); - size_t stride = (size_t)uvCoords.getStride (); + size_t sumUVSetPoints = uvCoords.getNumUVSets (); + if ( sumUVSetPoints == 0 ) return false; + meshNode.setUvSize ( sumUVSetPoints ); + + // Write the values + size_t initialIndex = 0; const COLLADAFW::MeshFloatDoubleInputs::DataType type = uvCoords.getType (); switch ( type ) { case COLLADAFW::MeshFloatDoubleInputs::DATA_TYPE_FLOAT: { const COLLADAFW::ArrayPrimitiveType<float>* values = uvCoords.getFloatUVCoords (); - size_t count = uvCoords.getUVCoordsCount (); - meshNode.startUvSetPoints ( 0, 0, (count/2)-1 ); - for ( size_t i=0, index=0; i<count; i+=stride, ++index ) + for ( size_t i=0; i<sumUVSetPoints; ++i ) { - meshNode.appendUvSetPoints ( (*values)[i] ); - meshNode.appendUvSetPoints ( (*values)[i+1] ); + meshNode.setUvSetName ( i, uvCoords.getUVSetName ( i ) ); + + size_t stride = uvCoords.getStride ( i ); + assert ( stride > 1 && stride <= 4 ); + if ( stride != 2 ) MGlobal::displayWarning ( "Just 2d uv set data will be imported! "); + + size_t indicesCount = uvCoords.getLength ( i ); + meshNode.startUvSetPoints ( i, 0, (indicesCount/stride)-1 ); + + unsigned int index = 0; + for ( size_t i=0; i<indicesCount; i+=stride ) + { + meshNode.appendUvSetPoints ( (*values)[initialIndex+i] ); + meshNode.appendUvSetPoints ( (*values)[initialIndex+i+1] ); + } + meshNode.endUvSetPoints (); + + initialIndex += indicesCount; } - meshNode.endUvSetPoints (); + break; } - break; case COLLADAFW::MeshFloatDoubleInputs::DATA_TYPE_DOUBLE: { const COLLADAFW::ArrayPrimitiveType<double>* values = uvCoords.getDoubleUVCoords (); - size_t count = uvCoords.getUVCoordsCount (); - meshNode.startUvSetPoints ( 0, 0, (count/2)-1 ); - for ( size_t i=0, index=0; i<count; i+=stride, ++index ) + for ( size_t i=0; i<sumUVSetPoints; ++i ) { - meshNode.appendUvSetPoints ( (float)(*values)[i] ); - meshNode.appendUvSetPoints ( (float)(*values)[i+1] ); + meshNode.setUvSetName ( i, uvCoords.getUVSetName ( i ) ); + + size_t stride = uvCoords.getStride ( i ); + assert ( stride > 1 && stride <= 4 ); + if ( stride != 2 ) MGlobal::displayWarning ( "Just 2d uv set data will be imported! "); + + size_t indicesCount = uvCoords.getLength ( i ); + meshNode.startUvSetPoints ( i, 0, (indicesCount/stride)-1 ); + + unsigned int index = 0; + for ( size_t i=0; i<indicesCount; i+=stride ) + { + meshNode.appendUvSetPoints ( (*values)[initialIndex+i] ); + meshNode.appendUvSetPoints ( (*values)[initialIndex+i+1] ); + } + meshNode.endUvSetPoints (); + + initialIndex += indicesCount; } - meshNode.endUvSetPoints (); } break; default: @@ -301,6 +394,91 @@ return false; } + +// // The current uv set points list index +// size_t currentUVSetPoint = 0; +// +// // We have to go through every mesh primitive and write the list of uv values +// // for the index list in the maya document. +// const COLLADAFW::MeshPrimitiveArray& meshPrimitives = mesh->getMeshPrimitives (); +// for ( size_t i=0; i<count; ++i ) +// { +// // Get the current primitive element. +// const COLLADAFW::MeshPrimitive* meshPrimitive = meshPrimitives [ i ]; +// +// // Write the index values for every tex coord index list of the current primitive. +// const COLLADAFW::IndexListArray& uvCoordIndicesArray = meshPrimitive->getUVCoordIndicesArray (); +// size_t numPrimitiveUVCoords = uvCoordIndicesArray.getCount (); +// for ( size_t j=0; j<numPrimitiveUVCoords; ++j, ++currentUVSetPoint ) +// { +// COLLADAFW::IndexList* uvCoordIndexList = uvCoordIndicesArray [j]; +// size_t indicesCount = uvCoordIndexList->getIndicesCount (); +// size_t stride = uvCoordIndexList->getStride (); +// size_t uvSetIndex = uvCoordIndexList->getInputSetIndex (); +// String uvSetName = uvCoordIndexList->getInputSetName (); +// meshNode.setUvSetName ( currentUVSetPoint, uvSetName ); +// +// // Get the values depend on the dimension. +// const COLLADAFW::MeshUVCoords* uvCoords; +// switch ( stride ) +// { +// case 2: uvCoords = &mesh->getUVCoords2d (); break; +// case 3: +// { +// uvCoords = &mesh->getUVCoords3d (); +// MGlobal::displayWarning ( "3d uv coordinates not supported! Just 2d data will be imported! "); +// break; +// } +// case 4: +// { +// uvCoords = &mesh->getUVCoords4d (); +// MGlobal::displayWarning ( "4d uv coordinates not supported! Just 2d data will be imported! "); +// break; +// } +// default: assert ( stride < 2 || stride > 4 ); +// } +// +// // Write the values list. +// const COLLADAFW::MeshFloatDoubleInputs::DataType type = uvCoords->getType (); +// switch ( type ) +// { +// case COLLADAFW::MeshFloatDoubleInputs::DATA_TYPE_FLOAT: +// { +// const COLLADAFW::ArrayPrimitiveType<float>* values = uvCoords->getFloatUVCoords (); +// meshNode.startUvSetPoints ( currentUVSetPoint, 0, (indicesCount/2)-1 ); +// unsigned int index = 0; +// for ( size_t i=0; i<indicesCount; i+=stride ) +// { +// index = uvCoordIndexList->getIndex ( i ); +// meshNode.appendUvSetPoints ( (*values)[index] ); +// index = uvCoordIndexList->getIndex ( i+1 ); +// meshNode.appendUvSetPoints ( (*values)[index] ); +// } +// meshNode.endUvSetPoints (); +// } +// break; +// case COLLADAFW::MeshFloatDoubleInputs::DATA_TYPE_DOUBLE: +// { +// const COLLADAFW::ArrayPrimitiveType<double>* values = uvCoords->getDoubleUVCoords (); +// meshNode.startUvSetPoints ( currentUVSetPoint, 0, (indicesCount/2)-1 ); +// unsigned int index = 0; +// for ( size_t i=0; i<indicesCount; i+=stride ) +// { +// index = uvCoordIndexList->getIndex ( i ); +// meshNode.appendUvSetPoints ( (*values)[index] ); +// index = uvCoordIndexList->getIndex ( i+1 ); +// meshNode.appendUvSetPoints ( (*values)[index] ); +// } +// meshNode.endUvSetPoints (); +// } +// break; +// default: +// std::cerr << "No valid data type for uv coordinates: " << type << std::endl; +// return false; +// } +// } +// } + return true; } @@ -370,15 +548,9 @@ const std::map<COLLADAFW::Edge,size_t>& edgeIndicesMap, MayaDM::Mesh &meshNode ) { - // Triangles: every face has 3 vertices. size_t positionIndex=0; + size_t uvSetIndicesIndex = 0; - // Get the position indices - const COLLADAFW::UIntValuesArray& positionIndices = primitiveElement->getPositionIndices (); - - // The vertex index values of an edge. - int edgeStartVtxIndex=0, edgeEndVtxIndex=0; - // The number of grouped vertex elements (faces, holes, tristrips or trifans). size_t groupedVerticesCount = getGroupedVerticesCount ( primitiveElement ); @@ -399,146 +571,212 @@ // grouped vertices object. If the number is negative, the grouped object is a hole. int numEdges = primitiveElement->getGroupedVerticesVertexCount ( groupedVtxIndex ); - // Handle faces - if ( numEdges >= 0 ) - { - // Create the poly face - MayaDM::polyFaces polyFace; - polyFace.f.faceEdgeCount = numEdges; - polyFace.f.edgeIdValue = new int[numEdges]; + // Create the poly face + MayaDM::polyFaces polyFace; - // Go through the edges and determine the face values. - for ( int edgeIndex=0; edgeIndex<numEdges; ++edgeIndex ) - { - // Set the edge vertex index values into an edge object. - edgeStartVtxIndex = positionIndices[positionIndex]; - if ( edgeIndex<(numEdges-1) ) - edgeEndVtxIndex = positionIndices[++positionIndex]; - else edgeEndVtxIndex = positionIndices[positionIndex-numEdges+1]; - COLLADAFW::Edge edge ( edgeStartVtxIndex, edgeEndVtxIndex ); + // Handle the face infos. + setFaceInfos ( mesh, primitiveElement, edgeIndicesMap, polyFace, numEdges, positionIndex, polygonPoints ); - // Polygons with holes: Get the first three polygon vertices to determine - // the polygon's orientation. - COLLADAFW::MeshPrimitive::PrimitiveType primitiveType = primitiveElement->getPrimitiveType (); - if ( primitiveType == COLLADAFW::MeshPrimitive::POLYGONS && edgeIndex < 3 ) - { - // Delete the old points, if they still exist. - if ( edgeIndex == 0 && polygonPoints.size () > 0 ) - { - // Delete the points. - size_t pSize = polygonPoints.size (); - for ( size_t i=0; i<pSize; ++i) - delete polygonPoints [i]; - polygonPoints.clear (); - } - // Store the vertex positions of the current start point. - polygonPoints.push_back ( getVertexPosition ( mesh, edgeStartVtxIndex ) ); - } + // Handle the uv set infos. + setUVSetInfos ( mesh, primitiveElement, polyFace, uvSetIndicesIndex, numEdges ); - // Variable for the current edge index. - int edgeIndexValue; + // Write the polyFace data in the maya file. + meshNode.appendFace ( polyFace ); + } - // Get the edge index value from the edge list. - if ( !getEdgeIndex ( edge, edgeIndicesMap, edgeIndexValue ) ) return false; + // Delete the points. + size_t pSize = polygonPoints.size (); + for ( size_t i=0; i<pSize; ++i) + delete polygonPoints [i]; + polygonPoints.clear (); - // Set the edge list index into the poly face - polyFace.f.edgeIdValue[edgeIndex] = edgeIndexValue; - } + return true; + } - // Increment the positions index for the next face - ++positionIndex; + // -------------------------------------------- + void GeometryImporter::setFaceInfos ( + const COLLADAFW::Mesh* mesh, + const COLLADAFW::MeshPrimitive* primitiveElement, + const std::map<COLLADAFW::Edge,size_t>& edgeIndicesMap, + MayaDM::polyFaces &polyFace, + int &numEdges, + size_t &positionIndex, + std::vector<COLLADABU::Math::Vector3*> &polygonPoints ) + { + // Handle faces + if ( numEdges >= 0 ) + setFaceInfo ( mesh, primitiveElement, edgeIndicesMap, polyFace, numEdges, positionIndex, polygonPoints ); + else + setHoleInfo ( mesh, primitiveElement, edgeIndicesMap, polyFace, numEdges, positionIndex, polygonPoints ); + } -// //mu 0 4 0 1 3 2 -// polyFace.mu.uvSet = 0; -// polyFace.mu.faceUVCount = 4; -// polyFace.mu.uvIdValue = new int[4]; -// polyFace.mu.uvIdValue[0] = 0; -// polyFace.mu.uvIdValue[1] = 1; -// polyFace.mu.uvIdValue[2] = 3; -// polyFace.mu.uvIdValue[3] = 2; + // -------------------------------------------- + void GeometryImporter::setFaceInfo ( + const COLLADAFW::Mesh* mesh, + const COLLADAFW::MeshPrimitive* primitiveElement, + const std::map<COLLADAFW::Edge,size_t>& edgeIndicesMap, + MayaDM::polyFaces &polyFace, + int& numEdges, + size_t& positionIndex, + std::vector<COLLADABU::Math::Vector3*> &polygonPoints ) + { + // Handle the edge informations. + polyFace.f.faceEdgeCount = numEdges; + polyFace.f.edgeIdValue = new int[numEdges]; - meshNode.appendFace ( polyFace ); + // Get the position indices + const COLLADAFW::UIntValuesArray& positionIndices = primitiveElement->getPositionIndices (); + + // Go through the edges and determine the face values. + for ( int edgeIndex=0; edgeIndex<numEdges; ++edgeIndex ) + { + // Set the edge vertex index values into an edge object. + int edgeStartVtxIndex = positionIndices[positionIndex]; + int edgeEndVtxIndex = 0; + if ( edgeIndex<(numEdges-1) ) + edgeEndVtxIndex = positionIndices[++positionIndex]; + else edgeEndVtxIndex = positionIndices[positionIndex-numEdges+1]; + COLLADAFW::Edge edge ( edgeStartVtxIndex, edgeEndVtxIndex ); + + // Polygons with holes: Get the first three polygon vertices to determine + // the polygon's orientation. + COLLADAFW::MeshPrimitive::PrimitiveType primitiveType = primitiveElement->getPrimitiveType (); + if ( primitiveType == COLLADAFW::MeshPrimitive::POLYGONS && edgeIndex < 3 ) + { + // Delete the old points, if they still exist. + if ( edgeIndex == 0 && polygonPoints.size () > 0 ) + { + // Delete the points. + size_t pSize = polygonPoints.size (); + for ( size_t i=0; i<pSize; ++i) + delete polygonPoints [i]; + polygonPoints.clear (); + } + // Store the vertex positions of the current start point. + polygonPoints.push_back ( getVertexPosition ( mesh, edgeStartVtxIndex ) ); } - else - { - // Handle a hole element. - numEdges *= -1; - // The orientation of a hole has always to be the opposite direction of his - // parenting polygon. About this, we have to determine the hole's orientation. - // We just need the first three vectors to determine the polygon's orientation. - std::vector<COLLADABU::Math::Vector3*> holePoints; + // Variable for the current edge index. + int edgeIndexValue; - // Create the poly face - MayaDM::polyFaces polyFace; - polyFace.h.holeEdgeCount = numEdges; - polyFace.h.edgeIdValue = new int[numEdges]; + // Get the edge index value from the edge list. + getEdgeIndex ( edge, edgeIndicesMap, edgeIndexValue ); - // Go through the edges and determine the face values. - for ( int edgeIndex=0; edgeIndex<numEdges; ++edgeIndex ) - { - // Set the edge vertex index values into an edge object. - edgeStartVtxIndex = positionIndices[positionIndex]; - if ( edgeIndex<(numEdges-1) ) - edgeEndVtxIndex = positionIndices[++positionIndex]; - else edgeEndVtxIndex = positionIndices[positionIndex-numEdges+1]; - COLLADAFW::Edge edge ( edgeStartVtxIndex, edgeEndVtxIndex ); + // Set the edge list index into the poly face + polyFace.f.edgeIdValue[edgeIndex] = edgeIndexValue; + } - // Polygons with holes: Get the first three polygon vertices to determine - // the polygon's orientation. - if ( edgeIndex < 3 ) - { - // Store the vertex positions of the current start point. - holePoints.push_back ( getVertexPosition ( mesh, edgeStartVtxIndex ) ); - } + // Increment the positions index for the next face + ++positionIndex; + } - // The current edge index. - int edgeIndexValue; + // -------------------------------------------- + void GeometryImporter::setHoleInfo ( + const COLLADAFW::Mesh* mesh, + const COLLADAFW::MeshPrimitive* primitiveElement, + const std::map<COLLADAFW::Edge,size_t>& edgeIndicesMap, + MayaDM::polyFaces &polyFace, + int &numEdges, + size_t &positionIndex, + std::vector<COLLADABU::Math::Vector3*> & polygonPoints ) + { + // Get the position indices + const COLLADAFW::UIntValuesArray& positionIndices = primitiveElement->getPositionIndices (); - // Get the edge index value from the edge list. - if ( !getEdgeIndex ( edge, edgeIndicesMap, edgeIndexValue ) ) return false; + // Handle a hole element. + numEdges *= -1; - // Set the edge list index into the poly face - polyFace.h.edgeIdValue[edgeIndex] = edgeIndexValue; - } + // The orientation of a hole has always to be the opposite direction of his + // parenting polygon. About this, we have to determine the hole's orientation. + // We just need the first three vectors to determine the polygon's orientation. + std::vector<COLLADABU::Math::Vector3*> holePoints; - // Check if we have to change the orientation of the current hole. - if ( changeHoleOrientation ( polygonPoints, holePoints ) ) - { - changePolyFaceHoleOrientation ( polyFace ); - } - // Delete the points. - size_t hSize = holePoints.size (); - for ( size_t i=0; i<holePoints.size (); ++i) - delete holePoints [i]; - holePoints.clear (); - - // Increment the positions index for the next face - ++positionIndex; + polyFace.h.holeEdgeCount = numEdges; + polyFace.h.edgeIdValue = new int[numEdges]; -// //mu 0 4 0 1 3 2 -// polyFace.mu.uvSet = 0; -// polyFace.mu.faceUVCount = 4; -// polyFace.mu.uvIdValue = new int[4]; -// polyFace.mu.uvIdValue[0] = 0; -// polyFace.mu.uvIdValue[1] = 1; -// polyFace.mu.uvIdValue[2] = 3; -// polyFace.mu.uvIdValue[3] = 2; + // Go through the edges and determine the face values. + for ( int edgeIndex=0; edgeIndex<numEdges; ++edgeIndex ) + { + // Set the edge vertex index values into an edge object. + int edgeStartVtxIndex = positionIndices[positionIndex]; + int edgeEndVtxIndex = 0; + if ( edgeIndex<(numEdges-1) ) + edgeEndVtxIndex = positionIndices[++positionIndex]; + else edgeEndVtxIndex = positionIndices[positionIndex-numEdges+1]; + COLLADAFW::Edge edge ( edgeStartVtxIndex, edgeEndVtxIndex ); - meshNode.appendFace ( polyFace ); + // Polygons with holes: Get the first three polygon vertices to determine + // the polygon's orientation. + if ( edgeIndex < 3 ) + { + // Store the vertex positions of the current start point. + holePoints.push_back ( getVertexPosition ( mesh, edgeStartVtxIndex ) ); } + + // The current edge index. + int edgeIndexValue; + + // Get the edge index value from the edge list. + getEdgeIndex ( edge, edgeIndicesMap, edgeIndexValue ); + + // Set the edge list index into the poly face + polyFace.h.edgeIdValue[edgeIndex] = edgeIndexValue; } + // Check if we have to change the orientation of the current hole. + if ( changeHoleOrientation ( polygonPoints, holePoints ) ) + { + changePolyFaceHoleOrientation ( polyFace ); + } + // Delete the points. - size_t pSize = polygonPoints.size (); - for ( size_t i=0; i<pSize; ++i) - delete polygonPoints [i]; - polygonPoints.clear (); + size_t hSize = holePoints.size (); + for ( size_t i=0; i<holePoints.size (); ++i) + delete holePoints [i]; + holePoints.clear (); - return true; + // Increment the positions index for the next face + ++positionIndex; } // -------------------------------------------- + void GeometryImporter::setUVSetInfos ( + const COLLADAFW::Mesh* mesh, + const COLLADAFW::MeshPrimitive* primitiveElement, + MayaDM::polyFaces &polyFace, + size_t& uvSetIndicesIndex, + const int numEdges ) + { + const COLLADAFW::IndexListArray& uvSetIndicesArray = primitiveElement->getUVCoordIndicesArray (); + size_t numUVSets = uvSetIndicesArray.getCount (); + polyFace.mu = new MayaDM::polyFaces::MU [ numUVSets ]; + polyFace.muCount = numUVSets; + for ( size_t i=0; i<numUVSets; ++i ) + { + // Get the index of the uv set + const COLLADAFW::IndexList* indexList = primitiveElement->getUVCoordIndices ( i ); + String uvSetName = indexList->getInputSetName (); + size_t index = mesh->getUVSetIndexByName ( uvSetName ); + + const COLLADAFW::MeshUVCoords& meshUVCoords = mesh->getUVCoords (); + polyFace.mu[i].uvSet = index; + polyFace.mu[i].faceUVCount = numEdges; + polyFace.mu[i].uvIdValue = new int [numEdges]; + + for ( size_t j=0; j<numEdges; ++j ) + { + size_t currentIndexPosition = j + uvSetIndicesIndex; + unsigned int currentIndex = indexList->getIndex ( currentIndexPosition ); + // Decrement the index values + size_t initialIndex = indexList->getInitialIndex (); + polyFace.mu[i].uvIdValue [j] = currentIndex - initialIndex; + } + } + // Increment the current uv set index for the number of edges. + uvSetIndicesIndex += numEdges; + } + + // -------------------------------------------- COLLADABU::Math::Vector3* GeometryImporter::getVertexPosition ( const COLLADAFW::Mesh* mesh , const size_t vertexIndex ) @@ -659,66 +897,6 @@ } // -------------------------------------------- - bool GeometryImporter::createMesh ( - const COLLADAFW::Mesh* mesh, - MayaNode* mayaTransformNode ) - { - // Create a unique name. - String meshName = mMeshNodeIdList.addId ( mesh->getName () ); - - // Create a maya node object of the current node and push it into the map. - const COLLADAFW::UniqueId& uniqueId = mesh->getUniqueId (); - MayaNode mayaMeshNode ( uniqueId, meshName, mayaTransformNode ); - mMayaMeshNodesMap [ uniqueId ] = mayaMeshNode; - - // Get the parent node name. - assert ( mayaTransformNode != NULL ); - String transformNodeName = mayaTransformNode->getName (); - - // Create the current mesh node. - FILE* file = getDocumentImporter ()->getFile (); - MayaDM::Mesh meshNode ( file, mesh->getName (), transformNodeName ); - - // Write the vertex positions. - // Just write the values, they will be referenced from the edges and the faces. - if ( !writeVertexPositions ( mesh, meshNode ) ) return false; - - // Write the normals. - if ( !writeNormals ( mesh, meshNode ) ) return false; - - // Write the uv corrdinates. - writeUVCoords ( mesh, meshNode ); - - // The vector of edge indices. We use it to write the list of edges into - // the maya file. The vector is already sorted. - std::vector<COLLADAFW::Edge> edgeIndices; - - // We store the edge indices also in a sorted map. The dublicate data holding - // is reasonable, because we need the index of a given edge. The search of - // values in a map is much faster than in a vector! - std::map<COLLADAFW::Edge,size_t> edgeIndicesMap; - - // Implementation for multiple primitive elements. - const COLLADAFW::MeshPrimitiveArray& primitiveElementsArray = mesh->getMeshPrimitives (); - size_t count = primitiveElementsArray.getCount (); - for ( size_t i=0; i<count; ++i ) - { - COLLADAFW::MeshPrimitive* primitiveElement = primitiveElementsArray [ i ]; - - // Determine the edge indices (unique edges, also for multiple primitive elements). - primitiveElement->appendEdgeIndices ( edgeIndices, edgeIndicesMap ); - } - - // Write the edge indices of all primitive elements into the maya file. - writeEdges ( edgeIndices, meshNode ); - - // Write the face informations of all primitive elements into the maya file. - writeFaces ( mesh, edgeIndicesMap, meshNode ); - - return true; - } - - // -------------------------------------------- const MayaNode* GeometryImporter::getMayaMeshNode ( const COLLADAFW::UniqueId& uniqueId ) const { UniqueIdMayaNodesMap::const_iterator it = mMayaMeshNodesMap.find ( uniqueId ); Modified: branches/nextgen/COLLADAMaya/src/COLLADAMayaVisualSceneImporter.cpp =================================================================== --- branches/nextgen/COLLADAMaya/src/COLLADAMayaVisualSceneImporter.cpp 2009-01-29 10:02:52 UTC (rev 331) +++ branches/nextgen/COLLADAMaya/src/COLLADAMayaVisualSceneImporter.cpp 2009-02-02 16:26:17 UTC (rev 332) @@ -22,6 +22,7 @@ #include "ColladaMayaException.h" #include "MayaDMJoint.h" +#include "MayaDMCommands.h" #include "COLLADAFWRotate.h" #include "COLLADAFWScale.h" Modified: branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLMeshLoader.h =================================================================== --- branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLMeshLoader.h 2009-01-29 10:02:52 UTC (r... [truncated message content] |
From: <rob...@us...> - 2009-01-29 10:02:57
|
Revision: 331 http://colladamaya.svn.sourceforge.net/colladamaya/?rev=331&view=rev Author: robertwuerfel Date: 2009-01-29 10:02:52 +0000 (Thu, 29 Jan 2009) Log Message: ----------- fix bug in hand written sax parser (dataEnd did not handle white spaces properly) Modified Paths: -------------- branches/nextgen/COLLADAFramework/include/COLLADAFWMaterial.h branches/nextgen/COLLADAFramework/include/COLLADAFWMeshPrimitive.h branches/nextgen/COLLADAFramework/include/COLLADAFWTypes.h branches/nextgen/COLLADAMax/include/COLLADAMaxDocumentImporter.h branches/nextgen/GeneratedSaxParser/include/GeneratedSaxParserParserTemplate.h Modified: branches/nextgen/COLLADAFramework/include/COLLADAFWMaterial.h =================================================================== --- branches/nextgen/COLLADAFramework/include/COLLADAFWMaterial.h 2009-01-28 17:10:44 UTC (rev 330) +++ branches/nextgen/COLLADAFramework/include/COLLADAFWMaterial.h 2009-01-29 10:02:52 UTC (rev 331) @@ -47,10 +47,10 @@ void setId ( const String Id ) { mId = Id; } /** The text string name of this element. Optional. */ - const String getName () const { return mName; } + const String& getName () const { return mName; } /** The text string name of this element. Optional. */ - void setName ( const String Name ) { mName = Name; } + void setName ( const String& Name ) { mName = Name; } private: Modified: branches/nextgen/COLLADAFramework/include/COLLADAFWMeshPrimitive.h =================================================================== --- branches/nextgen/COLLADAFramework/include/COLLADAFWMeshPrimitive.h 2009-01-28 17:10:44 UTC (rev 330) +++ branches/nextgen/COLLADAFramework/include/COLLADAFWMeshPrimitive.h 2009-01-29 10:02:52 UTC (rev 331) @@ -91,8 +91,12 @@ * application defined. Optional attribute. */ String mMaterial; + + /** The material id of the sub mesh. This material id is used to assign material + to submeshes when the mesh gets instantiated.*/ + MaterialId mMaterialId; - /** + /** * The index list of the positions array. */ UIntValuesArray mPositionIndices; @@ -211,7 +215,16 @@ */ void setUVCoordIndices ( const COLLADAFW::UIntValuesArray& UVCoordIndices ) { mUVCoordIndices = UVCoordIndices; } - /* + + /** @return The material id of the sub mesh. This material id is used to assign material + to submeshes when the mesh gets instantiated.*/ + COLLADAFW::MaterialId getMaterialId() const { return mMaterialId; } + + /** Sets the material id of the sub mesh. This material id is used to assign material + to submeshes when the mesh gets instantiated.*/ + void setMaterialId(COLLADAFW::MaterialId val) { mMaterialId = val; } + + /* * Fills the array with the index list of the edges * (the index list referes on the position indices) */ Modified: branches/nextgen/COLLADAFramework/include/COLLADAFWTypes.h =================================================================== --- branches/nextgen/COLLADAFramework/include/COLLADAFWTypes.h 2009-01-28 17:10:44 UTC (rev 330) +++ branches/nextgen/COLLADAFramework/include/COLLADAFWTypes.h 2009-01-29 10:02:52 UTC (rev 331) @@ -33,6 +33,8 @@ typedef unsigned long long ObjectId; + typedef unsigned long MaterialId; + // Element Type Enum namespace COLLADA_TYPE { Modified: branches/nextgen/COLLADAMax/include/COLLADAMaxDocumentImporter.h =================================================================== --- branches/nextgen/COLLADAMax/include/COLLADAMaxDocumentImporter.h 2009-01-28 17:10:44 UTC (rev 330) +++ branches/nextgen/COLLADAMax/include/COLLADAMaxDocumentImporter.h 2009-01-29 10:02:52 UTC (rev 331) @@ -138,17 +138,21 @@ /** Remove all objects that don't have an object. Deletes unused visual scenes.*/ void finish(){}; + /** When this method is called, the writer must write the global document asset. + @return The writer should return true, if writing succeeded, false otherwise.*/ + virtual bool writeGlobalAsset ( const COLLADAFW::FileInfo* asset ) { return true; }; + /** Writes the entire visual scene. @return True on succeeded, false otherwise.*/ - bool writeVisualScene ( const COLLADAFW::VisualScene* visualScene ); + virtual bool writeVisualScene ( const COLLADAFW::VisualScene* visualScene ); /** Handles all nodes in the library nodes. @return True on succeeded, false otherwise.*/ - bool writeLibraryNodes( const COLLADAFW::LibraryNodes* libraryNodes ); + virtual bool writeLibraryNodes( const COLLADAFW::LibraryNodes* libraryNodes ); /** Writes the geometry. @return True on succeeded, false otherwise.*/ - bool writeGeometry ( const COLLADAFW::Geometry* geometry ); + virtual bool writeGeometry ( const COLLADAFW::Geometry* geometry ); private: Modified: branches/nextgen/GeneratedSaxParser/include/GeneratedSaxParserParserTemplate.h =================================================================== --- branches/nextgen/GeneratedSaxParser/include/GeneratedSaxParserParserTemplate.h 2009-01-28 17:10:44 UTC (rev 330) +++ branches/nextgen/GeneratedSaxParser/include/GeneratedSaxParserParserTemplate.h 2009-01-29 10:02:52 UTC (rev 331) @@ -507,17 +507,20 @@ mEndOfDataInCurrentObjectOnStack = 0; if ( failed ) { - int bufferLength = (int)(mEndOfDataInCurrentObjectOnStack - bufferBegin); - ParserChar dataBufferError[21]; - size_t length = std::min(20, bufferLength); - memcpy(dataBufferError, bufferBegin, length); - dataBufferError[length] = '\0'; - if ( handleError(ParserError::SEVERITY_ERROR, - ParserError::ERROR_TEXTDATA_PARSING_FAILED, - 0, - dataBufferError)) + int bufferLength = (int)(bufferEnd - bufferBegin); + if ( bufferLength != 0) { - return false; + ParserChar dataBufferError[21]; + size_t length = std::min(20, bufferLength); + memcpy(dataBufferError, bufferBegin, length); + dataBufferError[length] = '\0'; + if ( handleError(ParserError::SEVERITY_ERROR, + ParserError::ERROR_TEXTDATA_PARSING_FAILED, + 0, + dataBufferError)) + { + return false; + } } } else This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jud...@us...> - 2009-01-28 17:10:51
|
Revision: 330 http://colladamaya.svn.sourceforge.net/colladamaya/?rev=330&view=rev Author: judithschenk Date: 2009-01-28 17:10:44 +0000 (Wed, 28 Jan 2009) Log Message: ----------- import collada global asset informations Modified Paths: -------------- branches/nextgen/COLLADAFramework/include/COLLADAFWIWriter.h branches/nextgen/COLLADAFramework/scripts/COLLADAFramework.vcproj branches/nextgen/COLLADAMaya/include/COLLADAMayaDocumentImporter.h branches/nextgen/COLLADAMaya/include/COLLADAMayaGeometryImporter.h branches/nextgen/COLLADAMaya/include/COLLADAMayaVisualSceneImporter.h branches/nextgen/COLLADAMaya/scripts/COLLADAMaya.vcproj branches/nextgen/COLLADAMaya/src/COLLADAMayaDocumentImporter.cpp branches/nextgen/COLLADAMaya/src/COLLADAMayaGeometryImporter.cpp branches/nextgen/COLLADAMaya/src/COLLADAMayaVisualSceneImporter.cpp branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLFileLoader.h branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLNodeLoader.h branches/nextgen/COLLADASaxFrameworkLoader/scripts/COLLADASaxFrameworkLoader.vcproj branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLColladaParserAutoGenPrivate.cpp branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLFileLoader.cpp branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLNodeLoader.cpp branches/nextgen/COLLADAStreamWriter/include/COLLADASWAsset.h branches/nextgen/Externals/MayaDataModel/include/MayaDMConnectables.h Added Paths: ----------- branches/nextgen/COLLADAFramework/include/COLLADAFWFileInfo.h branches/nextgen/COLLADAFramework/src/COLLADAFWFileInfo.cpp branches/nextgen/COLLADAMaya/include/COLLADAMayaNode.h branches/nextgen/COLLADAMaya/src/COLLADAMayaNode.cpp branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLAssetLoader.h branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLAssetLoader.cpp Added: branches/nextgen/COLLADAFramework/include/COLLADAFWFileInfo.h =================================================================== --- branches/nextgen/COLLADAFramework/include/COLLADAFWFileInfo.h (rev 0) +++ branches/nextgen/COLLADAFramework/include/COLLADAFWFileInfo.h 2009-01-28 17:10:44 UTC (rev 330) @@ -0,0 +1,165 @@ +/* + Copyright (c) 2008 NetAllied Systems GmbH + + This file is part of COLLADAFramework. + + Licensed under the MIT Open Source License, + for details please see LICENSE file or the website + http://www.opensource.org/licenses/mit-license.php +*/ + +#ifndef __COLLADAFW_ASSET_H__ +#define __COLLADAFW_ASSET_H__ + +#include "COLLADAFWPrerequisites.h" +#include "COLLADAFWArrayPrimitiveType.h" + + +namespace COLLADAFW +{ + + /** + Computers store vast amounts of information. An asset is a set of information that is organized into a + distinct collection and managed as a unit. A wide range of attributes describes assets so that the + information can be maintained and understood both by software tools and by humans. Asset information is + often hierarchical, where the parts of a large asset are divided into smaller pieces that are managed as + distinct assets themselves. + */ + class FileInfo + { + public: + + /** A pair where you can hold file informations. */ + ArrayPrimitiveType<std::pair<String, String>> mValuePairArray; + + /** Descriptive information about unit of measure. Its optional attributes are:*/ + struct Unit + { + /** + * The name of the distance unit to use in the scene. For example, + * "meter", "centimeter", "inches", or "parsec". This can be the + * real name of a measurement, or an imaginary name. + */ + String mLinearUnit; + + /** + * The angular unit; + */ + String mAngularUnit; + + /** + * The time unit. + */ + String mTimeUnit; + + }; + + /*Descriptive information about the coordinate system + of the geometric data. All coordinates are right handed + by definition. Valid values are X_UP, Y_UP, + or Z_UP. This element specifies which axis is + considered upward, which is considered to the + right, and which is considered inward.*/ + enum UpAxisType + { + NONE, + X_UP, + Y_UP, + Z_UP + }; + + static const String X_UP_STRING; + static const String Y_UP_STRING; + static const String Z_UP_STRING; + + private: + + /** Descriptive information about unit of measure. Its optional attributes are:*/ + Unit mUnit; + + /* Descriptive information about the coordinate system of the geometric data. + All coordinates are right handed by definition. Valid values are X_UP, Y_UP, + or Z_UP. This element specifies which axis is considered upward, which is considered + to the right, and which is considered inward. */ + UpAxisType mUpAxisType; + + public: + + /** Constructor. */ + FileInfo(); + + /** Destructor. */ + virtual ~FileInfo(); + + /** A pair where you can hold file informations. */ + void appendValuePair ( const std::pair<String, String>& valuePair ) + { + mValuePairArray.append ( valuePair ); + } + + /** A pair where you can hold file informations. */ + void appendValuePair ( const String& value1, String& value2 ) + { + mValuePairArray.append ( std::pair<String, String> ( value1, value2 ) ); + } + + /** A pair where you can hold file informations. */ + const ArrayPrimitiveType<std::pair<String, String>> getValuePairArray () const { return mValuePairArray; } + + + /** Sets the unit used by the document. + @param unit The unit to use. + */ + void setUnit ( const Unit& unit ) + { + mUnit = unit; + } + + /** + * Sets the linear unit. + */ + void setLinearUnit ( const String& linearUnit ) + { + mUnit.mLinearUnit = linearUnit; + } + + /** Returns the unit. */ + Unit& getUnit() + { + return mUnit; + } + + /** Returns the unit. */ + const Unit& getUnit() const + { + return mUnit; + } + + /** Sets the up axis of the document. */ + void setUpAxisType ( const UpAxisType& upAxisType ) + { + mUpAxisType = upAxisType; + } + + /** Sets the up axis of the document. */ + void setUpAxisType ( const String& upAxis ); + + /** Returns the up axis. */ + UpAxisType& getUpAxisType() + { + return mUpAxisType; + } + + private: + + /** Disable default copy ctor. */ + FileInfo( const FileInfo& pre ); + + /** Disable default assignment operator. */ + const FileInfo& operator= ( const FileInfo& pre ); + + }; + +} // namespace COLLADAFW + +#endif // __COLLADAFW_ASSET_H__ Modified: branches/nextgen/COLLADAFramework/include/COLLADAFWIWriter.h =================================================================== --- branches/nextgen/COLLADAFramework/include/COLLADAFWIWriter.h 2009-01-28 10:48:01 UTC (rev 329) +++ branches/nextgen/COLLADAFramework/include/COLLADAFWIWriter.h 2009-01-28 17:10:44 UTC (rev 330) @@ -16,10 +16,12 @@ namespace COLLADAFW { + class FileInfo; class VisualScene; class Geometry; class LibraryNodes; + /** Class that needs to be implemented by a writer. IMPORTANT: The write functions are called in arbitrary order.*/ class IWriter @@ -46,6 +48,10 @@ /** This method is called after the last write* method. No other methods will be called after this.*/ virtual void finish()=0; + /** When this method is called, the writer must write the global document asset. + @return The writer should return true, if writing succeeded, false otherwise.*/ + virtual bool writeGlobalAsset ( const FileInfo* asset ) = 0; + /** When this method is called, the writer must write the entire visual scene. @return The writer should return true, if writing succeeded, false otherwise.*/ virtual bool writeVisualScene ( const VisualScene* visualScene ) = 0; Modified: branches/nextgen/COLLADAFramework/scripts/COLLADAFramework.vcproj =================================================================== --- branches/nextgen/COLLADAFramework/scripts/COLLADAFramework.vcproj 2009-01-28 10:48:01 UTC (rev 329) +++ branches/nextgen/COLLADAFramework/scripts/COLLADAFramework.vcproj 2009-01-28 17:10:44 UTC (rev 330) @@ -308,6 +308,10 @@ > </File> <File + RelativePath="..\src\COLLADAFWFileInfo.cpp" + > + </File> + <File RelativePath="..\src\COLLADAFWGeometry.cpp" > </File> @@ -458,6 +462,10 @@ > </File> <File + RelativePath="..\include\COLLADAFWFileInfo.h" + > + </File> + <File RelativePath="..\include\COLLADAFWFloatOrParam.h" > </File> Added: branches/nextgen/COLLADAFramework/src/COLLADAFWFileInfo.cpp =================================================================== --- branches/nextgen/COLLADAFramework/src/COLLADAFWFileInfo.cpp (rev 0) +++ branches/nextgen/COLLADAFramework/src/COLLADAFWFileInfo.cpp 2009-01-28 17:10:44 UTC (rev 330) @@ -0,0 +1,50 @@ +/* + Copyright (c) 2008 NetAllied Systems GmbH + + This file is part of COLLADAFramework. + + Licensed under the MIT Open Source License, + for details please see LICENSE file or the website + http://www.opensource.org/licenses/mit-license.php +*/ + +#include "COLLADAFWStableHeaders.h" +#include "COLLADAFWFileInfo.h" + +#include "COLLADABUUtils.h" + + +namespace COLLADAFW +{ + + const String FileInfo::X_UP_STRING = "X_UP"; + const String FileInfo::Y_UP_STRING = "Y_UP"; + const String FileInfo::Z_UP_STRING = "Z_UP"; + + //------------------------------ + FileInfo::FileInfo() + : mUpAxisType ( Y_UP ) + { + mUnit.mLinearUnit = "centimeter"; + mUnit.mAngularUnit = "degree"; + mUnit.mTimeUnit = "film"; + } + + //------------------------------ + FileInfo::~FileInfo() + { + } + + //------------------------------ + void FileInfo::setUpAxisType ( const String& upAxis ) + { + if ( COLLADABU::Utils::equalsIgnoreCase ( upAxis, X_UP_STRING )) + mUpAxisType = X_UP; + else if ( COLLADABU::Utils::equalsIgnoreCase ( upAxis, Y_UP_STRING )) + mUpAxisType = Y_UP; + else if ( COLLADABU::Utils::equalsIgnoreCase ( upAxis, Z_UP_STRING )) + mUpAxisType = Z_UP; + else + mUpAxisType = NONE; + } +} // namespace COLLADAFW Modified: branches/nextgen/COLLADAMaya/include/COLLADAMayaDocumentImporter.h =================================================================== --- branches/nextgen/COLLADAMaya/include/COLLADAMayaDocumentImporter.h 2009-01-28 10:48:01 UTC (rev 329) +++ branches/nextgen/COLLADAMaya/include/COLLADAMayaDocumentImporter.h 2009-01-28 17:10:44 UTC (rev 330) @@ -18,18 +18,25 @@ #include "COLLADAMayaStableHeaders.h" #include "COLLADAMayaPrerequisites.h" +#include "COLLADAMayaNode.h" #include "COLLADAFWIWriter.h" +#include "COLLADAFWFileInfo.h" #include "COLLADAFWVisualScene.h" #include "COLLADAFWGeometry.h" +#include <set> + namespace COLLADAMaya { class VisualSceneImporter; class GeometryImporter; + typedef std::map<COLLADAFW::UniqueId, std::set<const COLLADAFW::UniqueId>> UniqueIdUniqueIdsMap; + typedef std::map<COLLADAFW::UniqueId, MayaNode> UniqueIdMayaNodesMap; + /** The main importer class. This class imports all data of the scene. */ class DocumentImporter : public COLLADAFW::IWriter { @@ -37,15 +44,22 @@ private: /** The name of the collada file. */ - String mFileName; + String mColladaFileName; + /** The name of the current maya ascii file. */ + COLLADABU::URI mMayaAsciiFileURI; + /** The id of the current scene. */ String mSceneId; /** The current maya ascii file to import the data. */ FILE* mFile; - bool mSceneGraphCreated; + bool mAssetWritten; + bool mSceneGraphWritten; + bool mGeometryWritten; + + bool mSceneGraphRead; bool mGeometryRead; /** Pointer to the visual scene importer. */ @@ -63,25 +77,38 @@ virtual ~DocumentImporter (); /** The current maya ascii file to import the data. */ - FILE* getFile() const { return mFile; } + FILE* getFile () const { return mFile; } void setFile ( FILE* val ) { mFile = val; } /** Imports the current scene. */ - void importCurrentScene(); + void importCurrentScene (); /** Reads the collada document. */ - void readColladaDocument(); + void readColladaDocument (); /** Create the maya ascii file (where with which name???) */ - bool createFile(); + bool createFile (); /** * Returns the name of the current collada file to export. * @return const String& Name of the current collada file */ - const String& getFilename() const; + const String& getColladaFilename () const; + /** + * Returns the name of the current maya ascii file to export. + * @return const String& The current maya ascii file + */ + const COLLADABU::URI& getMayaAsciiFileURI () const; + + /** + * Set the name of the current maya ascii file to export. + * @param const COLLADABU::URI& The current maya ascii file. + */ + void setMayaAsciiFileURI ( const COLLADABU::URI& fileURI ); + /** Pointer to the visual scene importer. */ + VisualSceneImporter* getVisualSceneImporter () { return mVisualSceneImporter; } const VisualSceneImporter* getVisualSceneImporter () const { return mVisualSceneImporter; } void setVisualSceneImporter ( VisualSceneImporter* val ) { mVisualSceneImporter = val; } @@ -106,6 +133,12 @@ @return True on success, false otherwise. */ bool import(); + /** When this method is called, the writer must write the global document asset. + @return The writer should return true, if writing succeeded, false otherwise.*/ + virtual bool writeGlobalAsset ( const COLLADAFW::FileInfo* asset ); + + void getCurrentDate ( std::stringstream& curDate ); + /** When this method is called, the writer must write the entire visual scene. @return The writer should return true, if writing succeeded, false otherwise.*/ virtual bool writeVisualScene ( const COLLADAFW::VisualScene* visualScene ); @@ -117,16 +150,10 @@ /** When this method is called, the writer must handle all nodes contained in the library nodes. @return The writer should return true, if writing succeeded, false otherwise.*/ - virtual bool writeLibraryNodes ( const COLLADAFW::LibraryNodes* libraryNodes ) - { - return false; - } + virtual bool writeLibraryNodes ( const COLLADAFW::LibraryNodes* libraryNodes ); private: - /** Imports the asset. */ - void importAsset(); - /** Imports the current scene. */ void exportScene(); @@ -137,10 +164,6 @@ /** Releases the import/export libraries */ void releaseLibraries(); - /** Write the header into the maya ascii file. */ - void writeHeader ( FILE* file ); - - }; } Modified: branches/nextgen/COLLADAMaya/include/COLLADAMayaGeometryImporter.h =================================================================== --- branches/nextgen/COLLADAMaya/include/COLLADAMayaGeometryImporter.h 2009-01-28 10:48:01 UTC (rev 329) +++ branches/nextgen/COLLADAMaya/include/COLLADAMayaGeometryImporter.h 2009-01-28 17:10:44 UTC (rev 330) @@ -18,17 +18,17 @@ #include "COLLADAMayaStableHeaders.h" #include "COLLADAMayaBaseImporter.h" +#include "COLLADAMayaNode.h" #include "COLLADAFWMesh.h" +#include "COLLADABUIDList.h" #include "Math/COLLADABUMathVector3.h" #include "MayaDMTypes.h" #include "MayaDMMesh.h" -#include <map> #include <vector> -#include <set> namespace COLLADAMaya @@ -40,18 +40,16 @@ private: - typedef std::map<const COLLADAFW::UniqueId, std::set<const COLLADAFW::UniqueId>> UniqueIdToUniqueIdsMap; - typedef std::map<const COLLADAFW::UniqueId, String> UniqueIdNamesMap; + /** + * The list of the unique maya mesh node names. + */ + COLLADABU::IDList mMeshNodeIdList; - /** The current transform object, for which the geometries should be created. */ - MObject mTransformObject; + /** + * The map holds the unique ids of the nodes to the maya specific nodes. + */ + UniqueIdMayaNodesMap mMayaMeshNodesMap; - /** Pointer to the current framework geometry object. */ - const COLLADAFW::Geometry* mGeometry; - - /** Pointer to the current framework mesh object. */ - const COLLADAFW::Mesh* mMesh; - public: /** Constructor. */ @@ -66,6 +64,16 @@ private: /** + * The map holds the unique ids of the nodes to the maya specific nodes. + */ + const MayaNode* getMayaMeshNode ( const COLLADAFW::UniqueId& uniqueId ) const; + + /** + * The map holds the unique ids of the nodes to the maya specific nodes. + */ + MayaNode* getMayaMeshNode ( const COLLADAFW::UniqueId& uniqueId ); + + /** * Imports the data of the current mesh element. */ bool importMesh ( const COLLADAFW::Mesh* mesh ); @@ -73,7 +81,9 @@ /** * Writes the geometry of the current mesh. */ - bool createMesh ( const COLLADAFW::Mesh* mesh, const String& parentNodeName ); + bool createMesh ( + const COLLADAFW::Mesh* mesh, + MayaNode* parentMayaNode ); /* * Write the face informations into the maya file. Added: branches/nextgen/COLLADAMaya/include/COLLADAMayaNode.h =================================================================== --- branches/nextgen/COLLADAMaya/include/COLLADAMayaNode.h (rev 0) +++ branches/nextgen/COLLADAMaya/include/COLLADAMayaNode.h 2009-01-28 17:10:44 UTC (rev 330) @@ -0,0 +1,77 @@ +#ifndef __COLLADAMAYA_NODE_H__ +#define __COLLADAMAYA_NODE_H__ + +#include "COLLADAMayaPrerequisites.h" + +#include "COLLADAFWUniqueId.h" + + +namespace COLLADAMaya +{ + class MayaNode + { + private: + + /** The unique id of the object.*/ + COLLADAFW::UniqueId mUniqueId; + + /** + * The name attribute is the text string name of the node. + * The name has to be unique in maya. + */ + String mName; + + /** The path of the current node. */ + String mPath; + + /** + * The parent node. + */ + MayaNode* mParent; + + public: + + MayaNode () : mParent (0), mName (""), mPath ("") {} + MayaNode ( COLLADAFW::UniqueId uniqueId, const String name, MayaNode* parent = NULL ) + : mUniqueId ( uniqueId ) + , mName ( name ) + , mParent ( parent ) + , mPath ("") + {} + virtual ~MayaNode() {} + + /** Returns the unique id of the object.*/ + const COLLADAFW::UniqueId& getUniqueId() const { return mUniqueId; } + + /** + * The parent node. + */ + MayaNode* getParent () { return mParent; } + const MayaNode* getParent () const { return mParent; } + void setParent ( MayaNode* val ) + { + mParent = val; + mPath = ""; + } + + /** + * The name attribute is the text string name of this element. + * Optional attribute. + */ + const COLLADAMaya::String getName () const { return mName; } + void setName ( COLLADAMaya::String val ) + { + mName = val; + mPath = ""; + } + + /** + * Get's the node path of the current maya node. + */ + const String getNodePath (); + void setNodePath ( const COLLADAMaya::String& val ) { mPath = val; } + + }; +} // namespace COLLADAMAYA + +#endif // __COLLADAMAYA_NODE_H__ Modified: branches/nextgen/COLLADAMaya/include/COLLADAMayaVisualSceneImporter.h =================================================================== --- branches/nextgen/COLLADAMaya/include/COLLADAMayaVisualSceneImporter.h 2009-01-28 10:48:01 UTC (rev 329) +++ branches/nextgen/COLLADAMaya/include/COLLADAMayaVisualSceneImporter.h 2009-01-28 17:10:44 UTC (rev 330) @@ -18,6 +18,7 @@ #include "COLLADAMayaStableHeaders.h" #include "COLLADAMayaBaseImporter.h" +#include "COLLADAMayaNode.h" #include "MayaDMTransform.h" @@ -39,12 +40,7 @@ /** Declares the importer implementation to import the visual scene nodes. */ class VisualSceneImporter : public BaseImporter { - public: - - typedef std::map<const COLLADAFW::UniqueId, std::set<const COLLADAFW::UniqueId>> UniqueIdUniqueIdsMap; - typedef std::map<const COLLADAFW::UniqueId, String> UniqueIdNamesMap; - private: /** @@ -56,16 +52,13 @@ * The map holds for every unique id of a geometry a list of transform node unique ids. * We need it for the creation of the geometry, to set the parent transform nodes. */ - UniqueIdUniqueIdsMap mGeometryNodesMap; + UniqueIdUniqueIdsMap mGeometryTransformIdsMap; - /** The map holds the unique ids of the nodes to the full node pathes (contains the name). */ - UniqueIdNamesMap mNodePathesMap; + /** + * The map holds the unique ids of the nodes to the full node pathes (contains the name). + */ + UniqueIdMayaNodesMap mMayaTransformNodesMap; - /** - * Save the structure of the scene graph. - */ - // TODO - /* * Helper class, to handle the transformations. */ @@ -116,28 +109,28 @@ */ void importNode ( const COLLADAFW::Node* rootNode, - const COLLADAFW::Node* parentNode = 0 ); + const COLLADAFW::UniqueId* parentNodeId = NULL ); + /** + * The map holds the unique ids of the nodes to the full node pathes (contains the name). + */ + const MayaNode* getMayaTransformNode ( const COLLADAFW::UniqueId& uniqueId ) const; + + /** + * The map holds the unique ids of the nodes to the full node pathes (contains the name). + */ + MayaNode* getMayaTransformNode ( const COLLADAFW::UniqueId& uniqueId ); + /* * The map holdes for every geometry (identified by it's unique id ) a list of all * transform nodes (identified by their names, which are unique!). * We need it for the creation of the geometry, to set the parent transform nodes. */ - const UniqueIdUniqueIdsMap& getGeometryNodesMap () const { return mGeometryNodesMap; } + const std::set<const COLLADAFW::UniqueId>* getGeometryTransformIds ( + const COLLADAFW::UniqueId& geometryId ) const; - /** - * The map with the node unique ids and the names for it. - */ - const UniqueIdNamesMap& getNodeNamesMap () const { return mNodePathesMap; } - private: - /* - * The map holdes for every unique id of a geometry a list of transform node unique ids. - * We need it for the creation of the geometry, to set the parent transform nodes. - */ - UniqueIdUniqueIdsMap& getGeometryNodesMap() { return mGeometryNodesMap; } - /** * Save the transformation ids to the geometry ids. */ Modified: branches/nextgen/COLLADAMaya/scripts/COLLADAMaya.vcproj =================================================================== --- branches/nextgen/COLLADAMaya/scripts/COLLADAMaya.vcproj 2009-01-28 10:48:01 UTC (rev 329) +++ branches/nextgen/COLLADAMaya/scripts/COLLADAMaya.vcproj 2009-01-28 17:10:44 UTC (rev 330) @@ -549,7 +549,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="..\include;"$(MAYA_PATH2008)\include";"$(MAYA_PATH2008)\devkit\plug-ins";"$(BOOST_ROOT)";..\..\COLLADABaseUtils\include;..\..\COLLADAStreamWriter\include;..\..\Externals\Cg\include;..\..\COLLADASaxFrameworkLoader\include;..\..\COLLADAFramework\include;..\..\Externals\MayaDataModel\include;..\..\GeneratedSaxParser\include;..\..\Externals\LibXML\include" - PreprocessorDefinitions="CREATE_IMPORT_PLUGIN;WIN32;NDEBUG;_WINDOWS;_AFXDLL;_MBCS;NT_PLUGIN;REQUIRE_IOSTREAM;CM_EXPORTS;GLUT_NO_LIB_PRAGMA;GLUT_NO_WARNING_DISABLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;$(NOINHERIT)" + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_AFXDLL;_MBCS;NT_PLUGIN;REQUIRE_IOSTREAM;CM_EXPORTS;GLUT_NO_LIB_PRAGMA;GLUT_NO_WARNING_DISABLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;$(NOINHERIT)" RuntimeLibrary="2" RuntimeTypeInfo="true" UsePrecompiledHeader="1" @@ -1705,7 +1705,6 @@ OutputDirectory="..\bin\win\$(PlatformName)\$(ConfigurationName)" IntermediateDirectory="..\obj\win\$(PlatformName)\$(ConfigurationName)" ConfigurationType="2" - InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" > <Tool Name="VCPreBuildEventTool" @@ -2063,7 +2062,7 @@ UseUnicodeResponseFiles="true" Optimization="0" AdditionalIncludeDirectories="..\include;"$(MAYA_PATH2009)\include";"$(MAYA_PATH2009)\devkit\plug-ins";"$(BOOST_ROOT)";..\..\COLLADABaseUtils\include;..\..\COLLADAStreamWriter\include;..\..\Externals\Cg\include;..\..\COLLADASaxFrameworkLoader\include;..\..\COLLADAFramework\include;..\..\Externals\MayaDataModel\include;..\..\GeneratedSaxParser\include;..\..\Externals\LibXML\include" - PreprocessorDefinitions="CREATE_IMPORT_PLUGIN;WIN32;_DEBUG;_WINDOWS;_AFXDLL;_MBCS;NT_PLUGIN;REQUIRE_IOSTREAM;CM_EXPORTS;GLUT_NO_LIB_PRAGMA;GLUT_NO_WARNING_DISABLE;_CRT_NONSTDC_NO_DEPRECATE;$(NOINHERIT)" + PreprocessorDefinitions="CREATE_IMPORT_PLUGIN;CREATE_IMPORT_PLUGIN;WIN32;_DEBUG;_WINDOWS;_AFXDLL;_MBCS;NT_PLUGIN;REQUIRE_IOSTREAM;CM_EXPORTS;GLUT_NO_LIB_PRAGMA;GLUT_NO_WARNING_DISABLE;_CRT_NONSTDC_NO_DEPRECATE;$(NOINHERIT)" BasicRuntimeChecks="3" RuntimeLibrary="3" RuntimeTypeInfo="true" @@ -2231,7 +2230,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="..\include;"$(MAYA_PATH2009)\include";"$(MAYA_PATH2009)\devkit\plug-ins";"$(BOOST_ROOT)";..\..\COLLADABaseUtils\include;..\..\COLLADAStreamWriter\include;..\..\Externals\Cg\include;..\..\COLLADASaxFrameworkLoader\include;..\..\COLLADAFramework\include;..\..\Externals\MayaDataModel\include;..\..\GeneratedSaxParser\include;..\..\Externals\LibXML\include" - PreprocessorDefinitions="CREATE_IMPORT_PLUGIN;WIN32;NDEBUG;_WINDOWS;_AFXDLL;_MBCS;NT_PLUGIN;REQUIRE_IOSTREAM;CM_EXPORTS;GLUT_NO_LIB_PRAGMA;GLUT_NO_WARNING_DISABLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;$(NOINHERIT)" + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_AFXDLL;_MBCS;NT_PLUGIN;REQUIRE_IOSTREAM;CM_EXPORTS;GLUT_NO_LIB_PRAGMA;GLUT_NO_WARNING_DISABLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;$(NOINHERIT)" RuntimeLibrary="2" RuntimeTypeInfo="true" UsePrecompiledHeader="1" @@ -2384,14 +2383,6 @@ Name="Source Files" Filter="cpp" > - <File - RelativePath="..\src\COLLADAMayaNode.cpp" - > - </File> - <File - RelativePath="..\src\COLLADAMayaTransformNodesHierarchy.cpp" - > - </File> <Filter Name="Utils" > @@ -3284,6 +3275,10 @@ </FileConfiguration> </File> <File + RelativePath="..\src\COLLADAMayaNode.cpp" + > + </File> + <File RelativePath="..\src\COLLADAMayaSceneNodeTraverser.cpp" > <FileConfiguration @@ -3933,14 +3928,6 @@ Name="Header Files" Filter="h" > - <File - RelativePath="..\include\COLLADAMayaNode.h" - > - </File> - <File - RelativePath="..\include\COLLADAMayaTransformNodesHierarchy.h" - > - </File> <Filter Name="Utils" > @@ -5274,6 +5261,10 @@ </FileConfiguration> </File> <File + RelativePath="..\include\COLLADAMayaNode.h" + > + </File> + <File RelativePath="..\include\COLLADAMayaSceneNodeTraverser.h" > <FileConfiguration Modified: branches/nextgen/COLLADAMaya/src/COLLADAMayaDocumentImporter.cpp =================================================================== --- branches/nextgen/COLLADAMaya/src/COLLADAMayaDocumentImporter.cpp 2009-01-28 10:48:01 UTC (rev 329) +++ branches/nextgen/COLLADAMaya/src/COLLADAMayaDocumentImporter.cpp 2009-01-28 17:10:44 UTC (rev 330) @@ -31,16 +31,23 @@ #include <maya/MFileIO.h> +#include <fstream> +#include <time.h> + + namespace COLLADAMaya { //--------------------------------- DocumentImporter::DocumentImporter ( const String& fileName ) - : mFileName ( fileName ) + : mColladaFileName ( fileName ) , mSceneId ( "MayaScene" ) , mFile ( 0 ) , mVisualSceneImporter (0) , mGeometryImporter (0) - , mSceneGraphCreated ( false ) + , mSceneGraphWritten ( false ) + , mGeometryWritten ( false ) + , mAssetWritten ( false ) + , mSceneGraphRead ( false ) , mGeometryRead ( false ) { } @@ -81,9 +88,6 @@ // Create the import/export library helpers. createLibraries (); - // Import the asset information. - importAsset (); - // Load the collada document into the collada framework. readColladaDocument(); } @@ -91,93 +95,32 @@ //----------------------------- bool DocumentImporter::createFile() { - // TODO Create the maya ascii file (where with which name???) - errno_t err = fopen_s ( &mFile, "c:\\temp\\cube_test.ma", "w+" ); - if ( err != 0 ) - { - std::cerr << "Can't open maya ascii file! " << endl; - return false; - } - - return true; - } - - //----------------------------- - void DocumentImporter::writeHeader( FILE* file ) - { // TODO - fprintf_s ( file, "//Maya ASCII 2008 scene\n" ); - fprintf_s ( file, "//Name: inMeshTest.ma\n" ); - fprintf_s ( file, "//Last modified: Mon, Dec 01, 2008 02:02:39 PM\n" ); - fprintf_s ( file, "//Codeset: 1252\n" ); - fprintf_s ( file, "requires maya \"2008\";\n" ); - fprintf_s ( file, "currentUnit -l centimeter -a degree -t film;\n" ); - fprintf_s ( file, "fileInfo \"application\" \"maya\";\n" ); - fprintf_s ( file, "fileInfo \"product\" \"Maya Unlimited 2008\";\n" ); - fprintf_s ( file, "fileInfo \"version\" \"2008\";\n" ); - fprintf_s ( file, "fileInfo \"cutIdentifier\" \"200708022245-704165\";\n" ); - fprintf_s ( file, "fileInfo \"osv\" \"Microsoft Windows XP Service Pack 3 (Build 2600)\\n\";\n" ); - } + mMayaAsciiFileURI.set ( mColladaFileName ); + mMayaAsciiFileURI.setPathExtension ( ".netallied.ma" ); + String mayaFileName = mMayaAsciiFileURI.getURIString (); - //--------------------------------- - void DocumentImporter::importAsset() - { - // Up_axis - if ( MGlobal::mayaState() != MGlobal::kBatch ) + // Check if the file already exist. + if ( std::ifstream ( mayaFileName.c_str () ) ) { - if ( ImportOptions::isOpenMode() && ImportOptions::importUpAxis() ) - { - char upAxis = 'y'; - -// daeDocument* daeDoc = mDocumentLoader.getDaeDocument (); -// domUpAxisType upAxisType = COLLADADH::DocumentUtil::getUpAxis ( daeDoc ); -// switch ( upAxisType ) -// { -// case UPAXISTYPE_Z_UP: upAxis = 'z'; -// case UPAXISTYPE_Y_UP: upAxis = 'y'; -// case UPAXISTYPE_X_UP: -// MGlobal::displayWarning ( "An up_axis of 'X' is not supported by Maya." ); -// default: -// MGlobal::displayWarning ( "Unknown up_axis value." ); -// } -// -// // Use the MEL commands to set the up_axis. Currently resets the view, if the axis must change.. -// MString command ( "string $currentAxis = `upAxis -q -ax`; if ($currentAxis != \"" ); -// command += upAxis; command += "\") { upAxis -ax \""; command += upAxis; -// command += "\"; viewSet -home persp; }"; -// MGlobal::executeCommand ( command ); - } + // TODO Open a dialog and ask the user to save the file under an other name. + std::cerr << "File already exists!"; } - // Retrieve Maya's current up-axis. - MString result; -// FMVector3 mayaUpAxis = FMVector3::Zero; - if ( ImportOptions::importUpAxis() ) + errno_t err = fopen_s ( &mFile, mayaFileName.c_str (), "w+" ); + if ( err != 0 ) { - MGlobal::executeCommand ( "upAxis -q -ax;", result, false, false ); - // TODO -// if ( result == "z" ) -// -// mayaUpAxis = FMVector3::YAxis; -// if (IsEquivalent(MConvert::ToFChar(result), FC("z"))) mayaUpAxis = FMVector3::ZAxis; + std::cerr << "Can't open maya ascii file! " << endl; + return false; } - float mayaUnit = 0.0f; - if ( ImportOptions::importUnits() ) mayaUnit = 0.01f; - - // TODO - // Standardize the COLLADA document on this up-axis and units (centimeters). -// FCDocumentTools::StandardizeUpAxisAndLength(colladaDocument, mayaUpAxis, mayaUnit); - - // Get the UI unit factor, for parts of Maya that don't handle variable lengths correctly - MDistance testDistance ( 1.0f, MDistance::uiUnit() ); - float uiUnitFactor = (float) testDistance.as ( MDistance::kCentimeters ); + return true; } //--------------------------------- - const String& DocumentImporter::getFilename() const + const String& DocumentImporter::getColladaFilename() const { - return mFileName; + return mColladaFileName; } //----------------------------- @@ -191,9 +134,6 @@ { // Create the maya file. assert ( createFile() ); - - // TODO Write the header informations and the asset into the file. - writeHeader ( mFile ); } //----------------------------- @@ -204,23 +144,77 @@ } //----------------------------- + bool DocumentImporter::writeGlobalAsset ( const COLLADAFW::FileInfo* asset ) + { + if ( mAssetWritten ) return true; + + // Create the file, if not already done. + if ( mFile == 0 ) start(); + + // TODO + String mayaVersion ( MGlobal::mayaVersion ().asChar () ); +// fprintf_s ( mFile, "//Maya ASCII %s scene\n", mayaVersion.c_str () ); +// fprintf_s ( mFile, "//Name: %s\n", mMayaAsciiFileURI.getPathFile ().c_str () ); + +// std::stringstream curDate; +// getCurrentDate ( curDate ); +// fprintf_s ( mFile, "//Last modified: %s\n", curDate.str () ); +// String codeset ( MGlobal::executeCommandStringResult ( "about -codeset" ).asChar () ); +// fprintf_s ( mFile, "//Codeset: %s\n", codeset.c_str() ); + + fprintf_s ( mFile, "requires maya \"%s\";\n", mayaVersion.c_str () ); + + // TODO Default values for the units! + const COLLADAFW::FileInfo::Unit& unit = asset->getUnit (); + fprintf_s ( mFile, "currentUnit -l %s -a %s -t %s;\n", unit.mLinearUnit.c_str (), unit.mAngularUnit.c_str (), unit.mTimeUnit.c_str () ); + +// String application ( MGlobal::executeCommandStringResult ( "about -application" ).asChar () ); +// fprintf_s ( mFile, "fileInfo \"application\" \"%s\";\n", application.c_str () ); +// String product ( MGlobal::executeCommandStringResult ( "about -product" ).asChar () ); +// fprintf_s ( mFile, "fileInfo \"product\" \"%s\";\n", product.c_str () ); +// fprintf_s ( mFile, "fileInfo \"version\" \"%s\";\n", mayaVersion.c_str () ); +// String cutIdentifier ( MGlobal::executeCommandStringResult ( "product -cutIdentifier" ).asChar () ); +// fprintf_s ( mFile, "fileInfo \"cutIdentifier\" \"%s\";\n", cutIdentifier.c_str () ); +// String operatingSystemVersion ( MGlobal::executeCommandStringResult ( "product -operatingSystemVersion" ).asChar () ); +// fprintf_s ( mFile, "fileInfo \"osv\" \"%s\";\n", operatingSystemVersion.c_str () ); + + mAssetWritten = true; + + if ( mSceneGraphRead || mGeometryRead ) + { + mSceneGraphRead = false; + mGeometryRead = false; + readColladaDocument (); + } + + return true; + } + + //----------------------------- bool DocumentImporter::writeVisualScene ( const COLLADAFW::VisualScene* visualScene ) { bool retValue = false; - if ( mSceneGraphCreated ) return retValue; - // TODO + // Order: asset, scene graph, geometry + if ( !mAssetWritten ) + { + mSceneGraphRead = true; + } + + if ( mSceneGraphWritten ) return true; + + // Create the file, if not already done. if ( mFile == 0 ) start(); retValue = mVisualSceneImporter->importVisualScene ( visualScene ); - mSceneGraphCreated = true; + mSceneGraphWritten = true; - // Nochmal lesen, zwecks Reihenfolge... - if ( mGeometryRead == true ) + if ( mGeometryRead ) { + mGeometryRead = false; readColladaDocument (); } - + return retValue; } @@ -229,17 +223,18 @@ { bool retValue = false; - // First the scene graph! - if ( !mSceneGraphCreated ) + // Order: asset, scene graph, geometry + if ( !mAssetWritten || !mSceneGraphWritten ) { mGeometryRead = true; - return retValue; + return false; } - // TODO + // Create the file, if not already done. if ( mFile == 0 ) start(); retValue = mGeometryImporter->importGeometry ( geometry ); + mGeometryWritten = true; return retValue; } @@ -249,8 +244,76 @@ { COLLADASaxFWL::Loader loader; COLLADAFW::Root root ( &loader, this ); - String filename = getFilename (); + String filename = getColladaFilename (); String fileUriString = URI::nativePathToUri ( filename ); root.loadDocument ( fileUriString ); } + + //----------------------------- + const COLLADABU::URI& DocumentImporter::getMayaAsciiFileURI () const + { + return mMayaAsciiFileURI; + } + + //----------------------------- + void DocumentImporter::setMayaAsciiFileURI ( const COLLADABU::URI& fileURI ) + { + mMayaAsciiFileURI.set ( fileURI.getURIString () ); + } + + //----------------------------- + void DocumentImporter::getCurrentDate ( std::stringstream& curDate ) + { + // create a stringstream containing the current date and time in ISO 8601 format + time_t _t; + time ( &_t ); + struct tm *t = localtime ( &_t ); + + int weekDay = t->tm_wday; // days since Sunday - [0,6] + switch ( weekDay ) + { + case 0: curDate << "Sun, "; break; + case 1: curDate << "Mon, "; break; + case 2: curDate << "Tue, "; break; + case 3: curDate << "Wed, "; break; + case 4: curDate << "Thu, "; break; + case 5: curDate << "Fri, "; break; + case 6: curDate << "Sat, "; break; + default: assert ( weekDay < 7 ); + } + + int month = t->tm_mon; // months since January - [0,11] + switch ( month ) + { + case 0: curDate << "Jan "; break; + case 1: curDate << "Feb "; break; + case 2: curDate << "Mar "; break; + case 3: curDate << "Apr "; break; + case 4: curDate << "Mai "; break; + case 5: curDate << "Jun "; break; + case 6: curDate << "Jul "; break; + case 7: curDate << "Aug "; break; + case 8: curDate << "Sep "; break; + case 9: curDate << "Oct "; break; + case 10: curDate << "Nov "; break; + case 11: curDate << "Dec "; break; + default: assert ( month < 12 ); + } + + // Mon, Dec 01, 2008 02:02:39 PM + curDate << t->tm_mday << " "; // day of the month - [1,31] + if ( t->tm_hour < 12 ) + curDate << t->tm_hour << ":" << t->tm_min << ":" << t->tm_sec << " AM\n"; + else if ( t->tm_hour == 12 ) + curDate << t->tm_hour << ":" << t->tm_min << ":" << t->tm_sec << " PM\n"; + else + curDate << t->tm_hour-12 << ":" << t->tm_min << ":" << t->tm_sec << " AM\n"; + } + + //----------------------------- + bool DocumentImporter::writeLibraryNodes ( const COLLADAFW::LibraryNodes* libraryNodes ) + { + // TODO + return false; + } } \ No newline at end of file Modified: branches/nextgen/COLLADAMaya/src/COLLADAMayaGeometryImporter.cpp =================================================================== --- branches/nextgen/COLLADAMaya/src/COLLADAMayaGeometryImporter.cpp 2009-01-28 10:48:01 UTC (rev 329) +++ branches/nextgen/COLLADAMaya/src/COLLADAMayaGeometryImporter.cpp 2009-01-28 17:10:44 UTC (rev 330) @@ -36,9 +36,6 @@ // -------------------------------------------- GeometryImporter::GeometryImporter( DocumentImporter* documentImporter ) : BaseImporter ( documentImporter ) - , mGeometry ( 0 ) - , mMesh ( 0 ) - , mTransformObject ( MObject::kNullObj ) {} // -------------------------------------------- @@ -46,9 +43,6 @@ { if ( geometry == 0 ) return false; - mGeometry = geometry; - -// const COLLADAFW::GeometricElement* geometricElement = geometry->getGeometricElement (); COLLADAFW::Geometry::GeometryType type = geometry->getType (); switch ( type ) { @@ -74,67 +68,47 @@ // -------------------------------------------- bool GeometryImporter::importMesh ( const COLLADAFW::Mesh* mesh ) { - // Set the current mesh member variable - mMesh = mesh; + // Get the unique framework mesh id + const COLLADAFW::UniqueId& meshUniqueId = mesh->getUniqueId (); - String id = mesh->getId (); - String name = mesh->getName (); - // Get the transform node of the current mesh. - const DocumentImporter* documentImporter = getDocumentImporter (); - const VisualSceneImporter* visualSceneImporter = documentImporter->getVisualSceneImporter (); - const UniqueIdToUniqueIdsMap& geometryNodesMap = visualSceneImporter->getGeometryNodesMap (); + DocumentImporter* documentImporter = getDocumentImporter (); + VisualSceneImporter* visualSceneImporter = documentImporter->getVisualSceneImporter (); - const COLLADAFW::UniqueId& geometryID = mesh->getUniqueId (); - //geometryNodesMap [ geometryID ]; - UniqueIdToUniqueIdsMap::const_iterator it = geometryNodesMap.find ( geometryID ); - if ( it == geometryNodesMap.end () ) + // Get all visual scene nodes, which use this geometry an make the parent connection + const std::set<const COLLADAFW::UniqueId>* transformNodesSet = + visualSceneImporter->getGeometryTransformIds ( meshUniqueId ); + size_t numNodes = transformNodesSet->size (); + std::set<const COLLADAFW::UniqueId>::const_iterator nodesIter = transformNodesSet->begin (); + while ( nodesIter != transformNodesSet->end () ) { - std::cerr << "No transform node for the current geometry!" << endl; - return false; - } + // Get the maya node of the current transform node. + const COLLADAFW::UniqueId& transformNodeUniqueId = *nodesIter; + MayaNode* mayaTransformNode = visualSceneImporter->getMayaTransformNode ( transformNodeUniqueId ); + String transformNodeName = mayaTransformNode->getName (); - // Get all visual scene nodes, which use this geometry - const std::set<const COLLADAFW::UniqueId>& nodesSet = ( *it ).second; - size_t numNodes = nodesSet.size (); - std::set<const COLLADAFW::UniqueId>::const_iterator nodesIter = nodesSet.begin (); - while ( nodesIter != nodesSet.end () ) - { - const COLLADAFW::UniqueId& nodeId = *nodesIter; - - // Get the name of the current node. - const UniqueIdNamesMap& nodeNamesMap = visualSceneImporter->getNodeNamesMap (); -// String nodeName = nodeNamesMap [ nodeId ]; - UniqueIdNamesMap::const_iterator it3 = nodeNamesMap.find ( nodeId ); - if ( it3 == nodeNamesMap.end () ) - { - std::cerr << "No name for the transform node!" << endl; - assert ( "No name for the transform node!" ); - return false; - } - String parentNodeName = (*it3).second; - // The first reference is a direct one, the others are instances. - if ( nodesIter == nodesSet.begin() ) + if ( nodesIter == transformNodesSet->begin() ) { // Create the current mesh node. - createMesh ( mesh, parentNodeName ); + createMesh ( mesh, mayaTransformNode ); } else { -// parent -shape -noConnections -relative -addObject "|pCube1|pCubeShape1" "pCube2"; - // TODO + // Get the path to the mesh and the parent transform node + String transformNodePath = mayaTransformNode->getNodePath (); + + // We need the path of the mesh. + const COLLADAFW::UniqueId& uniqueId = mesh->getUniqueId (); + MayaNode* mayaMeshNode = getMayaMeshNode ( uniqueId ); + String meshNodePath = mayaMeshNode->getNodePath (); - // Get the current maya ascii file to write the data. + // parent -shape -noConnections -relative -addObject "|pCube1|pCubeShape1" "pCube2"; FILE* file = getDocumentImporter ()->getFile (); - - // TODO We have to store the scene graph, otherwise we can't get the path to the node. - - // TODO Get the path to the parent node - String childPath = "|" + parentNodeName + "|" + mesh->getName (); - MayaDM::parentShape ( file, childPath, parentNodeName ); + MayaDM::parentShape ( file, meshNodePath, transformNodePath, false, true, true, true ); + } - } + ++nodesIter; } return true; @@ -687,14 +661,23 @@ // -------------------------------------------- bool GeometryImporter::createMesh ( const COLLADAFW::Mesh* mesh, - const String& parentNodeName ) + MayaNode* mayaTransformNode ) { - // Get the current maya ascii file to write the data. - FILE* file = getDocumentImporter ()->getFile (); + // Create a unique name. + String meshName = mMeshNodeIdList.addId ( mesh->getName () ); + // Create a maya node object of the current node and push it into the map. + const COLLADAFW::UniqueId& uniqueId = mesh->getUniqueId (); + MayaNode mayaMeshNode ( uniqueId, meshName, mayaTransformNode ); + mMayaMeshNodesMap [ uniqueId ] = mayaMeshNode; + + // Get the parent node name. + assert ( mayaTransformNode != NULL ); + String transformNodeName = mayaTransformNode->getName (); + // Create the current mesh node. - MayaDM::Mesh meshNode ( file, mesh->getName (), parentNodeName ); - meshNode.getInMesh (); + FILE* file = getDocumentImporter ()->getFile (); + MayaDM::Mesh meshNode ( file, mesh->getName (), transformNodeName ); // Write the vertex positions. // Just write the values, they will be referenced from the edges and the faces. @@ -734,4 +717,25 @@ return true; } + + // -------------------------------------------- + const MayaNode* GeometryImporter::getMayaMeshNode ( const COLLADAFW::UniqueId& uniqueId ) const + { + UniqueIdMayaNodesMap::const_iterator it = mMayaMeshNodesMap.find ( uniqueId ); + if ( it != mMayaMeshNodesMap.end () ) + return &(*it).second; + + return NULL; + } + + // -------------------------------------------- + MayaNode* GeometryImporter::getMayaMeshNode ( const COLLADAFW::UniqueId& uniqueId ) + { + UniqueIdMayaNodesMap::iterator it = mMayaMeshNodesMap.find ( uniqueId ); + if ( it != mMayaMeshNodesMap.end () ) + return &(*it).second; + + return NULL; + } + } \ No newline at end of file Added: branches/nextgen/COLLADAMaya/src/COLLADAMayaNode.cpp =================================================================== --- branches/nextgen/COLLADAMaya/src/COLLADAMayaNode.cpp (rev 0) +++ branches/nextgen/COLLADAMaya/src/COLLADAMayaNode.cpp 2009-01-28 17:10:44 UTC (rev 330) @@ -0,0 +1,39 @@ +/* + Copyright (c) 2008 NetAllied Systems GmbH + + This file is part of COLLADAMaya. + + Portions of the code are: + Copyright (c) 2005-2007 Feeling Software Inc. + Copyright (c) 2005-2007 Sony Computer Entertainment America + Copyright (c) 2004-2005 Alias Systems Corp. + + Licensed under the MIT Open Source License, + for details please see LICENSE file or the website + http://www.opensource.org/licenses/mit-license.php +*/ +#include "COLLADAMayaStableheaders.h" +#include "COLLADAMayaNode.h" + +#include "COLLADABUUtils.h" + + +namespace COLLADAMaya +{ + + // ------------------------------------ + const COLLADAMaya::String MayaNode::getNodePath () + { + if ( COLLADABU::Utils::equals ( mPath, "") ) + { + if ( mParent != NULL ) + { + mPath = mParent->getNodePath () + mPath; + } + mPath += "|" + mName; + } + + return mPath; + } + +} // namespace COLLADAMaya Modified: branches/nextgen/COLLADAMaya/src/COLLADAMayaVisualSceneImporter.cpp =================================================================== --- branches/nextgen/COLLADAMaya/src/COLLADAMayaVisualSceneImporter.cpp 2009-01-28 10:48:01 UTC (rev 329) +++ branches/nextgen/COLLADAMaya/src/COLLADAMayaVisualSceneImporter.cpp 2009-01-28 17:10:44 UTC (rev 330) @@ -65,19 +65,17 @@ // ----------------------------------- void VisualSceneImporter::importNode ( const COLLADAFW::Node* node, - const COLLADAFW::Node* parentNode ) + const COLLADAFW::UniqueId* parentTransformNodeId ) { - + // Check for a parent node name - COLLADAFW::UniqueId parentNodeId; - String parentNodeName = ""; - if ( parentNode != NULL ) + MayaNode* parentMayaNode = NULL; + String parentNodeName = ""; + if ( parentTransformNodeId != NULL ) { - parentNodeId = parentNode->getUniqueId (); - String parentNodePath = mNodePathesMap [ parentNodeId ]; - std::vector<String> parts; - COLLADABU::Utils::split ( parentNodePath, String("|"), parts ); - parentNodeName = parts [ parts.size () ]; + parentMayaNode = getMayaTransformNode ( *parentTransformNodeId ); + assert ( parentMayaNode != NULL ); + parentNodeName = parentMayaNode->getName (); } // Create the node object (joint or node) @@ -85,19 +83,21 @@ String nodeName = node->getName (); String nodeSid = node->getSid (); - // Set the node name in the list of names. + // Create a unique name. nodeName = mTransformNodeIdList.addId ( nodeName ); - mNodePathesMap [ node->getUniqueId () ] = nodeName; - // TODO Write the node in the node hierarchy graph + // Create a maya node object of the current node and push it into the map. + const COLLADAFW::UniqueId& transformNodeId = node->getUniqueId (); + MayaNode mayaNode ( transformNodeId, nodeName, parentMayaNode ); + mMayaTransformNodesMap [ transformNodeId ] = mayaNode; - // Import the tranformations + // Import the tranformations. importTransformations ( node, transformNode ); - // Import instance geometry + // Import instance geometry. readGeometryInstances ( node, transformNode ); - // TODO + // Import the node instances. readNodeInstances ( node ); // Recursive call for all child elements. @@ -106,30 +106,33 @@ for ( size_t i=0; i<numChildNodes; ++i ) { COLLADAFW::Node* childNode = childNodes [i]; - importNode ( childNode, node ); + importNode ( childNode, &transformNodeId ); } } // ----------------------------------- bool VisualSceneImporter::readNodeInstances ( const COLLADAFW::Node* node ) { - // Get the current maya ascii file to write the data. - FILE* file = getDocumentImporter ()->getFile (); - const COLLADAFW::InstanceNodeArray& nodeInstances = node->getInstanceNodes (); size_t numInstances = nodeInstances.getCount (); for ( size_t i=0; i<numInstances; ++i ) { const COLLADAFW::InstanceNode* nodeInstance = nodeInstances [i]; - const COLLADAFW::UniqueId& uniqueId = nodeInstance->getInstanciatedObjectId (); + const COLLADAFW::UniqueId& childInstanceId = nodeInstance->getInstanciatedObjectId (); - // TODO Check if the original node is already generated! - String nodeName = mNodePathesMap [ uniqueId ]; + // Check if the original node is already generated! + MayaNode* mayaChildNode = getMayaTransformNode ( childInstanceId ); + String childNodeName = mayaChildNode->getName (); - // TODO Get the pathes! - String nodePath = "bla"; - String parentNodePath = "blubber"; - MayaDM::parent ( file, nodePath, parentNodePath ); + // Get the pathes. + const COLLADAFW::UniqueId& nodeId = node->getUniqueId (); + MayaNode* mayaNode = getMayaTransformNode ( nodeId ); + String parentNodePath = mayaNode->getNodePath (); + String childNodePath = mayaChildNode->getNodePath (); + + // parent -shape -noConnections -relative -addObject "|node1|node2" "|rootNode"; + FILE* file = getDocumentImporter ()->getFile (); + MayaDM::parentShape ( file, childNodePath, parentNodePath, false, true, true, true ); } return true; @@ -154,7 +157,7 @@ const COLLADAFW::UniqueId& geometryId = instanceGeometry->getInstanciatedObjectId (); // Save for every geometry a list of transform nodes, which refer to it. - mGeometryNodesMap [ geometryId ].insert ( nodeId ); + mGeometryTransformIdsMap [ geometryId ].insert ( nodeId ); } return true; @@ -504,5 +507,36 @@ matrix[3][3] = 1.0f; } + // ----------------------------------- + const MayaNode* VisualSceneImporter::getMayaTransformNode ( + const COLLADAFW::UniqueId& uniqueId ) const + { + UniqueIdMayaNodesMap::const_iterator it = mMayaTransformNodesMap.find ( uniqueId ); + if ( it != mMayaTransformNodesMap.end () ) + return &(*it).second; + return NULL; + } + + // ----------------------------------- + MayaNode* VisualSceneImporter::getMayaTransformNode ( const COLLADAFW::UniqueId& uniqueId ) + { + UniqueIdMayaNodesMap::iterator it = mMayaTransformNodesMap.find ( uniqueId ); + if ( it != mMayaTransformNodesMap.end () ) + return &(*it).second; + + return NULL; + } + + // ----------------------------------- + const std::set<const COLLADAFW::UniqueId>* VisualSceneImporter::getGeometryTransformIds ( + const COLLADAFW::UniqueId& geometryId ) const + { + UniqueIdUniqueIdsMap::const_iterator it = mGeometryTransformIdsMap.find ( geometryId ); + + if ( it != mGeometryTransformIdsMap.end () ) + return &(*it).second; + + return NULL; + } } \ No newline at end of file Added: branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLAssetLoader.h =================================================================== --- branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLAssetLoader.h (rev 0) +++ branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLAssetLoader.h 2009-01-28 17:10:44 UTC (rev 330) @@ -0,0 +1,167 @@ +/* + Copyright (c) 2008 NetAllied Systems GmbH + + This file is part of COLLADASaxFrameworkLoader. + + Licensed under the MIT Open Source License, + for details please see LICENSE file or the website + http://www.opensource.org/licenses/mit-license.php +*/ + +#ifndef __COLLADASAXFWL_ASSETLOADER_H__ +#define __COLLADASAXFWL_ASSETLOADER_H__ + +#include "COLLADASaxFWLPrerequisites.h" +#include "COLLADASaxFWLFilePartLoader.h" + +#include "COLLADAFWFileInfo.h" +#include "COLLADAFWIWriter.h" + + +namespace COLLADASaxFWL +{ + + /** TODO Documentation */ + class AssetLoader : public FilePartLoader + { + private: + + /** Pointer to the asset this loader creates.*/ + COLLADAFW::FileInfo* mAsset; + + public: + + /** Constructor. */ + AssetLoader ( IFilePartLoader* callingFilePartLoader ); + + /** Destructor. */ + virtual ~AssetLoader (); + + /** Sax callback function for the end of the collada document asset information.*/ + virtual bool end__COLLADA__asset() + { + bool success = writer()->writeGlobalAsset ( mAsset ); + delete mAsset; + finish(); + return success; + } + + virtual bool begin__contributor(){return true;} + virtual bool end__contributor(){return true;} + + virtual bool begin__author(){return true;} + virtual bool end__author(){return true;} + virtual bool data__author( const ParserChar* data, size_t length ) + { + mAsset->appendValuePair ( "author", String ( (char*) data, length ) ); + return true; + } + + virtual bool begin__authoring_tool(){return true;} + virtual bool end__authoring_tool(){return true;} + virtual bool data__authoring_tool( const ParserChar* data, size_t length ) + { + mAsset->appendValuePair ( "authoring_tool", String ( (char*) data, length ) ); + return true; + } + + virtual bool begin__comments(){return true;} + virtual bool end__comments(){return true;} + virtual bool data__comments( const ParserChar* data, size_t length ) + { + mAsset->appendValuePair ( "comments", String ( (char*) data, length ) ); + return true; + } + + virtual bool begin__copyright(){return true;} + virtual bool end__copyright(){return true;} + virtual bool data__copyright( const ParserChar* data, size_t length ) + { + mAsset->appendValuePair ( "copyright", String ( (char*) data, length ) ); + return true; + } + + virtual bool begin__source_data(){return true;} + virtual bool end__source_data(){return true;} + virtual bool data__source_data( ... [truncated message content] |
From: <rob...@us...> - 2009-01-28 10:48:15
|
Revision: 329 http://colladamaya.svn.sourceforge.net/colladamaya/?rev=329&view=rev Author: robertwuerfel Date: 2009-01-28 10:48:01 +0000 (Wed, 28 Jan 2009) Log Message: ----------- update to new version of auto generated sax parser Only one attributeData struct for elements of same type with different parents Handling of list types in attributes Modified Paths: -------------- branches/nextgen/COLLADAMax/src/COLLADAMaxColladaPlugin.cpp branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLColladaParserAutoGen.h branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLColladaParserAutoGenAttributes.h branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLColladaParserAutoGenPrivate.h branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLLibraryNodesLoader.h branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLMeshLoader.h branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLNodeLoader.h branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLVisualSceneLoader.h branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLColladaParserAutoGenPrivate.cpp branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLColladaParserAutoGenPrivateFunctionMap.cpp branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLColladaParserAutoGenPrivateNameMap.cpp branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLLibraryNodesLoader.cpp branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLMeshLoader.cpp branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLNodeLoader.cpp branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLVisualSceneLoader.cpp branches/nextgen/GeneratedSaxParser/include/GeneratedSaxParserParserTemplate.h branches/nextgen/GeneratedSaxParser/include/GeneratedSaxParserParserTemplateBase.h branches/nextgen/GeneratedSaxParser/include/GeneratedSaxParserUtils.h branches/nextgen/GeneratedSaxParser/src/GeneratedSaxParserParserTemplateBase.cpp branches/nextgen/GeneratedSaxParser/src/GeneratedSaxParserUtils.cpp Modified: branches/nextgen/COLLADAMax/src/COLLADAMaxColladaPlugin.cpp =================================================================== --- branches/nextgen/COLLADAMax/src/COLLADAMaxColladaPlugin.cpp 2009-01-27 15:56:33 UTC (rev 328) +++ branches/nextgen/COLLADAMax/src/COLLADAMaxColladaPlugin.cpp 2009-01-28 10:48:01 UTC (rev 329) @@ -7,8 +7,8 @@ const String COLLADAPlugin::EXTENSIONNAME = "dae"; const String COLLADAPlugin::LONGDESCRIPTION = "New COLLADA Document"; const String COLLADAPlugin::SHORTDESCRIPTION = "NEWCOLLADA"; - const String COLLADAPlugin::AUTHORNAME = "netAllied"; - const String COLLADAPlugin::COPYRIGHTMESSAGE = "Copyright 2008-2009 netAllied. Copyright 2006 Feeling Software. Based on Autodesk' 3dsMax COLLADASW Tools."; + const String COLLADAPlugin::AUTHORNAME = "NetAllied Systems GmbH"; + const String COLLADAPlugin::COPYRIGHTMESSAGE = "Copyright 2008-2009 NetAllied Systems GmbH. Copyright 2006 Feeling Software. Based on Autodesk' 3dsMax COLLADASW Tools."; const String COLLADAPlugin::OTHERMESSAGE1 = ""; const String COLLADAPlugin::OTHERMESSAGE2 = ""; Modified: branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLColladaParserAutoGen.h =================================================================== --- branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLColladaParserAutoGen.h 2009-01-27 15:56:33 UTC (rev 328) +++ branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLColladaParserAutoGen.h 2009-01-28 10:48:01 UTC (rev 329) @@ -1,11 +1,11 @@ /* -Copyright (c) 2008 NetAllied Systems GmbH + Copyright (c) 2008 NetAllied Systems GmbH -This file is part of COLLADASaxFrameworkLoader. + This file is part of COLLADASaxFrameworkLoader. -Licensed under the MIT Open Source License, -for details please see LICENSE file or the website -http://www.opensource.org/licenses/mit-license.php + Licensed under the MIT Open Source License, + for details please see LICENSE file or the website + http://www.opensource.org/licenses/mit-license.php */ @@ -17,7 +17,7 @@ #include "COLLADASaxFWLColladaParserAutoGenAttributes.h" -namespace COLLADASaxFWL +namespace COLLADASaxFWL { @@ -94,7 +94,7 @@ virtual bool begin__library_animations__asset(){return true;} virtual bool end__library_animations__asset(){return true;} -virtual bool begin__library_animations__animation( const library_animations__animation__AttributeData& attributeData ){return true;} +virtual bool begin__library_animations__animation( const animation__AttributeData& attributeData ){return true;} virtual bool end__library_animations__animation(){return true;} virtual bool begin__animation__asset(){return true;} @@ -148,10 +148,10 @@ virtual bool begin__channel( const channel__AttributeData& attributeData ){return true;} virtual bool end__channel(){return true;} -virtual bool begin__animation__animation( const animation__animation__AttributeData& attributeData ){return true;} +virtual bool begin__animation__animation( const animation__AttributeData& attributeData ){return true;} virtual bool end__animation__animation(){return true;} -virtual bool begin__animation__extra( const animation__extra__AttributeData& attributeData ){return true;} +virtual bool begin__animation__extra( const extra__AttributeData& attributeData ){return true;} virtual bool end__animation__extra(){return true;} virtual bool begin__extra__asset(){return true;} @@ -160,7 +160,7 @@ virtual bool begin__extra__technique( const extra__technique__AttributeData& attributeData ){return true;} virtual bool end__extra__technique(){return true;} -virtual bool begin__library_animations__extra( const library_animations__extra__AttributeData& attributeData ){return true;} +virtual bool begin__library_animations__extra( const extra__AttributeData& attributeData ){return true;} virtual bool end__library_animations__extra(){return true;} virtual bool begin__library_animation_clips( const library_animation_clips__AttributeData& attributeData ){return true;} @@ -178,13 +178,13 @@ virtual bool begin__instance_animation( const instance_animation__AttributeData& attributeData ){return true;} virtual bool end__instance_animation(){return true;} -virtual bool begin__instance_animation__extra( const instance_animation__extra__AttributeData& attributeData ){return true;} +virtual bool begin__instance_animation__extra( const extra__AttributeData& attributeData ){return true;} virtual bool end__instance_animation__extra(){return true;} -virtual bool begin__animation_clip__extra( const animation_clip__extra__AttributeData& attributeData ){return true;} +virtual bool begin__animation_clip__extra( const extra__AttributeData& attributeData ){return true;} virtual bool end__animation_clip__extra(){return true;} -virtual bool begin__library_animation_clips__extra( const library_animation_clips__extra__AttributeData& attributeData ){return true;} +virtual bool begin__library_animation_clips__extra( const extra__AttributeData& attributeData ){return true;} virtual bool end__library_animation_clips__extra(){return true;} virtual bool begin__library_cameras( const library_cameras__AttributeData& attributeData ){return true;} @@ -216,15 +216,15 @@ virtual bool end__ymag(){return true;} virtual bool data__ymag( double value ){return true;} -virtual bool begin__orthographic__aspect_ratio( const orthographic__aspect_ratio__AttributeData& attributeData ){return true;} +virtual bool begin__orthographic__aspect_ratio( const aspect_ratio__AttributeData& attributeData ){return true;} virtual bool end__orthographic__aspect_ratio(){return true;} virtual bool data__orthographic__aspect_ratio( double value ){return true;} -virtual bool begin__orthographic__znear( const orthographic__znear__AttributeData& attributeData ){return true;} +virtual bool begin__orthographic__znear( const znear__AttributeData& attributeData ){return true;} virtual bool end__orthographic__znear(){return true;} virtual bool data__orthographic__znear( double value ){return true;} -virtual bool begin__orthographic__zfar( const orthographic__zfar__AttributeData& attributeData ){return true;} +virtual bool begin__orthographic__zfar( const zfar__AttributeData& attributeData ){return true;} virtual bool end__orthographic__zfar(){return true;} virtual bool data__orthographic__zfar( double value ){return true;} @@ -239,22 +239,22 @@ virtual bool end__yfov(){return true;} virtual bool data__yfov( double value ){return true;} -virtual bool begin__perspective__aspect_ratio( const perspective__aspect_ratio__AttributeData& attributeData ){return true;} +virtual bool begin__perspective__aspect_ratio( const aspect_ratio__AttributeData& attributeData ){return true;} virtual bool end__perspective__aspect_ratio(){return true;} virtual bool data__perspective__aspect_ratio( double value ){return true;} -virtual bool begin__perspective__znear( const perspective__znear__AttributeData& attributeData ){return true;} +virtual bool begin__perspective__znear( const znear__AttributeData& attributeData ){return true;} virtual bool end__perspective__znear(){return true;} virtual bool data__perspective__znear( double value ){return true;} -virtual bool begin__perspective__zfar( const perspective__zfar__AttributeData& attributeData ){return true;} +virtual bool begin__perspective__zfar( const zfar__AttributeData& attributeData ){return true;} virtual bool end__perspective__zfar(){return true;} virtual bool data__perspective__zfar( double value ){return true;} virtual bool begin__optics__technique( const optics__technique__AttributeData& attributeData ){return true;} virtual bool end__optics__technique(){return true;} -virtual bool begin__optics__extra( const optics__extra__AttributeData& attributeData ){return true;} +virtual bool begin__optics__extra( const extra__AttributeData& attributeData ){return true;} virtual bool end__optics__extra(){return true;} virtual bool begin__imager(){return true;} @@ -263,13 +263,13 @@ virtual bool begin__imager__technique( const imager__technique__AttributeData& attributeData ){return true;} virtual bool end__imager__technique(){return true;} -virtual bool begin__imager__extra( const imager__extra__AttributeData& attributeData ){return true;} +virtual bool begin__imager__extra( const extra__AttributeData& attributeData ){return true;} virtual bool end__imager__extra(){return true;} -virtual bool begin__camera__extra( const camera__extra__AttributeData& attributeData ){return true;} +virtual bool begin__camera__extra( const extra__AttributeData& attributeData ){return true;} virtual bool end__camera__extra(){return true;} -virtual bool begin__library_cameras__extra( const library_cameras__extra__AttributeData& attributeData ){return true;} +virtual bool begin__library_cameras__extra( const extra__AttributeData& attributeData ){return true;} virtual bool end__library_cameras__extra(){return true;} virtual bool begin__library_controllers( const library_controllers__AttributeData& attributeData ){return true;} @@ -300,7 +300,7 @@ virtual bool begin__joints__input( const joints__input__AttributeData& attributeData ){return true;} virtual bool end__joints__input(){return true;} -virtual bool begin__joints__extra( const joints__extra__AttributeData& attributeData ){return true;} +virtual bool begin__joints__extra( const extra__AttributeData& attributeData ){return true;} virtual bool end__joints__extra(){return true;} virtual bool begin__vertex_weights( const vertex_weights__AttributeData& attributeData ){return true;} @@ -317,10 +317,10 @@ virtual bool end__v(){return true;} virtual bool data__v( const long* value, size_t length ){return true;} -virtual bool begin__vertex_weights__extra( const vertex_weights__extra__AttributeData& attributeData ){return true;} +virtual bool begin__vertex_weights__extra( const extra__AttributeData& attributeData ){return true;} virtual bool end__vertex_weights__extra(){return true;} -virtual bool begin__skin__extra( const skin__extra__AttributeData& attributeData ){return true;} +virtual bool begin__skin__extra( const extra__AttributeData& attributeData ){return true;} virtual bool end__skin__extra(){return true;} virtual bool begin__morph( const morph__AttributeData& attributeData ){return true;} @@ -335,16 +335,16 @@ virtual bool begin__targets__input( const targets__input__AttributeData& attributeData ){return true;} virtual bool end__targets__input(){return true;} -virtual bool begin__targets__extra( const targets__extra__AttributeData& attributeData ){return true;} +virtual bool begin__targets__extra( const extra__AttributeData& attributeData ){return true;} virtual bool end__targets__extra(){return true;} -virtual bool begin__morph__extra( const morph__extra__AttributeData& attributeData ){return true;} +virtual bool begin__morph__extra( const extra__AttributeData& attributeData ){return true;} virtual bool end__morph__extra(){return true;} -virtual bool begin__controller__extra( const controller__extra__AttributeData& attributeData ){return true;} +virtual bool begin__controller__extra( const extra__AttributeData& attributeData ){return true;} virtual bool end__controller__extra(){return true;} -virtual bool begin__library_controllers__extra( const library_controllers__extra__AttributeData& attributeData ){return true;} +virtual bool begin__library_controllers__extra( const extra__AttributeData& attributeData ){return true;} virtual bool end__library_controllers__extra(){return true;} virtual bool begin__library_geometries( const library_geometries__AttributeData& attributeData ){return true;} @@ -365,16 +365,16 @@ virtual bool begin__convex_mesh__source( const convex_mesh__source__AttributeData& attributeData ){return true;} virtual bool end__convex_mesh__source(){return true;} -virtual bool begin__convex_mesh__vertices( const convex_mesh__vertices__AttributeData& attributeData ){return true;} +virtual bool begin__convex_mesh__vertices( const vertices__AttributeData& attributeData ){return true;} virtual bool end__convex_mesh__vertices(){return true;} virtual bool begin__vertices__input( const vertices__input__AttributeData& attributeData ){return true;} virtual bool end__vertices__input(){return true;} -virtual bool begin__vertices__extra( const vertices__extra__AttributeData& attributeData ){return true;} +virtual bool begin__vertices__extra( const extra__AttributeData& attributeData ){return true;} virtual bool end__vertices__extra(){return true;} -virtual bool begin__convex_mesh__lines( const convex_mesh__lines__AttributeData& attributeData ){return true;} +virtual bool begin__convex_mesh__lines( const lines__AttributeData& attributeData ){return true;} virtual bool end__convex_mesh__lines(){return true;} virtual bool begin__lines__input( const lines__input__AttributeData& attributeData ){return true;} @@ -384,10 +384,10 @@ virtual bool end__lines__p(){return true;} virtual bool data__lines__p( const unsigned long long* value, size_t length ){return true;} -virtual bool begin__lines__extra( const lines__extra__AttributeData& attributeData ){return true;} +virtual bool begin__lines__extra( const extra__AttributeData& attributeData ){return true;} virtual bool end__lines__extra(){return true;} -virtual bool begin__convex_mesh__linestrips( const convex_mesh__linestrips__AttributeData& attributeData ){return true;} +virtual bool begin__convex_mesh__linestrips( const linestrips__AttributeData& attributeData ){return true;} virtual bool end__convex_mesh__linestrips(){return true;} virtual bool begin__linestrips__input( const linestrips__input__AttributeData& attributeData ){return true;} @@ -397,10 +397,10 @@ virtual bool end__linestrips__p(){return true;} virtual bool data__linestrips__p( const unsigned long long* value, size_t length ){return true;} -virtual bool begin__linestrips__extra( const linestrips__extra__AttributeData& attributeData ){return true;} +virtual bool begin__linestrips__extra( const extra__AttributeData& attributeData ){return true;} virtual bool end__linestrips__extra(){return true;} -virtual bool begin__convex_mesh__polygons( const convex_mesh__polygons__AttributeData& attributeData ){return true;} +virtual bool begin__convex_mesh__polygons( const polygons__AttributeData& attributeData ){return true;} virtual bool end__convex_mesh__polygons(){return true;} virtual bool begin__polygons__input( const polygons__input__AttributeData& attributeData ){return true;} @@ -421,10 +421,10 @@ virtual bool end__h(){return true;} virtual bool data__h( const unsigned long long* value, size_t length ){return true;} -virtual bool begin__polygons__extra( const polygons__extra__AttributeData& attributeData ){return true;} +virtual bool begin__polygons__extra( const extra__AttributeData& attributeData ){return true;} virtual bool end__polygons__extra(){return true;} -virtual bool begin__convex_mesh__polylist( const convex_mesh__polylist__AttributeData& attributeData ){return true;} +virtual bool begin__convex_mesh__polylist( const polylist__AttributeData& attributeData ){return true;} virtual bool end__convex_mesh__polylist(){return true;} virtual bool begin__polylist__input( const polylist__input__AttributeData& attributeData ){return true;} @@ -438,10 +438,10 @@ virtual bool end__polylist__p(){return true;} virtual bool data__polylist__p( const unsigned long long* value, size_t length ){return true;} -virtual bool begin__polylist__extra( const polylist__extra__AttributeData& attributeData ){return true;} +virtual bool begin__polylist__extra( const extra__AttributeData& attributeData ){return true;} virtual bool end__polylist__extra(){return true;} -virtual bool begin__convex_mesh__triangles( const convex_mesh__triangles__AttributeData& attributeData ){return true;} +virtual bool begin__convex_mesh__triangles( const triangles__AttributeData& attributeData ){return true;} virtual bool end__convex_mesh__triangles(){return true;} virtual bool begin__triangles__input( const triangles__input__AttributeData& attributeData ){return true;} @@ -451,10 +451,10 @@ virtual bool end__triangles__p(){return true;} virtual bool data__triangles__p( const unsigned long long* value, size_t length ){return true;} -virtual bool begin__triangles__extra( const triangles__extra__AttributeData& attributeData ){return true;} +virtual bool begin__triangles__extra( const extra__AttributeData& attributeData ){return true;} virtual bool end__triangles__extra(){return true;} -virtual bool begin__convex_mesh__trifans( const convex_mesh__trifans__AttributeData& attributeData ){return true;} +virtual bool begin__convex_mesh__trifans( const trifans__AttributeData& attributeData ){return true;} virtual bool end__convex_mesh__trifans(){return true;} virtual bool begin__trifans__input( const trifans__input__AttributeData& attributeData ){return true;} @@ -464,10 +464,10 @@ virtual bool end__trifans__p(){return true;} virtual bool data__trifans__p( const unsigned long long* value, size_t length ){return true;} -virtual bool begin__trifans__extra( const trifans__extra__AttributeData& attributeData ){return true;} +virtual bool begin__trifans__extra( const extra__AttributeData& attributeData ){return true;} virtual bool end__trifans__extra(){return true;} -virtual bool begin__convex_mesh__tristrips( const convex_mesh__tristrips__AttributeData& attributeData ){return true;} +virtual bool begin__convex_mesh__tristrips( const tristrips__AttributeData& attributeData ){return true;} virtual bool end__convex_mesh__tristrips(){return true;} virtual bool begin__tristrips__input( const tristrips__input__AttributeData& attributeData ){return true;} @@ -477,10 +477,10 @@ virtual bool end__tristrips__p(){return true;} virtual bool data__tristrips__p( const unsigned long long* value, size_t length ){return true;} -virtual bool begin__tristrips__extra( const tristrips__extra__AttributeData& attributeData ){return true;} +virtual bool begin__tristrips__extra( const extra__AttributeData& attributeData ){return true;} virtual bool end__tristrips__extra(){return true;} -virtual bool begin__convex_mesh__extra( const convex_mesh__extra__AttributeData& attributeData ){return true;} +virtual bool begin__convex_mesh__extra( const extra__AttributeData& attributeData ){return true;} virtual bool end__convex_mesh__extra(){return true;} virtual bool begin__mesh(){return true;} @@ -489,31 +489,31 @@ virtual bool begin__mesh__source( const mesh__source__AttributeData& attributeData ){return true;} virtual bool end__mesh__source(){return true;} -virtual bool begin__mesh__vertices( const mesh__vertices__AttributeData& attributeData ){return true;} +virtual bool begin__mesh__vertices( const vertices__AttributeData& attributeData ){return true;} virtual bool end__mesh__vertices(){return true;} -virtual bool begin__mesh__lines( const mesh__lines__AttributeData& attributeData ){return true;} +virtual bool begin__mesh__lines( const lines__AttributeData& attributeData ){return true;} virtual bool end__mesh__lines(){return true;} -virtual bool begin__mesh__linestrips( const mesh__linestrips__AttributeData& attributeData ){return true;} +virtual bool begin__mesh__linestrips( const linestrips__AttributeData& attributeData ){return true;} virtual bool end__mesh__linestrips(){return true;} -virtual bool begin__mesh__polygons( const mesh__polygons__AttributeData& attributeData ){return true;} +virtual bool begin__mesh__polygons( const polygons__AttributeData& attributeData ){return true;} virtual bool end__mesh__polygons(){return true;} -virtual bool begin__mesh__polylist( const mesh__polylist__AttributeData& attributeData ){return true;} +virtual bool begin__mesh__polylist( const polylist__AttributeData& attributeData ){return true;} virtual bool end__mesh__polylist(){return true;} -virtual bool begin__mesh__triangles( const mesh__triangles__AttributeData& attributeData ){return true;} +virtual bool begin__mesh__triangles( const triangles__AttributeData& attributeData ){return true;} virtual bool end__mesh__triangles(){return true;} -virtual bool begin__mesh__trifans( const mesh__trifans__AttributeData& attributeData ){return true;} +virtual bool begin__mesh__trifans( const trifans__AttributeData& attributeData ){return true;} virtual bool end__mesh__trifans(){return true;} -virtual bool begin__mesh__tristrips( const mesh__tristrips__AttributeData& attributeData ){return true;} +virtual bool begin__mesh__tristrips( const tristrips__AttributeData& attributeData ){return true;} virtual bool end__mesh__tristrips(){return true;} -virtual bool begin__mesh__extra( const mesh__extra__AttributeData& attributeData ){return true;} +virtual bool begin__mesh__extra( const extra__AttributeData& attributeData ){return true;} virtual bool end__mesh__extra(){return true;} virtual bool begin__spline( const spline__AttributeData& attributeData ){return true;} @@ -528,16 +528,16 @@ virtual bool begin__control_vertices__input( const control_vertices__input__AttributeData& attributeData ){return true;} virtual bool end__control_vertices__input(){return true;} -virtual bool begin__control_vertices__extra( const control_vertices__extra__AttributeData& attributeData ){return true;} +virtual bool begin__control_vertices__extra( const extra__AttributeData& attributeData ){return true;} virtual bool end__control_vertices__extra(){return true;} -virtual bool begin__spline__extra( const spline__extra__AttributeData& attributeData ){return true;} +virtual bool begin__spline__extra( const extra__AttributeData& attributeData ){return true;} virtual bool end__spline__extra(){return true;} -virtual bool begin__geometry__extra( const geometry__extra__AttributeData& attributeData ){return true;} +virtual bool begin__geometry__extra( const extra__AttributeData& attributeData ){return true;} virtual bool end__geometry__extra(){return true;} -virtual bool begin__library_geometries__extra( const library_geometries__extra__AttributeData& attributeData ){return true;} +virtual bool begin__library_geometries__extra( const extra__AttributeData& attributeData ){return true;} virtual bool end__library_geometries__extra(){return true;} virtual bool begin__library_effects( const library_effects__AttributeData& attributeData ){return true;} @@ -552,7 +552,7 @@ virtual bool begin__effect__asset(){return true;} virtual bool end__effect__asset(){return true;} -virtual bool begin__effect__annotate( const effect__annotate__AttributeData& attributeData ){return true;} +virtual bool begin__effect__annotate( const annotate__AttributeData& attributeData ){return true;} virtual bool end__effect__annotate(){return true;} virtual bool begin__annotate__bool(){return true;} @@ -619,7 +619,7 @@ virtual bool end__annotate__string(){return true;} virtual bool data__annotate__string( const ParserChar* value, size_t length ){return true;} -virtual bool begin__effect__image( const effect__image__AttributeData& attributeData ){return true;} +virtual bool begin__effect__image( const image__AttributeData& attributeData ){return true;} virtual bool end__effect__image(){return true;} virtual bool begin__image__asset(){return true;} @@ -633,13 +633,13 @@ virtual bool end__image__init_from(){return true;} virtual bool data__image__init_from( const ParserChar* value, size_t length ){return true;} -virtual bool begin__image__extra( const image__extra__AttributeData& attributeData ){return true;} +virtual bool begin__image__extra( const extra__AttributeData& attributeData ){return true;} virtual bool end__image__extra(){return true;} virtual bool begin__effect__newparam( const effect__newparam__AttributeData& attributeData ){return true;} virtual bool end__effect__newparam(){return true;} -virtual bool begin__newparam__annotate( const newparam__annotate__AttributeData& attributeData ){return true;} +virtual bool begin__newparam__annotate( const annotate__AttributeData& attributeData ){return true;} virtual bool end__newparam__annotate(){return true;} virtual bool begin__semantic(){return true;} @@ -831,7 +831,7 @@ virtual bool end__option(){return true;} virtual bool data__option( const ParserChar* value, size_t length ){return true;} -virtual bool begin__format_hint__extra( const format_hint__extra__AttributeData& attributeData ){return true;} +virtual bool begin__format_hint__extra( const extra__AttributeData& attributeData ){return true;} virtual bool end__format_hint__extra(){return true;} virtual bool begin__surface__size(){return true;} @@ -850,7 +850,7 @@ virtual bool end__mipmap_generate(){return true;} virtual bool data__mipmap_generate( bool value ){return true;} -virtual bool begin__surface__extra( const surface__extra__AttributeData& attributeData ){return true;} +virtual bool begin__surface__extra( const extra__AttributeData& attributeData ){return true;} virtual bool end__surface__extra(){return true;} virtual bool begin__newparam__sampler1D(){return true;} @@ -888,7 +888,7 @@ virtual bool end__sampler1D__mipmap_bias(){return true;} virtual bool data__sampler1D__mipmap_bias( double value ){return true;} -virtual bool begin__sampler1D__extra( const sampler1D__extra__AttributeData& attributeData ){return true;} +virtual bool begin__sampler1D__extra( const extra__AttributeData& attributeData ){return true;} virtual bool end__sampler1D__extra(){return true;} virtual bool begin__newparam__sampler2D(){return true;} @@ -930,7 +930,7 @@ virtual bool end__sampler2D__mipmap_bias(){return true;} virtual bool data__sampler2D__mipmap_bias( double value ){return true;} -virtual bool begin__sampler2D__extra( const sampler2D__extra__AttributeData& attributeData ){return true;} +virtual bool begin__sampler2D__extra( const extra__AttributeData& attributeData ){return true;} virtual bool end__sampler2D__extra(){return true;} virtual bool begin__newparam__sampler3D(){return true;} @@ -976,7 +976,7 @@ virtual bool end__sampler3D__mipmap_bias(){return true;} virtual bool data__sampler3D__mipmap_bias( double value ){return true;} -virtual bool begin__sampler3D__extra( const sampler3D__extra__AttributeData& attributeData ){return true;} +virtual bool begin__sampler3D__extra( const extra__AttributeData& attributeData ){return true;} virtual bool end__sampler3D__extra(){return true;} virtual bool begin__newparam__samplerCUBE(){return true;} @@ -1022,7 +1022,7 @@ virtual bool end__samplerCUBE__mipmap_bias(){return true;} virtual bool data__samplerCUBE__mipmap_bias( double value ){return true;} -virtual bool begin__samplerCUBE__extra( const samplerCUBE__extra__AttributeData& attributeData ){return true;} +virtual bool begin__samplerCUBE__extra( const extra__AttributeData& attributeData ){return true;} virtual bool end__samplerCUBE__extra(){return true;} virtual bool begin__newparam__samplerRECT(){return true;} @@ -1064,7 +1064,7 @@ virtual bool end__samplerRECT__mipmap_bias(){return true;} virtual bool data__samplerRECT__mipmap_bias( double value ){return true;} -virtual bool begin__samplerRECT__extra( const samplerRECT__extra__AttributeData& attributeData ){return true;} +virtual bool begin__samplerRECT__extra( const extra__AttributeData& attributeData ){return true;} virtual bool end__samplerRECT__extra(){return true;} virtual bool begin__newparam__samplerDEPTH(){return true;} @@ -1090,7 +1090,7 @@ virtual bool end__samplerDEPTH__magfilter(){return true;} virtual bool data__samplerDEPTH__magfilter( const ParserChar* value, size_t length ){return true;} -virtual bool begin__samplerDEPTH__extra( const samplerDEPTH__extra__AttributeData& attributeData ){return true;} +virtual bool begin__samplerDEPTH__extra( const extra__AttributeData& attributeData ){return true;} virtual bool end__samplerDEPTH__extra(){return true;} virtual bool begin__newparam__enum(){return true;} @@ -1101,10 +1101,10 @@ virtual bool end__fx_profile_abstract(){return true;} virtual bool data__fx_profile_abstract( const ParserChar* value, size_t length ){return true;} -virtual bool begin__effect__extra( const effect__extra__AttributeData& attributeData ){return true;} +virtual bool begin__effect__extra( const extra__AttributeData& attributeData ){return true;} virtual bool end__effect__extra(){return true;} -virtual bool begin__library_effects__extra( const library_effects__extra__AttributeData& attributeData ){return true;} +virtual bool begin__library_effects__extra( const extra__AttributeData& attributeData ){return true;} virtual bool end__library_effects__extra(){return true;} virtual bool begin__library_force_fields( const library_force_fields__AttributeData& attributeData ){return true;} @@ -1122,10 +1122,10 @@ virtual bool begin__force_field__technique( const force_field__technique__AttributeData& attributeData ){return true;} virtual bool end__force_field__technique(){return true;} -virtual bool begin__force_field__extra( const force_field__extra__AttributeData& attributeData ){return true;} +virtual bool begin__force_field__extra( const extra__AttributeData& attributeData ){return true;} virtual bool end__force_field__extra(){return true;} -virtual bool begin__library_force_fields__extra( const library_force_fields__extra__AttributeData& attributeData ){return true;} +virtual bool begin__library_force_fields__extra( const extra__AttributeData& attributeData ){return true;} virtual bool end__library_force_fields__extra(){return true;} virtual bool begin__library_images( const library_images__AttributeData& attributeData ){return true;} @@ -1134,10 +1134,10 @@ virtual bool begin__library_images__asset(){return true;} virtual bool end__library_images__asset(){return true;} -virtual bool begin__library_images__image( const library_images__image__AttributeData& attributeData ){return true;} +virtual bool begin__library_images__image( const image__AttributeData& attributeData ){return true;} virtual bool end__library_images__image(){return true;} -virtual bool begin__library_images__extra( const library_images__extra__AttributeData& attributeData ){return true;} +virtual bool begin__library_images__extra( const extra__AttributeData& attributeData ){return true;} virtual bool end__library_images__extra(){return true;} virtual bool begin__library_lights( const library_lights__AttributeData& attributeData ){return true;} @@ -1176,15 +1176,15 @@ virtual bool end__point__color(){return true;} virtual bool data__point__color( const double* value, size_t length ){return true;} -virtual bool begin__point__constant_attenuation( const point__constant_attenuation__AttributeData& attributeData ){return true;} +virtual bool begin__point__constant_attenuation( const constant_attenuation__AttributeData& attributeData ){return true;} virtual bool end__point__constant_attenuation(){return true;} virtual bool data__point__constant_attenuation( double value ){return true;} -virtual bool begin__point__linear_attenuation( const point__linear_attenuation__AttributeData& attributeData ){return true;} +virtual bool begin__point__linear_attenuation( const linear_attenuation__AttributeData& attributeData ){return true;} virtual bool end__point__linear_attenuation(){return true;} virtual bool data__point__linear_attenuation( double value ){return true;} -virtual bool begin__point__quadratic_attenuation( const point__quadratic_attenuation__AttributeData& attributeData ){return true;} +virtual bool begin__point__quadratic_attenuation( const quadratic_attenuation__AttributeData& attributeData ){return true;} virtual bool end__point__quadratic_attenuation(){return true;} virtual bool data__point__quadratic_attenuation( double value ){return true;} @@ -1195,15 +1195,15 @@ virtual bool end__spot__color(){return true;} virtual bool data__spot__color( const double* value, size_t length ){return true;} -virtual bool begin__spot__constant_attenuation( const spot__constant_attenuation__AttributeData& attributeData ){return true;} +virtual bool begin__spot__constant_attenuation( const constant_attenuation__AttributeData& attributeData ){return true;} virtual bool end__spot__constant_attenuation(){return true;} virtual bool data__spot__constant_attenuation( double value ){return true;} -virtual bool begin__spot__linear_attenuation( const spot__linear_attenuation__AttributeData& attributeData ){return true;} +virtual bool begin__spot__linear_attenuation( const linear_attenuation__AttributeData& attributeData ){return true;} virtual bool end__spot__linear_attenuation(){return true;} virtual bool data__spot__linear_attenuation( double value ){return true;} -virtual bool begin__spot__quadratic_attenuation( const spot__quadratic_attenuation__AttributeData& attributeData ){return true;} +virtual bool begin__spot__quadratic_attenuation( const quadratic_attenuation__AttributeData& attributeData ){return true;} virtual bool end__spot__quadratic_attenuation(){return true;} virtual bool data__spot__quadratic_attenuation( double value ){return true;} @@ -1218,10 +1218,10 @@ virtual bool begin__light__technique( const light__technique__AttributeData& attributeData ){return true;} virtual bool end__light__technique(){return true;} -virtual bool begin__light__extra( const light__extra__AttributeData& attributeData ){return true;} +virtual bool begin__light__extra( const extra__AttributeData& attributeData ){return true;} virtual bool end__light__extra(){return true;} -virtual bool begin__library_lights__extra( const library_lights__extra__AttributeData& attributeData ){return true;} +virtual bool begin__library_lights__extra( const extra__AttributeData& attributeData ){return true;} virtual bool end__library_lights__extra(){return true;} virtual bool begin__library_materials( const library_materials__AttributeData& attributeData ){return true;} @@ -1236,7 +1236,7 @@ virtual bool begin__material__asset(){return true;} virtual bool end__material__asset(){return true;} -virtual bool begin__material__instance_effect( const material__instance_effect__AttributeData& attributeData ){return true;} +virtual bool begin__material__instance_effect( const instance_effect__AttributeData& attributeData ){return true;} virtual bool end__material__instance_effect(){return true;} virtual bool begin__technique_hint( const technique_hint__AttributeData& attributeData ){return true;} @@ -1382,13 +1382,13 @@ virtual bool end__setparam__enum(){return true;} virtual bool data__setparam__enum( const ParserChar* value, size_t length ){return true;} -virtual bool begin__instance_effect__extra( const instance_effect__extra__AttributeData& attributeData ){return true;} +virtual bool begin__instance_effect__extra( const extra__AttributeData& attributeData ){return true;} virtual bool end__instance_effect__extra(){return true;} -virtual bool begin__material__extra( const material__extra__AttributeData& attributeData ){return true;} +virtual bool begin__material__extra( const extra__AttributeData& attributeData ){return true;} virtual bool end__material__extra(){return true;} -virtual bool begin__library_materials__extra( const library_materials__extra__AttributeData& attributeData ){return true;} +virtual bool begin__library_materials__extra( const extra__AttributeData& attributeData ){return true;} virtual bool end__library_materials__extra(){return true;} virtual bool begin__library_nodes( const library_nodes__AttributeData& attributeData ){return true;} @@ -1397,7 +1397,7 @@ virtual bool begin__library_nodes__asset(){return true;} virtual bool end__library_nodes__asset(){return true;} -virtual bool begin__library_nodes__node( const library_nodes__node__AttributeData& attributeData ){return true;} +virtual bool begin__library_nodes__node( const node__AttributeData& attributeData ){return true;} virtual bool end__library_nodes__node(){return true;} virtual bool begin__node__asset(){return true;} @@ -1411,7 +1411,7 @@ virtual bool end__matrix(){return true;} virtual bool data__matrix( const double* value, size_t length ){return true;} -virtual bool begin__node__rotate( const node__rotate__AttributeData& attributeData ){return true;} +virtual bool begin__node__rotate( const rotate__AttributeData& attributeData ){return true;} virtual bool end__node__rotate(){return true;} virtual bool data__node__rotate( const double* value, size_t length ){return true;} @@ -1423,14 +1423,14 @@ virtual bool end__skew(){return true;} virtual bool data__skew( const double* value, size_t length ){return true;} -virtual bool begin__node__translate( const node__translate__AttributeData& attributeData ){return true;} +virtual bool begin__node__translate( const translate__AttributeData& attributeData ){return true;} virtual bool end__node__translate(){return true;} virtual bool data__node__translate( const double* value, size_t length ){return true;} virtual bool begin__instance_camera( const instance_camera__AttributeData& attributeData ){return true;} virtual bool end__instance_camera(){return true;} -virtual bool begin__instance_camera__extra( const instance_camera__extra__AttributeData& attributeData ){return true;} +virtual bool begin__instance_camera__extra( const extra__AttributeData& attributeData ){return true;} virtual bool end__instance_camera__extra(){return true;} virtual bool begin__instance_controller( const instance_controller__AttributeData& attributeData ){return true;} @@ -1459,46 +1459,46 @@ virtual bool begin__bind_vertex_input( const bind_vertex_input__AttributeData& attributeData ){return true;} virtual bool end__bind_vertex_input(){return true;} -virtual bool begin__instance_material__extra( const instance_material__extra__AttributeData& attributeData ){return true;} +virtual bool begin__instance_material__extra( const extra__AttributeData& attributeData ){return true;} virtual bool end__instance_material__extra(){return true;} virtual bool begin__bind_material__technique( const bind_material__technique__AttributeData& attributeData ){return true;} virtual bool end__bind_material__technique(){return true;} -virtual bool begin__bind_material__extra( const bind_material__extra__AttributeData& attributeData ){return true;} +virtual bool begin__bind_material__extra( const extra__AttributeData& attributeData ){return true;} virtual bool end__bind_material__extra(){return true;} -virtual bool begin__instance_controller__extra( const instance_controller__extra__AttributeData& attributeData ){return true;} +virtual bool begin__instance_controller__extra( const extra__AttributeData& attributeData ){return true;} virtual bool end__instance_controller__extra(){return true;} -virtual bool begin__node__instance_geometry( const node__instance_geometry__AttributeData& attributeData ){return true;} +virtual bool begin__node__instance_geometry( const instance_geometry__AttributeData& attributeData ){return true;} virtual bool end__node__instance_geometry(){return true;} virtual bool begin__instance_geometry__bind_material(){return true;} virtual bool end__instance_geometry__bind_material(){return true;} -virtual bool begin__instance_geometry__extra( const instance_geometry__extra__AttributeData& attributeData ){return true;} +virtual bool begin__instance_geometry__extra( const extra__AttributeData& attributeData ){return true;} virtual bool end__instance_geometry__extra(){return true;} virtual bool begin__instance_light( const instance_light__AttributeData& attributeData ){return true;} virtual bool end__instance_light(){return true;} -virtual bool begin__instance_light__extra( const instance_light__extra__AttributeData& attributeData ){return true;} +virtual bool begin__instance_light__extra( const extra__AttributeData& attributeData ){return true;} virtual bool end__instance_light__extra(){return true;} virtual bool begin__instance_node( const instance_node__AttributeData& attributeData ){return true;} virtual bool end__instance_node(){return true;} -virtual bool begin__instance_node__extra( const instance_node__extra__AttributeData& attributeData ){return true;} +virtual bool begin__instance_node__extra( const extra__AttributeData& attributeData ){return true;} virtual bool end__instance_node__extra(){return true;} -virtual bool begin__node__node( const node__node__AttributeData& attributeData ){return true;} +virtual bool begin__node__node( const node__AttributeData& attributeData ){return true;} virtual bool end__node__node(){return true;} -virtual bool begin__node__extra( const node__extra__AttributeData& attributeData ){return true;} +virtual bool begin__node__extra( const extra__AttributeData& attributeData ){return true;} virtual bool end__node__extra(){return true;} -virtual bool begin__library_nodes__extra( const library_nodes__extra__AttributeData& attributeData ){return true;} +virtual bool begin__library_nodes__extra( const extra__AttributeData& attributeData ){return true;} virtual bool end__library_nodes__extra(){return true;} virtual bool begin__library_physics_materials( const library_physics_materials__AttributeData& attributeData ){return true;} @@ -1507,7 +1507,7 @@ virtual bool begin__library_physics_materials__asset(){return true;} virtual bool end__library_physics_materials__asset(){return true;} -virtual bool begin__library_physics_materials__physics_material( const library_physics_materials__physics_material__AttributeData& attributeData ){return true;} +virtual bool begin__library_physics_materials__physics_material( const physics_material__AttributeData& attributeData ){return true;} virtual bool end__library_physics_materials__physics_material(){return true;} virtual bool begin__physics_material__asset(){return true;} @@ -1531,10 +1531,10 @@ virtual bool begin__physics_material__technique( const physics_material__technique__AttributeData& attributeData ){return true;} virtual bool end__physics_material__technique(){return true;} -virtual bool begin__physics_material__extra( const physics_material__extra__AttributeData& attributeData ){return true;} +virtual bool begin__physics_material__extra( const extra__AttributeData& attributeData ){return true;} virtual bool end__physics_material__extra(){return true;} -virtual bool begin__library_physics_materials__extra( const library_physics_materials__extra__AttributeData& attributeData ){return true;} +virtual bool begin__library_physics_materials__extra( const extra__AttributeData& attributeData ){return true;} virtual bool end__library_physics_materials__extra(){return true;} virtual bool begin__library_physics_models( const library_physics_models__AttributeData& attributeData ){return true;} @@ -1559,18 +1559,18 @@ virtual bool end__dynamic(){return true;} virtual bool data__dynamic( bool value ){return true;} -virtual bool begin__technique_common__mass( const technique_common__mass__AttributeData& attributeData ){return true;} +virtual bool begin__technique_common__mass( const mass__AttributeData& attributeData ){return true;} virtual bool end__technique_common__mass(){return true;} virtual bool data__technique_common__mass( double value ){return true;} virtual bool begin__mass_frame(){return true;} virtual bool end__mass_frame(){return true;} -virtual bool begin__mass_frame__translate( const mass_frame__translate__AttributeData& attributeData ){return true;} +virtual bool begin__mass_frame__translate( const translate__AttributeData& attributeData ){return true;} virtual bool end__mass_frame__translate(){return true;} virtual bool data__mass_frame__translate( const double* value, size_t length ){return true;} -virtual bool begin__mass_frame__rotate( const mass_frame__rotate__AttributeData& attributeData ){return true;} +virtual bool begin__mass_frame__rotate( const rotate__AttributeData& attributeData ){return true;} virtual bool end__mass_frame__rotate(){return true;} virtual bool data__mass_frame__rotate( const double* value, size_t length ){return true;} @@ -1578,13 +1578,13 @@ virtual bool end__inertia(){return true;} virtual bool data__inertia( const double* value, size_t length ){return true;} -virtual bool begin__technique_common__instance_physics_material( const technique_common__instance_physics_material__AttributeData& attributeData ){return true;} +virtual bool begin__technique_common__instance_physics_material( const instance_physics_material__AttributeData& attributeData ){return true;} virtual bool end__technique_common__instance_physics_material(){return true;} -virtual bool begin__instance_physics_material__extra( const instance_physics_material__extra__AttributeData& attributeData ){return true;} +virtual bool begin__instance_physics_material__extra( const extra__AttributeData& attributeData ){return true;} virtual bool end__instance_physics_material__extra(){return true;} -virtual bool begin__technique_common__physics_material( const technique_common__physics_material__AttributeData& attributeData ){return true;} +virtual bool begin__technique_common__physics_material( const physics_material__AttributeData& attributeData ){return true;} virtual bool end__technique_common__physics_material(){return true;} virtual bool begin__shape(){return true;} @@ -1594,7 +1594,7 @@ virtual bool end__hollow(){return true;} virtual bool data__hollow( bool value ){return true;} -virtual bool begin__shape__mass( const shape__mass__AttributeData& attributeData ){return true;} +virtual bool begin__shape__mass( const mass__AttributeData& attributeData ){return true;} virtual bool end__shape__mass(){return true;} virtual bool data__shape__mass( double value ){return true;} @@ -1602,13 +1602,13 @@ virtual bool end__density(){return true;} virtual bool data__density( double value ){return true;} -virtual bool begin__shape__instance_physics_material( const shape__instance_physics_material__AttributeData& attributeData ){return true;} +virtual bool begin__shape__instance_physics_material( const instance_physics_material__AttributeData& attributeData ){return true;} virtual bool end__shape__instance_physics_material(){return true;} -virtual bool begin__shape__physics_material( const shape__physics_material__AttributeData& attributeData ){return true;} +virtual bool begin__shape__physics_material( const physics_material__AttributeData& attributeData ){return true;} virtual bool end__shape__physics_material(){return true;} -virtual bool begin__shape__instance_geometry( const shape__instance_geometry__AttributeData& attributeData ){return true;} +virtual bool begin__shape__instance_geometry( const instance_geometry__AttributeData& attributeData ){return true;} virtual bool end__shape__instance_geometry(){return true;} virtual bool begin__plane(){return true;} @@ -1618,7 +1618,7 @@ virtual bool end__equation(){return true;} virtual bool data__equation( const double* value, size_t length ){return true;} -virtual bool begin__plane__extra( const plane__extra__AttributeData& attributeData ){return true;} +virtual bool begin__plane__extra( const extra__AttributeData& attributeData ){return true;} virtual bool end__plane__extra(){return true;} virtual bool begin__box(){return true;} @@ -1628,7 +1628,7 @@ virtual bool end__half_extents(){return true;} virtual bool data__half_extents( const double* value, size_t length ){return true;} -virtual bool begin__box__extra( const box__extra__AttributeData& attributeData ){return true;} +virtual bool begin__box__extra( const extra__AttributeData& attributeData ){return true;} virtual bool end__box__extra(){return true;} virtual bool begin__sphere(){return true;} @@ -1638,7 +1638,7 @@ virtual bool end__sphere__radius(){return true;} virtual bool data__sphere__radius( double value ){return true;} -virtual bool begin__sphere__extra( const sphere__extra__AttributeData& attributeData ){return true;} +virtual bool begin__sphere__extra( const extra__AttributeData& attributeData ){return true;} virtual bool end__sphere__extra(){return true;} virtual bool begin__cylinder(){return true;} @@ -1652,7 +1652,7 @@ virtual bool end__cylinder__radius(){return true;} virtual bool data__cylinder__radius( const double* value, size_t length ){return true;} -virtual bool begin__cylinder__extra( const cylinder__extra__AttributeData& attributeData ){return true;} +virtual bool begin__cylinder__extra( const extra__AttributeData& attributeData ){return true;} virtual bool end__cylinder__extra(){return true;} virtual bool begin__tapered_cylinder(){return true;} @@ -1670,7 +1670,7 @@ virtual bool end__tapered_cylinder__radius2(){return true;} virtual bool data__tapered_cylinder__radius2( const double* value, size_t length ){return true;} -virtual bool begin__tapered_cylinder__extra( const tapered_cylinder__extra__AttributeData& attributeData ){return true;} +virtual bool begin__tapered_cylinder__extra( const extra__AttributeData& attributeData ){return true;} virtual bool end__tapered_cylinder__extra(){return true;} virtual bool begin__capsule(){return true;} @@ -1684,7 +1684,7 @@ virtual bool end__capsule__radius(){return true;} virtual bool data__capsule__radius( const double* value, size_t length ){return true;} -virtual bool begin__capsule__extra( const capsule__extra__AttributeData& attributeData ){return true;} +virtual bool begin__capsule__extra( const extra__AttributeData& attributeData ){return true;} virtual bool end__capsule__extra(){return true;} virtual bool begin__tapered_capsule(){return true;} @@ -1702,24 +1702,24 @@ virtual bool end__tapered_capsule__radius2(){return true;} virtual bool data__tapered_capsule__radius2( const double* value, size_t length ){return true;} -virtual bool begin__tapered_capsule__extra( const tapered_capsule__extra__AttributeData& attributeData ){return true;} +virtual bool begin__tapered_capsule__extra( const extra__AttributeData& attributeData ){return true;} virtual bool end__tapered_capsule__extra(){return true;} -virtual bool begin__shape__translate( const shape__translate__AttributeData& attributeData ){return true;} +virtual bool begin__shape__translate( const translate__AttributeData& attributeData ){return true;} virtual bool end__shape__translate(){return true;} virtual bool data__shape__translate( const double* value, size_t length ){return true;} -virtual bool begin__shape__rotate( const shape__rotate__AttributeData& attributeData ){return true;} +virtual bool begin__shape__rotate( const rotate__AttributeData& attributeData ){return true;} virtual bool end__shape__rotate(){return true;} virtual bool data__shape__rotate( const double* value, size_t length ){return true;} -virtual bool begin__shape__extra( const shape__extra__AttributeData& attributeData ){return true;} +virtual bool begin__shape__extra( const extra__AttributeData& attributeData ){return true;} virtual bool end__shape__extra(){return true;} virtual bool begin__rigid_body__technique( const rigid_body__technique__AttributeData& attributeData ){return true;} virtual bool end__rigid_body__technique(){return true;} -virtual bool begin__rigid_body__extra( const rigid_body__extra__AttributeData& attributeData ){return true;} +virtual bool begin__rigid_body__extra( const extra__AttributeData& attributeData ){return true;} virtual bool end__rigid_body__extra(){return true;} virtual bool begin__rigid_constraint( const rigid_constraint__AttributeData& attributeData ){return true;} @@ -1728,29 +1728,29 @@ virtual bool begin__ref_attachment( const ref_attachment__AttributeData& attributeData ){return true;} virtual bool end__ref_attachment(){return true;} -virtual bool begin__ref_attachment__translate( const ref_attachment__translate__AttributeData& attributeData ){return true;} +virtual bool begin__ref_attachment__translate( const translate__AttributeData& attributeData ){return true;} virtual bool end__ref_attachment__translate(){return true;} virtual bool data__ref_attachment__translate( const double* value, size_t length ){return true;} -virtual bool begin__ref_attachment__rotate( const ref_attachment__rotate__AttributeData& attributeData ){return true;} +virtual bool begin__ref_attachment__rotate( const rotate__AttributeData& attributeData ){return true;} virtual bool end__ref_attachment__rotate(){return true;} virtual bool data__ref_attachment__rotate( const double* value, size_t length ){return true;} -virtual bool begin__ref_attachment__extra( const ref_attachment__extra__AttributeData& attributeData ){return true;} +virtual bool begin__ref_attachment__extra( const extra__AttributeData& attributeData ){return true;} virtual bool end__ref_attachment__extra(){return true;} virtual bool begin__attachment( const attachment__AttributeData& attributeData ){return true;} virtual bool end__attachment(){return true;} -virtual bool begin__attachment__translate( const attachment__translate__AttributeData& attributeData ){return true;} +virtual bool begin__attachment__translate( const translate__AttributeData& attributeData ){return true;} virtual bool end__attachment__translate(){return true;} virtual bool data__attachment__translate( const double* value, size_t length ){return true;} -virtual bool begin__attachment__rotate( const attachment__rotate__AttributeData& attributeData ){return true;} +virtual bool begin__attachment__rotate( const rotate__AttributeData& attributeData ){return true;} virtual bool end__attachment__rotate(){return true;} virtual bool data__attachment__rotate( const double* value, size_t length ){return true;} -virtual bool begin__attachment__extra( const attachment__extra__AttributeData& attributeData ){return true;} +virtual bool begin__attachment__extra( const extra__AttributeData& attributeData ){return true;} virtual bool end__attachment__extra(){return true;} virtual bool begin__rigid_constraint__technique_common(){return true;} @@ -1770,22 +1770,22 @@ virtual bool begin__swing_cone_and_twist(){return true;} virtual bool end__swing_cone_and_twist(){return true;} -virtual bool begin__swing_cone_and_twist__min( const swing_cone_and_twist__min__AttributeData& attributeData ){return true;} +virtual bool begin__swing_cone_and_twist__min( const min__AttributeData& attributeData ){return true;} virtual bool end__swing_cone_and_twist__min(){return true;} virtual bool data__swing_cone_and_twist__min( const double* value, size_t length ){return true;} -virtual bool begin__swing_cone_and_twist__max( const swing_cone_and_twist__max__AttributeData& attributeData ){return true;} +virtual bool begin__swing_cone_and_twist__max( const max__AttributeData& attributeData ){return true;} virtual bool end__swing_cone_and_twist__max(){return true;} virtual bool data__swing_cone_and_twist__max( const double* value, size_t length ){return true;} virtual bool begin__limits__linear(){return true;} virtual bool end__limits__linear(){return true;} -virtual bool begin__linear__min( const linear__min__AttributeData& attributeData ){return true;} +virtual bool begin__linear__min( const min__AttributeData& attributeData ){return true;} virtual bool end__linear__min(){return true;} virtual bool data__linear__min( const double* value, size_t length ){return true;} -virtual bool begin__linear__max( const linear__max__AttributeData& attributeData ){return true;} +virtual bool begin__linear__max( const max__AttributeData& attributeData ){return true;} virtual bool end__linear__max(){return true;} virtual bool data__linear__max( const double* value, size_t length ){return true;} @@ -1795,46 +1795,46 @@ virtual bool begin__angular(){return true;} virtual bool end__angular(){return true;} -virtual bool begin__angular__stiffness( const angular__stiffness__AttributeData& attributeData ){return true;} +virtual bool begin__angular__stiffness( const stiffness__AttributeData& attributeData ){return true;} virtual bool end__angular__stiffness(){return true;} virtual bool data__angular__stiffness( double value ){return true;} -virtual bool begin__angular__damping( const angular__damping__AttributeData& attributeData ){return true;} +virtual bool begin__angular__damping( const damping__AttributeData& attributeData ){return true;} virtual bool end__angular__damping(){return true;} virtual bool data__angular__damping( double value ){return true;} -virtual bool begin__angular__target_value( const angular__target_value__AttributeData& attributeData ){return true;} +virtual bool begin__angular__target_value( const target_value__AttributeData& attributeData ){return true;} virtual bool end__angular__target_value(){return true;} virtual bool data__angular__target_value( double value ){return true;} virtual bool begin__spring__linear(){return true;} virtual bool end__spring__linear(){return true;} -virtual bool begin__linear__stiffness( const linear__stiffness__AttributeData& attributeData ){return true;} +virtual bool begin__linear__stiffness( const stiffness__AttributeData& attributeData ){return true;} virtual bool end__linear__stiffness(){return true;} virtual bool data__linear__stiffness( double value ){return true;} -virtual bool begin__linear__damping( const linear__damping__AttributeData& attributeData ){return true;} +virtual bool begin__linear__damping( const damping__AttributeData& attributeData ){return true;} virtual bool end__linear__damping(){return true;} virtual bool data__linear__damping( double value ){return true;} -virtual bool begin__linear__target_value( const linear__target_value__AttributeData& attributeData ){return true;} +virtual bool begin__linear__target_value( const target_value__AttributeData& attributeData ){return true;} virtual bool end__linear__target_value(){return true;} virtual bool data__linear__target_value( double value ){return true;} virtual bool begin__rigid_constraint__technique( const rigid_constraint__technique__AttributeData& attributeData ){return true;} virtual bool end__rigid_constraint__technique(){return true;} -virtual bool begin__rigid_constraint__extra( const rigid_constraint__extra__AttributeData& attributeData ){return true;} +virtual bool begin__rigid_constraint__extra( const extra__AttributeData& attributeData ){return true;} virtual bool end__rigid_constraint__extra(){return true;} -virtual bool begi... [truncated message content] |
From: <rob...@us...> - 2009-01-27 15:56:39
|
Revision: 328 http://colladamaya.svn.sourceforge.net/colladamaya/?rev=328&view=rev Author: robertwuerfel Date: 2009-01-27 15:56:33 +0000 (Tue, 27 Jan 2009) Log Message: ----------- Fix bug in node hierarchy and in normals export Modified Paths: -------------- branches/nextgen/COLLADAFramework/src/COLLADAFWNode.cpp branches/nextgen/COLLADAMax/src/COLLADAMaxColladaPlugin.cpp branches/nextgen/COLLADAMax/src/COLLADAMaxGeometryImporter.cpp branches/nextgen/COLLADAMax/src/COLLADAMaxNodeImporter.cpp Modified: branches/nextgen/COLLADAFramework/src/COLLADAFWNode.cpp =================================================================== --- branches/nextgen/COLLADAFramework/src/COLLADAFWNode.cpp 2009-01-27 14:03:11 UTC (rev 327) +++ branches/nextgen/COLLADAFramework/src/COLLADAFWNode.cpp 2009-01-27 15:56:33 UTC (rev 328) @@ -50,7 +50,7 @@ Rotate* rotate = (Rotate*)transform; const COLLADABU::Math::Vector3& axis = rotate->getRotationAxis(); double angle = rotate->getRotationAngle(); - transformationMatrix = transformationMatrix * COLLADABU::Math::Matrix4(COLLADABU::Math::Quaternion(angle, axis)); + transformationMatrix = transformationMatrix * COLLADABU::Math::Matrix4(COLLADABU::Math::Quaternion(COLLADABU::Math::Utils::degToRad(angle), axis)); break; } case Transformation::TRANSLATE: Modified: branches/nextgen/COLLADAMax/src/COLLADAMaxColladaPlugin.cpp =================================================================== --- branches/nextgen/COLLADAMax/src/COLLADAMaxColladaPlugin.cpp 2009-01-27 14:03:11 UTC (rev 327) +++ branches/nextgen/COLLADAMax/src/COLLADAMaxColladaPlugin.cpp 2009-01-27 15:56:33 UTC (rev 328) @@ -8,7 +8,7 @@ const String COLLADAPlugin::LONGDESCRIPTION = "New COLLADA Document"; const String COLLADAPlugin::SHORTDESCRIPTION = "NEWCOLLADA"; const String COLLADAPlugin::AUTHORNAME = "netAllied"; - const String COLLADAPlugin::COPYRIGHTMESSAGE = "Copyright 2008 netAllied. Copyright 2006 Feeling Software. Based on Autodesk' 3dsMax COLLADASW Tools."; + const String COLLADAPlugin::COPYRIGHTMESSAGE = "Copyright 2008-2009 netAllied. Copyright 2006 Feeling Software. Based on Autodesk' 3dsMax COLLADASW Tools."; const String COLLADAPlugin::OTHERMESSAGE1 = ""; const String COLLADAPlugin::OTHERMESSAGE2 = ""; Modified: branches/nextgen/COLLADAMax/src/COLLADAMaxGeometryImporter.cpp =================================================================== --- branches/nextgen/COLLADAMax/src/COLLADAMaxGeometryImporter.cpp 2009-01-27 14:03:11 UTC (rev 327) +++ branches/nextgen/COLLADAMax/src/COLLADAMaxGeometryImporter.cpp 2009-01-27 15:56:33 UTC (rev 328) @@ -477,7 +477,6 @@ MNFace* face = polgonMesh.F((int)faceIndex); face->MakePoly(faceVertexCount, (int*) (&positionIndices[currentIndex])); currentIndex += faceVertexCount; - ++faceIndex; } break; @@ -547,8 +546,8 @@ { const COLLADAFW::UIntValuesArray& normalIndices = meshPrimitive->getNormalIndices(); MNNormalFace& normalFace = normalsSpecifier->Face((int) faceIndex); + normalFace.SetDegree(3); normalFace.SpecifyAll(); - normalFace.SetDegree(3); normalFace.SetNormalID(0, normalIndices[3*j]); normalFace.SetNormalID(1, normalIndices[3*j + 1]); normalFace.SetNormalID(2, normalIndices[3*j + 2]); @@ -568,8 +567,8 @@ for ( size_t j = nextTristripStartIndex + 2, lastVertex = nextTristripStartIndex + faceVertexCount; j < lastVertex; ++j ) { MNNormalFace& normalFace = normalsSpecifier->Face((int) faceIndex); + normalFace.SetDegree(3); normalFace.SpecifyAll(); - normalFace.SetDegree(3); normalFace.SetNormalID(0, normalIndices[j - 2]); normalFace.SetNormalID(1, normalIndices[j - 1]); normalFace.SetNormalID(2, normalIndices[j]); @@ -592,8 +591,8 @@ for ( size_t j = nextTrifanStartIndex + 2, lastVertex = nextTrifanStartIndex + faceVertexCount; j < lastVertex; ++j ) { MNNormalFace& normalFace = normalsSpecifier->Face((int) faceIndex); + normalFace.SetDegree(3); normalFace.SpecifyAll(); - normalFace.SetDegree(3); normalFace.SetNormalID(0, commonVertexIndex); normalFace.SetNormalID(1, normalIndices[j - 1]); normalFace.SetNormalID(2, normalIndices[j]); @@ -608,6 +607,7 @@ COLLADAFW::Polygons* polygons = (COLLADAFW::Polygons*) meshPrimitive; COLLADAFW::IntValuesArray& faceVertexCountArray = polygons->getGroupedVerticesVertexCountArray(); + size_t currentIndex = 0; for ( size_t j = 0, count = faceVertexCountArray.getCount(); j < count; ++j) { int faceVertexCount = faceVertexCountArray[j]; @@ -618,13 +618,14 @@ const COLLADAFW::UIntValuesArray& normalIndices = meshPrimitive->getNormalIndices(); MNNormalFace& normalFace = normalsSpecifier->Face((int) faceIndex); + normalFace.SetDegree((int)faceVertexCount); normalFace.SpecifyAll(); - - normalFace.SetDegree((int)faceVertexCount); for ( int k = 0; k < faceVertexCount; ++k) { - normalFace.SetNormalID(k, normalIndices[3*j + k]); + int gg = normalIndices[currentIndex + k]; + normalFace.SetNormalID(k, normalIndices[currentIndex + k]); } + currentIndex += faceVertexCount; ++faceIndex; } } Modified: branches/nextgen/COLLADAMax/src/COLLADAMaxNodeImporter.cpp =================================================================== --- branches/nextgen/COLLADAMax/src/COLLADAMaxNodeImporter.cpp 2009-01-27 14:03:11 UTC (rev 327) +++ branches/nextgen/COLLADAMax/src/COLLADAMaxNodeImporter.cpp 2009-01-27 15:56:33 UTC (rev 328) @@ -94,7 +94,7 @@ else { newImportNode = importInstanceGeometrie( node, parentImportNode ); - importNodes(node->getChildNodes(), parentImportNode); + importNodes(node->getChildNodes(), newImportNode); } // Append all nodes that are referenced by this node. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jud...@us...> - 2009-01-27 14:03:17
|
Revision: 327 http://colladamaya.svn.sourceforge.net/colladamaya/?rev=327&view=rev Author: judithschenk Date: 2009-01-27 14:03:11 +0000 (Tue, 27 Jan 2009) Log Message: ----------- version with revision Modified Paths: -------------- branches/nextgen/COLLADAMaya/include/COLLADAMayaSyntax.h branches/nextgen/COLLADAMaya/scripts/COLLADAMaya.vcproj branches/nextgen/COLLADAMaya/src/COLLADAMayaAnimationExporter.cpp branches/nextgen/COLLADAMaya/src/COLLADAMayaFileTranslator.cpp Modified: branches/nextgen/COLLADAMaya/include/COLLADAMayaSyntax.h =================================================================== --- branches/nextgen/COLLADAMaya/include/COLLADAMayaSyntax.h 2009-01-27 11:56:12 UTC (rev 326) +++ branches/nextgen/COLLADAMaya/include/COLLADAMayaSyntax.h 2009-01-27 14:03:11 UTC (rev 327) @@ -42,7 +42,7 @@ // COLLADA NetAllied Systems static const char* TRANSLATOR_VENDOR = "NetAllied Systems GmbH"; - static const char* TRANSLATOR_VERSION = "0.8.2"; + static const char* TRANSLATOR_VERSION = "0.8.2.327"; static const char* USERNAME = "USERNAME"; static const char* USER = "USER"; Modified: branches/nextgen/COLLADAMaya/scripts/COLLADAMaya.vcproj =================================================================== --- branches/nextgen/COLLADAMaya/scripts/COLLADAMaya.vcproj 2009-01-27 11:56:12 UTC (rev 326) +++ branches/nextgen/COLLADAMaya/scripts/COLLADAMaya.vcproj 2009-01-27 14:03:11 UTC (rev 327) @@ -214,7 +214,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="..\include;"$(MAYA_PATH2008)\include";"$(MAYA_PATH2008)\devkit\plug-ins";"$(BOOST_ROOT)";..\..\COLLADABaseUtils\include;..\..\COLLADAStreamWriter\include;..\..\Externals\Cg\include;..\..\COLLADASaxFrameworkLoader\include;..\..\COLLADAFramework\include;..\..\Externals\MayaDataModel\include;..\..\GeneratedSaxParser\include;..\..\Externals\LibXML\include" - PreprocessorDefinitions="CREATE_IMPORT_PLUGIN;WIN32;NDEBUG;_WINDOWS;_AFXDLL;_MBCS;NT_PLUGIN;REQUIRE_IOSTREAM;CM_EXPORTS;GLUT_NO_LIB_PRAGMA;GLUT_NO_WARNING_DISABLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;$(NOINHERIT)" + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_AFXDLL;_MBCS;NT_PLUGIN;REQUIRE_IOSTREAM;CM_EXPORTS;GLUT_NO_LIB_PRAGMA;GLUT_NO_WARNING_DISABLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;$(NOINHERIT)" RuntimeLibrary="2" RuntimeTypeInfo="true" UsePrecompiledHeader="1" @@ -1055,7 +1055,7 @@ Optimization="2" InlineFunctionExpansion="1" AdditionalIncludeDirectories="..\include;"$(MAYA_PATH2009)\include";"$(MAYA_PATH2009)\devkit\plug-ins";..\..\COLLADAStreamWriter\include;"$(BOOST_ROOT)";..\..\Externals\Cg\include;..\..\COLLADABaseUtils\include" - PreprocessorDefinitions="CREATE_IMPORT_PLUGIN;WIN32;NDEBUG;_WINDOWS;_AFXDLL;_MBCS;NT_PLUGIN;REQUIRE_IOSTREAM;CM_EXPORTS;GLUT_NO_LIB_PRAGMA;GLUT_NO_WARNING_DISABLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;$(NOINHERIT)" + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_AFXDLL;_MBCS;NT_PLUGIN;REQUIRE_IOSTREAM;CM_EXPORTS;GLUT_NO_LIB_PRAGMA;GLUT_NO_WARNING_DISABLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;$(NOINHERIT)" RuntimeLibrary="2" EnableFunctionLevelLinking="false" RuntimeTypeInfo="true" @@ -1282,7 +1282,7 @@ /> <Tool Name="VCPostBuildEventTool" - Description="Copy plug-in files:" + Description="Copy plug-in files" CommandLine="mkdir ..\bin\win\$(PlatformName)\$(ConfigurationName) 2> nul
copy $(TargetPath) ..\bin\win\$(PlatformName)\$(ConfigurationName) > nul

echo Copy COLLADAMaya plug-in
copy $(TargetPath) "%MAYA_PATH80%\bin\plug-ins" > nul

echo Copy COLLADAMaya plug-in mel scipts
copy "$(ProjectDir)*.mel" "%MAYA_PATH80%\scripts\others" > nul


rem echo Create Microsoft.VC80.MFC directory
rem mkdir ..\bin\win\$(PlatformName)\$(ConfigurationName)\Microsoft.VC80.MFC 2> nul

echo Copy Microsoft.VC80.MFC DLLs
rem copy "$(VCInstallDir)redist\x86\Microsoft.VC80.MFC\Microsoft.VC80.MFC.manifest" ..\bin\win\$(PlatformName)\$(ConfigurationName)\Microsoft.VC80.MFC > nul
copy "$(VCInstallDir)redist\x86\Microsoft.VC80.MFC\Microsoft.VC80.MFC.manifest" ..\bin\win\$(PlatformName)\$(ConfigurationName) > nul

echo Copy Microsoft.VC80.MFC DLLs
rem copy "..\bin\win\$(PlatformName)\$(ConfigurationName)\Microsoft.VC80.CRT.manifest" %MAYA_PATH80%\bin\plug-ins > nul
copy "..\bin\win\$(PlatformName)\$(ConfigurationName)\Microsoft.VC80.CRT.manifest" "%MAYA_PATH80%\scripts\others" > nul

echo done
" /> </Configuration> Modified: branches/nextgen/COLLADAMaya/src/COLLADAMayaAnimationExporter.cpp =================================================================== --- branches/nextgen/COLLADAMaya/src/COLLADAMayaAnimationExporter.cpp 2009-01-27 11:56:12 UTC (rev 326) +++ branches/nextgen/COLLADAMaya/src/COLLADAMayaAnimationExporter.cpp 2009-01-27 14:03:11 UTC (rev 327) @@ -684,7 +684,7 @@ input.push_back ( key->input ); if ( convertUnits ) - output.push_back ( MDistance::internalToUI ( key->output ) ); + output.push_back ( ( float ) MDistance::internalToUI ( key->output ) ); else output.push_back ( key->output ); Modified: branches/nextgen/COLLADAMaya/src/COLLADAMayaFileTranslator.cpp =================================================================== --- branches/nextgen/COLLADAMaya/src/COLLADAMayaFileTranslator.cpp 2009-01-27 11:56:12 UTC (rev 326) +++ branches/nextgen/COLLADAMaya/src/COLLADAMayaFileTranslator.cpp 2009-01-27 14:03:11 UTC (rev 327) @@ -72,10 +72,8 @@ // current directory. This can be changed, however, by calling: //MGlobal::setErrorLogPathName("..."); - int apiVersion = MGlobal::apiVersion (); - MString mayaVersion = MGlobal::mayaVersion (); std::ostringstream stream; - stream << apiVersion; + stream << MAYA_API_VERSION; MFnPlugin plugin ( obj, COLLADAMaya::TRANSLATOR_VENDOR, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jud...@us...> - 2009-01-27 13:19:43
|
Revision: 326 http://colladamaya.svn.sourceforge.net/colladamaya/?rev=326&view=rev Author: judithschenk Date: 2009-01-27 11:56:12 +0000 (Tue, 27 Jan 2009) Log Message: ----------- IDList from StreamWriter to BaseUtils; Bugfix on animation conversion. Modified Paths: -------------- branches/nextgen/COLLADABaseUtils/include/COLLADABUUtils.h branches/nextgen/COLLADABaseUtils/scripts/COLLADABaseUtils.vcproj branches/nextgen/COLLADABaseUtils/src/COLLADABUUtils.cpp branches/nextgen/COLLADAMax/include/COLLADAMaxColladaExporter.h branches/nextgen/COLLADAMax/include/COLLADAMaxDocumentExporter.h branches/nextgen/COLLADAMax/include/COLLADAMaxEffectExporter.h branches/nextgen/COLLADAMax/include/COLLADAMaxExportNode.h branches/nextgen/COLLADAMax/include/COLLADAMaxExportSceneGraph.h branches/nextgen/COLLADAMax/src/COLLADAMaxDocumentExporter.cpp branches/nextgen/COLLADAMax/src/COLLADAMaxExportSceneGraph.cpp branches/nextgen/COLLADAMaya/include/COLLADAMayaEffectExporter.h branches/nextgen/COLLADAMaya/include/COLLADAMayaGeometryExporter.h branches/nextgen/COLLADAMaya/include/COLLADAMayaVisualSceneImporter.h branches/nextgen/COLLADAMaya/scripts/COLLADAMaya.vcproj branches/nextgen/COLLADAMaya/src/COLLADAMayaAnimationExporter.cpp branches/nextgen/COLLADAMaya/src/COLLADAMayaGeometryImporter.cpp branches/nextgen/COLLADAMaya/src/COLLADAMayaVisualSceneImporter.cpp branches/nextgen/COLLADAStreamWriter/scripts/COLLADAStreamWriter.vcproj branches/nextgen/Externals/MayaDataModel/include/MayaDMConnectables.h Added Paths: ----------- branches/nextgen/COLLADABaseUtils/include/COLLADABUIDList.h branches/nextgen/COLLADABaseUtils/src/COLLADABUIDList.cpp Removed Paths: ------------- branches/nextgen/COLLADAStreamWriter/include/COLLADASWIDList.h branches/nextgen/COLLADAStreamWriter/src/COLLADASWIDList.cpp Added: branches/nextgen/COLLADABaseUtils/include/COLLADABUIDList.h =================================================================== --- branches/nextgen/COLLADABaseUtils/include/COLLADABUIDList.h (rev 0) +++ branches/nextgen/COLLADABaseUtils/include/COLLADABUIDList.h 2009-01-27 11:56:12 UTC (rev 326) @@ -0,0 +1,53 @@ +#ifndef __COLLADABU_IDLIST_H__ +#define __COLLADABU_IDLIST_H__ + +#include "COLLADABUPrerequisites.h" +#include "COLLADABUUtils.h" + +#include <set> + + +namespace COLLADABU +{ + /** A class to generate and store unique and valid ids.*/ + class IDList + { + private: + typedef std::set<String> IDSet; + + typedef String (*StringConversionFunction)(const String&); + + private: + /** Conversion function used to convert added Values*/ + StringConversionFunction mConversionFunction; + + /** A map that stores ids that are already managed by this instance of IDList.*/ + IDSet mIdSet; + + public: + /** Constructor*/ + IDList(StringConversionFunction conversionFunction = Utils::checkID); + + /** Destructor*/ + virtual ~IDList() {} + + /** Takes the string @a newId, checks that it is a valid id, if necessary changes it to + a valid id and adds it to the list of ids managed by IDList. If the id already exists a number + is added to make it unique. The resulting string is returned + @param newId The id / String to add + @param returnConverted If true, the converted new string is returned, otherwise the original string (@a newId) + probably with a number appended is returned. + @return The unique string, added to List. + */ + String addId ( const String & newId, bool returnConverted = true); + + private: + /** Disable default copy ctor. */ + IDList( const IDList& pre ); + /** Disable default assignment operator. */ + const IDList& operator= ( const IDList& pre ); + + }; +} // namespace COLLADABU + +#endif // __COLLADABU_IDLIST_H__ Modified: branches/nextgen/COLLADABaseUtils/include/COLLADABUUtils.h =================================================================== --- branches/nextgen/COLLADABaseUtils/include/COLLADABUUtils.h 2009-01-27 10:16:27 UTC (rev 325) +++ branches/nextgen/COLLADABaseUtils/include/COLLADABUUtils.h 2009-01-27 11:56:12 UTC (rev 326) @@ -16,7 +16,9 @@ #include <sstream> #include <fstream> #include <map> +#include <vector> + namespace COLLADABU { @@ -156,6 +158,17 @@ * @param replaceString The replace string. */ static void stringFindAndReplace ( String& source, const String searchString, const String replaceString ); + + /** + * Splits a string by the given seperator string and push the + * parts in a vector. + * @param String & text + * @param String & separators + * @param std::vector<String> & words + */ + static void split ( String& text, String& separators, std::vector<String>& words ); + + }; } Modified: branches/nextgen/COLLADABaseUtils/scripts/COLLADABaseUtils.vcproj =================================================================== --- branches/nextgen/COLLADABaseUtils/scripts/COLLADABaseUtils.vcproj 2009-01-27 10:16:27 UTC (rev 325) +++ branches/nextgen/COLLADABaseUtils/scripts/COLLADABaseUtils.vcproj 2009-01-27 11:56:12 UTC (rev 326) @@ -289,12 +289,24 @@ > </File> <File + RelativePath="..\src\COLLADABUIDList.cpp" + > + </File> + <File RelativePath="..\src\COLLADABUNativeString.cpp" > </File> <File RelativePath="..\src\COLLADABUPrecompiledHeaders.cpp" > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> </File> <File RelativePath="..\src\COLLADABUStringUtils.cpp" @@ -351,6 +363,10 @@ > </File> <File + RelativePath="..\include\COLLADABUIDList.h" + > + </File> + <File RelativePath="..\include\COLLADABUNativeString.h" > </File> Added: branches/nextgen/COLLADABaseUtils/src/COLLADABUIDList.cpp =================================================================== --- branches/nextgen/COLLADABaseUtils/src/COLLADABUIDList.cpp (rev 0) +++ branches/nextgen/COLLADABaseUtils/src/COLLADABUIDList.cpp 2009-01-27 11:56:12 UTC (rev 326) @@ -0,0 +1,37 @@ +#include "COLLADABUStableHeaders.h" +#include "COLLADABUIDList.h" + +namespace COLLADABU +{ + //------------------------------------- + IDList::IDList(StringConversionFunction conversionFunction ) + : mConversionFunction(conversionFunction) + {} + + //------------------------------------- + String IDList::addId ( const String & newId, bool returnConverted ) + { + String newIdChecked = mConversionFunction( newId ); + + IDSet::iterator it = mIdSet.find ( newIdChecked ); + if ( it == mIdSet.end() ) + { + mIdSet.insert ( newIdChecked ); + return returnConverted ? newIdChecked : newId; + } + + String idCandidate; + size_t numberSuffix = 0; + do + { + numberSuffix++; + idCandidate = newIdChecked + "_" + Utils::toString ( numberSuffix ); + } + while ( mIdSet.find ( idCandidate ) != mIdSet.end() ); + + mIdSet.insert ( idCandidate ); + + return returnConverted ? idCandidate : newId + "_" + Utils::toString ( numberSuffix ); + } + +} // namespace COLLADABU Modified: branches/nextgen/COLLADABaseUtils/src/COLLADABUUtils.cpp =================================================================== --- branches/nextgen/COLLADABaseUtils/src/COLLADABUUtils.cpp 2009-01-27 10:16:27 UTC (rev 325) +++ branches/nextgen/COLLADABaseUtils/src/COLLADABUUtils.cpp 2009-01-27 11:56:12 UTC (rev 326) @@ -185,4 +185,19 @@ #endif } + //-------------------------------- + void Utils::split ( String& text, String& separators, std::vector<String>& words ) + { + size_t n = text.length(); + size_t start, stop; + + start = text.find_first_not_of(separators); + while ((start >= 0) && (start < n)) + { + stop = text.find_first_of(separators, start); + if ((stop < 0) || (stop > n)) stop = n; + words.push_back(text.substr(start, stop - start)); + start = text.find_first_not_of(separators, stop+1); + } + } } \ No newline at end of file Modified: branches/nextgen/COLLADAMax/include/COLLADAMaxColladaExporter.h =================================================================== --- branches/nextgen/COLLADAMax/include/COLLADAMaxColladaExporter.h 2009-01-27 10:16:27 UTC (rev 325) +++ branches/nextgen/COLLADAMax/include/COLLADAMaxColladaExporter.h 2009-01-27 11:56:12 UTC (rev 326) @@ -20,7 +20,7 @@ #define __COLLADAMAX_COLLADASWEXPORTER_H__ #include "COLLADAMaxPrerequisites.h" -#include "COLLADASWIDList.h" +#include "COLLADABUIDList.h" #include <max.h> #include <iparamb2.h> @@ -46,7 +46,7 @@ private: /** Holds the unique file names of the exported XRef files. This is necessary if all files are exported into the same directory.*/ - COLLADASW::IDList mXRefExportFileNames; + COLLADABU::IDList mXRefExportFileNames; public: COLLADAExporter(); Modified: branches/nextgen/COLLADAMax/include/COLLADAMaxDocumentExporter.h =================================================================== --- branches/nextgen/COLLADAMax/include/COLLADAMaxDocumentExporter.h 2009-01-27 10:16:27 UTC (rev 325) +++ branches/nextgen/COLLADAMax/include/COLLADAMaxDocumentExporter.h 2009-01-27 11:56:12 UTC (rev 326) @@ -95,7 +95,7 @@ /** Constructor @param i the max interface @param filepath The file path the COLLADASW document should be written to*/ - DocumentExporter ( Interface* i, const NativeString &filepath, COLLADASW::IDList& xRefExportFileNames ); + DocumentExporter ( Interface* i, const NativeString &filepath, COLLADABU::IDList& xRefExportFileNames ); /** Constructor. Modified: branches/nextgen/COLLADAMax/include/COLLADAMaxEffectExporter.h =================================================================== --- branches/nextgen/COLLADAMax/include/COLLADAMaxEffectExporter.h 2009-01-27 10:16:27 UTC (rev 325) +++ branches/nextgen/COLLADAMax/include/COLLADAMaxEffectExporter.h 2009-01-27 11:56:12 UTC (rev 326) @@ -24,7 +24,7 @@ #include "COLLADAMaxStableHeaders.h" #include "COLLADASWStreamWriter.h" #include "COLLADASWLibraryEffects.h" -#include "COLLADASWIDList.h" +#include "COLLADABUIDList.h" #include "COLLADAMaxExportSceneGraph.h" #include "COLLADAMaxMaterialExporter.h" @@ -180,7 +180,7 @@ ExportedImageMap mExportedImageMap; /** List of unique base effect ids.*/ - COLLADASW::IDList mEffectIdList; + COLLADABU::IDList mEffectIdList; /** Maps material and channels to the IParamBlock of the corresponding StdUVGen*/ MaterialChannelPairParamBlockMap mMaterialChannelPairParamBlockMap; Modified: branches/nextgen/COLLADAMax/include/COLLADAMaxExportNode.h =================================================================== --- branches/nextgen/COLLADAMax/include/COLLADAMaxExportNode.h 2009-01-27 10:16:27 UTC (rev 325) +++ branches/nextgen/COLLADAMax/include/COLLADAMaxExportNode.h 2009-01-27 11:56:12 UTC (rev 326) @@ -23,7 +23,7 @@ #include <max.h> -#include "COLLADASWIDList.h" +#include "COLLADABUIDList.h" #include "COLLADAMaxControllerList.h" @@ -123,7 +123,7 @@ String mSid; /** List of the unique symbols of the mesh. (Only used if the node is a mesh).*/ - COLLADASW::IDList mSymbolList; + COLLADABU::IDList mSymbolList; /** All the controllers that are applied to the represented node and that are supported by COLLADASW.*/ ControllerList * mControllerList; @@ -289,7 +289,7 @@ It is ensured, that the id is a valid id according to the xml spec*/ const String& setId ( const String& id ) { - mId = COLLADASW::Utils::checkID ( id ); + mId = COLLADABU::Utils::checkID ( id ); return mId; } Modified: branches/nextgen/COLLADAMax/include/COLLADAMaxExportSceneGraph.h =================================================================== --- branches/nextgen/COLLADAMax/include/COLLADAMaxExportSceneGraph.h 2009-01-27 10:16:27 UTC (rev 325) +++ branches/nextgen/COLLADAMax/include/COLLADAMaxExportSceneGraph.h 2009-01-27 11:56:12 UTC (rev 326) @@ -22,7 +22,7 @@ #include "COLLADAMaxPrerequisites.h" #include "COLLADAMaxExportNode.h" -#include "COLLADASWIDList.h" +#include "COLLADABUIDList.h" #include <map> #include <vector> @@ -72,17 +72,17 @@ INode * mRootNode; /** The file name of the max file represented by this export scene graph.*/ - COLLADASW::URI mMaxFileUri; + COLLADABU::URI mMaxFileUri; /** List of all XRef scenes below the file represented by this export scene graph*/ XRefSceneGraphList mXRefSceneGraphList; /** Holds the unique ids of the nodes.*/ - COLLADASW::IDList mNodeIdList; + COLLADABU::IDList mNodeIdList; /** Holds the unique file names of the exported XRef files. This is necessary if all files are exported into the same directory.*/ - COLLADASW::IDList& mXRefExportFileNames; + COLLADABU::IDList& mXRefExportFileNames; /** Mapping between INodes and ExportNodes.*/ INodeExportNodeMap mINodeExportNodeMap; @@ -100,7 +100,7 @@ MorphControllerHelperGeometryList mMorphControllerHelperGeometryList; public: - ExportSceneGraph ( INode * iNode, const COLLADASW::URI& maxFileUri, COLLADASW::IDList& xRefExportFileNames ); + ExportSceneGraph ( INode * iNode, const COLLADABU::URI& maxFileUri, COLLADABU::IDList& xRefExportFileNames ); ~ExportSceneGraph(); /** Creates the export scene graph. @@ -114,7 +114,7 @@ } /** Returns the uri of the max file represented by this export scene graph.*/ - const COLLADASW::URI& getMaxFileUri() const + const COLLADABU::URI& getMaxFileUri() const { return mMaxFileUri; } Modified: branches/nextgen/COLLADAMax/src/COLLADAMaxDocumentExporter.cpp =================================================================== --- branches/nextgen/COLLADAMax/src/COLLADAMaxDocumentExporter.cpp 2009-01-27 10:16:27 UTC (rev 325) +++ branches/nextgen/COLLADAMax/src/COLLADAMaxDocumentExporter.cpp 2009-01-27 11:56:12 UTC (rev 326) @@ -41,7 +41,7 @@ const String DocumentExporter::SCENE_ID = "MaxScene"; //--------------------------------------------------------------- - DocumentExporter::DocumentExporter ( Interface * i, const NativeString &filepath, COLLADASW::IDList& xRefExportFileNames ) + DocumentExporter::DocumentExporter ( Interface * i, const NativeString &filepath, COLLADABU::IDList& xRefExportFileNames ) : mOptions(i), mMaxInterface ( i ), Modified: branches/nextgen/COLLADAMax/src/COLLADAMaxExportSceneGraph.cpp =================================================================== --- branches/nextgen/COLLADAMax/src/COLLADAMaxExportSceneGraph.cpp 2009-01-27 10:16:27 UTC (rev 325) +++ branches/nextgen/COLLADAMax/src/COLLADAMaxExportSceneGraph.cpp 2009-01-27 11:56:12 UTC (rev 326) @@ -30,7 +30,7 @@ const String ExportSceneGraph::HELPER_GEOMETRY_ID_SUFFIX ="-helper_geometry"; const String ExportSceneGraph::JOINT_SID_BASE_NAME = "joint"; - ExportSceneGraph::ExportSceneGraph ( INode * iNode, const COLLADASW::URI& maxFileUri, COLLADASW::IDList& xRefExportFileNames ) + ExportSceneGraph::ExportSceneGraph ( INode * iNode, const COLLADASW::URI& maxFileUri, COLLADABU::IDList& xRefExportFileNames ) : mExportSelection ( false ), mRootNode ( iNode ), mMaxFileUri(maxFileUri), Modified: branches/nextgen/COLLADAMaya/include/COLLADAMayaEffectExporter.h =================================================================== --- branches/nextgen/COLLADAMaya/include/COLLADAMayaEffectExporter.h 2009-01-27 10:16:27 UTC (rev 325) +++ branches/nextgen/COLLADAMaya/include/COLLADAMayaEffectExporter.h 2009-01-27 11:56:12 UTC (rev 326) @@ -26,7 +26,7 @@ #include "COLLADASWStreamWriter.h" #include "COLLADASWEffectProfile.h" #include "COLLADASWLibraryEffects.h" -#include "COLLADASWIDList.h" +#include "COLLADABUIDList.h" #include <maya/MObject.h> @@ -102,7 +102,7 @@ EffectMap mExportedEffectMap; /** List of unique base effect ids*/ - COLLADASW::IDList mEffectIdList; + COLLADABU::IDList mEffectIdList; /** A texture channel. Used by standard effects to assign textures to channels. Modified: branches/nextgen/COLLADAMaya/include/COLLADAMayaGeometryExporter.h =================================================================== --- branches/nextgen/COLLADAMaya/include/COLLADAMayaGeometryExporter.h 2009-01-27 10:16:27 UTC (rev 325) +++ branches/nextgen/COLLADAMaya/include/COLLADAMayaGeometryExporter.h 2009-01-27 11:56:12 UTC (rev 326) @@ -33,7 +33,7 @@ #include "COLLADASWLibraryGeometries.h" #include "COLLADASWInputList.h" #include "COLLADASWPrimitves.h" -#include "COLLADASWIDList.h" +#include "COLLADABUIDList.h" namespace COLLADAMaya @@ -55,8 +55,7 @@ DocumentExporter* mDocumentExporter; /** List of unique meshIds from the already exported geometries. */ -// std::vector<String> mExportedGeometries; - COLLADASW::IDList mExportedGeometries; + COLLADABU::IDList mExportedGeometries; /** * Holds all the polygon sources of the geometry of the current mesh. Modified: branches/nextgen/COLLADAMaya/include/COLLADAMayaVisualSceneImporter.h =================================================================== --- branches/nextgen/COLLADAMaya/include/COLLADAMayaVisualSceneImporter.h 2009-01-27 10:16:27 UTC (rev 325) +++ branches/nextgen/COLLADAMaya/include/COLLADAMayaVisualSceneImporter.h 2009-01-27 11:56:12 UTC (rev 326) @@ -24,6 +24,7 @@ #include "COLLADAFWVisualScene.h" #include "COLLADAFWSkew.h" +#include "COLLADABUIDList.h" #include "Math/COLLADABUMathUtils.h" #include "Math/COLLADABUMathMatrix4.h" #include "Math/COLLADABUMathQuaternion.h" @@ -46,15 +47,25 @@ private: + /** + * The list of the unique maya transform node names. + */ + COLLADABU::IDList mTransformNodeIdList; + /* * The map holds for every unique id of a geometry a list of transform node unique ids. * We need it for the creation of the geometry, to set the parent transform nodes. */ UniqueIdUniqueIdsMap mGeometryNodesMap; - /** The map holds the unique ids of the nodes to the names. */ - UniqueIdNamesMap mNodeNamesMap; + /** The map holds the unique ids of the nodes to the full node pathes (contains the name). */ + UniqueIdNamesMap mNodePathesMap; + /** + * Save the structure of the scene graph. + */ + // TODO + /* * Helper class, to handle the transformations. */ @@ -105,7 +116,7 @@ */ void importNode ( const COLLADAFW::Node* rootNode, - const COLLADAFW::UniqueId* parentNodeId = 0 ); + const COLLADAFW::Node* parentNode = 0 ); /* * The map holdes for every geometry (identified by it's unique id ) a list of all @@ -117,7 +128,7 @@ /** * The map with the node unique ids and the names for it. */ - const UniqueIdNamesMap& getNodeNamesMap () const { return mNodeNamesMap; } + const UniqueIdNamesMap& getNodeNamesMap () const { return mNodePathesMap; } private: @@ -181,7 +192,7 @@ */ MayaDM::Transform* createNode ( const COLLADAFW::Node* node, - const COLLADAFW::UniqueId* parentNodeId ); + const String& parentNodeName ); /** * Converts the skew into a matrix. Modified: branches/nextgen/COLLADAMaya/scripts/COLLADAMaya.vcproj =================================================================== --- branches/nextgen/COLLADAMaya/scripts/COLLADAMaya.vcproj 2009-01-27 10:16:27 UTC (rev 325) +++ branches/nextgen/COLLADAMaya/scripts/COLLADAMaya.vcproj 2009-01-27 11:56:12 UTC (rev 326) @@ -2384,6 +2384,14 @@ Name="Source Files" Filter="cpp" > + <File + RelativePath="..\src\COLLADAMayaNode.cpp" + > + </File> + <File + RelativePath="..\src\COLLADAMayaTransformNodesHierarchy.cpp" + > + </File> <Filter Name="Utils" > @@ -3925,6 +3933,14 @@ Name="Header Files" Filter="h" > + <File + RelativePath="..\include\COLLADAMayaNode.h" + > + </File> + <File + RelativePath="..\include\COLLADAMayaTransformNodesHierarchy.h" + > + </File> <Filter Name="Utils" > Modified: branches/nextgen/COLLADAMaya/src/COLLADAMayaAnimationExporter.cpp =================================================================== --- branches/nextgen/COLLADAMaya/src/COLLADAMayaAnimationExporter.cpp 2009-01-27 10:16:27 UTC (rev 325) +++ branches/nextgen/COLLADAMaya/src/COLLADAMayaAnimationExporter.cpp 2009-01-27 11:56:12 UTC (rev 326) @@ -676,19 +676,23 @@ // Add the key values for ( uint i=0; i<keyCount; ++i ) { + // Convert the maya internal units to the UI units, if necessary + const AnimationElement* parent = animationCurve.getParent (); + bool convertUnits = parent->getConvertUnits (); + AnimationKey* key = ( ( AnimationKey* ) animationCurve.getKey ( i ) ); input.push_back ( key->input ); - output.push_back ( key->output ); + if ( convertUnits ) + output.push_back ( MDistance::internalToUI ( key->output ) ); + else + output.push_back ( key->output ); + interpolations.push_back ( COLLADASW::LibraryAnimations::getNameOfInterpolation ( key->interpolation ) ); // Handle Tangents if ( hasTangents ) { - // Convert the maya internal units to the UI units, if necessary - const AnimationElement* parent = animationCurve.getParent (); - bool convertUnits = parent->getConvertUnits (); - if ( key->interpolation == COLLADASW::LibraryAnimations::BEZIER ) { // Export bezier tangents @@ -1799,6 +1803,7 @@ if ( key->interpolation == COLLADASW::LibraryAnimations::BEZIER ) { // Create the bezier keys + MFnAnimCurve::AnimCurveType type = animCurveFn.animCurveType (); createBezierKey ( key, animCurveFn, keyPosition, keyCount ); } } Modified: branches/nextgen/COLLADAMaya/src/COLLADAMayaGeometryImporter.cpp =================================================================== --- branches/nextgen/COLLADAMaya/src/COLLADAMayaGeometryImporter.cpp 2009-01-27 10:16:27 UTC (rev 325) +++ branches/nextgen/COLLADAMaya/src/COLLADAMayaGeometryImporter.cpp 2009-01-27 11:56:12 UTC (rev 326) @@ -124,8 +124,16 @@ { // parent -shape -noConnections -relative -addObject "|pCube1|pCubeShape1" "pCube2"; // TODO -// MayaDM::Parent parent; + // Get the current maya ascii file to write the data. + FILE* file = getDocumentImporter ()->getFile (); + + // TODO We have to store the scene graph, otherwise we can't get the path to the node. + + // TODO Get the path to the parent node + String childPath = "|" + parentNodeName + "|" + mesh->getName (); + MayaDM::parentShape ( file, childPath, parentNodeName ); + } } Modified: branches/nextgen/COLLADAMaya/src/COLLADAMayaVisualSceneImporter.cpp =================================================================== --- branches/nextgen/COLLADAMaya/src/COLLADAMayaVisualSceneImporter.cpp 2009-01-27 10:16:27 UTC (rev 325) +++ branches/nextgen/COLLADAMaya/src/COLLADAMayaVisualSceneImporter.cpp 2009-01-27 11:56:12 UTC (rev 326) @@ -34,7 +34,9 @@ #include <maya/MFnTransform.h> #include <maya/MVector.h> +#include <vector> + namespace COLLADAMaya { @@ -63,16 +65,32 @@ // ----------------------------------- void VisualSceneImporter::importNode ( const COLLADAFW::Node* node, - const COLLADAFW::UniqueId* parentNodeId ) + const COLLADAFW::Node* parentNode ) { + + // Check for a parent node name + COLLADAFW::UniqueId parentNodeId; + String parentNodeName = ""; + if ( parentNode != NULL ) + { + parentNodeId = parentNode->getUniqueId (); + String parentNodePath = mNodePathesMap [ parentNodeId ]; + std::vector<String> parts; + COLLADABU::Utils::split ( parentNodePath, String("|"), parts ); + parentNodeName = parts [ parts.size () ]; + } + // Create the node object (joint or node) - MayaDM::Transform* transformNode = createNode ( node, parentNodeId ); + MayaDM::Transform* transformNode = createNode ( node, parentNodeName ); String nodeName = node->getName (); String nodeSid = node->getSid (); // Set the node name in the list of names. - mNodeNamesMap [ node->getUniqueId () ] = nodeName; + nodeName = mTransformNodeIdList.addId ( nodeName ); + mNodePathesMap [ node->getUniqueId () ] = nodeName; + // TODO Write the node in the node hierarchy graph + // Import the tranformations importTransformations ( node, transformNode ); @@ -88,21 +106,30 @@ for ( size_t i=0; i<numChildNodes; ++i ) { COLLADAFW::Node* childNode = childNodes [i]; - importNode ( childNode, &node->getUniqueId () ); + importNode ( childNode, node ); } } // ----------------------------------- bool VisualSceneImporter::readNodeInstances ( const COLLADAFW::Node* node ) { + // Get the current maya ascii file to write the data. + FILE* file = getDocumentImporter ()->getFile (); + const COLLADAFW::InstanceNodeArray& nodeInstances = node->getInstanceNodes (); size_t numInstances = nodeInstances.getCount (); for ( size_t i=0; i<numInstances; ++i ) { const COLLADAFW::InstanceNode* nodeInstance = nodeInstances [i]; const COLLADAFW::UniqueId& uniqueId = nodeInstance->getInstanciatedObjectId (); - String name = nodeInstance->getName (); + // TODO Check if the original node is already generated! + String nodeName = mNodePathesMap [ uniqueId ]; + + // TODO Get the pathes! + String nodePath = "bla"; + String parentNodePath = "blubber"; + MayaDM::parent ( file, nodePath, parentNodePath ); } return true; @@ -242,7 +269,7 @@ // ----------------------------------- MayaDM::Transform* VisualSceneImporter::createNode ( const COLLADAFW::Node* node, - const COLLADAFW::UniqueId* parentNodeId ) + const String& parentNodeName ) { String nodeName = node->getName (); String nodeSid = node->getSid (); @@ -253,13 +280,6 @@ // Create a transform node of the specific type. MayaDM::Transform* transformNode; - // Check for a parent node name - String parentNodeName = ""; - if ( parentNodeId != 0 ) - { - parentNodeName = mNodeNamesMap [ *parentNodeId ]; - } - COLLADAFW::Node::NodeType nodeType = node->getType (); switch ( nodeType ) { Deleted: branches/nextgen/COLLADAStreamWriter/include/COLLADASWIDList.h =================================================================== --- branches/nextgen/COLLADAStreamWriter/include/COLLADASWIDList.h 2009-01-27 10:16:27 UTC (rev 325) +++ branches/nextgen/COLLADAStreamWriter/include/COLLADASWIDList.h 2009-01-27 11:56:12 UTC (rev 326) @@ -1,60 +0,0 @@ -/* - Copyright (c) 2008 NetAllied Systems GmbH - - This file is part of COLLADAStreamWriter. - - Licensed under the MIT Open Source License, - for details please see LICENSE file or the website - http://www.opensource.org/licenses/mit-license.php -*/ - -#ifndef __COLLADASTREAMWRITER_IDLIST_H__ -#define __COLLADASTREAMWRITER_IDLIST_H__ - -#include "COLLADASWPrerequisites.h" -#include "COLLADABUUtils.h" - -#include <set> - -namespace COLLADASW -{ - - /** A class to generate and store unique and valid ids.*/ - - class IDList - { - private: - typedef std::set<String> IDSet; - - typedef String (*StringConversionFunction)(const String&); - - private: - /** Conversion function used to convert added Values*/ - StringConversionFunction mConversionFunction; - - /** A map that stores ids that are already managed by this instance of IDList.*/ - IDSet mIdSet; - - public: - /** Constructor*/ - IDList(StringConversionFunction conversionFunction = Utils::checkID); - - /** Destructor*/ - ~IDList() {} - - /** Takes the string @a newId, checks that it is a valid id, if necessary changes it to - a valid id and adds it to the list of ids managed by IDList. If the id already exists a number - is added to make it unique. The resulting string is returned - @param newId The id / String to add - @param returnConverted If true, the converted new string is returned, otherwise the original string (@a newId) - probably with a number appended is returned. - @return The unique string, added to List. - */ - String addId ( const String & newId, bool returnConverted = true); - - }; - - -} - -#endif // #define __COLLADASTREAMWRITER_IDLIST_H__ Modified: branches/nextgen/COLLADAStreamWriter/scripts/COLLADAStreamWriter.vcproj =================================================================== --- branches/nextgen/COLLADAStreamWriter/scripts/COLLADAStreamWriter.vcproj 2009-01-27 10:16:27 UTC (rev 325) +++ branches/nextgen/COLLADAStreamWriter/scripts/COLLADAStreamWriter.vcproj 2009-01-27 11:56:12 UTC (rev 326) @@ -614,10 +614,6 @@ > </File> <File - RelativePath="..\src\COLLADASWIDList.cpp" - > - </File> - <File RelativePath="..\src\COLLADASWImage.cpp" > </File> @@ -848,10 +844,6 @@ > </File> <File - RelativePath="..\include\COLLADASWIDList.h" - > - </File> - <File RelativePath="..\include\COLLADASWImage.h" > </File> Deleted: branches/nextgen/COLLADAStreamWriter/src/COLLADASWIDList.cpp =================================================================== --- branches/nextgen/COLLADAStreamWriter/src/COLLADASWIDList.cpp 2009-01-27 10:16:27 UTC (rev 325) +++ branches/nextgen/COLLADAStreamWriter/src/COLLADASWIDList.cpp 2009-01-27 11:56:12 UTC (rev 326) @@ -1,47 +0,0 @@ -/* - Copyright (c) 2008 NetAllied Systems GmbH - - This file is part of COLLADAStreamWriter. - - Licensed under the MIT Open Source License, - for details please see LICENSE file or the website - http://www.opensource.org/licenses/mit-license.php -*/ - -#include "COLLADASWIDList.h" - -namespace COLLADASW -{ - - IDList::IDList(StringConversionFunction conversionFunction ) - : mConversionFunction(conversionFunction) - {} - - - String IDList::addId ( const String & newId, bool returnConverted ) - { - String newIdChecked = mConversionFunction( newId ); - - IDSet::iterator it = mIdSet.find ( newIdChecked ); - if ( it == mIdSet.end() ) - { - mIdSet.insert ( newIdChecked ); - return returnConverted ? newIdChecked : newId; - } - - String idCandidate; - size_t numberSuffix = 0; - do - { - numberSuffix++; - idCandidate = newIdChecked + "_" + Utils::toString ( numberSuffix ); - } - while ( mIdSet.find ( idCandidate ) != mIdSet.end() ); - - mIdSet.insert ( idCandidate ); - - return returnConverted ? idCandidate : newId + "_" + Utils::toString ( numberSuffix ); - } - - -} \ No newline at end of file Modified: branches/nextgen/Externals/MayaDataModel/include/MayaDMConnectables.h =================================================================== --- branches/nextgen/Externals/MayaDataModel/include/MayaDMConnectables.h 2009-01-27 10:16:27 UTC (rev 325) +++ branches/nextgen/Externals/MayaDataModel/include/MayaDMConnectables.h 2009-01-27 11:56:12 UTC (rev 326) @@ -330,9 +330,51 @@ /** Macro to connect compatible attributes.*/ #define connectAttr(file, src, dst) { \ fprintf(file, "connectAttr "); \ - src; \ + unsigned int t1 = src; \ fprintf(file, " "); \ - dst; \ - fprintf(file, ";\n"); } + unsigned int t2 = dst; \ + fprintf(file, ";\n"); \ + assert(t1 == t2); } + + static void parent ( FILE* file, std::string childName, std::string parentName = "", + bool absolute = false, bool addObject = false, bool noConnections = false, + bool relative = false, bool removeObject = false, bool shape = false, + bool world = false ) + { + fprintf ( file, "parent" ); + + if ( absolute ) fprintf ( file, " -a" ); + if ( addObject ) fprintf ( file, " -add" ); + if ( noConnections ) fprintf ( file, " -nc" ); + if ( relative ) fprintf ( file, " -r" ); + if ( removeObject ) fprintf ( file, " -rm" ); + if ( shape ) fprintf ( file, " -s" ); + if ( world ) fprintf ( file, " -w" ); + + fprintf ( file, " \"%s\"", childName ); + if ( strcmp ( parentName.c_str (), "" ) != 0 ) fprintf ( file, " \"%s\"", parentName.c_str () ); + fprintf ( file, ";\n" ); + } + + static void parentShape ( FILE* file, std::string childName, std::string parentName = "", + bool absolute = false, bool addObject = false, bool noConnections = false, + bool relative = false, bool removeObject = false, bool world = false ) + { + // parent -shape -noConnections -relative -addObject "|pCube1|pCubeShape1" "pCube2"; + fprintf ( file, "parent" ); + + if ( absolute ) fprintf ( file, " -a" ); + if ( addObject ) fprintf ( file, " -add" ); + if ( noConnections ) fprintf ( file, " -nc" ); + if ( relative ) fprintf ( file, " -r" ); + if ( removeObject ) fprintf ( file, " -rm" ); + fprintf ( file, " -s" ); + if ( world ) fprintf ( file, " -w" ); + + fprintf ( file, " \"%s\"", childName ); + if ( strcmp ( parentName.c_str (), "" ) != 0 ) fprintf ( file, " \"%s\"", parentName.c_str () ); + fprintf ( file, ";\n" ); + } + }//namespace MayaDM #endif//__MayaDM_CONNECTABLES_H__ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |