You can subscribe to this list here.
2009 |
Jan
(14) |
Feb
(44) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
---|
From: <jud...@us...> - 2009-02-24 16:09:36
|
Revision: 375 http://colladamaya.svn.sourceforge.net/colladamaya/?rev=375&view=rev Author: judithschenk Date: 2009-02-24 16:09:28 +0000 (Tue, 24 Feb 2009) Log Message: ----------- Doku Modified Paths: -------------- branches/nextgen/COLLADAFramework/include/COLLADAFWSampler.h Modified: branches/nextgen/COLLADAFramework/include/COLLADAFWSampler.h =================================================================== --- branches/nextgen/COLLADAFramework/include/COLLADAFWSampler.h 2009-02-24 16:09:03 UTC (rev 374) +++ branches/nextgen/COLLADAFramework/include/COLLADAFWSampler.h 2009-02-24 16:09:28 UTC (rev 375) @@ -20,7 +20,10 @@ namespace COLLADAFW { - /** Declares the storage for the graphical representation of an object. */ + /** + * Declares the storage for the graphical representation of an object. + * The samplerId is the array index position in the samplers array. + */ class Sampler { public: @@ -85,6 +88,7 @@ }; private: + /** The type of the current sampler. */ SamplerType mSamplerType; @@ -204,6 +208,9 @@ }; + /** + * The samplerId is the array index position in the samplers array. + */ typedef PointerArray<Sampler> SamplerPointerArray; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jud...@us...> - 2009-02-24 16:09:12
|
Revision: 374 http://colladamaya.svn.sourceforge.net/colladamaya/?rev=374&view=rev Author: judithschenk Date: 2009-02-24 16:09:03 +0000 (Tue, 24 Feb 2009) Log Message: ----------- Doku Modified Paths: -------------- branches/nextgen/COLLADAFramework/include/COLLADAFWTexture.h Modified: branches/nextgen/COLLADAFramework/include/COLLADAFWTexture.h =================================================================== --- branches/nextgen/COLLADAFramework/include/COLLADAFWTexture.h 2009-02-24 11:42:23 UTC (rev 373) +++ branches/nextgen/COLLADAFramework/include/COLLADAFWTexture.h 2009-02-24 16:09:03 UTC (rev 374) @@ -33,7 +33,11 @@ /** Destructor. */ virtual ~Texture(); - /** Returns the id of the sampler.*/ + /** + * Returns the id of the sampler. + * The sampler id is the array index position in the samplers array + * (see COLLADAFW::EffectCommon::mSamplers from type COLLADAFW::SamplerPointerArray). + */ SamplerID getSamplerId() const { return mSamplerId; } /** Sets the id of the sampler.*/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rob...@us...> - 2009-02-24 12:22:46
|
Revision: 373 http://colladamaya.svn.sourceforge.net/colladamaya/?rev=373&view=rev Author: robertwuerfel Date: 2009-02-24 11:42:23 +0000 (Tue, 24 Feb 2009) Log Message: ----------- update build scripts Modified Paths: -------------- branches/nextgen/COLLADAMax/scripts/make_release.bat branches/nextgen/COLLADAMax/scripts/make_release_for_installer.bat Modified: branches/nextgen/COLLADAMax/scripts/make_release.bat =================================================================== --- branches/nextgen/COLLADAMax/scripts/make_release.bat 2009-02-24 11:28:52 UTC (rev 372) +++ branches/nextgen/COLLADAMax/scripts/make_release.bat 2009-02-24 11:42:23 UTC (rev 373) @@ -9,7 +9,7 @@ SET WD=%CD% -CALL "C:\netallied\software\vs2005\VC\vcvarsall.bat" +CALL "%VS2005_PATH%\VC\vcvarsall.bat" devenv ..\COLLADAMax.sln /build "Release Max2008|Win32" devenv ..\COLLADAMax.sln /build "Release Max2008|x64" Modified: branches/nextgen/COLLADAMax/scripts/make_release_for_installer.bat =================================================================== --- branches/nextgen/COLLADAMax/scripts/make_release_for_installer.bat 2009-02-24 11:28:52 UTC (rev 372) +++ branches/nextgen/COLLADAMax/scripts/make_release_for_installer.bat 2009-02-24 11:42:23 UTC (rev 373) @@ -1,5 +1,8 @@ @echo off & setlocal +REM set VS2005_PATH to your vs2005 installation path +REM set MAXMAYA_INSTALLER_PATH to the location of the maxmaya installer + SET VERSION=0.8.1.217_alpha SET DESTINATION=%MAXMAYA_INSTALLER_PATH%\ColladaMaxInstaller\bin @@ -7,9 +10,8 @@ SET LOGFILE=release_log.txt SET WD=%CD% +CALL "%VS2005_PATH%\VC\vcvarsall.bat" -CALL "C:\netallied\software\vs2005\VC\vcvarsall.bat" - del /Q %WD%\%LOGFILE% This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rob...@us...> - 2009-02-24 11:28:54
|
Revision: 372 http://colladamaya.svn.sourceforge.net/colladamaya/?rev=372&view=rev Author: robertwuerfel Date: 2009-02-24 11:28:52 +0000 (Tue, 24 Feb 2009) Log Message: ----------- update export dialog add release build script ( only for use with our msi builder project ) Modified Paths: -------------- branches/nextgen/COLLADAMax/include/COLLADAMaxGeometryExporter.h branches/nextgen/COLLADAMax/res/ColladaMax.rc branches/nextgen/COLLADAMax/src/COLLADAMaxGeometryExporter.cpp Added Paths: ----------- branches/nextgen/COLLADAMax/scripts/make_release_for_installer.bat Modified: branches/nextgen/COLLADAMax/include/COLLADAMaxGeometryExporter.h =================================================================== --- branches/nextgen/COLLADAMax/include/COLLADAMaxGeometryExporter.h 2009-02-24 10:19:30 UTC (rev 371) +++ branches/nextgen/COLLADAMax/include/COLLADAMaxGeometryExporter.h 2009-02-24 11:28:52 UTC (rev 372) @@ -91,6 +91,9 @@ /** True if object must be deleted by us.*/ bool mDeleteObject; + /** True, if normals should be exported*/ + bool mExportNormals; + /** True, if TEXTANGENS and TEXNORMALS should be generated*/ bool mExportTextangentsAndNormals; Modified: branches/nextgen/COLLADAMax/res/ColladaMax.rc =================================================================== --- branches/nextgen/COLLADAMax/res/ColladaMax.rc 2009-02-24 10:19:30 UTC (rev 371) +++ branches/nextgen/COLLADAMax/res/ColladaMax.rc 2009-02-24 11:28:52 UTC (rev 372) @@ -44,12 +44,12 @@ GROUPBOX "Animation",IDC_STATIC,7,80,259,40 CONTROL "Triangulate",IDC_GEOM_TRIANGLES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,84,49,69,10 CONTROL "Sample animation",IDC_ANIM_SAMPLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,105,71,10 - CONTROL "Create clip",IDC_ANIM_CLIP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,84,92,49,10 + CONTROL "Create clip",IDC_ANIM_CLIP,"Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,84,92,49,10 GROUPBOX "Standard Options",IDC_STATIC,7,6,259,28 CONTROL "Bake Matrices",IDC_BAKE_MATRICES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,19,61,10 - CONTROL "Relative Paths",IDC_RELATIVE_PATHS,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,84,19,62,10 + CONTROL "Relative Paths",IDC_RELATIVE_PATHS,"Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_DISABLED | WS_TABSTOP,84,19,62,10 CONTROL "Tangents/Binormals",IDC_GEOM_TANGENTS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,61,79,10 - CONTROL "Include XRefs",IDC_GEOM_XREFS,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,163,49,69,10 + CONTROL "Include XRefs",IDC_GEOM_XREFS,"Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_DISABLED | WS_TABSTOP,163,49,69,10 CONTROL "Enable export",IDC_ANIM_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,92,59,10 END @@ -295,7 +295,7 @@ IDS_COLLADASW_EFFECT_CLASS_NAME "ColladaEffect" IDS_CATEGORY_I "Import" IDS_CLASS_NAME_I "ColladaImporter" - IDS_COLLADASW_XREF_CA "COLLADASW XRef" + IDS_COLLADASW_XREF_CA "COLLADASW XRef" IDS_COLLADASW_EFFECT_NAME "Collada Effect" IDS_CE_NAME "Techniques" IDS_CE_TECHNIQUES "Techniques" @@ -308,7 +308,7 @@ STRINGTABLE BEGIN - IDS_COLLADASW_A_PARAMS "COLLADASW Params" + IDS_COLLADASW_A_PARAMS "COLLADASW Params" IDS_CLASS_NAME_A "ColladaXml" IDS_CLASS_NAME_XREF "ColladaXRef" IDS_CE_SHADERS_PARAMS "Shaders" @@ -316,7 +316,7 @@ STRINGTABLE BEGIN - IDS_COLLADASW_XREF_ID "Collada ID" + IDS_COLLADASW_XREF_ID "Collada ID" IDS_CE_BOOL "My check box" END Added: branches/nextgen/COLLADAMax/scripts/make_release_for_installer.bat =================================================================== --- branches/nextgen/COLLADAMax/scripts/make_release_for_installer.bat (rev 0) +++ branches/nextgen/COLLADAMax/scripts/make_release_for_installer.bat 2009-02-24 11:28:52 UTC (rev 372) @@ -0,0 +1,53 @@ +@echo off & setlocal + +SET VERSION=0.8.1.217_alpha + +SET DESTINATION=%MAXMAYA_INSTALLER_PATH%\ColladaMaxInstaller\bin + +SET LOGFILE=release_log.txt +SET WD=%CD% + + +CALL "C:\netallied\software\vs2005\VC\vcvarsall.bat" + +del /Q %WD%\%LOGFILE% + + + +devenv ..\COLLADAMax.sln /build "Release Max8|Win32" > %LOGFILE% +copy "..\bin\win\win32\release max8\COLLADAMaxNew.dle" %DESTINATION%\max8-x86 > %LOGFILE% + + +devenv ..\COLLADAMax.sln /build "Release Max9|Win32" >> %LOGFILE% +copy "..\bin\win\win32\release max9\COLLADAMaxNew.dle" %DESTINATION%\max9-x86 >> %LOGFILE% + +devenv ..\COLLADAMax.sln /build "Release Max9|x64" +copy "..\bin\win\x64\release max9\COLLADAMaxNew.dle" %DESTINATION%\max9-x64 >> %LOGFILE% + + +devenv ..\COLLADAMax.sln /build "Release Max2008|Win32" >> %LOGFILE% +copy "..\bin\win\win32\release max2008\COLLADAMaxNew.dle" %DESTINATION%\max2008-x86 >> %LOGFILE% + +devenv ..\COLLADAMax.sln /build "Release Max2008|x64" +copy "..\bin\win\x64\release max2008\COLLADAMaxNew.dle" %DESTINATION%\max2008-x64 >> %LOGFILE% + + +devenv ..\COLLADAMax.sln /build "Release Max2009|Win32" >> %LOGFILE% +copy "..\bin\win\win32\release max2009\COLLADAMaxNew.dle" %DESTINATION%\max2009-x86 >> %LOGFILE% + +devenv ..\COLLADAMax.sln /build "Release Max2009|x64" +copy "..\bin\win\x64\release max2009\COLLADAMaxNew.dle" %DESTINATION%\max2009-x64 >> %LOGFILE% + + + +pause + + + + + + + + + + Modified: branches/nextgen/COLLADAMax/src/COLLADAMaxGeometryExporter.cpp =================================================================== --- branches/nextgen/COLLADAMax/src/COLLADAMaxGeometryExporter.cpp 2009-02-24 10:19:30 UTC (rev 371) +++ branches/nextgen/COLLADAMax/src/COLLADAMaxGeometryExporter.cpp 2009-02-24 11:28:52 UTC (rev 372) @@ -88,7 +88,8 @@ mTriObject ( 0 ), mGeomObject ( 0 ), mDeleteObject ( false ), - mExportTextangentsAndNormals(documentExporter->getOptions().getExportTangents()) + mExportNormals( documentExporter->getOptions().getExportNormals() ), + mExportTextangentsAndNormals( mExportNormals && documentExporter->getOptions().getExportTangents() ) {} //--------------------------------------------------------------- @@ -102,7 +103,8 @@ mTriObject ( 0 ), mGeomObject ( 0 ), mDeleteObject ( false ) , - mExportTextangentsAndNormals(documentExporter->getOptions().getExportTangents()) + mExportNormals( documentExporter->getOptions().getExportNormals() ), + mExportTextangentsAndNormals( mExportNormals && documentExporter->getOptions().getExportTangents() ) {} @@ -167,7 +169,7 @@ Class_ID id = object->ClassID(); - bool exportEPolyAsTriangles = mDocumentExporter->getOptions().getExportEPolyAsTriangles(); + bool exportEPolyAsTriangles = mDocumentExporter->getOptions().getExportEPolyAsTriangles() || mExportTextangentsAndNormals; if ( !exportEPolyAsTriangles ) { @@ -350,7 +352,10 @@ else exportPositions(); - exportNormals(); + if ( mExportNormals ) + { + exportNormals(); + } ChannelList channelList; @@ -1025,7 +1030,10 @@ triangles.setCount ( numberOfFaces ); triangles.setMaterial ( symbol ); triangles.getInputList().push_back ( COLLADASW::Input ( COLLADASW::VERTEX, "#" + mId + COLLADASW::LibraryGeometries::VERTICES_ID_SUFFIX, offset++ ) ); - triangles.getInputList().push_back ( COLLADASW::Input ( COLLADASW::NORMAL, "#" + mId + COLLADASW::LibraryGeometries::NORMALS_SOURCE_ID_SUFFIX, offset++ ) ); + if ( mExportNormals ) + { + triangles.getInputList().push_back ( COLLADASW::Input ( COLLADASW::NORMAL, "#" + mId + COLLADASW::LibraryGeometries::NORMALS_SOURCE_ID_SUFFIX, offset++ ) ); + } for ( ChannelList::const_iterator it = channelList.begin(); it != channelList.end(); ++it ) { @@ -1048,7 +1056,10 @@ { for ( int vertexIndex = 0; vertexIndex < 3; ++vertexIndex ) { - triangles.appendValues ( face.v[ vertexIndex ], norms->GetNormalIndex ( faceIndex, vertexIndex ) ); + if ( mExportNormals ) + { + triangles.appendValues ( face.v[ vertexIndex ], norms->GetNormalIndex ( faceIndex, vertexIndex ) ); + } for ( ChannelList::const_iterator it = channelList.begin(); it != channelList.end(); ++it ) { @@ -1088,7 +1099,10 @@ polylist.setCount ( ( unsigned long ) polylist.getVCountList().size() ); polylist.setMaterial ( symbol ); polylist.getInputList().push_back ( COLLADASW::Input ( COLLADASW::VERTEX, "#" + mId + COLLADASW::LibraryGeometries::VERTICES_ID_SUFFIX, offset++ ) ); - polylist.getInputList().push_back ( COLLADASW::Input ( COLLADASW::NORMAL, "#" + mId + COLLADASW::LibraryGeometries::NORMALS_SOURCE_ID_SUFFIX, offset++ ) ); + if ( mExportNormals ) + { + polylist.getInputList().push_back ( COLLADASW::Input ( COLLADASW::NORMAL, "#" + mId + COLLADASW::LibraryGeometries::NORMALS_SOURCE_ID_SUFFIX, offset++ ) ); + } for ( ChannelList::const_iterator it = channelList.begin(); it != channelList.end(); ++it ) { @@ -1109,7 +1123,10 @@ for ( int vertexIndex = 0; vertexIndex < vertexCount; ++vertexIndex ) { - polylist.appendValues ( mnFace->vtx[ vertexIndex ], normmalSpec->GetNormalIndex ( faceIndex, vertexIndex ) ); + if ( mExportNormals ) + { + polylist.appendValues ( mnFace->vtx[ vertexIndex ], normmalSpec->GetNormalIndex ( faceIndex, vertexIndex ) ); + } for ( ChannelList::const_iterator it = channelList.begin(); it != channelList.end(); ++it ) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rob...@us...> - 2009-02-24 10:19:41
|
Revision: 371 http://colladamaya.svn.sourceforge.net/colladamaya/?rev=371&view=rev Author: robertwuerfel Date: 2009-02-24 10:19:30 +0000 (Tue, 24 Feb 2009) Log Message: ----------- optionally calculate and export textangents and texbinormals for triangle meshes Modified Paths: -------------- branches/nextgen/COLLADABaseUtils/include/Math/COLLADABUMathVector3.h branches/nextgen/COLLADAMax/include/COLLADAMaxGeometryExporter.h branches/nextgen/COLLADAMax/scripts/COLLADAMax.vcproj branches/nextgen/COLLADAMax/src/COLLADAMaxGeometryExporter.cpp branches/nextgen/COLLADAStreamWriter/include/COLLADASWConstants.h branches/nextgen/COLLADAStreamWriter/src/COLLADASWConstants.cpp branches/nextgen/COLLADAStreamWriter/src/COLLADASWInputList.cpp Added Paths: ----------- branches/nextgen/COLLADAMax/include/COLLADAMaxIMeshAccess.h branches/nextgen/COLLADAMax/include/COLLADAMaxMeshAccess.h branches/nextgen/COLLADAMax/include/COLLADAMaxTexTangentCalculator.h branches/nextgen/COLLADAMax/src/COLLADAMaxTexTangentCalculator.cpp Modified: branches/nextgen/COLLADABaseUtils/include/Math/COLLADABUMathVector3.h =================================================================== --- branches/nextgen/COLLADABaseUtils/include/Math/COLLADABUMathVector3.h 2009-02-20 15:55:04 UTC (rev 370) +++ branches/nextgen/COLLADABaseUtils/include/Math/COLLADABUMathVector3.h 2009-02-24 10:19:30 UTC (rev 371) @@ -25,7 +25,7 @@ /** Standard 3-dimensional vector. @remarks A direction in 3D space represented as distances along the 3 - orthoganal axes (x, y, z). Note that positions, directions and + orthogonal axes (x, y, z). Note that positions, directions and scaling factors can be represented by a vector, depending on how you interpret the values. */ @@ -73,6 +73,13 @@ : x( rkVector.x ), y( rkVector.y ), z( rkVector.z ) {} + inline void set( Real fX, Real fY, Real fZ ) + { + x = fX; + y = fY; + z = fZ; + } + inline Real operator [] ( size_t i ) const { assert( i < 3 ); Modified: branches/nextgen/COLLADAMax/include/COLLADAMaxGeometryExporter.h =================================================================== --- branches/nextgen/COLLADAMax/include/COLLADAMaxGeometryExporter.h 2009-02-20 15:55:04 UTC (rev 370) +++ branches/nextgen/COLLADAMax/include/COLLADAMaxGeometryExporter.h 2009-02-24 10:19:30 UTC (rev 371) @@ -30,6 +30,7 @@ namespace COLLADAMax { + class TexTangentCalculator; class ExportNode; struct MorphControllerHelperGeometry; @@ -52,8 +53,10 @@ /** List of indices.*/ typedef std::vector<int> IndicesList; + typedef std::map<int, TexTangentCalculator*> ChannelIndexTexTangentCalculatorMap; + public: /** Symbol used for simple color materials.*/ static const String COLOR_MATERIAL_SYMBOL; @@ -93,6 +96,8 @@ static const String SYMBOL_NAME_PREFIX; + ChannelIndexTexTangentCalculatorMap mChannelIndexTexTangentCalculatorMap; + public: /** Constructor @param exportNode The node which geometry should be exported @@ -180,12 +185,6 @@ /** Create list of materials used by this geometry.*/ void flattenMaterials ( Mtl* material, MaterialList& mtlMap, int materialIndex = -1 ); - /** Calculates the textangents and texbinormals of the current mesh and MeshMap @a meshMap and stores them in - @a texTangents and @a texBinormals. The are not reduces, i.e. no indices are needed since the are always the same.*/ - void calculateTriangleMeshTextangentsAndTexbinormals(int channelIndex, - Point3List& texTangents, - Point3List& texBinormals); - }; } Added: branches/nextgen/COLLADAMax/include/COLLADAMaxIMeshAccess.h =================================================================== --- branches/nextgen/COLLADAMax/include/COLLADAMaxIMeshAccess.h (rev 0) +++ branches/nextgen/COLLADAMax/include/COLLADAMaxIMeshAccess.h 2009-02-24 10:19:30 UTC (rev 371) @@ -0,0 +1,70 @@ +/* +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_IMESHACCESS_H__ +#define __COLLADAMAX_IMESHACCESS_H__ + +#include "COLLADAMaxPrerequisites.h" + +#include "Math/COLLADABUMathVector3.h" + +namespace COLLADAMax +{ + + /** Interface to access mesh data. Used by TexTangentCalculator */ + class IMeshAccess + { + private: + + public: + + /** Constructor. */ + IMeshAccess() {} + + /** Destructor. */ + virtual ~IMeshAccess(){} + + /** Returns the number of faces in the mesh.*/ + virtual int getFaceCount() = 0; + + /** Returns the number of vertices of the face with index @a faceIndex.*/ + virtual int getVertexCount( int faceIndex ) = 0; + + /** Returns the vertex index of the @a faceVertexIndex'th vertex of the @a faceIndex'th face.*/ + virtual int getPositionIndex( int faceIndex, int faceVertexIndex) = 0; + + /** Returns the position of the vertex with index @a vertexIndex.*/ + virtual COLLADABU::Math::Vector3 getVertex( int vertexIndex ) = 0; + + /** Returns the normal index of the @a faceVertexIndex'th vertex of the @a faceIndex'th face.*/ + virtual int getNormalIndex( int faceIndex, int faceVertexIndex) = 0; + + /** Returns the normal with index @a normalIndex.*/ + virtual COLLADABU::Math::Vector3 getNormal( int normalIndex ) = 0; + + /** Returns the texcoord index of the @a faceVertexIndex'th vertex of the @a faceIndex'th face.*/ + virtual int getTexcoordIndex( int faceIndex, int faceVertexIndex) = 0; + + /** Returns the texcoord with index @a textureIndex.*/ + virtual COLLADABU::Math::Vector3 getTexcoord( int textureIndex ) = 0; + + + }; + +} // namespace COLLADAMAX + +#endif // __COLLADAMAX_IMESHACCESS_H__ Added: branches/nextgen/COLLADAMax/include/COLLADAMaxMeshAccess.h =================================================================== --- branches/nextgen/COLLADAMax/include/COLLADAMaxMeshAccess.h (rev 0) +++ branches/nextgen/COLLADAMax/include/COLLADAMaxMeshAccess.h 2009-02-24 10:19:30 UTC (rev 371) @@ -0,0 +1,105 @@ +/* +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_MESHACCESS_H__ +#define __COLLADAMAX_MESHACCESS_H__ + +#include "COLLADAMaxPrerequisites.h" + +#include "COLLADAMaxIMeshAccess.h" + +#include <max.h> + + +namespace COLLADAMax +{ + + /** Implements IMeshAccess for a max mesh */ + class MeshAccess : public IMeshAccess + { + private: + Mesh& mMesh; + MeshNormalSpec *mNormalSpec; + MeshMap& mTextureMap; + + public: + + /** Constructor. */ + MeshAccess( Mesh& mesh, int mapChannel) + : mMesh(mesh) + , mNormalSpec(mesh.GetSpecifiedNormals()) + , mTextureMap(mesh.Map ( mapChannel )) + { + if ( !mNormalSpec ) + { + mesh.SpecifyNormals(); + mNormalSpec = mesh.GetSpecifiedNormals(); + } + } + + /** Destructor. */ + virtual ~MeshAccess(){} + + /** Returns the number of faces in the mesh.*/ + virtual int getFaceCount() { return mMesh.getNumFaces(); } + + /** Returns the number of vertices of the face with index @a faceIndex.*/ + virtual int getVertexCount( int faceIndex ) { return 3; } + + /** Returns the vertex index of the @a faceVertexIndex'th vertex of the @a faceIndex'th face.*/ + virtual int getPositionIndex( int faceIndex, int faceVertexIndex) { return mMesh.faces[faceIndex].v[faceVertexIndex]; } + + /** Returns the position of the vertex with index @a vertexIndex.*/ + virtual COLLADABU::Math::Vector3 getVertex( int vertexIndex ) + { + Point3& vertex = mMesh.verts[vertexIndex]; + return COLLADABU::Math::Vector3(vertex.x, vertex.y, vertex.z); + } + + /** Returns the normal index of the @a faceVertexIndex'th vertex of the @a faceIndex'th face.*/ + virtual int getNormalIndex( int faceIndex, int faceVertexIndex){ return mNormalSpec->GetNormalIndex ( faceIndex, faceVertexIndex ) ; } + + /** Returns the normal with index @a normalIndex.*/ + virtual COLLADABU::Math::Vector3 getNormal( int normalIndex ) + { + Point3 & normal = mNormalSpec->Normal ( normalIndex ); + return COLLADABU::Math::Vector3(normal.x, normal.y, normal.z); + } + + /** Returns the texcoord index of the @a faceVertexIndex'th vertex of the @a faceIndex'th face.*/ + virtual int getTexcoordIndex( int faceIndex, int faceVertexIndex) { return mTextureMap.tf[ faceIndex ].t[faceVertexIndex];} + + /** Returns the texcoord with index @a textureIndex.*/ + virtual COLLADABU::Math::Vector3 getTexcoord( int textureIndex ) + { + Point3& texCoord = mTextureMap.tv[ textureIndex ]; + return COLLADABU::Math::Vector3(texCoord.x, texCoord.y, texCoord.z); + } + + private: + + /** Disable default copy ctor. */ + MeshAccess( const MeshAccess& pre ); + + /** Disable default assignment operator. */ + const MeshAccess& operator= ( const MeshAccess& pre ); + + }; + +} // namespace COLLADAMAX + +#endif // __COLLADAMAX_MESHACCESS_H__ Added: branches/nextgen/COLLADAMax/include/COLLADAMaxTexTangentCalculator.h =================================================================== --- branches/nextgen/COLLADAMax/include/COLLADAMaxTexTangentCalculator.h (rev 0) +++ branches/nextgen/COLLADAMax/include/COLLADAMaxTexTangentCalculator.h 2009-02-24 10:19:30 UTC (rev 371) @@ -0,0 +1,111 @@ +/* +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_TEXTANGENTCALCULATOR_H__ +#define __COLLADAMAX_TEXTANGENTCALCULATOR_H__ + +#include "COLLADAMaxPrerequisites.h" +#include "math/COLLADABUMathVector3.h" + +#include "COLLADAMaxIMeshAccess.h" + +#include <vector> + +namespace COLLADAMax +{ + + /** Calculates textangents and texbinormals for a triangle mesh */ + class TexTangentCalculator + { + public: + typedef COLLADABU::Math::Vector3 Vector3; + typedef COLLADABU::Math::Real Real; + + struct VertexIdentifier + { + int positionIndex; + int normalIndex; + int textureIndex; + bool operator<(const VertexIdentifier& rhs) const; + }; + + struct VertexTexTangentInfo + { + Vector3 tangent; + Vector3 biTangent; + int count; + unsigned long index; + }; + + typedef std::map<VertexIdentifier, VertexTexTangentInfo*> VertexIdentifierVertexTexTangentInfoMap; + + + /** List of vector3.*/ + typedef std::vector<VertexTexTangentInfo*> VertexTexTangentInfoList; + + /** List of indices.*/ + typedef std::vector<unsigned long> IndicesList; + + private: + IMeshAccess* mMesh; + + VertexTexTangentInfoList mTexTangents; + + IndicesList mIndices; + + VertexIdentifierVertexTexTangentInfoMap mVertexIdentifierVertexTexTangentInfoMap; + + unsigned long mTexTangentsCount; + + public: + + /** Constructor. */ + TexTangentCalculator( IMeshAccess* mesh ); + + /** Destructor. */ + virtual ~TexTangentCalculator(); + + void calculateTriangleMeshTextangents(); + + const VertexTexTangentInfoList& getTexTangents() const { return mTexTangents; } + + void clearTexTangentData(); + + const IndicesList& getIndices() const { return mIndices; } + + private: + + /** Disable default copy ctor. */ + TexTangentCalculator( const TexTangentCalculator& pre ); + + /** Disable default assignment operator. */ + const TexTangentCalculator& operator= ( const TexTangentCalculator& pre ); + + void computeTangent( Vector3 textureVertex[3], Vector3 geometryVertex[3], Vector3& texTangent); + + unsigned long addTexTangent( int vertexIndex, int normalIndex, int textureIndex, const Vector3& texTangent ); + + void normalizeTangentsAndCalculateBiTangents(); + + void deleteTexTangentInfo(); + + + }; + +} // namespace COLLADAMAX + +#endif // __COLLADAMAX_TEXTANGENTCALCULATOR_H__ Modified: branches/nextgen/COLLADAMax/scripts/COLLADAMax.vcproj =================================================================== --- branches/nextgen/COLLADAMax/scripts/COLLADAMax.vcproj 2009-02-20 15:55:04 UTC (rev 370) +++ branches/nextgen/COLLADAMax/scripts/COLLADAMax.vcproj 2009-02-24 10:19:30 UTC (rev 371) @@ -1799,6 +1799,10 @@ > </File> <File + RelativePath="..\src\COLLADAMaxTexTangentCalculator.cpp" + > + </File> + <File RelativePath="..\src\COLLADAMaxVisualSceneExporter.cpp" > </File> @@ -2221,6 +2225,10 @@ > </File> <File + RelativePath="..\include\COLLADAMaxIMeshAccess.h" + > + </File> + <File RelativePath="..\include\COLLADAMaxLightExporter.h" > </File> @@ -2229,10 +2237,18 @@ > </File> <File + RelativePath="..\include\COLLADAMaxMeshAccess.h" + > + </File> + <File RelativePath="..\include\COLLADAMaxOptions.h" > </File> <File + RelativePath="..\include\COLLADAMaxTexTangentCalculator.h" + > + </File> + <File RelativePath="..\include\COLLADAMaxVisualSceneExporter.h" > </File> @@ -2334,6 +2350,10 @@ > </File> </Filter> + <File + RelativePath="..\res\error.fx" + > + </File> </Files> <Globals> </Globals> Modified: branches/nextgen/COLLADAMax/src/COLLADAMaxGeometryExporter.cpp =================================================================== --- branches/nextgen/COLLADAMax/src/COLLADAMaxGeometryExporter.cpp 2009-02-20 15:55:04 UTC (rev 370) +++ branches/nextgen/COLLADAMax/src/COLLADAMaxGeometryExporter.cpp 2009-02-24 10:19:30 UTC (rev 371) @@ -34,6 +34,9 @@ #include "COLLADAMaxXRefFunctions.h" +#include "COLLADAMaxMeshAccess.h" +#include "COLLADAMaxTexTangentCalculator.h" + #include <algorithm> #include <max.h> @@ -938,9 +941,16 @@ { continue; } + + MeshAccess mesh( mTriObject->GetMesh(), channelIndex); + TexTangentCalculator* texTangentCalculator = new TexTangentCalculator( &mesh ); + mChannelIndexTexTangentCalculatorMap.insert(std::make_pair(channelIndex, texTangentCalculator)); - calculateTriangleMeshTextangentsAndTexbinormals( channelIndex, texTangents, texBinormals); + texTangentCalculator->calculateTriangleMeshTextangents(); + // calculateTriangleMeshTextangents( channelIndex, texTangents, texBinormals); + + const TexTangentCalculator::VertexTexTangentInfoList& texTangents = texTangentCalculator->getTexTangents(); // textangents size_t texTangentsCount = texTangents.size(); COLLADASW::FloatSource texTangentSource ( mGeometriesExporter->mSW ); @@ -958,14 +968,14 @@ for ( size_t j = 0; j < texTangentsCount; ++j) { - Point3& texTangent = texTangents[j]; + COLLADABU::Math::Vector3& texTangent = texTangents[j]->tangent; texTangentSource.appendValues ( texTangent.x, texTangent.y, texTangent.z ); } texTangentSource.finish(); // texbinormals - size_t texBinormalsCount = texBinormals.size(); + size_t texBinormalsCount = texTangentsCount; COLLADASW::FloatSource texBinormalSource ( mGeometriesExporter->mSW ); String texBinormalSourceId = mId + getTexbinormalSourceIdSuffix( channelIndex ); texBinormalSource.setId ( texBinormalSourceId ); @@ -981,11 +991,12 @@ for ( size_t j = 0; j < texBinormalsCount; ++j) { - Point3& texBinormal = texBinormals[j]; + COLLADABU::Math::Vector3& texBinormal = texTangents[j]->biTangent; texBinormalSource.appendValues ( texBinormal.x, texBinormal.y, texBinormal.z ); } texBinormalSource.finish(); + texTangentCalculator->clearTexTangentData(); } } @@ -1018,10 +1029,12 @@ for ( ChannelList::const_iterator it = channelList.begin(); it != channelList.end(); ++it ) { - triangles.getInputList().push_back ( COLLADASW::Input ( ( *it <= 0 ) ? COLLADASW::COLOR : COLLADASW::TEXCOORD, "#" + mId + getTextureSourceIdSuffix ( *it ), offset++, *it ) ); - if ( mExportTextangentsAndNormals && ( *it > 0 ) ) + int channelIndex = *it; + triangles.getInputList().push_back ( COLLADASW::Input ( ( channelIndex <= 0 ) ? COLLADASW::COLOR : COLLADASW::TEXCOORD, "#" + mId + getTextureSourceIdSuffix ( channelIndex ), offset++, channelIndex ) ); + if ( mExportTextangentsAndNormals && ( channelIndex > 0 ) ) { - triangles.getInputList().push_back ( COLLADASW::Input ( COLLADASW::TEXTANGENT, "#" + mId + getTextureSourceIdSuffix ( *it ), offset++, *it ) ); + triangles.getInputList().push_back ( COLLADASW::Input ( COLLADASW::TEXTANGENT, "#" + mId + getTextangentSourceIdSuffix( channelIndex ), offset, channelIndex ) ); + triangles.getInputList().push_back ( COLLADASW::Input ( COLLADASW::TEXBINORMAL, "#" + mId + getTexbinormalSourceIdSuffix( channelIndex ), offset++, channelIndex ) ); } } @@ -1046,6 +1059,13 @@ MeshMap & tmap = mesh.Map ( channel ); TVFace& tvFace = tmap.tf[ faceIndex ]; triangles.appendValues ( tvFace.t[ vertexIndex ] ); + + if ( mExportTextangentsAndNormals && ( channel > 0 ) ) + { + const TexTangentCalculator* texTangentCalculator = mChannelIndexTexTangentCalculatorMap[channel]; + const TexTangentCalculator::IndicesList& indices = texTangentCalculator->getIndices(); + triangles.appendValues ( indices[ 3*faceIndex + vertexIndex ] ); + } } } } @@ -1166,57 +1186,11 @@ - //--------------------------------------------------------------- - void GeometryExporter::calculateTriangleMeshTextangentsAndTexbinormals(int channelIndex, - Point3List& texTangents, - Point3List& texBinormals) - { - Mesh mesh = mTriObject->GetMesh(); - int numFaces = mesh.getNumFaces(); - Point3 geometryVertex[3]; - Point3 textureVertex[3]; - Point3 basisVectors[2]; + - MeshMap& meshMap = mTriObject->GetMesh().Map ( channelIndex ); + - TVFace* mapFaces = meshMap.tf; - UVVert* mapVerts = meshMap.tv; - texTangents.clear(); - texTangents.reserve( 3*numFaces ); - texBinormals.clear(); - texBinormals.reserve( 3*numFaces ); - for ( int i = 0; i < numFaces; ++i) - { - - Face& geomFace = mesh.faces[i]; - geometryVertex[0] = mesh.verts[ geomFace.v[0] ]; - geometryVertex[1] = mesh.verts[ geomFace.v[1] ]; - geometryVertex[2] = mesh.verts[ geomFace.v[2] ]; - - - TVFace& mapFace = mapFaces[i]; - textureVertex[0] = mapVerts[ mapFace.t[0] ]; - textureVertex[1] = mapVerts[ mapFace.t[1] ]; - textureVertex[2] = mapVerts[ mapFace.t[2] ]; - - ComputeTangentAndBinormal( textureVertex, geometryVertex, basisVectors ); - - Point3 mapNormal = FNormalize( (textureVertex[1] - textureVertex[0]) ^ (textureVertex[2] - textureVertex[1]) ); - if( mapNormal.z<0 ) - { - basisVectors[1] = -basisVectors[1]; //is the UV face flipped? flip the binormal - } - - texTangents.push_back(basisVectors[0]); - texBinormals.push_back(basisVectors[1]); - } - - } - - - - } Added: branches/nextgen/COLLADAMax/src/COLLADAMaxTexTangentCalculator.cpp =================================================================== --- branches/nextgen/COLLADAMax/src/COLLADAMaxTexTangentCalculator.cpp (rev 0) +++ branches/nextgen/COLLADAMax/src/COLLADAMaxTexTangentCalculator.cpp 2009-02-24 10:19:30 UTC (rev 371) @@ -0,0 +1,241 @@ +/* +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 "COLLADAMaxTexTangentCalculator.h" + + + +namespace COLLADAMax +{ + + TexTangentCalculator::TexTangentCalculator( IMeshAccess* mesh ) + : mMesh(mesh) + , mTexTangentsCount(0) + { + } + + //------------------------------ + TexTangentCalculator::~TexTangentCalculator() + { + deleteTexTangentInfo(); + } + + + void TexTangentCalculator::computeTangent( Vector3 textureVertex[3], Vector3 geometryVertex[3], Vector3& texTangent ) + { + const Vector3& w1 = textureVertex[0]; + const Vector3& w2 = textureVertex[1]; + const Vector3& w3 = textureVertex[2]; + + const Vector3& v1 = geometryVertex[0]; + const Vector3& v2 = geometryVertex[1]; + const Vector3& v3 = geometryVertex[2]; + + Real x1 = v2.x - v1.x; + Real x2 = v3.x - v1.x; + Real y1 = v2.y - v1.y; + Real y2 = v3.y - v1.y; + Real z1 = v2.z - v1.z; + Real z2 = v3.z - v1.z; + + Real s1 = w2.x - w1.x; + Real s2 = w3.x - w1.x; + Real t1 = w2.y - w1.y; + Real t2 = w3.y - w1.y; + + Real r = (Real)1.0 / (s1 * t2 - s2 * t1); + texTangent.set( (t2 * x1 - t1 * x2) * r, (t2 * y1 - t1 * y2) * r, (t2 * z1 - t1 * z2) * r); + texTangent.normalise(); + // tDir.set( (s1 * x2 - s2 * x1) * r, (s1 * y2 - s2 * y1) * r, (s1 * z2 - s2 * z1) * r); + } + + + + //--------------------------------------------------------------- + void TexTangentCalculator::calculateTriangleMeshTextangents() + { + mTexTangents.clear(); + + //Mesh mesh = mTriObject->GetMesh(); + + int numFaces = mMesh->getFaceCount(); + + mIndices.reserve( numFaces * 3 ); + + Vector3 geometryVertex[3]; + Vector3 textureVertex[3]; + Vector3 normalVertex[3]; + Vector3 texTangent[3]; + Vector3 computetTexTangent; +/* Vector3 basisVectors[2]; + Vector3 basisVectors2[2]; + */ + +// MeshMap& meshMap = mTriObject->GetMesh().Map ( channelIndex ); + +// TVFace* mapFaces = meshMap.tf; +// UVVert* mapVerts = meshMap.tv; + + + for ( int i = 0; i < numFaces; ++i) + { +/* Face& geomFace = mesh.faces[i]; + int index1 = geomFace.v[0]; + int index2 = geomFace.v[1]; + int index3 = geomFace.v[2]; +*/ + int vertexIndex1 = mMesh->getPositionIndex(i, 0); + int vertexIndex2 = mMesh->getPositionIndex(i, 1); + int vertexIndex3 = mMesh->getPositionIndex(i, 2); + + geometryVertex[0] = mMesh->getVertex(vertexIndex1); + geometryVertex[1] = mMesh->getVertex(vertexIndex2); + geometryVertex[2] = mMesh->getVertex(vertexIndex3); + +/* TVFace& mapFace = mapFaces[i]; + textureVertex[0] = mapVerts[ mapFace.t[0] ]; + textureVertex[1] = mapVerts[ mapFace.t[1] ]; + textureVertex[2] = mapVerts[ mapFace.t[2] ]; +*/ + int textureIndex1 = mMesh->getTexcoordIndex(i, 0); + int textureIndex2 = mMesh->getTexcoordIndex(i, 1); + int textureIndex3 = mMesh->getTexcoordIndex(i, 2); + + textureVertex[0] = mMesh->getTexcoord( textureIndex1 ); + textureVertex[1] = mMesh->getTexcoord( textureIndex2 ); + textureVertex[2] = mMesh->getTexcoord( textureIndex3 ); + + computeTangent( textureVertex, geometryVertex, computetTexTangent ); + +/* Point3 mapNormal = FNormalize( (textureVertex[1] - textureVertex[0]) ^ (textureVertex[2] - textureVertex[1]) ); + if( mapNormal.z<0 ) + { + basisVectors[1] = -basisVectors[1]; //is the UV face flipped? flip the binormal + } +*/ + + int normalIndex1 = mMesh->getNormalIndex(i, 0); + int normalIndex2 = mMesh->getNormalIndex(i, 1); + int normalIndex3 = mMesh->getNormalIndex(i, 2); + + normalVertex[0] = mMesh->getNormal( normalIndex1 ); + normalVertex[1] = mMesh->getNormal( normalIndex2 ); + normalVertex[2] = mMesh->getNormal( normalIndex3 ); + + texTangent[0] = computetTexTangent - normalVertex[0] * (normalVertex[0].dotProduct(computetTexTangent)); + texTangent[1] = computetTexTangent - normalVertex[1] * (normalVertex[1].dotProduct(computetTexTangent)); + texTangent[2] = computetTexTangent - normalVertex[2] * (normalVertex[2].dotProduct(computetTexTangent)); + + mIndices.push_back(addTexTangent( vertexIndex1, normalIndex1, textureIndex1, texTangent[0] )); + mIndices.push_back(addTexTangent( vertexIndex2, normalIndex2, textureIndex2, texTangent[1] )); + mIndices.push_back(addTexTangent( vertexIndex3, normalIndex3, textureIndex3, texTangent[2] )); + + } + + normalizeTangentsAndCalculateBiTangents(); + } + + //--------------------------------------------------------------- + unsigned long TexTangentCalculator::addTexTangent( int vertexIndex, int normalIndex, int textureIndex, const Vector3& texTangent ) + { + VertexIdentifier vertexIdentifier; + vertexIdentifier.positionIndex = vertexIndex; + vertexIdentifier.normalIndex = normalIndex; + vertexIdentifier.textureIndex = textureIndex; + VertexIdentifierVertexTexTangentInfoMap::iterator it = mVertexIdentifierVertexTexTangentInfoMap.find(vertexIdentifier); + if ( it == mVertexIdentifierVertexTexTangentInfoMap.end() ) + { + VertexTexTangentInfo* vertexTexTangentInfo = new VertexTexTangentInfo; + vertexTexTangentInfo->tangent = texTangent; + vertexTexTangentInfo->count = 1; + vertexTexTangentInfo->index = mTexTangentsCount++; + mTexTangents.push_back(vertexTexTangentInfo); + mVertexIdentifierVertexTexTangentInfoMap.insert(std::make_pair(vertexIdentifier, vertexTexTangentInfo)); + return vertexTexTangentInfo->index; + } + else + { + VertexTexTangentInfo& vertexTexTangentInfo = *it->second; + vertexTexTangentInfo.tangent += texTangent; + vertexTexTangentInfo.count++; + return vertexTexTangentInfo.index; + } + } + + //--------------------------------------------------------------- + void TexTangentCalculator::normalizeTangentsAndCalculateBiTangents() + { + VertexIdentifierVertexTexTangentInfoMap::iterator it = mVertexIdentifierVertexTexTangentInfoMap.begin(); + VertexIdentifierVertexTexTangentInfoMap::iterator endIt = mVertexIdentifierVertexTexTangentInfoMap.end(); + for ( ; it != endIt; ++it) + { + VertexTexTangentInfo& vertexTexTangentInfo = *it->second; + vertexTexTangentInfo.tangent = vertexTexTangentInfo.tangent / (Real)(vertexTexTangentInfo.count); + + const VertexIdentifier& vertexIdentifier = it->first; + Vector3 normal = mMesh->getNormal( vertexIdentifier.normalIndex ); + + vertexTexTangentInfo.biTangent = vertexTexTangentInfo.tangent.crossProduct( normal ); + vertexTexTangentInfo.biTangent.normalise(); + } + } + + //--------------------------------------------------------------- + void TexTangentCalculator::clearTexTangentData() + { + mTexTangents.clear(); + deleteTexTangentInfo(); + mVertexIdentifierVertexTexTangentInfoMap.clear(); + } + + //--------------------------------------------------------------- + void TexTangentCalculator::deleteTexTangentInfo() + { + VertexIdentifierVertexTexTangentInfoMap::iterator it = mVertexIdentifierVertexTexTangentInfoMap.begin(); + VertexIdentifierVertexTexTangentInfoMap::iterator endIt = mVertexIdentifierVertexTexTangentInfoMap.end(); + for ( ; it != endIt; ++it) + { + delete it->second; + } + } + + //--------------------------------------------------------------- + bool TexTangentCalculator::VertexIdentifier::operator<( const VertexIdentifier& rhs ) const + { + if ( positionIndex < rhs.positionIndex ) + return true; + + if ( positionIndex > rhs.positionIndex ) + return false; + + if ( normalIndex < rhs.normalIndex ) + return true; + + if ( normalIndex > rhs.normalIndex ) + return false; + + if ( textureIndex < rhs.textureIndex ) + return true; + + if ( textureIndex > rhs.textureIndex ) + return false; + + return false; + } + +} // namespace COLLADAMax Modified: branches/nextgen/COLLADAStreamWriter/include/COLLADASWConstants.h =================================================================== --- branches/nextgen/COLLADAStreamWriter/include/COLLADASWConstants.h 2009-02-20 15:55:04 UTC (rev 370) +++ branches/nextgen/COLLADAStreamWriter/include/COLLADASWConstants.h 2009-02-24 10:19:30 UTC (rev 371) @@ -259,7 +259,9 @@ static const String CSW_SEMANTIC_OUTPUT; static const String CSW_SEMANTIC_OUT_TANGENT; static const String CSW_SEMANTIC_POSITION; - static const String CSW_SEMANTIC_TEXCOORD; + static const String CSW_SEMANTIC_TEXCOORD; + static const String CSW_SEMANTIC_TEXTANGENT; + static const String CSW_SEMANTIC_TEXBINORMAL; static const String CSW_SEMANTIC_VERTEX; static const String CSW_SEMANTIC_WEIGHT; Modified: branches/nextgen/COLLADAStreamWriter/src/COLLADASWConstants.cpp =================================================================== --- branches/nextgen/COLLADAStreamWriter/src/COLLADASWConstants.cpp 2009-02-20 15:55:04 UTC (rev 370) +++ branches/nextgen/COLLADAStreamWriter/src/COLLADASWConstants.cpp 2009-02-24 10:19:30 UTC (rev 371) @@ -249,7 +249,9 @@ const String CSWC::CSW_SEMANTIC_OUTPUT = "OUTPUT"; const String CSWC::CSW_SEMANTIC_OUT_TANGENT = "OUT_TANGENT"; const String CSWC::CSW_SEMANTIC_POSITION = "POSITION"; - const String CSWC::CSW_SEMANTIC_TEXCOORD = "TEXCOORD"; + const String CSWC::CSW_SEMANTIC_TEXCOORD = "TEXCOORD"; + const String CSWC::CSW_SEMANTIC_TEXTANGENT = "TEXTANGENT"; + const String CSWC::CSW_SEMANTIC_TEXBINORMAL = "TEXBINORMAL"; const String CSWC::CSW_SEMANTIC_VERTEX = "VERTEX"; const String CSWC::CSW_SEMANTIC_WEIGHT = "WEIGHT"; Modified: branches/nextgen/COLLADAStreamWriter/src/COLLADASWInputList.cpp =================================================================== --- branches/nextgen/COLLADAStreamWriter/src/COLLADASWInputList.cpp 2009-02-20 15:55:04 UTC (rev 370) +++ branches/nextgen/COLLADAStreamWriter/src/COLLADASWInputList.cpp 2009-02-24 10:19:30 UTC (rev 371) @@ -52,9 +52,15 @@ case NORMAL: return CSWC::CSW_SEMANTIC_NORMAL; - case TEXCOORD: - return CSWC::CSW_SEMANTIC_TEXCOORD; + case TEXCOORD: + return CSWC::CSW_SEMANTIC_TEXCOORD; + case TEXTANGENT: + return CSWC::CSW_SEMANTIC_TEXTANGENT; + + case TEXBINORMAL: + return CSWC::CSW_SEMANTIC_TEXBINORMAL; + case COLOR: return CSWC::CSW_SEMANTIC_COLOR; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rob...@us...> - 2009-02-20 15:55:11
|
Revision: 370 http://colladamaya.svn.sourceforge.net/colladamaya/?rev=370&view=rev Author: robertwuerfel Date: 2009-02-20 15:55:04 +0000 (Fri, 20 Feb 2009) Log Message: ----------- textangent backup Modified Paths: -------------- branches/nextgen/COLLADAMax/include/COLLADAMaxGeometryExporter.h branches/nextgen/COLLADAMax/include/COLLADAMaxOptions.h branches/nextgen/COLLADAMax/src/COLLADAMaxGeometryExporter.cpp branches/nextgen/COLLADAMax/src/COLLADAMaxGeometryImporter.cpp branches/nextgen/COLLADAStreamWriter/include/COLLADASWLibraryGeometries.h branches/nextgen/COLLADAStreamWriter/src/COLLADASWLibraryGeometries.cpp Modified: branches/nextgen/COLLADAMax/include/COLLADAMaxGeometryExporter.h =================================================================== --- branches/nextgen/COLLADAMax/include/COLLADAMaxGeometryExporter.h 2009-02-19 14:15:34 UTC (rev 369) +++ branches/nextgen/COLLADAMax/include/COLLADAMaxGeometryExporter.h 2009-02-20 15:55:04 UTC (rev 370) @@ -46,7 +46,14 @@ /** List of max materials.*/ typedef std::vector<Mtl*> MaterialList; + /** List of floats.*/ + typedef std::vector<Point3> Point3List; + /** List of indices.*/ + typedef std::vector<int> IndicesList; + + + public: /** Symbol used for simple color materials.*/ static const String COLOR_MATERIAL_SYMBOL; @@ -81,6 +88,9 @@ /** True if object must be deleted by us.*/ bool mDeleteObject; + /** True, if TEXTANGENS and TEXNORMALS should be generated*/ + bool mExportTextangentsAndNormals; + static const String SYMBOL_NAME_PREFIX; public: @@ -105,7 +115,12 @@ /** Returns the suffix of a texture that corresponds to channel @a channel.*/ static String getTextureSourceIdSuffix ( int channel ); + /** Returns the suffix of a Textangent that corresponds to channel @a channel.*/ + String getTextangentSourceIdSuffix ( int channel ); + /** Returns the suffix of a Texbinormal that corresponds to channel @a channel.*/ + String getTexbinormalSourceIdSuffix ( int channel ); + private: GeometryExporter ( const GeometryExporter & geometryExporter ); GeometryExporter & operator= ( const GeometryExporter & geometryExporter ); @@ -147,6 +162,9 @@ /** Exports the textures of @a mesh.*/ void exportTextures ( const ChannelList & channelList, Mtl* material ); + /** Exports TEXTANGENTS and TEXBINORMALS of a triangle mesh.*/ + void exportTriangleMeshTextangentsAndTexbinormals(const ChannelList & channelList); + /** Exports the texture channel of @a mesh.*/ void exportTextureChannel ( int channelIndex, Mtl* material ); @@ -161,6 +179,13 @@ /** Create list of materials used by this geometry.*/ void flattenMaterials ( Mtl* material, MaterialList& mtlMap, int materialIndex = -1 ); + + /** Calculates the textangents and texbinormals of the current mesh and MeshMap @a meshMap and stores them in + @a texTangents and @a texBinormals. The are not reduces, i.e. no indices are needed since the are always the same.*/ + void calculateTriangleMeshTextangentsAndTexbinormals(int channelIndex, + Point3List& texTangents, + Point3List& texBinormals); + }; } Modified: branches/nextgen/COLLADAMax/include/COLLADAMaxOptions.h =================================================================== --- branches/nextgen/COLLADAMax/include/COLLADAMaxOptions.h 2009-02-19 14:15:34 UTC (rev 369) +++ branches/nextgen/COLLADAMax/include/COLLADAMaxOptions.h 2009-02-20 15:55:04 UTC (rev 370) @@ -91,74 +91,41 @@ } /** Returns, if the editable polygons are exported as triangles.*/ - bool getExportEPolyAsTriangles() const - { - return mTriangulate; - } + bool getExportEPolyAsTriangles() const { return mTriangulate; } /** Returns, if XRef are exported.*/ - bool getIncludeXRefs() const - { - return mIncludeXrefs; - } + bool getIncludeXRefs() const { return mIncludeXrefs; } /** Returns, if tangents are exported.*/ - bool getExportTangents() const - { - return mTangents; - } + bool getExportTangents() const { return mTangents; } /** Returns, if animations are exported.*/ - bool getExportAnimations() const - { - return mAnimations; - } + bool getExportAnimations() const { return mAnimations; } /** Returns, if animations are sampled.*/ - bool getSampleAnimation() const - { - return mSampleAnimation; - } + bool getSampleAnimation() const { return mSampleAnimation; } /** Returns, if an animation clip is exported.*/ - bool getExportAnimClip() const - { - return mCreateClip; - } + bool getExportAnimClip() const { return mCreateClip; } /** Returns, if the transformations are exported as matrices.*/ - bool getBakeMatrices() const - { - return mBakeMatrices; - } + bool getBakeMatrices() const { return mBakeMatrices; } /** Returns, if paths are exported as relative paths.*/ - bool getExportRelativePaths() const - { - return mRelativePaths; - } + bool getExportRelativePaths() const { return mRelativePaths; } /** Returns, if animations are checked if they are really animated*/ bool getCheckIfAnimationsIsAnimated() const { return mCheckIfAnimationIsAnimated;} /** Returns if only the selected parts are exported.*/ - bool getExportSelected() const - { - return mSelectionOnly; - } + bool getExportSelected() const { return mSelectionOnly; } /** Returns the animation start time.*/ - TimeValue getAnimationStart() const - { - return mAnimationStart; - } + TimeValue getAnimationStart() const { return mAnimationStart; } /** Returns the animation end time.*/ - TimeValue getAnimationEnd() const - { - return mAnimationEnd; - } + TimeValue getAnimationEnd() const { return mAnimationEnd; } /** Returns the directory where the XRef files should be exported to.*/ const String& getXRefOutputDir() const { return mXRefOutputDir; } Modified: branches/nextgen/COLLADAMax/src/COLLADAMaxGeometryExporter.cpp =================================================================== --- branches/nextgen/COLLADAMax/src/COLLADAMaxGeometryExporter.cpp 2009-02-19 14:15:34 UTC (rev 369) +++ branches/nextgen/COLLADAMax/src/COLLADAMaxGeometryExporter.cpp 2009-02-20 15:55:04 UTC (rev 370) @@ -1,18 +1,18 @@ /* - Copyright (c) 2008 NetAllied Systems GmbH +Copyright (c) 2008 NetAllied Systems GmbH - This file is part of COLLADAMax. +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 +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 */ @@ -61,31 +61,32 @@ - inline bool isFinite ( const Point3& p ) - { - return _finite ( p.x ) && _finite ( p.y ) && _finite ( p.z ); - } + inline bool isFinite ( const Point3& p ) + { + return _finite ( p.x ) && _finite ( p.y ) && _finite ( p.z ); + } - const String GeometryExporter::COLOR_MATERIAL_SYMBOL = "ColorMaterial"; + const String GeometryExporter::COLOR_MATERIAL_SYMBOL = "ColorMaterial"; - const String GeometryExporter::SYMBOL_NAME_PREFIX = "channel"; + const String GeometryExporter::SYMBOL_NAME_PREFIX = "channel"; - //--------------------------------------------------------------- - GeometryExporter::GeometryExporter ( ExportNode * exportNode, GeometriesExporter * geometriesExporter, DocumentExporter * documentExporter ) - : mExportNode ( exportNode ), - mMorphControllerHelperGeometry(0), - mGeometriesExporter ( geometriesExporter ), - mDocumentExporter ( documentExporter ), - mMaterialChannelPairParamBlockMap(documentExporter->getEffectExporter()->getMaterialChannelPairParamBlockMap()), - mPolyObject ( 0 ), - mTriObject ( 0 ), - mGeomObject ( 0 ), - mDeleteObject ( false ) - {} + //--------------------------------------------------------------- + GeometryExporter::GeometryExporter ( ExportNode * exportNode, GeometriesExporter * geometriesExporter, DocumentExporter * documentExporter ) + : mExportNode ( exportNode ), + mMorphControllerHelperGeometry(0), + mGeometriesExporter ( geometriesExporter ), + mDocumentExporter ( documentExporter ), + mMaterialChannelPairParamBlockMap(documentExporter->getEffectExporter()->getMaterialChannelPairParamBlockMap()), + mPolyObject ( 0 ), + mTriObject ( 0 ), + mGeomObject ( 0 ), + mDeleteObject ( false ), + mExportTextangentsAndNormals(documentExporter->getOptions().getExportTangents()) + {} //--------------------------------------------------------------- GeometryExporter::GeometryExporter ( const MorphControllerHelperGeometry * helperGeometry, GeometriesExporter * geometriesExporter, DocumentExporter * documentExporter ) @@ -97,183 +98,194 @@ mPolyObject ( 0 ), mTriObject ( 0 ), mGeomObject ( 0 ), - mDeleteObject ( false ) + mDeleteObject ( false ) , + mExportTextangentsAndNormals(documentExporter->getOptions().getExportTangents()) {} - //--------------------------------------------------------------- - String GeometryExporter::getTextureSourceIdSuffix ( int channel ) - { - std::ostringstream idSuffix; - idSuffix << COLLADASW::LibraryGeometries::TEXTURE_CHANNEL_SOURCE_ID_SUFFIX << channel; - return idSuffix.str(); - } + //--------------------------------------------------------------- + String GeometryExporter::getTextureSourceIdSuffix ( int channel ) + { + std::ostringstream idSuffix; + idSuffix << COLLADASW::LibraryGeometries::TEXTURE_CHANNEL_SOURCE_ID_SUFFIX << channel; + return idSuffix.str(); + } + //--------------------------------------------------------------- + String GeometryExporter::getTextangentSourceIdSuffix ( int channel ) + { + return getTextureSourceIdSuffix( channel) + COLLADASW::LibraryGeometries::TEXTANGENT_SOURCE_ID_SUFFIX; + } - //--------------------------------------------------------------- - void GeometryExporter::getBaseObjectAndID ( Object*& object, SClass_ID& sid ) - { - if ( object == NULL ) - return ; + //--------------------------------------------------------------- + String GeometryExporter::getTexbinormalSourceIdSuffix ( int channel ) + { + return getTextureSourceIdSuffix( channel) + COLLADASW::LibraryGeometries::TEXBINORMAL_SOURCE_ID_SUFFIX; + } - sid = object->SuperClassID(); + //--------------------------------------------------------------- + void GeometryExporter::getBaseObjectAndID ( Object*& object, SClass_ID& sid ) + { + if ( object == NULL ) + return ; - if ( sid == WSM_DERIVOB_CLASS_ID || sid == DERIVOB_CLASS_ID || sid == GEN_DERIVOB_CLASS_ID ) - { - IDerivedObject * derivedObject = ( IDerivedObject* ) object; + sid = object->SuperClassID(); - if ( derivedObject->NumModifiers() > 0 ) - { - // Remember that 3dsMax has the mod stack reversed in its internal structures. - // So that evaluating the zero'th modifier implies evaluating the whole modifier stack. - ObjectState state = derivedObject->Eval ( 0, 0 ); - object = state.obj; - } + if ( sid == WSM_DERIVOB_CLASS_ID || sid == DERIVOB_CLASS_ID || sid == GEN_DERIVOB_CLASS_ID ) + { + IDerivedObject * derivedObject = ( IDerivedObject* ) object; - else - { - object = derivedObject->GetObjRef(); - } + if ( derivedObject->NumModifiers() > 0 ) + { + // Remember that 3dsMax has the mod stack reversed in its internal structures. + // So that evaluating the zero'th modifier implies evaluating the whole modifier stack. + ObjectState state = derivedObject->Eval ( 0, 0 ); + object = state.obj; + } + else + { + object = derivedObject->GetObjRef(); + } - sid = object->SuperClassID(); - } - } + sid = object->SuperClassID(); + } + } - //--------------------------------------------------------------- - void GeometryExporter::classifyObject ( Object* object /*, bool affectsControllers*/ ) - { - SClass_ID sid; - getBaseObjectAndID ( object, sid ); + //--------------------------------------------------------------- + void GeometryExporter::classifyObject ( Object* object /*, bool affectsControllers*/ ) + { + SClass_ID sid; + getBaseObjectAndID ( object, sid ); TimeValue animationStart = mDocumentExporter->getOptions().getAnimationStart(); - Class_ID id = object->ClassID(); + Class_ID id = object->ClassID(); - bool exportEPolyAsTriangles = mDocumentExporter->getOptions().getExportEPolyAsTriangles(); + bool exportEPolyAsTriangles = mDocumentExporter->getOptions().getExportEPolyAsTriangles(); - if ( !exportEPolyAsTriangles ) - { - // Check for the possibility of an editable poly object. + if ( !exportEPolyAsTriangles ) + { + // Check for the possibility of an editable poly object. - if ( sid == GEOMOBJECT_CLASS_ID && ( id == EPOLYOBJ_CLASS_ID || id.PartA() == POLYOBJ_CLASS_ID ) ) - { - mPolyObject = ( PolyObject* ) object; - } - } + if ( sid == GEOMOBJECT_CLASS_ID && ( id == EPOLYOBJ_CLASS_ID || id.PartA() == POLYOBJ_CLASS_ID ) ) + { + mPolyObject = ( PolyObject* ) object; + } + } - if ( !mPolyObject ) - { - // Check for the possibility of an editable mesh object. + if ( !mPolyObject ) + { + // Check for the possibility of an editable mesh object. - if ( sid == GEOMOBJECT_CLASS_ID && ( id.PartA() == EDITTRIOBJ_CLASS_ID || id.PartA() == TRIOBJ_CLASS_ID ) ) - { - mTriObject = ( TriObject* ) object; - } + if ( sid == GEOMOBJECT_CLASS_ID && ( id.PartA() == EDITTRIOBJ_CLASS_ID || id.PartA() == TRIOBJ_CLASS_ID ) ) + { + mTriObject = ( TriObject* ) object; + } - if ( !mTriObject ) - { + if ( !mTriObject ) + { #if 0 - // Check for geometry primitives (Box, Cylinder, Torus, etc.) and convert them to TriObject - // since they don't export well as PolyObject (controllers are messed up) + // Check for geometry primitives (Box, Cylinder, Torus, etc.) and convert them to TriObject + // since they don't export well as PolyObject (controllers are messed up) - if ( affectsControllers && - ( id == Class_ID ( BOXOBJ_CLASS_ID, 0 ) || - id == Class_ID ( SPHERE_CLASS_ID, 0 ) || - id == Class_ID ( CYLINDER_CLASS_ID, 0 ) || + if ( affectsControllers && + ( id == Class_ID ( BOXOBJ_CLASS_ID, 0 ) || + id == Class_ID ( SPHERE_CLASS_ID, 0 ) || + id == Class_ID ( CYLINDER_CLASS_ID, 0 ) || #if (MAX_VERSION_MAJOR >= 8) #ifndef NO_OBJECT_STANDARD_PRIMITIVES - id == PLANE_CLASS_ID || - id == PYRAMID_CLASS_ID || - id == GSPHERE_CLASS_ID || + id == PLANE_CLASS_ID || + id == PYRAMID_CLASS_ID || + id == GSPHERE_CLASS_ID || #endif // NO_OBJECT_STANDARD_PRIMITIVES #endif // USE_MAX_8 - id == Class_ID ( CONE_CLASS_ID, 0 ) || - id == Class_ID ( TORUS_CLASS_ID, 0 ) || - id == Class_ID ( TUBE_CLASS_ID, 0 ) || - id == Class_ID ( HEDRA_CLASS_ID, 0 ) || - id == Class_ID ( BOOLOBJ_CLASS_ID, 0 ) ) ) - { - if ( object->CanConvertToType ( Class_ID ( TRIOBJ_CLASS_ID, 0 ) ) ) - { - mTriObject = ( TriObject* ) object->ConvertToType ( animationStart, Class_ID ( TRIOBJ_CLASS_ID, 0 ) ); - mDeleteObject = true; - } - } + id == Class_ID ( CONE_CLASS_ID, 0 ) || + id == Class_ID ( TORUS_CLASS_ID, 0 ) || + id == Class_ID ( TUBE_CLASS_ID, 0 ) || + id == Class_ID ( HEDRA_CLASS_ID, 0 ) || + id == Class_ID ( BOOLOBJ_CLASS_ID, 0 ) ) ) + { + if ( object->CanConvertToType ( Class_ID ( TRIOBJ_CLASS_ID, 0 ) ) ) + { + mTriObject = ( TriObject* ) object->ConvertToType ( animationStart, Class_ID ( TRIOBJ_CLASS_ID, 0 ) ); + mDeleteObject = true; + } + } #endif - if ( !mTriObject && !exportEPolyAsTriangles && object->CanConvertToType ( Class_ID ( POLYOBJ_CLASS_ID, 0 ) ) ) - { - mPolyObject = ( PolyObject* ) object->ConvertToType ( animationStart, Class_ID ( POLYOBJ_CLASS_ID, 0 ) ); - mDeleteObject = true; - } + if ( !mTriObject && !exportEPolyAsTriangles && object->CanConvertToType ( Class_ID ( POLYOBJ_CLASS_ID, 0 ) ) ) + { + mPolyObject = ( PolyObject* ) object->ConvertToType ( animationStart, Class_ID ( POLYOBJ_CLASS_ID, 0 ) ); + mDeleteObject = true; + } - if ( !mTriObject && !mPolyObject && object->CanConvertToType ( Class_ID ( TRIOBJ_CLASS_ID, 0 ) ) ) - { - mTriObject = ( TriObject* ) object->ConvertToType ( animationStart, Class_ID ( TRIOBJ_CLASS_ID, 0 ) ); - // ST - Copy over animated vertices, this is not done by default + if ( !mTriObject && !mPolyObject && object->CanConvertToType ( Class_ID ( TRIOBJ_CLASS_ID, 0 ) ) ) + { + mTriObject = ( TriObject* ) object->ConvertToType ( animationStart, Class_ID ( TRIOBJ_CLASS_ID, 0 ) ); + // ST - Copy over animated vertices, this is not done by default - if ( id == EPOLYOBJ_CLASS_ID || id.PartA() == POLYOBJ_CLASS_ID ) - { - // Copy over any animated vertices, because that is not done by default. - int numVertControllers = object->NumRefs() - EPOLY_VERT_BASE_REF; + if ( id == EPOLYOBJ_CLASS_ID || id.PartA() == POLYOBJ_CLASS_ID ) + { + // Copy over any animated vertices, because that is not done by default. + int numVertControllers = object->NumRefs() - EPOLY_VERT_BASE_REF; - if ( numVertControllers > 0 ) - { - // Initialize our triObj to recieve vert controllers. - mTriObject->ReplaceReference ( ET_VERT_BASE_REF, NULL ); + if ( numVertControllers > 0 ) + { + // Initialize our triObj to recieve vert controllers. + mTriObject->ReplaceReference ( ET_VERT_BASE_REF, NULL ); - // Assert we now have the same count + // Assert we now have the same count #ifdef _DEBUG - assert ( ( mTriObject->NumRefs() - ET_VERT_BASE_REF ) == numVertControllers ); + assert ( ( mTriObject->NumRefs() - ET_VERT_BASE_REF ) == numVertControllers ); #endif - for ( int i = 0; i < numVertControllers; ++i ) - { - mTriObject->AssignController ( object->GetReference ( EPOLY_VERT_BASE_REF + i ), ET_VERT_BASE_REF + i ); - } - } - } + for ( int i = 0; i < numVertControllers; ++i ) + { + mTriObject->AssignController ( object->GetReference ( EPOLY_VERT_BASE_REF + i ), ET_VERT_BASE_REF + i ); + } + } + } - mDeleteObject = true; - } + mDeleteObject = true; + } - if ( !mTriObject && exportEPolyAsTriangles ) - { - // Last possibility: do check for an editable poly type that does not convert to a TriObject on its own. - //[untested]. + if ( !mTriObject && exportEPolyAsTriangles ) + { + // Last possibility: do check for an editable poly type that does not convert to a TriObject on its own. + //[untested]. - if ( object->CanConvertToType ( Class_ID ( POLYOBJ_CLASS_ID, 0 ) ) ) - { - PolyObject * tempPolyObject = ( PolyObject* ) object->ConvertToType ( animationStart, Class_ID ( POLYOBJ_CLASS_ID, 0 ) ); - mTriObject = ( TriObject* ) tempPolyObject->ConvertToType ( animationStart, Class_ID ( TRIOBJ_CLASS_ID, 0 ) ); - tempPolyObject->DeleteMe(); - mDeleteObject = true; - } - } - } - } + if ( object->CanConvertToType ( Class_ID ( POLYOBJ_CLASS_ID, 0 ) ) ) + { + PolyObject * tempPolyObject = ( PolyObject* ) object->ConvertToType ( animationStart, Class_ID ( POLYOBJ_CLASS_ID, 0 ) ); + mTriObject = ( TriObject* ) tempPolyObject->ConvertToType ( animationStart, Class_ID ( TRIOBJ_CLASS_ID, 0 ) ); + tempPolyObject->DeleteMe(); + mDeleteObject = true; + } + } + } + } - mGeomObject = ( mPolyObject ) ? ( GeomObject* ) mPolyObject : ( GeomObject* ) mTriObject; - } + mGeomObject = ( mPolyObject ) ? ( GeomObject* ) mPolyObject : ( GeomObject* ) mTriObject; + } - //--------------------------------------------------------------- - void GeometryExporter::doExport() - { + //--------------------------------------------------------------- + void GeometryExporter::doExport() + { if ( mExportNode->getType() != ExportNode::MESH ) return; if ( !mMorphControllerHelperGeometry && !(mExportNode->getIsInVisualScene() || mExportNode->getIsReferenced()) ) return; - INode * iNode = mExportNode->getINode(); + INode * iNode = mExportNode->getINode(); Object * object; // Max does not apply any controller to morph targets. Therefore we need the base geometry if we export helper geometries. @@ -286,8 +298,8 @@ if ( !object ) return; - if ( object ) - { + if ( object ) + { // Retrieve the list of materials assigned to the different polygons of this mesh Mtl* nodeMaterial = iNode->GetMtl(); @@ -310,13 +322,13 @@ return; } - // Retrieve the TriObject or PolyObject representation of this geometric object. - classifyObject ( object /*, affectsControllers*/ ); + // Retrieve the TriObject or PolyObject representation of this geometric object. + classifyObject ( object /*, affectsControllers*/ ); - if ( !mGeomObject || ( !mTriObject && !mPolyObject ) ) + if ( !mGeomObject || ( !mTriObject && !mPolyObject ) ) { mExportNode->setTypeToUnknown(); - return ; + return ; } if ( mMorphControllerHelperGeometry ) @@ -328,147 +340,146 @@ if ( !mMorphControllerHelperGeometry ) mDocumentExporter->insertExportedObject(ObjectIdentifier( object ), mExportNode); - mGeometriesExporter->openMesh ( mId, COLLADASW::Utils::checkNCName ( NativeString(iNode->GetName()) ) ); + mGeometriesExporter->openMesh ( mId, COLLADASW::Utils::checkNCName ( NativeString(iNode->GetName()) ) ); if ( mMorphControllerHelperGeometry ) exportMorphHelperPositions(); else exportPositions(); - exportNormals(); + exportNormals(); - ChannelList channelList; + ChannelList channelList; - if ( isEditablePoly() ) - { - MNMesh & mnMesh = mPolyObject->GetMesh(); - int chanNum = mnMesh.MNum(); + if ( isEditablePoly() ) + { + MNMesh & mnMesh = mPolyObject->GetMesh(); + int chanNum = mnMesh.MNum(); - for ( int i = -NUM_HIDDENMAPS; i < chanNum; ++i ) - { - MNMap *map = mnMesh.M ( i ); + for ( int i = -NUM_HIDDENMAPS; i < chanNum; ++i ) + { + MNMap *map = mnMesh.M ( i ); - if ( map == NULL ) - continue; + if ( map == NULL ) + continue; - if ( !map->GetFlag ( MN_DEAD ) ) - channelList.push_back ( i ); - } - } + if ( !map->GetFlag ( MN_DEAD ) ) + channelList.push_back ( i ); + } + } + else + { + Mesh &triMesh = mTriObject->GetMesh(); + // according to SPARKS... valid maps = 0 (color) to MAX_MESHMAPS - else - { - Mesh &triMesh = mTriObject->GetMesh(); - // according to SPARKS... valid maps = 0 (color) to MAX_MESHMAPS + for ( int i = -NUM_HIDDENMAPS; i < MAX_MESHMAPS; ++i ) + { + if ( triMesh.mapSupport ( i ) ) + channelList.push_back ( i ); + } + } - for ( int i = -NUM_HIDDENMAPS; i < MAX_MESHMAPS; ++i ) - { - if ( triMesh.mapSupport ( i ) ) - channelList.push_back ( i ); - } - } - - - exportTextures ( channelList, nodeMaterial ); + size_t numMaterials = materials.size(); - size_t numMaterials = materials.size(); + //map<Matid, number of faces> + std::map<size_t, size_t> facesPerMaterialIdMap; + //map<Matid, COLLADASW::Polylist> + typedef std::map<size_t, COLLADASW::Polylist> PolylistListPerMaterialIdMap; + PolylistListPerMaterialIdMap polylistListPerMaterialIdMap; - //map<Matid, number of faces> - std::map<size_t, size_t> facesPerMaterialIdMap; - //map<Matid, COLLADASW::Polylist> - typedef std::map<size_t, COLLADASW::Polylist> PolylistListPerMaterialIdMap; - PolylistListPerMaterialIdMap polylistListPerMaterialIdMap; + if ( isEditablePoly() ) + { + if ( numMaterials > 1 ) + { + MNMesh & mnMesh = mPolyObject->GetMesh(); + int numberOfFaces = mnMesh.FNum(); - if ( isEditablePoly() ) - { - if ( numMaterials > 1 ) - { - MNMesh & mnMesh = mPolyObject->GetMesh(); - int numberOfFaces = mnMesh.FNum(); + for ( int i = 0; i < numberOfFaces; ++i ) + { + MNFace *face = mnMesh.F ( i ); + size_t materialId = face->material % numMaterials; + PolylistListPerMaterialIdMap::iterator it = polylistListPerMaterialIdMap.find ( materialId ); - for ( int i = 0; i < numberOfFaces; ++i ) - { - MNFace *face = mnMesh.F ( i ); - size_t materialId = face->material % numMaterials; - PolylistListPerMaterialIdMap::iterator it = polylistListPerMaterialIdMap.find ( materialId ); + if ( it == polylistListPerMaterialIdMap.end() ) + it = ( polylistListPerMaterialIdMap.insert ( std::pair<size_t, COLLADASW::Polylist> ( materialId, COLLADASW::Polylist ( mGeometriesExporter->mSW ) ) ) ).first; - if ( it == polylistListPerMaterialIdMap.end() ) - it = ( polylistListPerMaterialIdMap.insert ( std::pair<size_t, COLLADASW::Polylist> ( materialId, COLLADASW::Polylist ( mGeometriesExporter->mSW ) ) ) ).first; + it->second.getVCountList().push_back ( face->deg ); - it->second.getVCountList().push_back ( face->deg ); + if ( find ( materialIDs.begin(), materialIDs.end(), materialId ) == materialIDs.end() ) + materialIDs.push_back ( materialId ); + } + } + else + { + polylistListPerMaterialIdMap.insert ( std::pair<size_t, COLLADASW::Polylist> ( 0, COLLADASW::Polylist ( mGeometriesExporter->mSW ) ) ); + MNMesh &mnMesh = mPolyObject->GetMesh(); + int numberOfFaces = mnMesh.FNum(); - if ( find ( materialIDs.begin(), materialIDs.end(), materialId ) == materialIDs.end() ) - materialIDs.push_back ( materialId ); - } - } + for ( int i = 0; i < numberOfFaces; ++i ) + { + MNFace *face = mnMesh.F ( i ); + polylistListPerMaterialIdMap[ 0 ].getVCountList().push_back ( face->deg ); + } - else - { - polylistListPerMaterialIdMap.insert ( std::pair<size_t, COLLADASW::Polylist> ( 0, COLLADASW::Polylist ( mGeometriesExporter->mSW ) ) ); - MNMesh &mnMesh = mPolyObject->GetMesh(); - int numberOfFaces = mnMesh.FNum(); + materialIDs.push_back ( 0 ); + } + } + else + { + if ( mExportTextangentsAndNormals ) + { + exportTriangleMeshTextangentsAndTexbinormals(channelList); + } - for ( int i = 0; i < numberOfFaces; ++i ) - { - MNFace *face = mnMesh.F ( i ); - polylistListPerMaterialIdMap[ 0 ].getVCountList().push_back ( face->deg ); - } + if ( numMaterials > 1 ) + { + Mesh & mesh = mTriObject->GetMesh(); + int numberOfFaces = mesh.getNumFaces(); - materialIDs.push_back ( 0 ); - } - } + for ( int i = 0; i < numberOfFaces; ++i ) + { + Face& face = mesh.faces[ i ]; + size_t materialId = face.getMatID() % numMaterials; + facesPerMaterialIdMap[ materialId ] ++; - else - { - if ( numMaterials > 1 ) - { - Mesh & mesh = mTriObject->GetMesh(); - int numberOfFaces = mesh.getNumFaces(); + if ( find ( materialIDs.begin(), materialIDs.end(), materialId ) == materialIDs.end() ) + materialIDs.push_back ( materialId ); + } + } - for ( int i = 0; i < numberOfFaces; ++i ) - { - Face& face = mesh.faces[ i ]; - size_t materialId = face.getMatID() % numMaterials; - facesPerMaterialIdMap[ materialId ] ++; + else + { + facesPerMaterialIdMap[ 0 ] = mTriObject->GetMesh().getNumFaces(); + materialIDs.push_back ( 0 ); + } - if ( find ( materialIDs.begin(), materialIDs.end(), materialId ) == materialIDs.end() ) - materialIDs.push_back ( materialId ); - } - } + } - else - { - facesPerMaterialIdMap[ 0 ] = mTriObject->GetMesh().getNumFaces(); - materialIDs.push_back ( 0 ); - } + exportVertices ( mId ); - } + // Create one COLLADASW polygon set for each material used in the mesh + // FCDMaterial* blackMtl = NULL; - exportVertices ( mId ); - - // Create one COLLADASW polygon set for each material used in the mesh - // FCDMaterial* blackMtl = NULL; - for ( GeometriesExporter::MaterialIDList::iterator it = materialIDs.begin(); it != materialIDs.end(); ++it ) - { - size_t matID = *it; + { + size_t matID = *it; - String symbol; + String symbol; - if ( !nodeMaterial ) - { - symbol = COLOR_MATERIAL_SYMBOL; - } + if ( !nodeMaterial ) + { + symbol = COLOR_MATERIAL_SYMBOL; + } - else - { - Mtl* subMaterial = materials[ matID % numMaterials ]; + else + { + Mtl* subMaterial = materials[ matID % numMaterials ]; - if ( subMaterial ) - { - // check for XRefs + if ( subMaterial ) + { + // check for XRefs if (XRefFunctions::isXRefMaterial(subMaterial)) { if ( mDocumentExporter->getOptions().getIncludeXRefs() ) @@ -478,38 +489,38 @@ } // else do nothing, this is only a material instance } - symbol = mExportNode->getSymbolByMaterialAndSetAsUsed ( subMaterial ); - } + symbol = mExportNode->getSymbolByMaterialAndSetAsUsed ( subMaterial ); + } - else - { - assert ( false ); - /*if (blackMtl == NULL)*/ - } - } + else + { + assert ( false ); + /*if (blackMtl == NULL)*/ + } + } - // Add the polygons set input and its tessellation indices + // Add the polygons set input and its tessellation indices - if ( isEditablePoly() ) - exportPolylist ( symbol, polylistListPerMaterialIdMap[ matID ], numMaterials <= 1 ? -1 : ( int ) matID, numMaterials, channelList ); - else - exportTriangles ( symbol, ( unsigned long ) facesPerMaterialIdMap[ matID ], numMaterials <= 1 ? -1 : ( int ) matID, numMaterials, channelList ); - } + if ( isEditablePoly() ) + exportPolylist( symbol, polylistListPerMaterialIdMap[ matID ], numMaterials <= 1 ? -1 : ( int ) matID, numMaterials, channelList ); + else + exportTriangles( symbol, ( unsigned long ) facesPerMaterialIdMap[ matID ], numMaterials <= 1 ? -1 : ( int ) matID, numMaterials, channelList ); + } - mGeometriesExporter->closeMesh(); + mGeometriesExporter->closeMesh(); - GeometryExtra geometryExtra ( mGeometriesExporter->mSW, mDocumentExporter, object, mId ); + GeometryExtra geometryExtra( mGeometriesExporter->mSW, mDocumentExporter, object, mId ); - geometryExtra.doExport(); + geometryExtra.doExport(); - mGeometriesExporter->closeGeometry(); - } + mGeometriesExporter->closeGeometry(); + } - } + } @@ -527,7 +538,7 @@ if ( exportedObjectMaterial ) { - flattenMaterials ( exportedObjectMaterial, exportedObjectMaterials ); + flattenMaterials( exportedObjectMaterial, exportedObjectMaterials ); } size_t numExportedObjectMaterials = exportedObjectMaterials.size(); @@ -571,7 +582,7 @@ symbol.used = true; -// mExportNode->getSymbolByMaterialAndSetAsUsed ( subMaterial ); + // mExportNode->getSymbolByMaterialAndSetAsUsed ( subMaterial ); } } @@ -582,48 +593,48 @@ - //--------------------------------------------------------------- - void GeometryExporter::exportPositions() - { - COLLADASW::FloatSource source ( mGeometriesExporter->mSW ); - source.setId ( mId + COLLADASW::LibraryGeometries::POSITIONS_SOURCE_ID_SUFFIX ); - source.setArrayId ( mId + COLLADASW::LibraryGeometries::POSITIONS_SOURCE_ID_SUFFIX + COLLADASW::LibraryGeometries::ARRAY_ID_SUFFIX ); - source.setAccessorStride ( 3 ); - source.getParameterNameList().push_back ( "X" ); - source.getParameterNameList().push_back ( "Y" ); - source.getParameterNameList().push_back ( "Z" ); + //--------------------------------------------------------------- + void GeometryExporter::exportPositions() + { + COLLADASW::FloatSource source ( mGeometriesExporter->mSW ); + source.setId ( mId + COLLADASW::LibraryGeometries::POSITIONS_SOURCE_ID_SUFFIX ); + source.setArrayId ( mId + COLLADASW::LibraryGeometries::POSITIONS_SOURCE_ID_SUFFIX + COLLADASW::LibraryGeometries::ARRAY_ID_SUFFIX ); + source.setAccessorStride ( 3 ); + source.getParameterNameList().push_back ( "X" ); + source.getParameterNameList().push_back ( "Y" ); + source.getParameterNameList().push_back ( "Z" ); - if ( isEditablePoly() ) - { - // editable poly. case - MNMesh & mnMesh = mPolyObject->GetMesh(); - int vertexCount = mnMesh.VNum(); - source.setAccessorCount ( vertexCount ); - source.prepareToAppendValues(); + if ( isEditablePoly() ) + { + // editable poly. case + MNMesh & mnMesh = mPolyObject->GetMesh(); + int vertexCount = mnMesh.VNum(); + source.setAccessorCount ( vertexCount ); + source.prepareToAppendValues(); - for ( int i = 0; i < vertexCount; ++i ) - { - Point3 &position = mnMesh.V ( i ) ->p; - source.appendValues ( position.x, position.y, position.z ); - } - } + for ( int i = 0; i < vertexCount; ++i ) + { + Point3 &position = mnMesh.V ( i ) ->p; + source.appendValues ( position.x, position.y, position.z ); + } + } - else - { - Mesh & mesh = mTriObject->GetMesh(); - int vertexCount = mesh.numVerts; - source.setAccessorCount ( vertexCount ); - source.prepareToAppendValues(); + else + { + Mesh & mesh = mTriObject->GetMesh(); + int vertexCount = mesh.numVerts; + source.setAccessorCount ( vertexCount ); + source.prepareToAppendValues(); - for ( int i = 0; i < vertexCount; ++i ) - { - Point3 & position = mesh.verts[ i ]; - source.appendValues ( position.x, position.y, position.z ); - } - } + for ( int i = 0; i < vertexCount; ++i ) + { + Point3 & position = mesh.verts[ i ]; + source.appendValues ( position.x, position.y, position.z ); + } + } - source.finish(); - } + source.finish(); + } @@ -642,7 +653,7 @@ source.setAccessorCount ( channel.mNumPoints ); source.prepareToAppendValues(); - + for (int i = 0; i < channel.mNumPoints; ++i) { const Point3& point = channel.mPoints[i]; @@ -653,166 +664,166 @@ - //--------------------------------------------------------------- - void GeometryExporter::exportNormals() - { - if ( isEditablePoly() ) - exportEditablePolyNormals(); - else - exportTriangleMeshNormals(); - } + //--------------------------------------------------------------- + void GeometryExporter::exportNormals() + { + if ( isEditablePoly() ) + exportEditablePolyNormals(); + else + exportTriangleMeshNormals(); + } - //--------------------------------------------------------------- - void GeometryExporter::exportTriangleMeshNormals() - { - Mesh & mesh = mTriObject->GetMesh(); - MeshNormalSpec *normalSpec = mesh.GetSpecifiedNormals(); + //--------------------------------------------------------------- + void GeometryExporter::exportTriangleMeshNormals() + { + Mesh & mesh = mTriObject->GetMesh(); + MeshNormalSpec *normalSpec = mesh.GetSpecifiedNormals(); - if ( normalSpec == NULL ) - { - mesh.SpecifyNormals(); - normalSpec = mesh.GetSpecifiedNormals(); - } + if ( normalSpec == NULL ) + { + mesh.SpecifyNormals(); + normalSpec = mesh.GetSpecifiedNormals(); + } - if ( normalSpec->GetNumNormals() == 0 ) - { - normalSpec->SetParent ( &mesh ); - normalSpec->CheckNormals(); - } + if ( normalSpec->GetNumNormals() == 0 ) + { + normalSpec->SetParent ( &mesh ); + normalSpec->CheckNormals(); + } - if ( normalSpec == NULL ) - return ; + if ( normalSpec == NULL ) + return ; - if ( normalSpec->GetNumNormals() == 0 ) - { - normalSpec->SetParent ( &mesh ); - normalSpec->CheckNormals(); - } + if ( normalSpec->GetNumNormals() == 0 ) + { + normalSpec->SetParent ( &mesh ); + normalSpec->CheckNormals(); + } - int normalCount = normalSpec->GetNumNormals(); + int normalCount = normalSpec->GetNumNormals(); - COLLADASW::FloatSource source ( mGeometriesExporter->mSW ); - source.setId ( mId + COLLADASW::LibraryGeometries::NORMALS_SOURCE_ID_SUFFIX ); - source.setArrayId ( mId + COLLADASW::LibraryGeometries::NORMALS_SOURCE_ID_SUFFIX + COLLADASW::LibraryGeometries::ARRAY_ID_SUFFIX ); - source.setAccessorStride ( 3 ); - source.setAccessorCount ( normalCount ); - source.getParameterNameList().push_back ( "X" ); - source.getParameterNameList().push_back ( "Y" ); - source.getParameterNameList().push_back ( "Z" ); - source.prepareToAppendValues(); + COLLADASW::FloatSource source ( mGeometriesExporter->mSW ); + source.setId ( mId + COLLADASW::LibraryGeometries::NORMALS_SOURCE_ID_SUFFIX ); + source.setArrayId ( mId + COLLADASW::LibraryGeometries::NORMALS_SOURCE_ID_SUFFIX + COLLADASW::LibraryGeometries::ARRAY_ID_SUFFIX ); + source.setAccessorStride ( 3 ); + source.setAccessorCount ( normalCount ); + source.getParameterNameList().push_back ( "X" ); + source.getParameterNameList().push_back ( "Y" ); + source.getParameterNameList().push_back ( "Z" ); + source.prepareToAppendValues(); - for ( int i = 0; i < normalCount; ++i ) - { - Point3 & normal = normalSpec->Normal ( i ); - // TODO: find a better solution for the case of not existing normals + for ( int i = 0; i < normalCount; ++i ) + { + Point3 & normal = normalSpec->Normal ( i ); + // TODO: find a better solution for the case of not existing normals - if ( isFinite ( normal ) ) - source.appendValues ( normal.x, normal.y, normal.z ); - else - source.appendValues ( 0, 0, 1 ); - } + if ( isFinite ( normal ) ) + source.appendValues ( normal.x, normal.y, normal.z ); + else + source.appendValues ( 0, 0, 1 ); + } - source.finish(); - } + source.finish(); + } - //--------------------------------------------------------------- - void GeometryExporter::exportEditablePolyNormals() - { - MNMesh & mnMesh = mPolyObject->GetMesh(); - MNNormalSpec *mnNormalSpec = mnMesh.GetSpecifiedNormals(); + //--------------------------------------------------------------- + void GeometryExporter::exportEditablePolyNormals() + { + MNMesh & mnMesh = mPolyObject->GetMesh(); + MNNormalSpec *mnNormalSpec = mnMesh.GetSpecifiedNormals(); - if ( mnNormalSpec == NULL ) - { - mnMesh.SpecifyNormals(); - mnNormalSpec = mnMesh.GetSpecifiedNormals(); - } + if ( mnNormalSpec == NULL ) + { + mnMesh.SpecifyNormals(); + mnNormalSpec = mnMesh.GetSpecifiedNormals(); + } - if ( mnNormalSpec == NULL ) - return ; + if ( mnNormalSpec == NULL ) + return ; - // rebuild as needed - mnNormalSpec->CheckNormals(); + // rebuild as needed + mnNormalSpec->CheckNormals(); - int normalCount = mnNormalSpec->GetNumNormals(); + int normalCount = mnNormalSpec->GetNumNormals(); - if ( normalCount == 0 ) - return ; + if ( normalCount == 0 ) + return ; - COLLADASW::FloatSource source ( mGeometriesExporter->mSW ); + COLLADASW::FloatSource source ( mGeometriesExporter->mSW ); - source.setId ( mId + COLLADASW::LibraryGeometries::NORMALS_SOURCE_ID_SUFFIX ); + source.setId ( mId + COLLADASW::LibraryGeometries::NORMALS_SOURCE_ID_SUFFIX ); - source.setArrayId ( mId + COLLADASW::LibraryGeometries::NORMALS_SOURCE_ID_SUFFIX + COLLADASW::LibraryGeometries::ARRAY_ID_SUFFIX ); + source.setArrayId ( mId + COLLADASW::LibraryGeometries::NORMALS_SOURCE_ID_SUFFIX + COLLADASW::LibraryGeometries::ARRAY_ID_SUFFIX ); - source.setAccessorStride ( 3 ); + source.setAccessorStride ( 3 ); - source.setAccessorCount ( normalCount ); + source.setAccessorCount ( normalCount ); - source.getParameterNameList().push_back ( "X" ); + source.getParameterNameList().push_back ( "X" ); - source.getParameterNameList().push_back ( "Y" ); + source.getParameterNameList().push_back ( "Y" ); - source.getParameterNameList().push_back ( "Z" ); + source.getParameterNameList().push_back ( "Z" ); - source.prepareToAppendValues(); + source.prepareToAppendValues(); - for ( int i = 0; i < normalCount; ++i ) - { - Point3 & normal = mnNormalSpec->Normal ( i ); - // TODO: find a better solution for the case of not existing normals + for ( int i = 0; i < normalCount; ++i ) + { + Point3 & normal = mnNormalSpec->Normal ( i ); + // TODO: find a better solution for the case of not existing normals - if ( isFinite ( normal ) ) - source.appendValues ( normal.x, normal.y, normal.z ); - else - source.appendValues ( 0, 0, 1 ); - } + if ( isFinite ( normal ) ) + source.appendValues ( normal.x, normal.y, normal.z ); + else + source.appendValues ( 0, 0, 1 ); + } - source.finish(); - } + source.finish(); + } - //--------------------------------------------------------------- - void GeometryExporter::exportTextures ( const ChannelList & channelList, Mtl* material ) - { - // Export the map channel sources (valid indices are from -2 to 99) - // Offset the negative map channels indices by MAX_MESHMAPS, in order to bring - // the -2,-1 channels into non-negative range and not clash with the valid map channels. + //--------------------------------------------------------------- + void GeometryExporter::exportTextures ( const ChannelList & channelList, Mtl* material ) + { + // Export the map channel sources (valid indices are from -2 to 99) + // Offset the negative map channels indices by MAX_MESHMAPS, in order to bring + // the -2,-1 channels into non-negative range and not clash with the valid map channels. - for ( size_t i = 0; i < channelList.size(); ++i ) - { - exportTextureChannel ( channelList[ i ], material ); - } - } + for ( size_t i = 0; i < channelList.size(); ++i ) + { + exportTextureChannel ( channelList[ i ], material ); + } + } - //--------------------------------------------------------------- - void GeometryExporter::exportTextureChannel ( int channelIndex, Mtl* material ) - { - // return if channel index is invalid - /* if (channelIndex >= mesh.getNumMaps() || channelIndex < -NUM_HIDDENMAPS) - return;*/ + //--------------------------------------------------------------- + void GeometryExporter::exportTextureChannel ( int channelIndex, Mtl* material ) + { + // return if channel index is invalid + /* if (channelIndex >= mesh.getNumMaps() || channelIndex < -NUM_HIDDENMAPS) + return;*/ - COLLADASW::FloatSource source ( mGeometriesExporter->mSW ); - String sourceId = mId + getTextureSourceIdSuffix ( channelIndex ); - source.setId ( sourceId ); - source.setArrayId ( sourceId + COLLADASW::LibraryGeometries::ARRAY_ID_SUFFIX ); - source.setAccessorStride ( 3 ); + COLLADASW::FloatSource source ( mGeometriesExporter->mSW ); + String sourceId = mId + getTextureSourceIdSuffix ( channelIndex ); + source.setId ( sourceId ); + source.setArrayId ( sourceId + COLLADASW::LibraryGeometries::ARRAY_ID_SUFFIX ); + source.setAccessorStride ( 3 ); - if ( channelIndex <= 0 ) - { - source.getParameterNameList().push_back ( "R" ); - source.getParameterNameList().push_back ( "G" ); - source.getParameterNameList().push_back ( "B" ); - } + if ( channelIndex <= 0 ) + { + source.getParameterNameList().push_back ( "R" ); + source.getParameterNameList().push_back ( "G" ); + source.getParameterNameList().push_back ( "B" ); + } - else - { - source.getParameterNameList().push_back ( "S" ); - source.getParameterNameList().push_back ( "T" ); - source.getParameterNameList().push_back ( "P" ); - } + else + { + source.getParameterNameList().push_back ( "S" ); + source.getParameterNameList().push_back ( "T" ); + source.getParameterNameList().push_back ( "P" ); + } /* start testing */ @@ -836,253 +847,376 @@ } } -/* EffectExporter::MaterialChannelPairParamBlockMap::const_iterator it = mMaterialChannelPairParamBlockMap.find(EffectExporter::MaterialChannelPair(material, channelIndex)); + /* EffectExporter::MaterialChannelPairParamBlockMap::const_iterator it = mMaterialChannelPairParamBlockMap.find(EffectExporter::MaterialChannelPair(material, channelIndex)); IParamBlock * uVGenParamBlock = 0; if ( it != mMaterialChannelPairParamBlockMap.end() ) - uVGenParamBlock = it->second; + uVGenParamBlock = it->second; float wAngle = 0; if ( uVGenParamBlock ) - wAngle = uVGenParamBlock->GetFloat(StdUVGenEnums::w_angle, TIME_EXPORT_START); + wAngle = uVGenParamBlock->GetFloat(StdUVGenEnums::w_angle, TIME_EXPORT_START); - */ + */ /* end testing*/ - if ( isEditablePoly() ) - { - MNMesh & mnMesh = mPolyObject->GetMesh(); - MNMap *mnMap = mnMesh.M ( channelIndex ); + if ( isEditablePoly() ) + { + MNMesh & mnMesh = mPolyObject->GetMesh(); + MNMap *mnMap = mnMesh.M ( channelIndex ); - if ( !mnMap ) - return ; + if ( !mnMap ) + return ; - int mapVertexCount = mnMap->numv; + int mapVertexCount = mnMap->numv; - source.setAccessorCount ( mapVertexCount ); + source.setAccessorCount ( mapVertexCount ); - source.prepareToAppendValues(); + source.prepareToAppendValues(); - for ( int i = 0; i < mapVertexCount; ++i ) - { - UVVert texCoord = mnMap->V ( i ); + for ( int i = 0; i < mapVertexCount; ++i ) + { + UVVert texCoord = mnMap->V ( i ); - // TODO: find a better solution for the case of not existing texture coordinates + // TODO: find a better solution for the case of not existing texture coordinates - if ( isFinite ( texCoord ) ) + if ( isFinite ( texCoord ) ) { if ( applyUVTransformation ) texCoord = uvTransfomationMatrix * texCoord; - source.appendValues ( texCoord.x, texCoord.y, texCoord.z ); + source.appendValues ( texCoord.x, texCoord.y, texCoord.z ); } - else + else { - source.appendValues ( 0, 0, 1 ); + source.appendValues ( 0, 0, 1 ); } - } - } + } + } - else - { - MeshMap& meshMap = mTriObject->GetMesh().Map ( channelIndex ); - int mapVertexCount = meshMap.getNumVerts(); - source.setAccessorCount ( mapVertexCount ); - source.prepareToAppendValues(); + else + { + MeshMap& meshMap = mTriObject->GetMesh().Map ( channelIndex ); + int mapVertexCount = meshMap.getNumVerts(); + source.setAccessorCount ( mapVertexCount ); + source.prepareToAppendValues(); - for ( int i = 0; i < mapVertexCount; ++i ) - { - Point3& texCoord = meshMap.tv[ i ]; + for ( int i = 0; i < mapVertexCount; ++i ) + { + Point3& texCoord = meshMap.tv[ i ]; - // TODO: find a better solution for the case of not existing texture coordinates + // TODO: find a better solution for the case of not existing texture coordinates - if ( isFinite ( texCoord ) ) + if ( isFinite ( texCoord ) ) { if ( applyUVTransformation ) texCoord = uvTransfomationMatrix * texCoord; - source.appendValues ( texCoord.x, texCoord.y, texCoord.z ); + source.appendValues ( texCoord.x, texCoord.y, texCoord.z ); } - else + else { - source.appendValues ( 0, 0, 1 ); + source.appendValues ( 0, 0, 1 ); } - } - } - source.finish(); - } + } + } + source.finish(); + } - void GeometryExporter::exportVertices ( const String & meshId ) - { - COLLADASW::VerticesElement vertices ( mGeometriesExporter->mSW ); - vertices.setId ( meshId + COLLADASW::LibraryGeometries::VERTICES_ID_SUFFIX ); - vertices.getInputList().push_back ( COLLADASW::Input ( COLLADASW::POSITION, "#" + meshId + COLLADASW::LibraryGeometries::POSITIONS_SOURCE_ID_SUFFIX ) ); - vertices.add(); - } + //--------------------------------------------------------------- + void GeometryExporter::exportTriangleMeshTextangentsAndTexbinormals(const ChannelList & channelList) + { + Point3List texTangents; + Point3List texBinormals; + for ( size_t i = 0; i < channelList.size(); ++i ) + { + int channelIndex = channelList[i]; + + // check that it is not a color channel + if ( channelIndex <= 0 ) + { + continue; + } + calculateTriangleMeshTextangentsAndTexbinormals( channelIndex, texTangents, texBinormals); - //--------------------------------------------------------------- - void GeometryExporter::exportTriangles ( const String & symbol, unsigned long numberOfFaces, int matId, size_t numMaterials, const ChannelList & channelList ) - { + // textangents + size_t texTangentsCount = texTangents.size(); + COLLADASW::FloatSource texTangentSource ( mGeometriesExporter->mSW ); + String texTangentSourceId = mId + getTextangentSourceIdSuffix( channelIndex ); + texTangentSource.setId ( texTangentSourceId ); + texTangentSource.setArrayId ( texTangentSourceId + COLLADASW::LibraryGeometries::ARRAY_ID_SUFFIX ); + texTangentSource.setAccessorStride ( 3 ); + texTangentSource.setAccessorCount( (unsigned long)texTangentsCount ); - Mesh & mesh = mTriObject->GetMesh(); + texTangentSource.getParameterNameList().push_back ( "X" ); + texTangentSource.getParameterNameList().push_back ( "Y" ); + texTangentSource.getParameterNameList().push_back ( "Z" ); - MeshNormalSpec *norms = mesh.GetSpecifiedNormals(); + texTangentSource.prepareToAppendValues(); - int offset = 0; - COLLADASW::Triangles triangles ( mGeometriesExporter->mSW ); - triangles.setCount ( numberOfFaces ); - triangles.setMaterial ( symbol ); - triangles.getInputList().push_back ( COLLADASW::Input ( COLLADASW::VERTEX, "#" + mId + COLLADASW::LibraryGeometries::VERTICES_ID_SUFFIX, offset++ ) ); - triangles.getInputList().push_back ( COLLADASW::Input ( COLLADASW::NORMAL, "#" + mId + COLLADASW::LibraryGeometries::NORMALS_SOURCE_ID_SUFFIX, offset++ ) ); + for ( size_t j = 0; j < texTangentsCount; ++j) + { + Point3& texTangent = texTangents[j]; + texTangentSource.appendValues ( texTangent.x, texTangent.y, texTangent.z ); + } + texTangentSource.finish(); - for ( ChannelList::const_iterator it = channelList.begin(); it != channelList.end(); ++it ) - { - triangles.getInputList().push_back ( COLLADASW::Input ( ( *it <= 0 ) ? COLLADASW::COLOR : COLLADASW::TEXCOORD, "#" + mId + getTextureSourceIdSuffix ( *it ), offset++, *it ) ); - } - triangles.prepareToAppendValues(); + // texbinormals + size_t texBinormalsCount = texBinormals.size(); + COLLADASW::FloatSource texBinormalSource ( mGeometriesExporter->mSW ); + String texBinormalSourceId = mId + getTexbinormalSourceIdSuffix( channelIndex ); + texBinormalSource.setId ( texBinormalSourceId ); + texBinormalSource.setArrayId ( texBinormalSourceId + COLLADASW::LibraryGeometries::ARRAY_ID_SUFFIX ); + texBinormalSource.setAccessorStride ( 3 ); + texBinormalSource.setAccessorCount( (unsigned long)texBinormalsCount ); - for ( int faceIndex = 0; faceIndex < mesh.numFaces; ++faceIndex ) - { - Face& face = mesh.faces[ faceIndex ]; + texBinormalSource.getParameterNameList().push_back ( "X" ); + texBinormalSource.getParameterNameList().push_back ( "Y" ); + texBinormalSource.getParameterNameList().push_back ( "Z" ); - if ( numMaterials <= 1 || face.getMatID() % numMaterials == matId ) - { - for ( int vertexIndex = 0; vertexIndex < 3; ++vertexIndex ) - { - triangles.appendValues ( face.v[ vertexIndex ], norms->GetNormalIndex ( faceIndex, vertexIndex ) ); + texBinormalSource.prepareToAppendValues(); - for ( ChannelList::const_iterator it = channelList.begin(); it != channelList.end(); ++it ) - { - int channel = *it; + for ( size_t j = 0; j < texBinormalsCount; ++j) + { + Point3& texBinormal = texBinormals[j]; + texBinormalSource.appendValues ( texBinormal.x, texBinormal.y, texBinormal.z ); + } - if ( channel < mesh.getNumMaps() && channel >= -NUM_HIDDENMAPS ) - { - MeshMap & tmap = mesh.Map ( channel ); - TVFace& tvFace = tmap.tf[ faceIndex ]; - triangles.appendValues ( tvFace.t[ vertexIndex ] ); - } - } - } - } + texBinormalSource.finish(); + } - } + } - triangles.finish(); - } + //--------------------------------------------------------------- + void GeometryExporter::exportVertices ( const String & meshId ) + { + COLLADASW::VerticesElement vertices ( mGeometriesExporter->mSW ); + vertices.setId ( meshId + COLLADASW::LibraryGeometries::VERTICES_ID_SUFFIX ); + vertices.getInputList().push_back ( COLLADASW::Input ( COLLADASW::POSITION, "#" + meshId + COLLADASW::LibraryGeometries::POSITIONS_SOURCE_ID_SUFFIX ) ); + vertices.add(); + } - //--------------------------------------------------------------- - void GeometryExporter::exportPolylist ( const String & symbol, COLLADASW::Polylist & polylist, int matId, size_t numMaterials, const ChannelList & channelList ) - { - MNMesh & mnMesh = mPolyObject->GetMesh(); - MNNormalSpec *normmalSpec = mnMesh.GetSpecifiedNormals(); + //--------------------------------------------------------------- + void GeometryExporter::exportTriangles ( const String & symbol, unsigned long numberOfFaces, int matId, size_t numMaterials, const ChannelList & channelList ) + { - int offset = 0; - polylist.setCount ( ( unsigned long ) polylist.getVCountList().size() ); - polylist.setMaterial ( symbol ); - polylist.getInputList().push_back ( COLLADASW::Input ( COLLADASW::VERTEX, "#" + mId + COLLADASW::LibraryGeometries::VERTICES_ID_SUFFIX, offset++ ) ); - polylist.getInputList().push_back ( COLLADASW::Input ( COLLADASW::NORMAL, "#" + mId + COLLADASW::LibraryGeometries::NORMALS_SOURCE_ID_SUFFIX, offset++ ) ); + Mesh & mesh = mTriObject->GetMesh(); - for ( ChannelList::const_iterator it = channelList.begin(); it != channelList.end(); ++it ) - { - polylist.getInputList().push_back ( COLLADASW::Input ( ( *it <= 0 ) ? COLLADASW::COLOR : COLLADASW::TEXCOORD, "#" + mId + getTextureSourceIdSuffix ( *it ), offset++, *it ) ); - } + MeshNormalSpec *norms = mesh.GetSpecifiedNormals(); - polylist.prepareToAppendValues(); + int offset = 0; + COLLADASW::Triangles triangles ( mGeometriesExporter->mSW ); + triangles.setCount ( numberOfFaces ); + triangles.setMaterial ( symbol ); + triangles.getInputList().push_back ( COLLADASW::Input ( COLLADASW::VERTEX, "#" + mId + COLLADASW::LibraryGeometries::VERTICES_ID_SUFFIX, offset++ ) ); + triangles.getInputList().push_back ( COLLADASW::Input ( COLLADASW::NORMAL, "#" + mId + COLLADASW::LibraryGeometries::NORMALS_SOURCE_ID_SUFFIX, offset++ ) ); - int numberOfFaces = mnMesh.FNum(); + for ( ChannelList::const_iterator it = channelList.begin(); it != channelList.end(); ++it ) + { + triangles.getInputList().push_back ( COLLADASW::Input ( ( *it <= 0 ) ? COLLADASW::COLOR : COLLADASW::TEXCOORD, "#" + mId + getTextureSourceIdSuffix ( *it ), offset++, *it ) ); + if ( mExportTextangentsAndNormals && ( *it > 0 ) ) + { + triangles.get... [truncated message content] |
From: <rob...@us...> - 2009-02-19 14:15:40
|
Revision: 369 http://colladamaya.svn.sourceforge.net/colladamaya/?rev=369&view=rev Author: robertwuerfel Date: 2009-02-19 14:15:34 +0000 (Thu, 19 Feb 2009) Log Message: ----------- Texture coordinates in max plug-in ( still incomplete) Modified Paths: -------------- branches/nextgen/COLLADABaseUtils/scripts/COLLADABaseUtils.vcproj branches/nextgen/COLLADAFramework/include/COLLADAFWIndexList.h branches/nextgen/COLLADAFramework/include/COLLADAFWMeshVertexData.h branches/nextgen/COLLADAMax/include/COLLADAMaxGeometryImporter.h branches/nextgen/COLLADAMax/src/COLLADAMaxGeometryImporter.cpp Property Changed: ---------------- branches/nextgen/COLLADAFramework/ Modified: branches/nextgen/COLLADABaseUtils/scripts/COLLADABaseUtils.vcproj =================================================================== --- branches/nextgen/COLLADABaseUtils/scripts/COLLADABaseUtils.vcproj 2009-02-18 17:42:55 UTC (rev 368) +++ branches/nextgen/COLLADABaseUtils/scripts/COLLADABaseUtils.vcproj 2009-02-19 14:15:34 UTC (rev 369) @@ -360,6 +360,14 @@ /> </FileConfiguration> <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + UsePrecompiledHeader="0" + /> + </FileConfiguration> + <FileConfiguration Name="Release|Win32" > <Tool @@ -368,6 +376,14 @@ PrecompiledHeaderThrough="" /> </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + UsePrecompiledHeader="0" + /> + </FileConfiguration> </File> </Filter> </Filter> Property changes on: branches/nextgen/COLLADAFramework ___________________________________________________________________ Modified: svn:ignore - COLLADAFramework.suo + COLLADAFramework.suo *.ncb Modified: branches/nextgen/COLLADAFramework/include/COLLADAFWIndexList.h =================================================================== --- branches/nextgen/COLLADAFramework/include/COLLADAFWIndexList.h 2009-02-18 17:42:55 UTC (rev 368) +++ branches/nextgen/COLLADAFramework/include/COLLADAFWIndexList.h 2009-02-19 14:15:34 UTC (rev 369) @@ -44,23 +44,22 @@ {} virtual ~IndexList () {} - UIntValuesArray& getIndices () { return mIndices; } + UIntValuesArray& getIndices () { return mIndices; } + const UIntValuesArray& getIndices () const { 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 setSetIndex ( size_t inputSet ) { mSetIndex = inputSet; } - size_t getSetIndex () { return mSetIndex; } + size_t getSetIndex () const { return mSetIndex; } void setStride ( size_t stride ) { mStride = stride; } - size_t getStride () { return mStride; } + size_t getStride () const { return mStride; } 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; } + size_t getInitialIndex () const { return mInitialIndex; } + void setInitialIndex ( size_t val ) { mInitialIndex = val; } private: Modified: branches/nextgen/COLLADAFramework/include/COLLADAFWMeshVertexData.h =================================================================== --- branches/nextgen/COLLADAFramework/include/COLLADAFWMeshVertexData.h 2009-02-18 17:42:55 UTC (rev 368) +++ branches/nextgen/COLLADAFramework/include/COLLADAFWMeshVertexData.h 2009-02-19 14:15:34 UTC (rev 369) @@ -87,10 +87,10 @@ } /** The data type of the stored position values. */ - const COLLADAFW::MeshVertexData::DataType getType () const { return mType; } + DataType getType () const { return mType; } /** The data type of the stored position values. */ - void setType ( const COLLADAFW::MeshVertexData::DataType Type ) { mType = Type; } + void setType ( DataType Type ) { mType = Type; } /** Returns the count of stored elements in the array. */ const size_t getValuesCount () const @@ -105,6 +105,9 @@ */ size_t getNumInputInfos () const { return mInputInfosArray.getCount (); } + /** Returns the InputInfosArray.*/ + const InputInfosArray& getInputInfosArray() const { return mInputInfosArray; } + /** * Appends the values in the array on the list of values and stores the information * of the current input. Modified: branches/nextgen/COLLADAMax/include/COLLADAMaxGeometryImporter.h =================================================================== --- branches/nextgen/COLLADAMax/include/COLLADAMaxGeometryImporter.h 2009-02-18 17:42:55 UTC (rev 368) +++ branches/nextgen/COLLADAMax/include/COLLADAMaxGeometryImporter.h 2009-02-19 14:15:34 UTC (rev 369) @@ -39,6 +39,15 @@ { private: + /** Maps initial indices from index list of multiple texture or color inputs to the index of the source*/ + typedef std::map<size_t /* initial index*/, size_t /* Source index*/> InitialIndexSourceIndexMap; + + /** Maps index of the source to the initial indices from index list of multiple texture or color inputs*/ + typedef std::map<size_t /* Source index*/, size_t /* initial index*/> SourceIndexInitialIndexMap; + + typedef std::pair<long/*set index negative for color positive for uv*/,size_t /* initial index*/> SetSourcePair; + typedef std::map<SetSourcePair, int /* max map channel*/> SetSourcePairMapChannelMap; + private: /** The geometry that should be imported.*/ const COLLADAFW::Geometry* mGeometry; @@ -46,7 +55,25 @@ /** The number of all triangles in all primitives that contain triangles (Triangles, Tristrips, Trisfans).*/ size_t mTotalTrianglesCount; - + + /** Maps a set index, source ( data source in MeshVertexData) pair to the max map channel.*/ + SetSourcePairMapChannelMap mSetSourcePairMapChannelMap; + + /** Maps initial indices from index list of multiple texture inputs to the index of the source*/ + InitialIndexSourceIndexMap mUVInitialIndexSourceIndexMap; + + /** Maps index of the source to the initial indices from index list of multiple texture inputs*/ + SourceIndexInitialIndexMap mUVSourceIndexInitialIndexMap; + + /** Maps initial indices from index list of multiple color inputs to the index of the source*/ + InitialIndexSourceIndexMap mColorInitialIndexSourceIndexMap; + + /** Maps index of the source to the initial indices from index list of multiple color inputs*/ + SourceIndexInitialIndexMap mColorSourceIndexInitialIndexMap; + + /** The number of the largest map channel used.*/ + int mMapChannelCount; + public: /** Constructor. */ @@ -111,6 +138,26 @@ /** Disable default assignment operator. */ const GeometryImporter& operator= ( const GeometryImporter& pre ); + /** Creates the SetSourcePairMapChannelMap using the current geometry.*/ + void createSetSourcePairMapChannelMap(); + + /** assigns map channel to inputs in the indexlist array add inserts them to mSetSourcePairMapChannelMap. + @return false if all map channel are used, true otherwise.*/ + template<bool isColorChannel, bool isFirstTry> + bool assignMapChannels( const COLLADAFW::IndexListArray& indices, + const InitialIndexSourceIndexMap& initialIndexSourceIndexMap, + bool usedMapChannels[MAX_MESHMAPS + NUM_HIDDENMAPS]); + + /** Sets the uv vertices stored in uvArray into @a meshMap. + @param uvArray The vertices source + @param meshMap The mesh map to be filled + @param stride The size of the uv vertex tuples + @param startPosition The index of the first vertexs first component in the uvArray + @param vertsCount the number of vertices to copy. Must be equal to the number set with MeshMap::setNumFaces()*/ + template<class NumberArray> + void setUVVertices(const NumberArray& uvArray, MeshMap& meshMap, size_t stride, size_t startPosition, size_t vertsCount); + + }; } // namespace COLLADAMAX Modified: branches/nextgen/COLLADAMax/src/COLLADAMaxGeometryImporter.cpp =================================================================== --- branches/nextgen/COLLADAMax/src/COLLADAMaxGeometryImporter.cpp 2009-02-18 17:42:55 UTC (rev 368) +++ branches/nextgen/COLLADAMax/src/COLLADAMaxGeometryImporter.cpp 2009-02-19 14:15:34 UTC (rev 369) @@ -35,6 +35,7 @@ : ImporterBase(documentImporter) , mGeometry(geometry) , mTotalTrianglesCount(0) + , mMapChannelCount(0) { @@ -365,9 +366,214 @@ } //------------------------------ + template<class NumberArray> + void GeometryImporter::setUVVertices(const NumberArray& uvArray, MeshMap& meshMap, size_t stride, size_t startPosition, size_t vertsCount) + { + size_t uvIndex = startPosition; + + switch ( stride ) + { + case 1: + { + for ( size_t i = 0; i < vertsCount; ++i) + { + UVVert& textureVertex = meshMap.tv[i]; + textureVertex.x = (float)uvArray[uvIndex++]; + } + break; + } + case 2: + { + for ( size_t i = 0; i < vertsCount; ++i) + { + UVVert& textureVertex = meshMap.tv[i]; + textureVertex.x = (float)uvArray[uvIndex++]; + textureVertex.y = (float)uvArray[uvIndex++]; + } + break; + } + case 3: + { + for ( size_t i = 0; i < vertsCount; ++i) + { + UVVert& textureVertex = meshMap.tv[i]; + textureVertex.Set((float)uvArray[uvIndex++], (float)uvArray[uvIndex++], (float)uvArray[uvIndex++]); + } + break; + } + case 4: + { + for ( size_t i = 0; i < vertsCount; ++i) + { + UVVert& textureVertex = meshMap.tv[i]; + textureVertex.Set((float)uvArray[uvIndex++], (float)uvArray[uvIndex++], (float)uvArray[uvIndex++]); + uvIndex++; + } + break; + } + default: + assert(false); + } + + } + + //------------------------------ bool GeometryImporter::importTriangleMeshUVCoords( TriObject* triangleObject ) { + COLLADAFW::Mesh* mesh = (COLLADAFW::Mesh*) mGeometry; + createSetSourcePairMapChannelMap(); + + Mesh& triangleMesh = triangleObject->GetMesh(); + + triangleMesh.setNumMaps( mMapChannelCount ); + + int facesCount = (int)mTotalTrianglesCount; + + // reset all texture indices of all used maps + for ( int i = 0; i < mMapChannelCount; ++i ) + { + MeshMap& meshMap = triangleMesh.Map(i); + meshMap.setNumFaces( facesCount ); + memset( meshMap.tv, 0, sizeof(UVVert) * facesCount); + } + + const COLLADAFW::MeshVertexData& uvCoordinates = mesh->getUVCoords(); + const COLLADAFW::MeshVertexData::InputInfosArray& inputInfos = uvCoordinates.getInputInfosArray(); + + SetSourcePairMapChannelMap::const_iterator it = mSetSourcePairMapChannelMap.begin(); + for ( ; it != mSetSourcePairMapChannelMap.end(); ++it ) + { + const SetSourcePair& setSourcePair = it->first; + const size_t& sourceIndex = setSourcePair.second; + // check that the channel is a texture channel and not a color channel + if ( setSourcePair.first < 0 ) + continue; + int mapChannel = it->second; + + const COLLADAFW::MeshVertexData::InputInfos* inputInfo = inputInfos[ sourceIndex ]; + + size_t stride = inputInfo->mStride; + size_t vertsCount = inputInfo->mLength / stride; + + // calculate first index position + size_t startPosition = 0; + for ( size_t i = 0; i < sourceIndex; ++i) + { + const COLLADAFW::MeshVertexData::InputInfos* inputInfo = inputInfos[ sourceIndex ]; + startPosition += inputInfo->mLength; + } + + MeshMap& meshMap = triangleMesh.Map(mapChannel); + meshMap.setNumVerts((int)vertsCount); + + + if ( uvCoordinates.getType() == COLLADAFW::MeshVertexData::DATA_TYPE_DOUBLE ) + { + const COLLADAFW::DoubleArray& uvArray = *uvCoordinates.getDoubleValues(); + setUVVertices(uvArray, meshMap, stride, startPosition, vertsCount); + } + else + { + const COLLADAFW::FloatArray& uvArray = *uvCoordinates.getFloatValues(); + setUVVertices(uvArray, meshMap, stride, startPosition, vertsCount); + } + } + + + COLLADAFW::MeshPrimitiveArray& meshPrimitiveArray = mesh->getMeshPrimitives(); + size_t faceIndex = 0; + for ( size_t i = 0, count = meshPrimitiveArray.getCount(); i < count; ++i) + { + const COLLADAFW::MeshPrimitive* meshPrimitive = meshPrimitiveArray[i]; + if ( ! meshPrimitive ) + continue; + + size_t currentFaceIndex = faceIndex; + + const COLLADAFW::IndexListArray& uvIndexArray = meshPrimitive->getUVCoordIndicesArray(); + for ( size_t j = 0, count = uvIndexArray.getCount(); j < count; ++j) + { + const COLLADAFW::IndexList& uvIndexList = *uvIndexArray[j]; + size_t sourceIndex = mUVInitialIndexSourceIndexMap[uvIndexList.getInitialIndex()]; + size_t setIndex = uvIndexList.getSetIndex(); + SetSourcePair setSourcePair( (long)setIndex, sourceIndex); + int mapChannel = mSetSourcePairMapChannelMap[ setSourcePair ]; + + const COLLADAFW::UIntValuesArray& uvIndices = uvIndexList.getIndices(); + + MeshMap& meshMap = triangleMesh.Map(mapChannel); + + currentFaceIndex = faceIndex; + + switch (meshPrimitive->getPrimitiveType()) + { + case COLLADAFW::MeshPrimitive::TRIANGLES: + { + for ( size_t j = 0, count = uvIndices.getCount() ; j < count; j+=3 ) + { + TVFace& face = meshMap.tf[currentFaceIndex]; + face.setTVerts(uvIndices[j], uvIndices[j + 1], uvIndices[j + 2]); + ++currentFaceIndex; + } + break; + } + case COLLADAFW::MeshPrimitive::TRIANGLE_STRIPS: + { + const COLLADAFW::Tristrips* tristrips = (const COLLADAFW::Tristrips*) meshPrimitive; + const COLLADAFW::UIntValuesArray& faceVertexCountArray = tristrips->getGroupedVerticesVertexCountArray(); + size_t nextTristripStartIndex = 0; + 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 ) + { + TVFace& face = meshMap.tf[currentFaceIndex]; + if ( switchOrientation ) + { + face.setTVerts(uvIndices[j - 1], uvIndices[j - 2], uvIndices[j]); + switchOrientation = false; + } + else + { + face.setTVerts(uvIndices[j - 2], uvIndices[j - 1], uvIndices[j]); + switchOrientation = true; + } + ++currentFaceIndex; + } + nextTristripStartIndex += faceVertexCount; + } + break; + } + case COLLADAFW::MeshPrimitive::TRIANGLE_FANS: + { + const COLLADAFW::Trifans* trifans = (const COLLADAFW::Trifans*) meshPrimitive; + const COLLADAFW::UIntValuesArray& faceVertexCountArray = trifans->getGroupedVerticesVertexCountArray(); + size_t nextTrifanStartIndex = 0; + for ( size_t k = 0, count = faceVertexCountArray.getCount(); k < count; ++k) + { + unsigned int faceVertexCount = faceVertexCountArray[k]; + unsigned int commonVertexIndex = uvIndices[nextTrifanStartIndex]; + for ( size_t j = nextTrifanStartIndex + 2, lastVertex = nextTrifanStartIndex + faceVertexCount; j < lastVertex; ++j ) + { + TVFace& face = meshMap.tf[currentFaceIndex]; + face.setTVerts(commonVertexIndex, uvIndices[j - 1], uvIndices[j]); + ++currentFaceIndex; + } + nextTrifanStartIndex += faceVertexCount; + } + break; + } + default: + continue; + } + + } + + faceIndex = currentFaceIndex; + + } return true; } @@ -723,4 +929,136 @@ } } + //------------------------------ + void GeometryImporter::createSetSourcePairMapChannelMap() + { + if ( mGeometry->getType() != COLLADAFW::Geometry::GEO_TYPE_MESH ) + return; + + bool usedMapChannels[MAX_MESHMAPS + NUM_HIDDENMAPS]; + memset(usedMapChannels, false, sizeof(bool) * (MAX_MESHMAPS + NUM_HIDDENMAPS)); + + COLLADAFW::Mesh* mesh = (COLLADAFW::Mesh*) mGeometry; + + const COLLADAFW::MeshVertexData& colors = mesh->getColors(); + const COLLADAFW::MeshVertexData::InputInfosArray& colorInputInfos = colors.getInputInfosArray(); + size_t colorInitialIndex = 0; + for ( size_t i = 0, count = colorInputInfos.getCount(); i < count; ++i) + { + const COLLADAFW::MeshVertexData::InputInfos* inputInfo = colorInputInfos[i]; + size_t& sourceIndex = i; + mColorInitialIndexSourceIndexMap.insert(std::make_pair(colorInitialIndex, sourceIndex)); + mColorSourceIndexInitialIndexMap.insert(std::make_pair(sourceIndex, colorInitialIndex)); + colorInitialIndex += (inputInfo->mLength / inputInfo->mStride); + } + + const COLLADAFW::MeshVertexData& uvCoords = mesh->getUVCoords(); + const COLLADAFW::MeshVertexData::InputInfosArray& uVInputInfos = uvCoords.getInputInfosArray(); + size_t uVInitialIndex; + for ( size_t i = 0, count = uVInputInfos.getCount(); i < count; ++i) + { + const COLLADAFW::MeshVertexData::InputInfos* inputInfo = uVInputInfos[i]; + size_t& sourceIndex = i; + mUVInitialIndexSourceIndexMap.insert(std::make_pair(uVInitialIndex, sourceIndex)); + mUVSourceIndexInitialIndexMap.insert(std::make_pair(sourceIndex, uVInitialIndex)); + uVInitialIndex += (inputInfo->mLength / inputInfo->mStride); + } + + + const COLLADAFW::MeshPrimitiveArray& meshPrimitives = mesh->getMeshPrimitives(); + + // first try + for ( size_t i = 0, count = meshPrimitives.getCount(); i < count; ++i ) + { + const COLLADAFW::MeshPrimitive* meshPrimitive = meshPrimitives[i]; + const COLLADAFW::IndexListArray& uvIndices = meshPrimitive->getUVCoordIndicesArray(); + const COLLADAFW::IndexListArray& colorIndices = meshPrimitive->getColorIndicesArray(); + + assignMapChannels<true, true>( colorIndices, mColorInitialIndexSourceIndexMap, usedMapChannels); + assignMapChannels<false, true>( uvIndices, mUVInitialIndexSourceIndexMap, usedMapChannels); + } + + // second try + for ( size_t i = 0, count = meshPrimitives.getCount(); i < count; ++i ) + { + const COLLADAFW::MeshPrimitive* meshPrimitive = meshPrimitives[i]; + const COLLADAFW::IndexListArray& uvIndices = meshPrimitive->getUVCoordIndicesArray(); + const COLLADAFW::IndexListArray& colorIndices = meshPrimitive->getColorIndicesArray(); + + if ( !assignMapChannels<true, false>( colorIndices, mColorInitialIndexSourceIndexMap, usedMapChannels) ) + break; + if ( !assignMapChannels<false, false>( uvIndices, mUVInitialIndexSourceIndexMap, usedMapChannels) ) + break; + } + + } + + template<bool isColorChannel, bool isFirstTry> + bool GeometryImporter::assignMapChannels( const COLLADAFW::IndexListArray& indices, + const InitialIndexSourceIndexMap& initialIndexSourceIndexMap, + bool usedMapChannels[MAX_MESHMAPS + NUM_HIDDENMAPS]) + { + for ( size_t j = 0, count = indices.getCount(); j < count; ++j) + { + const COLLADAFW::IndexList* indexList = indices[j]; + size_t setIndex = indexList->getSetIndex(); + size_t initialIndex = indexList->getInitialIndex(); + InitialIndexSourceIndexMap::const_iterator sourecIndexIt = initialIndexSourceIndexMap.find(initialIndex); + assert(sourecIndexIt != initialIndexSourceIndexMap.end()); + size_t sourceIndex = sourecIndexIt->second; + SetSourcePair setSourcePair( isColorChannel ? -(long)(setIndex-1) : (long)setIndex, sourceIndex); + SetSourcePairMapChannelMap::const_iterator it = mSetSourcePairMapChannelMap.find( setSourcePair ); + + // check if we have already assigned a map channel to this color set/ source combination + if ( it != mSetSourcePairMapChannelMap.end() ) + break; + + // assign a map channel + int favoredMapChannel = isColorChannel ? ((setIndex == 1) ? 0 : (int)setIndex) : ((setIndex == 0) ? 1 : (int)setIndex); + + if ( isFirstTry ) + { + if ( favoredMapChannel <= MAX_MESHMAPS) + { + if ( !usedMapChannels[favoredMapChannel + NUM_HIDDENMAPS]) + { + mSetSourcePairMapChannelMap.insert( std::make_pair(setSourcePair, favoredMapChannel)); + + if ( favoredMapChannel > mMapChannelCount ) + mMapChannelCount = favoredMapChannel; + + usedMapChannels[favoredMapChannel + NUM_HIDDENMAPS] = true; + } + } + } + else + { + // assign a map channel + int mapChannelIndex = 1; + + // Use the next unused map channel + while ( true ) + { + if ( mapChannelIndex > MAX_MESHMAPS) + return false; + + if ( !usedMapChannels[mapChannelIndex + NUM_HIDDENMAPS] ) + { + mSetSourcePairMapChannelMap.insert( std::make_pair(setSourcePair, mapChannelIndex)); + + if ( mapChannelIndex > mMapChannelCount ) + mMapChannelCount = mapChannelIndex; + + usedMapChannels[mapChannelIndex + NUM_HIDDENMAPS] = true; + break; + } + + ++mapChannelIndex; + } + } + } + return true; + } + + } // namespace COLLADAMax This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jud...@us...> - 2009-02-18 17:42:58
|
Revision: 368 http://colladamaya.svn.sourceforge.net/colladamaya/?rev=368&view=rev Author: judithschenk Date: 2009-02-18 17:42:55 +0000 (Wed, 18 Feb 2009) Log Message: ----------- light linker connections; texture import Modified Paths: -------------- branches/nextgen/COLLADAFramework/include/COLLADAFWFloatOrParam.h branches/nextgen/COLLADAFramework/scripts/COLLADAFramework.vcproj branches/nextgen/COLLADAMaya/include/COLLADAMayaEffectImporter.h branches/nextgen/COLLADAMaya/include/COLLADAMayaImageImporter.h branches/nextgen/COLLADAMaya/include/COLLADAMayaLightImporter.h branches/nextgen/COLLADAMaya/include/COLLADAMayaMaterialImporter.h branches/nextgen/COLLADAMaya/include/COLLADAMayaVisualSceneImporter.h branches/nextgen/COLLADAMaya/src/COLLADAMayaEffectImporter.cpp branches/nextgen/COLLADAMaya/src/COLLADAMayaImageImporter.cpp branches/nextgen/COLLADAMaya/src/COLLADAMayaLightImporter.cpp branches/nextgen/COLLADAMaya/src/COLLADAMayaMaterialImporter.cpp Modified: branches/nextgen/COLLADAFramework/include/COLLADAFWFloatOrParam.h =================================================================== --- branches/nextgen/COLLADAFramework/include/COLLADAFWFloatOrParam.h 2009-02-18 12:43:48 UTC (rev 367) +++ branches/nextgen/COLLADAFramework/include/COLLADAFWFloatOrParam.h 2009-02-18 17:42:55 UTC (rev 368) @@ -73,6 +73,9 @@ /** Destructor. */ virtual ~FloatOrParam () {}; + /** The type of the current element. */ + const COLLADAFW::FloatOrParam::Type& getType () const { return mType; } + private: /** Disable default copy ctor. */ Modified: branches/nextgen/COLLADAFramework/scripts/COLLADAFramework.vcproj =================================================================== --- branches/nextgen/COLLADAFramework/scripts/COLLADAFramework.vcproj 2009-02-18 12:43:48 UTC (rev 367) +++ branches/nextgen/COLLADAFramework/scripts/COLLADAFramework.vcproj 2009-02-18 17:42:55 UTC (rev 368) @@ -500,6 +500,13 @@ <File RelativePath="..\include\COLLADAFWFloatOrParam.h" > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> </File> <File RelativePath="..\include\COLLADAFWGeometry.h" Modified: branches/nextgen/COLLADAMaya/include/COLLADAMayaEffectImporter.h =================================================================== --- branches/nextgen/COLLADAMaya/include/COLLADAMayaEffectImporter.h 2009-02-18 12:43:48 UTC (rev 367) +++ branches/nextgen/COLLADAMaya/include/COLLADAMayaEffectImporter.h 2009-02-18 17:42:55 UTC (rev 368) @@ -17,6 +17,7 @@ #include "COLLADABUIDList.h" #include "COLLADAFWEffectCommon.h" +//#include "COLLADAFWFloatOrParam.h" namespace COLLADAMaya @@ -30,8 +31,47 @@ /** The standard name for a effect without name. */ static const String EFFECT_NAME; + /** + * The enumeration of valid shader attributes. + * We need this for the connections of the effect attributes to textures. + */ + enum ShaderAttribute + { + ATTR_COLOR, + ATTR_INCANDESCENE, + ATTR_TRANSPARENCY, + ATTR_UNKNOWN + }; + + /** + * The maya shader type of the current effect. + */ + enum ShaderType + { + SHADER_LAMBERT, + SHADER_BLINN, + SHADER_PHONG, + SHADER_UNKNOWN + }; + + /** + * This struct holds the attribute of an effect. + * The type of the effect depends on the attribute. + * It's either an lambert, blinn or phong shader. + */ + struct ShaderNodeAttribute + { + MayaDM::DependNode* mShaderNode; + ShaderType mShaderType; + ShaderAttribute mShaderAttribute; + }; + private: + typedef std::map<COLLADAFW::SamplerID, std::vector<ShaderNodeAttribute>> SamplerIdShaderNodesMap; + + private: + /** * The list of the unique maya effect names. */ @@ -47,6 +87,12 @@ */ UniqueIdDependNodeMap mMayaEffectMap; + /** + * The map holds for every sampler id the shader node attributes, + * which use this sampler image file. + */ + SamplerIdShaderNodesMap mSamplerIdShaderNodesMap; + public: /** Constructor. */ @@ -101,71 +147,141 @@ */ template<class T> void importShaderAttributes ( - T* lambert, + const ShaderType& shaderType, + T* shaderNode, const COLLADAFW::Effect* effect, const COLLADAFW::EffectCommon* commonEffect ) { - // TODO Textures! - + // -------------------- + // Get the color and set it into the shader node (if it is a valid color). const COLLADAFW::Color& standardColor = effect->getStandardColor (); if ( standardColor.isValid () ) - lambert->setColor ( MayaDM::float3 ( (float)standardColor.getRed (), (float)standardColor.getGreen (), (float)standardColor.getBlue ()) ); + { + shaderNode->setColor ( MayaDM::float3 ( (float)standardColor.getRed (), (float)standardColor.getGreen (), (float)standardColor.getBlue ()) ); + } - + // -------------------- const COLLADAFW::ColorOrTexture& diffuse = commonEffect->getDiffuse (); if ( diffuse.isColor () ) { + // Get the color and set it into the shader node (if it is a valid color). const COLLADAFW::Color& color = diffuse.getColor (); if ( color.isValid () ) - lambert->setColor ( MayaDM::float3 ( (float)color.getRed (), (float)color.getGreen (), (float)color.getBlue ()) ); + shaderNode->setColor ( MayaDM::float3 ( (float)color.getRed (), (float)color.getGreen (), (float)color.getBlue ()) ); } else { - // TODO + // Get the texure and the current shader attribute. + const COLLADAFW::Texture& texture = diffuse.getTexture (); + ShaderAttribute shaderAttribute = ATTR_COLOR; + + // Create a shader node attribute and append it on the list of shader node + // attributes to the current sampler file id. + appendShaderNodeAttribute ( texture, shaderType, shaderAttribute, shaderNode ); } + // -------------------- const COLLADAFW::ColorOrTexture& emission = commonEffect->getEmission (); if ( emission.isColor () ) { + // Get the color and set it into the shader node (if it is a valid color). const COLLADAFW::Color& color = emission.getColor (); if ( color.isValid () ) - lambert->setIncandescence ( MayaDM::float3 ( (float)color.getRed (), (float)color.getGreen (), (float)color.getBlue ()) ); + shaderNode->setIncandescence ( MayaDM::float3 ( (float)color.getRed (), (float)color.getGreen (), (float)color.getBlue ()) ); } + else + { + // Get the texure and the current shader attribute. + const COLLADAFW::Texture& texture = diffuse.getTexture (); + ShaderAttribute shaderAttribute = ATTR_INCANDESCENE; + // Create a shader node attribute and append it on the list of shader node + // attributes to the current sampler file id. + appendShaderNodeAttribute ( texture, shaderType, shaderAttribute, shaderNode ); + } + + // -------------------- // TODO - commonEffect->getIndexOfRefraction (); + const COLLADAFW::FloatOrParam& indexOfRefraction = commonEffect->getIndexOfRefraction (); + shaderNode->setRefractiveIndex ( indexOfRefraction ); + // -------------------- const COLLADAFW::ColorOrTexture& reflective = commonEffect->getReflective (); if ( reflective.isColor () ) { + // Get the color and set it into the shader node (if it is a valid color). const COLLADAFW::Color& color = reflective.getColor (); // TODO } + // -------------------- // TODO - commonEffect->getReflectivity (); - commonEffect->getShininess (); + { + const COLLADAFW::FloatOrParam& reflectivity = commonEffect->getReflectivity (); +// const COLLADAFW::FloatOrParam::Type& type = reflectivity.getType (); +// switch ( type ) +// { +// case COLLADAFW::FloatOrParam::FLOAT: +// break; +// case COLLADAFW::FloatOrParam::PARAM: +// break; +// default: +// MGlobal::displayError ( "Unknown param type!" ); +// std::cerr << "Unknown param type!" << endl; +// break; +// } + } + // -------------------- + // TODO Not on lambert shader! Just phong and blinn! + const COLLADAFW::FloatOrParam& shininess = commonEffect->getShininess (); + + // -------------------- + // TODO Not on lambert shader! Just phong and blinn! const COLLADAFW::ColorOrTexture& specular = commonEffect->getSpecular (); if ( specular.isColor () ) { + // Get the color and set it into the shader node (if it is a valid color). const COLLADAFW::Color& color = specular.getColor (); // TODO } + // -------------------- // TODO - commonEffect->getTransparency (); + const COLLADAFW::FloatOrParam& transparency = commonEffect->getTransparency (); + // -------------------- const COLLADAFW::ColorOrTexture& transparent = commonEffect->getTransparent(); if ( transparent.isColor () ) { + // Get the color and set it into the shader node (if it is a valid color). const COLLADAFW::Color& color = transparent.getColor (); if ( color.isValid () ) - lambert->setTransparency ( MayaDM::float3 ( (float)color.getRed (), (float)color.getGreen (), (float)color.getBlue ()) ); + shaderNode->setTransparency ( MayaDM::float3 ( (float)color.getRed (), (float)color.getGreen (), (float)color.getBlue ()) ); } + else + { + // Get the texure and the current shader attribute. + const COLLADAFW::Texture& texture = diffuse.getTexture (); + ShaderAttribute shaderAttribute = ATTR_INCANDESCENE; + + // Create a shader node attribute and append it on the list of shader node + // attributes to the current sampler file id. + appendShaderNodeAttribute ( texture, shaderType, shaderAttribute, shaderNode ); + } } + /** + * Create a shader node attribute and append it on the list of shader node attributes + * to the current sampler file id. + */ + void appendShaderNodeAttribute ( + const COLLADAFW::Texture &texture, + const ShaderType& shaderType, + const ShaderAttribute& shaderAttribute, + MayaDM::DependNode* shaderNode ); + /** Disable default copy ctor. */ EffectImporter( const EffectImporter& pre ); Modified: branches/nextgen/COLLADAMaya/include/COLLADAMayaImageImporter.h =================================================================== --- branches/nextgen/COLLADAMaya/include/COLLADAMayaImageImporter.h 2009-02-18 12:43:48 UTC (rev 367) +++ branches/nextgen/COLLADAMaya/include/COLLADAMayaImageImporter.h 2009-02-18 17:42:55 UTC (rev 368) @@ -18,7 +18,9 @@ #include "COLLADAFWImage.h" +#include <MayaDMFile.h> + namespace COLLADAMaya { @@ -29,7 +31,12 @@ /** The standard name for image without name. */ static const String IMAGE_NAME; + static const String PLACE_2D_TEXTURE_NAME; + static const String DEFAULT_TEXTURE_LIST; + private: + + typedef std::map<COLLADAFW::UniqueId, MayaDM::File> UniqueIdMayaImagesMap; private: /** @@ -37,6 +44,16 @@ */ COLLADABU::IDList mImageIdList; + /** + * The list with the unique maya place2dtexture names. + */ + COLLADABU::IDList mPlace2dTextureIdList; + + /** + * The map holds the Maya image file objects for the unique image file ids. + */ + UniqueIdMayaImagesMap mImageIdMayaImageFileMap; + public: /** Constructor. */ @@ -50,14 +67,19 @@ */ void importImage ( const COLLADAFW::Image* image ); + /** + * Write the connections between files and defaultTextureList and effects. + */ + void writeConnections (); + private: - /** Disable default copy ctor. */ - ImageImporter( const ImageImporter& pre ); + /** + * Returns a pointer to the maya image file with the given image id, + * or NULL, if it is not in the list. + */ + const MayaDM::File* findMayaImageFile ( const COLLADAFW::UniqueId& imageId ); - /** Disable default assignment operator. */ - const ImageImporter& operator= ( const ImageImporter& pre ); - }; } // namespace COLLADAMAYA Modified: branches/nextgen/COLLADAMaya/include/COLLADAMayaLightImporter.h =================================================================== --- branches/nextgen/COLLADAMaya/include/COLLADAMayaLightImporter.h 2009-02-18 12:43:48 UTC (rev 367) +++ branches/nextgen/COLLADAMaya/include/COLLADAMayaLightImporter.h 2009-02-18 17:42:55 UTC (rev 368) @@ -18,6 +18,7 @@ #include <MayaDMSpotLight.h> #include <MayaDMPointLight.h> +#include <MayaDMLightLinker.h> namespace COLLADAMaya @@ -28,21 +29,32 @@ { private: - /** The name of maya's default light list. */ + // TODO LightLinker + + /** The standard name for camera without name. */ + static const String LIGHT_NAME; + + /** The name of maya's default light list and set. */ static const String INITIAL_LIGHT_LIST; static const String DEFAULT_LIGHT_SET; + /** The name of the light linker to link all the light objects. */ + static const String LIGHT_LINKER_NAME; + private: typedef std::map<COLLADAFW::UniqueId, MayaDM::Light*> UniqueIdLightNodeMap; - private: + private: - /** The standard name for camera without name. */ - static const String LIGHT_NAME; + /** + * If we have one or more lights, we need a light linker. + * This node defines light linking relationships between lights and objects. Connecting a + * light to the "light" child of the "link" compound will cause it to illuminate the object + * connected to the "object" child of the same index of the "link" compound. + */ + MayaDM::LightLinker* mLightLinker; - private: - /** * The list of the unique maya light names. */ @@ -77,14 +89,32 @@ */ void writeConnections (); + void connectLightObjects (); private: /** + * If we have one or more lights, we need a light linker. + * This node defines light linking relationships between lights and objects. Connecting a + * light to the "light" child of the "link" compound will cause it to illuminate the object + * connected to the "object" child of the same index of the "link" compound. + */ + void createLightLinker (); + + /** * Creates a light. */ void createLight ( const COLLADAFW::Light* light, MayaNode* mayaTransformNode ); /** + * Writes the object connections of the light linker into the maya ascii file. + * If we have one or more lights, we need a light linker. + * This node defines light linking relationships between lights and objects. Connecting a + * light to the "light" child of the "link" compound will cause it to illuminate the object + * connected to the "object" child of the same index of the "link" compound. + */ + void connectLightLinkers (); + + /** * Sets the spot light specific attributes. */ void setSpotLightAttributes ( Modified: branches/nextgen/COLLADAMaya/include/COLLADAMayaMaterialImporter.h =================================================================== --- branches/nextgen/COLLADAMaya/include/COLLADAMayaMaterialImporter.h 2009-02-18 12:43:48 UTC (rev 367) +++ branches/nextgen/COLLADAMaya/include/COLLADAMayaMaterialImporter.h 2009-02-18 17:42:55 UTC (rev 368) @@ -36,6 +36,11 @@ class MaterialImporter : public BaseImporter { + public: + + /** The name of maya's initial shading engine. */ + static const String INITIAL_SHADING_ENGINE; + private: /** The standard name for a shading engine. */ @@ -49,14 +54,13 @@ /** The name of maya's default shader list. */ static const String DEFAULT_SHADER_LIST; - static const String INITIAL_SHADING_ENGINE; static const String ATTR_SHADERS; public: typedef std::map<COLLADAFW::UniqueId, MayaDM::DependNode*> UniqueIdMayaMaterialMap; - private: + public: /** * The maya shading engine and material info. @@ -86,6 +90,8 @@ }; typedef std::map<COLLADAFW::UniqueId, ShadingData*> ShadingDataMap; + private: + /** * The binding of a geometry instance to a material. */ @@ -176,6 +182,11 @@ */ MayaDM::DependNode* findMayaMaterial ( const COLLADAFW::UniqueId& val ) const; + /** + * The map with the unique ids of the shading engine to the shading engines itself. + */ + const ShadingDataMap& getShadingEnginesMap () const { return mShaderDataMap; } + private: /** Connect the material with the shading engine and the material info. */ @@ -210,11 +221,6 @@ /** * The map with the unique ids of the shading engine to the shading engines itself. */ - const ShadingDataMap& getShadingEnginesMap () const { return mShaderDataMap; } - - /** - * The map with the unique ids of the shading engine to the shading engines itself. - */ ShadingData* findShaderData ( const COLLADAFW::UniqueId& val ); /** Modified: branches/nextgen/COLLADAMaya/include/COLLADAMayaVisualSceneImporter.h =================================================================== --- branches/nextgen/COLLADAMaya/include/COLLADAMayaVisualSceneImporter.h 2009-02-18 12:43:48 UTC (rev 367) +++ branches/nextgen/COLLADAMaya/include/COLLADAMayaVisualSceneImporter.h 2009-02-18 17:42:55 UTC (rev 368) @@ -94,7 +94,6 @@ std::vector<MVector> translate3Vec; size_t numTranslate3; - // 5 phases size_t phase; }; Modified: branches/nextgen/COLLADAMaya/src/COLLADAMayaEffectImporter.cpp =================================================================== --- branches/nextgen/COLLADAMaya/src/COLLADAMayaEffectImporter.cpp 2009-02-18 12:43:48 UTC (rev 367) +++ branches/nextgen/COLLADAMaya/src/COLLADAMayaEffectImporter.cpp 2009-02-18 17:42:55 UTC (rev 368) @@ -62,7 +62,8 @@ importBlinnShader ( effect, commonEffect ); break; case COLLADAFW::EffectCommon::SHADER_CONSTANT: - // TODO + // Import as a lambert shader. + importLambertShader ( effect, commonEffect ); break; case COLLADAFW::EffectCommon::SHADER_PHONG: importPhongShader ( effect, commonEffect ); @@ -72,6 +73,7 @@ break; case COLLADAFW::EffectCommon::SHADER_UNKNOWN: default: + // TODO // Standard shader (lambert?) break; } @@ -100,7 +102,7 @@ MayaDM::Blinn* blinn = new MayaDM::Blinn ( file, effectName ); // Import the shader attributes. - importShaderAttributes ( blinn, effect, commonEffect ); + importShaderAttributes ( SHADER_BLINN, blinn, effect, commonEffect ); // Push it into the map. appendEffect ( effectId, blinn ); @@ -126,7 +128,7 @@ MayaDM::Phong* phong = new MayaDM::Phong ( file, effectName ); // Import the shader attributes. - importShaderAttributes ( phong, effect, commonEffect ); + importShaderAttributes ( SHADER_PHONG, phong, effect, commonEffect ); // Push it into the map. appendEffect ( effectId, phong ); @@ -152,7 +154,7 @@ MayaDM::Lambert* lambert = new MayaDM::Lambert ( file, effectName ); // Import the shader attributes. - importShaderAttributes ( lambert, effect, commonEffect ); + importShaderAttributes ( SHADER_LAMBERT, lambert, effect, commonEffect ); // Push it into the map. appendEffect ( effectId, lambert ); @@ -175,5 +177,24 @@ mMayaEffectMap [id] = effectNode; } + // -------------------------- + void EffectImporter::appendShaderNodeAttribute ( + const COLLADAFW::Texture &texture, + const ShaderType& shaderType, + const ShaderAttribute& shaderAttribute, + MayaDM::DependNode* shaderNode ) + { + // Get the current sampler id. + COLLADAFW::SamplerID samplerId = texture.getSamplerId (); + // Save the samplerId to this effect, so we can do the connection one time later. + ShaderNodeAttribute shaderNodeAttribute; + shaderNodeAttribute.mShaderType = shaderType; + shaderNodeAttribute.mShaderAttribute = shaderAttribute; + shaderNodeAttribute.mShaderNode = shaderNode; + + // Push the shader node attribute data in the map to the sampler id. + mSamplerIdShaderNodesMap [ samplerId ].push_back ( shaderNodeAttribute ); + } + } // namespace COLLADAMaya Modified: branches/nextgen/COLLADAMaya/src/COLLADAMayaImageImporter.cpp =================================================================== --- branches/nextgen/COLLADAMaya/src/COLLADAMayaImageImporter.cpp 2009-02-18 12:43:48 UTC (rev 367) +++ branches/nextgen/COLLADAMaya/src/COLLADAMayaImageImporter.cpp 2009-02-18 17:42:55 UTC (rev 368) @@ -11,11 +11,16 @@ #include "COLLADAMayaStableHeaders.h" #include "COLLADAMayaImageImporter.h" +#include <MayaDMPlace2dTexture.h> +#include <MayaDMDefaultTextureList.h> + namespace COLLADAMaya { const String ImageImporter::IMAGE_NAME = "Image"; + const String ImageImporter::PLACE_2D_TEXTURE_NAME = "place2dTexture"; + const String ImageImporter::DEFAULT_TEXTURE_LIST = ":defaultTextureList1"; //------------------------------ @@ -34,7 +39,7 @@ { // Check if the light is already imported. const COLLADAFW::UniqueId& imageId = image->getUniqueId (); -// if ( findMayaLightNode ( imageId ) != 0 ) return; + if ( findMayaImageFile ( imageId ) != 0 ) return; // Create a unique name. String imageName = image->getName (); @@ -42,8 +47,69 @@ imageName = IMAGE_NAME; imageName = mImageIdList.addId ( imageName ); - + // Get the maya ascii file. + FILE* file = getDocumentImporter ()->getFile (); + // Get the image uri + const COLLADABU::URI& imageURI = image->getImageURI (); + //createNode file -name "file1"; + // setAttr ".fileTextureName" -type "string" "C:/netallied/projekte/COLLADA/TestdataMaya/Themes/Textures/tex/checkerRGB.jpg"; + MayaDM::File mayaImage ( file, imageName ); + mayaImage.setFileTextureName ( imageURI.getURIString () ); + + // Push the maya image file in the map to the unique image id. + mImageIdMayaImageFileMap [ imageId ] = mayaImage; } + + // ----------------------------------- + const MayaDM::File* ImageImporter::findMayaImageFile ( const COLLADAFW::UniqueId& imageId ) + { + UniqueIdMayaImagesMap::const_iterator it = mImageIdMayaImageFileMap.find ( imageId ); + if ( it == mImageIdMayaImageFileMap.end () ) + { + return 0; + } + + return &(it->second); + } + + //------------------------------ + void ImageImporter::writeConnections () + { + // Get the maya ascii file. + FILE* file = getDocumentImporter ()->getFile (); + + // TODO Create this in depend on the texture mapping of effects. + // createNode place2dTexture -n "place2dTexture1"; + String place2dTextureName = mPlace2dTextureIdList.addId ( PLACE_2D_TEXTURE_NAME ); + MayaDM::Place2dTexture place2dTexture ( file, place2dTextureName ); + + // Create the defaultTextureList object + MayaDM::DefaultTextureList defaultTextureList ( file, DEFAULT_TEXTURE_LIST, "", false ); + + size_t textureIndex = 0; + + // Get the created images. + UniqueIdMayaImagesMap::iterator it = mImageIdMayaImageFileMap.begin (); + while ( it != mImageIdMayaImageFileMap.end () ) + { + const COLLADAFW::UniqueId& imageId = it->first; + const MayaDM::File& imageFile = it->second; + + //connectAttr "file1.message" ":defaultTextureList1.textures" -nextAvailable; + connectAttr ( file, imageFile.getMessage (), defaultTextureList.getTextures ( textureIndex ) ); + ++textureIndex; + + //connectAttr "file1.outColor" ":lambert1.color"; + // TODO Get all effects, which use this image file. +// findImageEffects ( imageId ); +// connectAttr ( file, imageFile.getOutColor (), effect.getColor () ); + + //connectAttr "file1.message" ":initialMaterialInfo.texture" -nextAvailable; + + ++it; + } + + } } // namespace COLLADAMaya Modified: branches/nextgen/COLLADAMaya/src/COLLADAMayaLightImporter.cpp =================================================================== --- branches/nextgen/COLLADAMaya/src/COLLADAMayaLightImporter.cpp 2009-02-18 12:43:48 UTC (rev 367) +++ branches/nextgen/COLLADAMaya/src/COLLADAMayaLightImporter.cpp 2009-02-18 17:42:55 UTC (rev 368) @@ -11,6 +11,7 @@ #include "COLLADAMayaStableHeaders.h" #include "COLLADAMayaLightImporter.h" #include "COLLADAMayaVisualSceneImporter.h" +#include "COLLADAMayaMaterialImporter.h" #include "math\COLLADABUMathUtils.h" @@ -30,17 +31,21 @@ const String LightImporter::LIGHT_NAME = "Light"; const String LightImporter::INITIAL_LIGHT_LIST = ":lightList1"; const String LightImporter::DEFAULT_LIGHT_SET = ":defaultLightSet"; + const String LightImporter::LIGHT_LINKER_NAME = "lightLinker1"; //------------------------------ LightImporter::LightImporter ( DocumentImporter* documentImporter ) : BaseImporter ( documentImporter ) + , mLightLinker (0) { } //------------------------------ LightImporter::~LightImporter() { + delete mLightLinker; + UniqueIdLightNodeMap::const_iterator it = mMayaLightMap.begin (); if ( it != mMayaLightMap.end () ) { @@ -50,8 +55,21 @@ } //------------------------------ + void LightImporter::createLightLinker () + { + if ( mLightLinker == 0 ) + { + FILE* file = getDocumentImporter ()->getFile (); + mLightLinker = new MayaDM::LightLinker ( file, LIGHT_LINKER_NAME ); + } + } + + //------------------------------ void LightImporter::importLight ( const COLLADAFW::Light* light ) { + // If we have one or more lights, we need a light linker + if ( mLightLinker == 0 ) createLightLinker (); + // Check if the light is already imported. const COLLADAFW::UniqueId& lightId = light->getUniqueId (); if ( findMayaLightNode ( lightId ) != 0 ) return; @@ -238,32 +256,114 @@ mMayaLightMap [id] = lightNode; } - // -------------------------------------------- + // -------------------------- void LightImporter::writeConnections () { + connectLightObjects(); + connectLightLinkers (); + } + + // -------------------------- + void LightImporter::connectLightLinkers () + { + if ( !mLightLinker ) return; + + // The maya ascii file. FILE* file = getDocumentImporter ()->getFile (); + size_t lightLinkerLinkIndex = 0; + + // Get the default light set. + MayaDM::ObjectSet defaultLightSet ( file, DEFAULT_LIGHT_SET, "", false ); + + // Connect the existing shader engines with the first light linker link's object. + MaterialImporter* materialImporter = getDocumentImporter ()->getMaterialImporter (); + const MaterialImporter::ShadingDataMap& shadingDataMap = materialImporter->getShadingEnginesMap (); + MaterialImporter::ShadingDataMap::const_iterator it = shadingDataMap.begin (); + while ( it != shadingDataMap.end () ) + { + MaterialImporter::ShadingData* shadingData = it->second; + MayaDM::ShadingEngine* shadingEngine = shadingData->getShadingEngine (); + + // Connect the the default light set message with the next light linker link's light + // connectAttr ":defaultLightSet.message" "lightLinker1.link[0].light"; + connectAttr ( file, defaultLightSet.getMessage (), mLightLinker->getLight ( lightLinkerLinkIndex ) ); + + // Connect the current shading engine's message with the next light linker link's object. + // connectAttr "lambert2SG.message" "lightLinker1.link[0].object"; + connectAttr ( file, shadingEngine->getMessage (), mLightLinker->getObject ( lightLinkerLinkIndex ) ); + + // Connect the the default light set message with the next light linker shadow link's shadow light + // connectAttr ":defaultLightSet.message" "lightLinker1.shadowLink[0].shadowLight"; + connectAttr ( file, defaultLightSet.getMessage (), mLightLinker->getShadowLight ( lightLinkerLinkIndex ) ); + + // Connect the current shading engine's message with the next light linker shadow link's shadow object. + // connectAttr "lambert2SG.message" "lightLinker1.shadowLink[0].shadowObject"; + connectAttr ( file, shadingEngine->getMessage (), mLightLinker->getShadowObject ( lightLinkerLinkIndex ) ); + + // Increment the light linker index + ++lightLinkerLinkIndex; + + ++it; + } + + // Create the dummy object of the initial shading group. + MayaDM::ShadingEngine initialShadingEngine ( file, MaterialImporter::INITIAL_SHADING_ENGINE, "", false ); + + // Connect the default light set message with the next light linker link's light + // connectAttr ":defaultLightSet.message" "lightLinker1.link[1].light"; + connectAttr ( file, defaultLightSet.getMessage (), mLightLinker->getLight ( lightLinkerLinkIndex ) ); + // Connect the initial shading group message with the next light linker link's object + // connectAttr ":initialShadingGroup.message" "lightLinker1.link[1].object"; + connectAttr ( file, initialShadingEngine.getMessage (), mLightLinker->getObject ( lightLinkerLinkIndex ) ); + + // Connect the default light set message with the light linker shadow link's shadow light + // connectAttr ":defaultLightSet.message" "lightLinker1.shadowLink[1].shadowLight"; + connectAttr ( file, defaultLightSet.getMessage (), mLightLinker->getShadowLight ( lightLinkerLinkIndex ) ); + // Connect the initial shading group message with the next light linker shadow link's shadow object + // connectAttr ":initialShadingGroup.message" "lightLinker1.shadowLink[1].shadowObject"; + connectAttr ( file, initialShadingEngine.getMessage (), mLightLinker->getShadowObject ( lightLinkerLinkIndex ) ); + + // Create a dummy object for the light list. MayaDM::LightList lightList ( file, INITIAL_LIGHT_LIST, "", false ); - size_t lightIndex = 0; - size_t lightSetIndex = 0; - UniqueIdMayaNodesMap::iterator it = mMayaLightNodesMap.begin (); - while ( it != mMayaLightNodesMap.end () ) - { - const COLLADAFW::UniqueId& lightId = it->first; - MayaNode& mayaNode = it->second; - - MayaDM::DependNode* dependNode = findMayaLight ( lightId ); - MayaDM::Light* lightNode = ( MayaDM::Light* ) dependNode; - dependNode->setName ( mayaNode.getNodePath () ); - + // Connect the light linker the initial light list link Nodes + // connectAttr "lightLinker1.message" ":lightList1.linkNodes" -nextAvailable; + connectAttr ( file, mLightLinker->getMessage (), lightList.getLinkNodes (0) ); + + } + + // -------------------------- + void LightImporter::connectLightObjects () + { + // The maya ascii file. + FILE* file = getDocumentImporter ()->getFile (); + + // Create a dummy object for the light list. + MayaDM::LightList lightList ( file, INITIAL_LIGHT_LIST, "", false ); + + // Create the default light set dummy object, if we need it for the connections. + MayaDM::ObjectSet* defaultLightSet = 0; + + size_t lightIndex = 0; + size_t lightSetIndex = 0; + UniqueIdMayaNodesMap::iterator it = mMayaLightNodesMap.begin (); + while ( it != mMayaLightNodesMap.end () ) + { + const COLLADAFW::UniqueId& lightId = it->first; + MayaNode& mayaNode = it->second; + + MayaDM::DependNode* dependNode = findMayaLight ( lightId ); + MayaDM::Light* lightNode = ( MayaDM::Light* ) dependNode; + dependNode->setName ( mayaNode.getNodePath () ); + // Connect the light data of the lights (just real ones, no instances), with the light list. - //connectAttr "|spotLight1|spotLightShape1.lightData" ":lightList1.lights" -nextAvailable; - //connectAttr "spotLightShape2.lightData" ":lightList1.lights" -nextAvailable; - connectAttr ( file, lightNode->getLightData (), lightList.getLights ( lightIndex ) ); - ++lightIndex; - + //connectAttr "|spotLight1|spotLightShape1.lightData" ":lightList1.lights" -nextAvailable; + //connectAttr "spotLightShape2.lightData" ":lightList1.lights" -nextAvailable; + connectAttr ( file, lightNode->getLightData (), lightList.getLights ( lightIndex ) ); + ++lightIndex; + // Get the transform nodes, which work with this light instance. VisualSceneImporter* visualSceneImporter = getDocumentImporter ()->getVisualSceneImporter (); const UniqueIdVec* transformNodes = visualSceneImporter->findLightTransformIds ( lightId ); @@ -285,23 +385,25 @@ String transformNodePath = mayaTransformNode->getNodePath (); MayaDM::Transform transformNode ( file, transformNodePath, "", false ); - // Get the default light set to add the light transform nodes. - MayaDM::ObjectSet lightSet ( file, DEFAULT_LIGHT_SET, "", false ); - + // Create the dummy object of the default light set, if we need it. + if ( defaultLightSet == 0 ) + defaultLightSet = new MayaDM::ObjectSet ( file, DEFAULT_LIGHT_SET, "", false ); + // Connect the light transforms instance object groups with the default light set. - //connectAttr "spotLight1.instObjGroups" ":defaultLightSet.dagSetMembers" -nextAvailable; - //connectAttr "|spotLight2.instObjGroups" ":defaultLightSet.dagSetMembers" -nextAvailable; - //connectAttr "spotLight3.instObjGroups" ":defaultLightSet.dagSetMembers" -nextAvailable; - connectAttr ( file, transformNode.getInstObjGroups (0), lightSet.getDagSetMembers (lightSetIndex) ); - ++lightSetIndex; + //connectAttr "spotLight1.instObjGroups" ":defaultLightSet.dagSetMembers" -nextAvailable; + //connectAttr "|spotLight2.instObjGroups" ":defaultLightSet.dagSetMembers" -nextAvailable; + //connectAttr "spotLight3.instObjGroups" ":defaultLightSet.dagSetMembers" -nextAvailable; + connectAttr ( file, transformNode.getInstObjGroups (0), defaultLightSet->getDagSetMembers (lightSetIndex) ); + ++lightSetIndex; ++nodesIter; - } - - ++it; - } + } + ++it; + } + if ( defaultLightSet != 0 ) + delete defaultLightSet; } } // namespace COLLADAMaya Modified: branches/nextgen/COLLADAMaya/src/COLLADAMayaMaterialImporter.cpp =================================================================== --- branches/nextgen/COLLADAMaya/src/COLLADAMayaMaterialImporter.cpp 2009-02-18 12:43:48 UTC (rev 367) +++ branches/nextgen/COLLADAMaya/src/COLLADAMayaMaterialImporter.cpp 2009-02-18 17:42:55 UTC (rev 368) @@ -229,12 +229,6 @@ // -------------------------- void MaterialImporter::writeConnections () { - // select -noExpand :defaultShaderList1; - // select -noExpand :initialShadingGroup; - FILE* file = getDocumentImporter ()->getFile (); - mayaSelect ( file, DEFAULT_SHADER_LIST, true ); - mayaSelect ( file, INITIAL_SHADING_ENGINE, true ); - // If there are some object groups, we have to connect them with the geometries. connectGeometryGroups(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jud...@us...> - 2009-02-18 12:43:57
|
Revision: 367 http://colladamaya.svn.sourceforge.net/colladamaya/?rev=367&view=rev Author: judithschenk Date: 2009-02-18 12:43:48 +0000 (Wed, 18 Feb 2009) Log Message: ----------- enhancement on unit handling and conversion; light import; node instances; image import; Modified Paths: -------------- branches/nextgen/COLLADAFramework/include/COLLADAFWFileInfo.h branches/nextgen/COLLADAFramework/src/COLLADAFWFileInfo.cpp branches/nextgen/COLLADAMaya/include/COLLADAMayaBaseImporter.h branches/nextgen/COLLADAMaya/include/COLLADAMayaDocumentImporter.h branches/nextgen/COLLADAMaya/include/COLLADAMayaEffectImporter.h branches/nextgen/COLLADAMaya/include/COLLADAMayaLightImporter.h branches/nextgen/COLLADAMaya/include/COLLADAMayaMaterialImporter.h branches/nextgen/COLLADAMaya/include/COLLADAMayaVisualSceneImporter.h branches/nextgen/COLLADAMaya/scripts/COLLADAMaya.vcproj branches/nextgen/COLLADAMaya/src/COLLADAMayaDocumentImporter.cpp branches/nextgen/COLLADAMaya/src/COLLADAMayaLightImporter.cpp branches/nextgen/COLLADAMaya/src/COLLADAMayaMaterialImporter.cpp branches/nextgen/COLLADAMaya/src/COLLADAMayaVisualSceneImporter.cpp branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLAssetLoader.h Added Paths: ----------- branches/nextgen/COLLADAMaya/include/COLLADAMayaImageImporter.h branches/nextgen/COLLADAMaya/src/COLLADAMayaImageImporter.cpp Modified: branches/nextgen/COLLADAFramework/include/COLLADAFWFileInfo.h =================================================================== --- branches/nextgen/COLLADAFramework/include/COLLADAFWFileInfo.h 2009-02-17 11:37:48 UTC (rev 366) +++ branches/nextgen/COLLADAFramework/include/COLLADAFWFileInfo.h 2009-02-18 12:43:48 UTC (rev 367) @@ -35,14 +35,72 @@ public: /** Descriptive information about unit of measure. Its optional attributes are:*/ - struct Unit + class Unit { + public: + static const double LINEAR_UNIT_KILOMETER; + static const double LINEAR_UNIT_METER; + static const double LINEAR_UNIT_DECIMETER; + static const double LINEAR_UNIT_CENTIMETER; + static const double LINEAR_UNIT_MILLIMETER; + static const double LINEAR_UNIT_FOOT; + static const double LINEAR_UNIT_INCH; + static const double LINEAR_UNIT_YARD; + + static const String LINEAR_UNIT_KILOMETER_NAME; + static const String LINEAR_UNIT_METER_NAME; + static const String LINEAR_UNIT_DECIMETER_NAME; + static const String LINEAR_UNIT_CENTIMETER_NAME; + static const String LINEAR_UNIT_MILLIMETER_NAME; + static const String LINEAR_UNIT_FOOT_NAME; + static const String LINEAR_UNIT_INCH_NAME; + static const String LINEAR_UNIT_YARD_NAME; + + static const String ANGULAR_UNIT_DEGREES_NAME; + static const String ANGULAR_UNIT_RADIANS_NAME; + + static const String TIME_UNIT_FILM_NAME; + + + enum LinearUnit + { + KILOMETER, + METER, + DECIMETER, + CENTIMETER, + MILLIMETER, + FOOT, + INCH, + YARD, + UNKNOWN_LINEAR_UNIT + }; + + enum AngularUnit + { + DEGREES, + RADIANS, + UNKNOWN_ANGULAR_UNIT + }; + + enum TimeUnit + { + FILM, + UNKNOWN_TIME_UNIT + }; + + private: + + /** + * The enum value for the linear unit. + */ + LinearUnit mLinearUnitUnit; + /** * 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; + String mLinearUnitName; /** * How many real-world meters in one distance unit as a floating-point number. @@ -54,15 +112,96 @@ /** * The angular unit; */ - String mAngularUnit; + String mAngularUnitName; + AngularUnit mAngularUnitUnit; /** * The time unit. */ - String mTimeUnit; + String mTimeUnitName; + TimeUnit mTimeUnitUnit; + public: + + Unit () + : mLinearUnitName ( LINEAR_UNIT_METER_NAME ) + , mLinearUnitUnit ( METER ) + , mLinearUnitMeter ( LINEAR_UNIT_METER ) + , mAngularUnitName ( ANGULAR_UNIT_DEGREES_NAME ) + , mAngularUnitUnit ( DEGREES ) + , mTimeUnitName ( TIME_UNIT_FILM_NAME ) + , mTimeUnitUnit ( FILM ) + {} + + Unit ( String linearUnitName, double linearUnitMeter, + String angularUnitName, String timeUnitName = TIME_UNIT_FILM_NAME ) + : mLinearUnitName ( linearUnitName ) + , mLinearUnitMeter ( linearUnitMeter ) + , mAngularUnitName ( angularUnitName ) + , mTimeUnitName ( timeUnitName ) + { + initializeLinearUnitUnitByName ( mLinearUnitName ); + initializeAngularUnitUnitByName ( mAngularUnitName ); + initializeTimeUnitUnitByName ( mTimeUnitName ); + } + + virtual ~Unit () {} + + /** + * The enum value for the linear unit. + */ + const LinearUnit& getLinearUnitUnit () const { return mLinearUnitUnit; } + void setLinearUnitUnit ( const LinearUnit& val ) { mLinearUnitUnit = val; } + + /** + * 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. + */ + const String& getLinearUnit () const { return mLinearUnitName; } + void setLinearUnit ( const String& val ); + + /** + * Initializes the linear unit unit with the specified enum value + * in depend of the given name. + */ + void initializeLinearUnitUnitByName ( const String& val ); + + /** + * 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; } + void setLinearUnitMeter ( const double val ) { mLinearUnitMeter = val; } + + /** + * The angular unit; + */ + const String& getAngularUnitName () const { return mAngularUnitName; } + void setAngularUnitName ( const String& val ); + + /** + * Initializes the angular unit unit with the specified enum value + * in depend of the given name. + */ + void initializeAngularUnitUnitByName ( const String& angularUnitName ); + + /** + * The time unit. + */ + const String& getTimeUnitName () const { return mTimeUnitName; } + void setTimeUnitName ( const String& val ); + + /** + * Initializes the time unit unit with the specified enum value + * in depend of the given name. + */ + void initializeTimeUnitUnitByName ( const String& timeUnitName ); + }; + /*Descriptive information about the coordinate system of the geometric data. All coordinates are right handed by definition. Valid values are X_UP, Y_UP, @@ -126,7 +265,7 @@ */ void setLinearUnit ( const String& linearUnit ) { - mUnit.mLinearUnit = linearUnit; + mUnit.setLinearUnit ( linearUnit ); } /** @@ -134,7 +273,7 @@ */ void setLinearUnitMeter ( const double linearUnitMeter ) { - mUnit.mLinearUnitMeter = linearUnitMeter; + mUnit.setLinearUnitMeter ( linearUnitMeter ); } /** Returns the unit. */ Modified: branches/nextgen/COLLADAFramework/src/COLLADAFWFileInfo.cpp =================================================================== --- branches/nextgen/COLLADAFramework/src/COLLADAFWFileInfo.cpp 2009-02-17 11:37:48 UTC (rev 366) +++ branches/nextgen/COLLADAFramework/src/COLLADAFWFileInfo.cpp 2009-02-18 12:43:48 UTC (rev 367) @@ -21,14 +21,35 @@ const String FileInfo::Y_UP_STRING = "Y_UP"; const String FileInfo::Z_UP_STRING = "Z_UP"; + const double FileInfo::Unit::LINEAR_UNIT_KILOMETER = 1000; + const double FileInfo::Unit::LINEAR_UNIT_METER = 1; + const double FileInfo::Unit::LINEAR_UNIT_DECIMETER = 0.01; + const double FileInfo::Unit::LINEAR_UNIT_CENTIMETER = 0.01; + const double FileInfo::Unit::LINEAR_UNIT_MILLIMETER = 0.001; + const double FileInfo::Unit::LINEAR_UNIT_FOOT = 0.3048; + const double FileInfo::Unit::LINEAR_UNIT_INCH = 0.0254; + const double FileInfo::Unit::LINEAR_UNIT_YARD = 0.9144; + + const String FileInfo::Unit::LINEAR_UNIT_KILOMETER_NAME = "kilometer"; + const String FileInfo::Unit::LINEAR_UNIT_METER_NAME = "meter"; + const String FileInfo::Unit::LINEAR_UNIT_DECIMETER_NAME = "decimeter"; + const String FileInfo::Unit::LINEAR_UNIT_CENTIMETER_NAME = "centimeter"; + const String FileInfo::Unit::LINEAR_UNIT_MILLIMETER_NAME = "millimeter"; + const String FileInfo::Unit::LINEAR_UNIT_FOOT_NAME = "foot"; + const String FileInfo::Unit::LINEAR_UNIT_INCH_NAME = "inch"; + const String FileInfo::Unit::LINEAR_UNIT_YARD_NAME = "yard"; + + const String FileInfo::Unit::ANGULAR_UNIT_DEGREES_NAME = "degree"; + const String FileInfo::Unit::ANGULAR_UNIT_RADIANS_NAME = "radian"; + + const String FileInfo::Unit::TIME_UNIT_FILM_NAME = "film"; + + //------------------------------ FileInfo::FileInfo() : mUpAxisType ( Y_UP ) , mValuePairArray ( ValuePairArray::OWNER ) { - mUnit.mLinearUnit = "centimeter"; - mUnit.mAngularUnit = "degree"; - mUnit.mTimeUnit = "film"; } //------------------------------ @@ -60,4 +81,71 @@ { mValuePairArray.append ( new ValuePair ( value1, value2 ) ); } + + //------------------------------ + void FileInfo::Unit::setAngularUnitName ( const String& val ) + { + mAngularUnitName = val; + + initializeAngularUnitUnitByName ( mAngularUnitName ); + } + + //------------------------------ + void FileInfo::Unit::setLinearUnit ( const String& val ) + { + mLinearUnitName = val; + + initializeLinearUnitUnitByName ( mLinearUnitName ); + } + + //------------------------------ + void FileInfo::Unit::setTimeUnitName ( const String& val ) + { + mTimeUnitName = val; + + initializeTimeUnitUnitByName ( mTimeUnitName ); + } + + //------------------------------ + void FileInfo::Unit::initializeLinearUnitUnitByName ( const String& linearUnitName ) + { + if ( COLLADABU::Utils::equalsIgnoreCase ( linearUnitName, LINEAR_UNIT_KILOMETER_NAME ) ) + mLinearUnitUnit = KILOMETER; + else if ( COLLADABU::Utils::equalsIgnoreCase ( linearUnitName, LINEAR_UNIT_METER_NAME ) ) + mLinearUnitUnit = METER; + else if ( COLLADABU::Utils::equalsIgnoreCase ( linearUnitName, LINEAR_UNIT_METER_NAME ) ) + mLinearUnitUnit = METER; + else if ( COLLADABU::Utils::equalsIgnoreCase ( linearUnitName, LINEAR_UNIT_DECIMETER_NAME ) ) + mLinearUnitUnit = DECIMETER; + else if ( COLLADABU::Utils::equalsIgnoreCase ( linearUnitName, LINEAR_UNIT_CENTIMETER_NAME ) ) + mLinearUnitUnit = CENTIMETER; + else if ( COLLADABU::Utils::equalsIgnoreCase ( linearUnitName, LINEAR_UNIT_MILLIMETER_NAME ) ) + mLinearUnitUnit = MILLIMETER; + else if ( COLLADABU::Utils::equalsIgnoreCase ( linearUnitName, LINEAR_UNIT_FOOT_NAME ) ) + mLinearUnitUnit = FOOT; + else if ( COLLADABU::Utils::equalsIgnoreCase ( linearUnitName, LINEAR_UNIT_INCH_NAME ) ) + mLinearUnitUnit = INCH; + else if ( COLLADABU::Utils::equalsIgnoreCase ( linearUnitName, LINEAR_UNIT_METER_NAME ) ) + mLinearUnitUnit = YARD; + else mLinearUnitUnit = UNKNOWN_LINEAR_UNIT; + } + + //------------------------------ + void FileInfo::Unit::initializeAngularUnitUnitByName ( const String& angularUnitName ) + { + if ( COLLADABU::Utils::equalsIgnoreCase ( angularUnitName, ANGULAR_UNIT_DEGREES_NAME ) ) + mAngularUnitUnit = DEGREES; + else if ( COLLADABU::Utils::equalsIgnoreCase ( angularUnitName, ANGULAR_UNIT_RADIANS_NAME ) ) + mAngularUnitUnit = RADIANS; + else mAngularUnitUnit = UNKNOWN_ANGULAR_UNIT; + } + + //------------------------------ + void FileInfo::Unit::initializeTimeUnitUnitByName ( const String& timeUnitName ) + { + if ( COLLADABU::Utils::equalsIgnoreCase ( timeUnitName, TIME_UNIT_FILM_NAME ) ) + mTimeUnitUnit = FILM; + else mTimeUnitUnit = UNKNOWN_TIME_UNIT; + } + } // namespace COLLADAFW Modified: branches/nextgen/COLLADAMaya/include/COLLADAMayaBaseImporter.h =================================================================== --- branches/nextgen/COLLADAMaya/include/COLLADAMayaBaseImporter.h 2009-02-17 11:37:48 UTC (rev 366) +++ branches/nextgen/COLLADAMaya/include/COLLADAMayaBaseImporter.h 2009-02-18 12:43:48 UTC (rev 367) @@ -44,6 +44,8 @@ typedef std::map<COLLADAFW::UniqueId, MayaNode> UniqueIdMayaNodesMap; typedef std::map<COLLADAFW::UniqueId, MayaDM::Mesh> UniqueIdMayaDMMeshMap; + typedef std::map<COLLADAFW::UniqueId, MayaDM::DependNode*> UniqueIdDependNodeMap; + typedef std::pair<COLLADAFW::UniqueId,COLLADAFW::MaterialId> CombinedId; typedef std::vector<size_t> IndicesVector; typedef std::map<CombinedId, IndicesVector> CombinedIdIndicesMap; Modified: branches/nextgen/COLLADAMaya/include/COLLADAMayaDocumentImporter.h =================================================================== --- branches/nextgen/COLLADAMaya/include/COLLADAMayaDocumentImporter.h 2009-02-17 11:37:48 UTC (rev 366) +++ branches/nextgen/COLLADAMaya/include/COLLADAMayaDocumentImporter.h 2009-02-18 12:43:48 UTC (rev 367) @@ -41,6 +41,7 @@ class EffectImporter; class CameraImporter; class LightImporter; + class ImageImporter; /** The main importer class. This class imports all data of the scene. */ @@ -79,6 +80,7 @@ bool mGeometryRead; bool mCameraRead; bool mLightRead; + bool mImageRead; /** Pointer to the visual scene importer. */ VisualSceneImporter* mVisualSceneImporter; @@ -98,6 +100,9 @@ /** Pointer to the light importer. */ LightImporter* mLightImporter; + /** Pointer to the image importer. */ + ImageImporter* mImageImporter; + /** The variable tells, how many times the document is read. */ size_t mNumDocumentParses; @@ -223,6 +228,10 @@ @return The writer should return true, if writing succeeded, false otherwise.*/ virtual bool writeLight( const COLLADAFW::Light* camera ); + /** When this method is called, the writer must write the image. + @return The writer should return true, if writing succeeded, false otherwise.*/ + virtual bool writeImage( const COLLADAFW::Image* image ); + /** * Replace offending characters by some that are supported within maya. */ Modified: branches/nextgen/COLLADAMaya/include/COLLADAMayaEffectImporter.h =================================================================== --- branches/nextgen/COLLADAMaya/include/COLLADAMayaEffectImporter.h 2009-02-17 11:37:48 UTC (rev 366) +++ branches/nextgen/COLLADAMaya/include/COLLADAMayaEffectImporter.h 2009-02-18 12:43:48 UTC (rev 367) @@ -25,10 +25,6 @@ /** TODO Documentation */ class EffectImporter : public BaseImporter { - public: - - typedef std::map<COLLADAFW::UniqueId, MayaDM::DependNode*> UniqueIdDependNodeMap; - private: /** The standard name for a effect without name. */ @@ -47,7 +43,7 @@ UniqueIdNamesMap mMayaEffectNamesMap; /** - * The map holds the maya effect objects. + * The map holds the maya effect objects for the connections. */ UniqueIdDependNodeMap mMayaEffectMap; Added: branches/nextgen/COLLADAMaya/include/COLLADAMayaImageImporter.h =================================================================== --- branches/nextgen/COLLADAMaya/include/COLLADAMayaImageImporter.h (rev 0) +++ branches/nextgen/COLLADAMaya/include/COLLADAMayaImageImporter.h 2009-02-18 12:43:48 UTC (rev 367) @@ -0,0 +1,65 @@ +/* + 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 __COLLADAMAYA_IMAGEIMPORTER_H__ +#define __COLLADAMAYA_IMAGEIMPORTER_H__ + +#include "COLLADAMayaPrerequisites.h" +#include "COLLADAMayaBaseImporter.h" + +#include "COLLADABUIDList.h" + +#include "COLLADAFWImage.h" + + +namespace COLLADAMaya +{ + + /** TODO Documentation */ + class ImageImporter : BaseImporter + { + private: + + /** The standard name for image without name. */ + static const String IMAGE_NAME; + + private: + + /** + * The list of the unique maya image names. + */ + COLLADABU::IDList mImageIdList; + + public: + + /** Constructor. */ + ImageImporter ( DocumentImporter* documentImporter ); + + /** Destructor. */ + virtual ~ImageImporter(); + + /** + * Imports the data of the current light. + */ + void importImage ( const COLLADAFW::Image* image ); + + private: + + /** Disable default copy ctor. */ + ImageImporter( const ImageImporter& pre ); + + /** Disable default assignment operator. */ + const ImageImporter& operator= ( const ImageImporter& pre ); + + }; + +} // namespace COLLADAMAYA + +#endif // __COLLADAMAYA_IMAGEIMPORTER_H__ Modified: branches/nextgen/COLLADAMaya/include/COLLADAMayaLightImporter.h =================================================================== --- branches/nextgen/COLLADAMaya/include/COLLADAMayaLightImporter.h 2009-02-17 11:37:48 UTC (rev 366) +++ branches/nextgen/COLLADAMaya/include/COLLADAMayaLightImporter.h 2009-02-18 12:43:48 UTC (rev 367) @@ -28,6 +28,16 @@ { private: + /** The name of maya's default light list. */ + static const String INITIAL_LIGHT_LIST; + static const String DEFAULT_LIGHT_SET; + + private: + + typedef std::map<COLLADAFW::UniqueId, MayaDM::Light*> UniqueIdLightNodeMap; + + private: + /** The standard name for camera without name. */ static const String LIGHT_NAME; @@ -40,9 +50,15 @@ /** * The map holds the unique ids of the light nodes to the maya specific nodes. + * Need for the instances. */ UniqueIdMayaNodesMap mMayaLightNodesMap; + /** + * The map holds the maya light objects for the connections. + */ + UniqueIdLightNodeMap mMayaLightMap; + public: /** Constructor. */ @@ -56,6 +72,11 @@ */ void importLight ( const COLLADAFW::Light* light ); + /** + * Writes the connection attributes into the maya ascii file. + */ + void writeConnections (); + private: /** @@ -77,8 +98,22 @@ const COLLADAFW::Light* light, MayaDM::Light* mayaLight ); + /** + * The map holds the unique ids of the light nodes to the maya specific nodes. + * Need for the instances. + */ MayaNode* findMayaLightNode ( const COLLADAFW::UniqueId& lightId ); + /** + * The map holds the maya material objects. + */ + MayaDM::Light* findMayaLight ( const COLLADAFW::UniqueId& val ) const; + + /** + * The map holds the maya light objects. + */ + void appendLight ( const COLLADAFW::UniqueId& id, MayaDM::Light* lightNode ); + }; } // namespace COLLADAMAYA Modified: branches/nextgen/COLLADAMaya/include/COLLADAMayaMaterialImporter.h =================================================================== --- branches/nextgen/COLLADAMaya/include/COLLADAMayaMaterialImporter.h 2009-02-17 11:37:48 UTC (rev 366) +++ branches/nextgen/COLLADAMaya/include/COLLADAMayaMaterialImporter.h 2009-02-18 12:43:48 UTC (rev 367) @@ -49,7 +49,7 @@ /** The name of maya's default shader list. */ static const String DEFAULT_SHADER_LIST; - static const String DEFAULT_SHADING_ENGINE; + static const String INITIAL_SHADING_ENGINE; static const String ATTR_SHADERS; public: @@ -166,7 +166,9 @@ const COLLADAFW::UniqueId& transformNodeId, const COLLADAFW::InstanceGeometry* instanceGeometry ); - /** Writes the connection attributes into the maya ascii file. */ + /** + * Writes the connection attributes into the maya ascii file. + */ void writeConnections (); /** Modified: branches/nextgen/COLLADAMaya/include/COLLADAMayaVisualSceneImporter.h =================================================================== --- branches/nextgen/COLLADAMaya/include/COLLADAMayaVisualSceneImporter.h 2009-02-17 11:37:48 UTC (rev 366) +++ branches/nextgen/COLLADAMaya/include/COLLADAMayaVisualSceneImporter.h 2009-02-18 12:43:48 UTC (rev 367) @@ -49,37 +49,9 @@ 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 mGeometryTransformIdsMap; - - /* - * The map holds for every unique id of a camera a list of transform node unique ids. - * We need it for the creation of the camera, to set the parent transform nodes. + * Helper class, to handle the transformations. */ - UniqueIdUniqueIdsMap mCameraTransformIdsMap; - - /* - * The map holds for every unique id of a light a list of transform node unique ids. - * We need it for the creation of the light, to set the parent transform nodes. - */ - UniqueIdUniqueIdsMap mLightTransformIdsMap; - - /** - * The map holds the unique ids of the nodes to the full node pathes (contains the name). - */ - UniqueIdMayaNodesMap mMayaTransformNodesMap; - - /* - * Helper class, to handle the transformations. - */ class MayaTransformation { public: @@ -121,12 +93,48 @@ MVector translate3; // = 0,0,0 std::vector<MVector> translate3Vec; size_t numTranslate3; - + // 5 phases size_t phase; }; + private: + + /** + * The list of the unique maya transform node names. + */ + COLLADABU::IDList mTransformNodeIdList; + + /** + * The map holds the unique ids of the nodes to the full node pathes (contains the name). + */ + UniqueIdMayaNodesMap mMayaTransformNodesMap; + + /** + * The map holds for every transform node a list of all existing parent transform nodes + * (this are the nodes, which hold an instance of the current transform node). + */ + UniqueIdUniqueIdsMap mTransformInstancesMap; + + /* + * 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 mGeometryTransformIdsMap; + + /* + * The map holds for every unique id of a camera a list of transform node unique ids. + * We need it for the creation of the camera, to set the parent transform nodes. + */ + UniqueIdUniqueIdsMap mCameraTransformIdsMap; + + /* + * The map holds for every unique id of a light a list of transform node unique ids. + * We need it for the creation of the light, to set the parent transform nodes. + */ + UniqueIdUniqueIdsMap mLightTransformIdsMap; + public: /** Constructor. */ @@ -150,6 +158,12 @@ */ MayaNode* findMayaTransformNode ( const COLLADAFW::UniqueId& uniqueId ); + /** + * The map holds for every transform node a list of all existing parent transform nodes + * (this are the nodes, which hold an instance of the current transform node). + */ + const UniqueIdVec* findTransformInstances ( const COLLADAFW::UniqueId& transformId ) const; + /* * 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!). @@ -207,6 +221,11 @@ */ bool readNodeInstances ( const COLLADAFW::Node* node ); + /** + * Write the parenting informations about node instances into the maya ascii file. + */ + void writeNodeInstances (); + /* * Transform the input matrix and convert it in a double[4][4] matrix. */ Modified: branches/nextgen/COLLADAMaya/scripts/COLLADAMaya.vcproj =================================================================== --- branches/nextgen/COLLADAMaya/scripts/COLLADAMaya.vcproj 2009-02-17 11:37:48 UTC (rev 366) +++ branches/nextgen/COLLADAMaya/scripts/COLLADAMaya.vcproj 2009-02-18 12:43:48 UTC (rev 367) @@ -2691,6 +2691,10 @@ > </File> <File + RelativePath="..\src\COLLADAMayaImageImporter.cpp" + > + </File> + <File RelativePath="..\src\COLLADAMayaLightImporter.cpp" > </File> @@ -3724,6 +3728,10 @@ </FileConfiguration> </File> <File + RelativePath="..\include\COLLADAMayaImageImporter.h" + > + </File> + <File RelativePath="..\include\COLLADAMayaLightImporter.h" > </File> Modified: branches/nextgen/COLLADAMaya/src/COLLADAMayaDocumentImporter.cpp =================================================================== --- branches/nextgen/COLLADAMaya/src/COLLADAMayaDocumentImporter.cpp 2009-02-17 11:37:48 UTC (rev 366) +++ branches/nextgen/COLLADAMaya/src/COLLADAMayaDocumentImporter.cpp 2009-02-18 12:43:48 UTC (rev 367) @@ -22,6 +22,7 @@ #include "COLLADAMayaGeometryImporter.h" #include "COLLADAMayaCameraImporter.h" #include "COLLADAMayaLightImporter.h" +#include "COLLADAMayaImageImporter.h" #include "COLLADAMayaVisualSceneImporter.h" #include "COLLADAMayaVisualSceneImporter.h" @@ -50,12 +51,14 @@ , mEffectImporter (0) , mCameraImporter (0) , mLightImporter (0) + , mImageImporter (0) , mSceneGraphWritten (false) , mAssetWritten (false) , mSceneGraphRead (false) , mGeometryRead (false) , mCameraRead (false) , mLightRead (false) + , mImageRead (false) , mLinearUnitMeter (1) , mNumDocumentParses (0) { @@ -82,6 +85,7 @@ mEffectImporter = new EffectImporter ( this ); mCameraImporter = new CameraImporter ( this ); mLightImporter = new LightImporter ( this ); + mImageImporter = new ImageImporter (this); // Get the sceneID (assign a name to the scene) MString sceneName = MFileIO::currentFile (); @@ -100,6 +104,7 @@ delete mEffectImporter; delete mCameraImporter; delete mLightImporter; + delete mImageImporter; } //----------------------------- @@ -186,6 +191,7 @@ // TODO After the complete read of the collada document, // the connections can be written into the maya file. mMaterialImporter->writeConnections (); + mLightImporter->writeConnections (); // Close the file closeMayaAsciiFile (); @@ -305,12 +311,85 @@ fprintf_s ( mFile, "requires maya \"%s\";\n", mayaVersion.c_str () ); - // TODO Default values for the units! + // Get the unit informations. 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; + // TODO Default values for the units! + String linearUnitName = unit.getLinearUnit (); + double linearUnitMeter = unit.getLinearUnitMeter (); + + // Set the linear unit in meters. + // Maya knows: millimeter, centimeter, meter, foot, inch and yard. + switch ( unit.getLinearUnitUnit () ) + { + case COLLADAFW::FileInfo::Unit::KILOMETER: + { + // Convert to meters + linearUnitName = COLLADAFW::FileInfo::Unit::LINEAR_UNIT_METER_NAME; + linearUnitMeter = COLLADAFW::FileInfo::Unit::LINEAR_UNIT_KILOMETER / COLLADAFW::FileInfo::Unit::LINEAR_UNIT_METER;; + break; + } + case COLLADAFW::FileInfo::Unit::METER: + { + linearUnitName = COLLADAFW::FileInfo::Unit::LINEAR_UNIT_METER_NAME; + linearUnitMeter = COLLADAFW::FileInfo::Unit::LINEAR_UNIT_METER; + break; + } + case COLLADAFW::FileInfo::Unit::DECIMETER: + { + // Convert to meters + linearUnitName = COLLADAFW::FileInfo::Unit::LINEAR_UNIT_METER_NAME; + linearUnitMeter = COLLADAFW::FileInfo::Unit::LINEAR_UNIT_DECIMETER; + break; + } + case COLLADAFW::FileInfo::Unit::CENTIMETER: + { + // Don't convert + linearUnitName = COLLADAFW::FileInfo::Unit::LINEAR_UNIT_CENTIMETER_NAME; + linearUnitMeter = COLLADAFW::FileInfo::Unit::LINEAR_UNIT_CENTIMETER / COLLADAFW::FileInfo::Unit::LINEAR_UNIT_CENTIMETER; + break; + } + case COLLADAFW::FileInfo::Unit::MILLIMETER: + { + // Convert to centimeters + linearUnitName = COLLADAFW::FileInfo::Unit::LINEAR_UNIT_CENTIMETER_NAME; + linearUnitMeter = COLLADAFW::FileInfo::Unit::LINEAR_UNIT_MILLIMETER / COLLADAFW::FileInfo::Unit::LINEAR_UNIT_CENTIMETER; + break; + } + case COLLADAFW::FileInfo::Unit::FOOT: + { + // Don't convert + linearUnitName = COLLADAFW::FileInfo::Unit::LINEAR_UNIT_FOOT_NAME; + linearUnitMeter = COLLADAFW::FileInfo::Unit::LINEAR_UNIT_FOOT / COLLADAFW::FileInfo::Unit::LINEAR_UNIT_FOOT; + break; + } + case COLLADAFW::FileInfo::Unit::INCH: + { + // Don't convert + linearUnitName = COLLADAFW::FileInfo::Unit::LINEAR_UNIT_INCH_NAME; + linearUnitMeter = COLLADAFW::FileInfo::Unit::LINEAR_UNIT_INCH / COLLADAFW::FileInfo::Unit::LINEAR_UNIT_INCH; + break; + } + case COLLADAFW::FileInfo::Unit::YARD: + { + // Don't convert + linearUnitName = COLLADAFW::FileInfo::Unit::LINEAR_UNIT_YARD_NAME; + linearUnitMeter = COLLADAFW::FileInfo::Unit::LINEAR_UNIT_YARD / COLLADAFW::FileInfo::Unit::LINEAR_UNIT_YARD; + break; + } + default: + { + // Set to meters + linearUnitName = COLLADAFW::FileInfo::Unit::LINEAR_UNIT_METER_NAME; + linearUnitMeter = COLLADAFW::FileInfo::Unit::LINEAR_UNIT_METER; + break; + } + } + + fprintf_s ( mFile, "currentUnit -l %s -a %s -t %s;\n", + linearUnitName.c_str (), unit.getAngularUnitName ().c_str (), unit.getTimeUnitName ().c_str () ); + + mLinearUnitMeter = linearUnitMeter; mUpAxisType = asset->getUpAxisType (); // String application ( MGlobal::executeCommandStringResult ( "about -application" ).asChar () ); @@ -325,12 +404,13 @@ mAssetWritten = true; - if ( mSceneGraphRead || mGeometryRead || mCameraRead || mLightRead ) + if ( mSceneGraphRead || mGeometryRead || mCameraRead || mLightRead || mImageRead ) { mSceneGraphRead = false; mGeometryRead = false; mCameraRead = false; mLightRead = false; + mImageRead = false; readColladaDocument (); } @@ -355,11 +435,12 @@ mVisualSceneImporter->importVisualScene ( visualScene ); mSceneGraphWritten = true; - if ( mGeometryRead || mCameraRead || mLightRead ) + if ( mGeometryRead || mCameraRead || mLightRead || mImageRead ) { mGeometryRead = false; mCameraRead = false; mLightRead = false; + mImageRead = false; readColladaDocument (); } @@ -436,7 +517,7 @@ } //----------------------------- - bool DocumentImporter::writeLight ( const COLLADAFW::Light* camera ) + bool DocumentImporter::writeLight ( const COLLADAFW::Light* light ) { // Order: asset, scene graph, others if ( !mAssetWritten || !mSceneGraphWritten ) @@ -449,9 +530,27 @@ if ( mFile == 0 ) start(); // Import the data. - mLightImporter->importLight ( camera ); + mLightImporter->importLight ( light ); return true; } + //----------------------------- + bool DocumentImporter::writeImage ( const COLLADAFW::Image* image ) + { + // Order: asset, scene graph, others + if ( !mAssetWritten || !mSceneGraphWritten ) + { + mImageRead = true; + return true; + } + + // Create the file, if not already done. + if ( mFile == 0 ) start(); + + // Import the data. + mImageImporter->importImage ( image ); + + return true; + } } \ No newline at end of file Added: branches/nextgen/COLLADAMaya/src/COLLADAMayaImageImporter.cpp =================================================================== --- branches/nextgen/COLLADAMaya/src/COLLADAMayaImageImporter.cpp (rev 0) +++ branches/nextgen/COLLADAMaya/src/COLLADAMayaImageImporter.cpp 2009-02-18 12:43:48 UTC (rev 367) @@ -0,0 +1,49 @@ +/* + 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 "COLLADAMayaStableHeaders.h" +#include "COLLADAMayaImageImporter.h" + + +namespace COLLADAMaya +{ + + const String ImageImporter::IMAGE_NAME = "Image"; + + + //------------------------------ + ImageImporter::ImageImporter ( DocumentImporter* documentImporter ) + : BaseImporter ( documentImporter ) + { + } + + //------------------------------ + ImageImporter::~ImageImporter() + { + } + + //------------------------------ + void ImageImporter::importImage ( const COLLADAFW::Image* image ) + { + // Check if the light is already imported. + const COLLADAFW::UniqueId& imageId = image->getUniqueId (); +// if ( findMayaLightNode ( imageId ) != 0 ) return; + + // Create a unique name. + String imageName = image->getName (); + if ( COLLADABU::Utils::equals ( imageName, "" ) ) + imageName = IMAGE_NAME; + imageName = mImageIdList.addId ( imageName ); + + + + + } +} // namespace COLLADAMaya Modified: branches/nextgen/COLLADAMaya/src/COLLADAMayaLightImporter.cpp =================================================================== --- branches/nextgen/COLLADAMaya/src/COLLADAMayaLightImporter.cpp 2009-02-17 11:37:48 UTC (rev 366) +++ branches/nextgen/COLLADAMaya/src/COLLADAMayaLightImporter.cpp 2009-02-18 12:43:48 UTC (rev 367) @@ -20,12 +20,16 @@ #include <MayaDMLight.h> #include <MayaDMAmbientLight.h> #include <MayaDMDirectionalLight.h> +#include <MayaDMLightList.h> +#include <MayaDMObjectSet.h> namespace COLLADAMaya { const String LightImporter::LIGHT_NAME = "Light"; + const String LightImporter::INITIAL_LIGHT_LIST = ":lightList1"; + const String LightImporter::DEFAULT_LIGHT_SET = ":defaultLightSet"; //------------------------------ @@ -37,22 +41,29 @@ //------------------------------ LightImporter::~LightImporter() { + UniqueIdLightNodeMap::const_iterator it = mMayaLightMap.begin (); + if ( it != mMayaLightMap.end () ) + { + MayaDM::Light* light = it->second; + delete light; + } } //------------------------------ void LightImporter::importLight ( const COLLADAFW::Light* light ) { - // Check if the camera is already imported. + // Check if the light is already imported. const COLLADAFW::UniqueId& lightId = light->getUniqueId (); if ( findMayaLightNode ( lightId ) != 0 ) return; - // Get the transform nodes, which work with this camera instance. + // Get the transform nodes, which work with this light instance. VisualSceneImporter* visualSceneImporter = getDocumentImporter ()->getVisualSceneImporter (); - const UniqueIdVec* transformNodes = visualSceneImporter->findCameraTransformIds ( lightId ); + const UniqueIdVec* transformNodes = visualSceneImporter->findLightTransformIds ( lightId ); if ( transformNodes == 0 ) { - MGlobal::displayError ( "No camera node which implements this camera!" ); - std::cerr << "No camera node which implements this camera!" << endl; + MGlobal::displayError ( "No transform node which implements this light!" ); + std::cerr << "No transform node which implements this light!" << endl; + return; } UniqueIdVec::const_iterator nodesIter = transformNodes->begin (); @@ -74,7 +85,7 @@ } else { - // Get the path to the mesh. + // Get the path to the node. MayaNode* mayaLightNode = findMayaLightNode ( lightId ); String lightNodePath = mayaLightNode->getNodePath (); @@ -143,7 +154,7 @@ COLLADAFW::Color color = light->getColor (); mayaLight->setColor ( MayaDM::float3 ( (float)color.getRed (), (float)color.getGreen (), (float)color.getBlue () ) ); - delete mayaLight; + appendLight ( lightId, mayaLight ); } // -------------------------------------------- @@ -203,11 +214,94 @@ // Cone and Penumbra Angles double fallOffAngle = light->getFallOffAngle (); - spotLight->setConeAngle ( COLLADABU::Math::Utils::degToRad ( fallOffAngle ) ); + spotLight->setConeAngle ( fallOffAngle ); // double penumbraAngle = ( light->getOuterAngle() - light->getFallOffAngle() ) / 2.0f; // spotLight->setPenumbraAngle ( COLLADABU::Math::Utils::degToRad ( penumbraAngle )); } + // -------------------------- + MayaDM::Light* LightImporter::findMayaLight ( const COLLADAFW::UniqueId& val ) const + { + UniqueIdLightNodeMap::const_iterator it = mMayaLightMap.find ( val ); + if ( it != mMayaLightMap.end () ) + { + return it->second; + } + return 0; + } + + // -------------------------- + void LightImporter::appendLight ( const COLLADAFW::UniqueId& id, MayaDM::Light* lightNode ) + { + mMayaLightMap [id] = lightNode; + } + + // -------------------------------------------- + void LightImporter::writeConnections () + { + FILE* file = getDocumentImporter ()->getFile (); + + // Create a dummy object for the light list. + MayaDM::LightList lightList ( file, INITIAL_LIGHT_LIST, "", false ); + + size_t lightIndex = 0; + size_t lightSetIndex = 0; + UniqueIdMayaNodesMap::iterator it = mMayaLightNodesMap.begin (); + while ( it != mMayaLightNodesMap.end () ) + { + const COLLADAFW::UniqueId& lightId = it->first; + MayaNode& mayaNode = it->second; + + MayaDM::DependNode* dependNode = findMayaLight ( lightId ); + MayaDM::Light* lightNode = ( MayaDM::Light* ) dependNode; + dependNode->setName ( mayaNode.getNodePath () ); + + // Connect the light data of the lights (just real ones, no instances), with the light list. + //connectAttr "|spotLight1|spotLightShape1.lightData" ":lightList1.lights" -nextAvailable; + //connectAttr "spotLightShape2.lightData" ":lightList1.lights" -nextAvailable; + connectAttr ( file, lightNode->getLightData (), lightList.getLights ( lightIndex ) ); + ++lightIndex; + + // Get the transform nodes, which work with this light instance. + VisualSceneImporter* visualSceneImporter = getDocumentImporter ()->getVisualSceneImporter (); + const UniqueIdVec* transformNodes = visualSceneImporter->findLightTransformIds ( lightId ); + if ( transformNodes == 0 ) + { + MGlobal::displayError ( "No transform node which implements this light!" ); + std::cerr << "No transform node which implements this light!" << endl; + return; + } + + size_t nodeIndex = 0; + UniqueIdVec::const_iterator nodesIter = transformNodes->begin (); + while ( nodesIter != transformNodes->end () ) + { + // Get the transform node. + const COLLADAFW::UniqueId& transformNodeId = *nodesIter; + MayaNode* mayaTransformNode = visualSceneImporter->findMayaTransformNode ( transformNodeId ); + String transformNodeName = mayaTransformNode->getName (); + String transformNodePath = mayaTransformNode->getNodePath (); + MayaDM::Transform transformNode ( file, transformNodePath, "", false ); + + // Get the default light set to add the light transform nodes. + MayaDM::ObjectSet lightSet ( file, DEFAULT_LIGHT_SET, "", false ); + + // Connect the light transforms instance object groups with the default light set. + //connectAttr "spotLight1.instObjGroups" ":defaultLightSet.dagSetMembers" -nextAvailable; + //connectAttr "|spotLight2.instObjGroups" ":defaultLightSet.dagSetMembers" -nextAvailable; + //connectAttr "spotLight3.instObjGroups" ":defaultLightSet.dagSetMembers" -nextAvailable; + connectAttr ( file, transformNode.getInstObjGroups (0), lightSet.getDagSetMembers (lightSetIndex) ); + ++lightSetIndex; + + ++nodesIter; + } + + ++it; + } + + + } + } // namespace COLLADAMaya Modified: branches/nextgen/COLLADAMaya/src/COLLADAMayaMaterialImporter.cpp =================================================================== --- branches/nextgen/COLLADAMaya/src/COLLADAMayaMaterialImporter.cpp 2009-02-17 11:37:48 UTC (rev 366) +++ branches/nextgen/COLLADAMaya/src/COLLADAMayaMaterialImporter.cpp 2009-02-18 12:43:48 UTC (rev 367) @@ -34,8 +34,8 @@ const String MaterialImporter::MATERIAL_NAME = "Material"; const String MaterialImporter::SHADING_ENGINE_NAME = "ShadingEngine"; const String MaterialImporter::MATERIAL_INFO_NAME = "MaterialInfo"; - const String MaterialImporter::DEFAULT_SHADER_LIST = "defaultShaderList1"; - const String MaterialImporter::DEFAULT_SHADING_ENGINE = "initialShadingGroup"; + const String MaterialImporter::DEFAULT_SHADER_LIST = ":defaultShaderList1"; + const String MaterialImporter::INITIAL_SHADING_ENGINE = ":initialShadingGroup"; const String MaterialImporter::ATTR_SHADERS = "shaders"; @@ -201,18 +201,39 @@ mShadingEngineBindingMap [shadingEngineId].insert ( shadingBinding ); } + // -------------------------- + size_t MaterialImporter::getGeometryInstanceIndex ( + const COLLADAFW::UniqueId& geometryId, + const COLLADAFW::UniqueId& transformNodeId ) + { + size_t meshInstanceIndex = 0; + + // Get all visual scene nodes, which use this geometry and make the parent connections. + VisualSceneImporter* visualSceneImporter = getDocumentImporter ()->getVisualSceneImporter (); + const UniqueIdVec* transformNodes = visualSceneImporter->findGeometryTransformIds ( geometryId ); + size_t numNodeInstances = transformNodes->size (); + + bool found = false; + for ( size_t index=0; index<numNodeInstances && !found; ++index ) + { + const COLLADAFW::UniqueId& nodeId = (*transformNodes) [index]; + if ( nodeId == transformNodeId ) + { + meshInstanceIndex = index; + found = true; + } + } + return meshInstanceIndex; + } + // -------------------------- void MaterialImporter::writeConnections () { - // TODO // select -noExpand :defaultShaderList1; - // setAttr -size 4 ".shaders"; // select -noExpand :initialShadingGroup; FILE* file = getDocumentImporter ()->getFile (); - String defaultShaderName = ":" + DEFAULT_SHADER_LIST; - mayaSelect ( file, defaultShaderName, true ); - String defaultShadingEngineName = ":" + DEFAULT_SHADING_ENGINE; - mayaSelect ( file, defaultShadingEngineName, true ); + mayaSelect ( file, DEFAULT_SHADER_LIST, true ); + mayaSelect ( file, INITIAL_SHADING_ENGINE, true ); // If there are some object groups, we have to connect them with the geometries. connectGeometryGroups(); @@ -228,31 +249,6 @@ } // -------------------------- - size_t MaterialImporter::getGeometryInstanceIndex ( - const COLLADAFW::UniqueId& geometryId, - const COLLADAFW::UniqueId& transformNodeId ) - { - size_t meshInstanceIndex = 0; - - // Get all visual scene nodes, which use this geometry and make the parent connections. - VisualSceneImporter* visualSceneImporter = getDocumentImporter ()->getVisualSceneImporter (); - const UniqueIdVec* transformNodes = visualSceneImporter->findGeometryTransformIds ( geometryId ); - size_t numNodeInstances = transformNodes->size (); - - bool found = false; - for ( size_t index=0; index<numNodeInstances && !found; ++index ) - { - const COLLADAFW::UniqueId& nodeId = (*transformNodes) [index]; - if ( nodeId == transformNodeId ) - { - meshInstanceIndex = index; - found = true; - } - } - return meshInstanceIndex; - } - - // -------------------------- void MaterialImporter::connectShadingEngines () { ShadingDataMap::iterator shaderDataIter = mShaderDataMap.begin(); @@ -401,15 +397,12 @@ const EffectImporter::UniqueIdDependNodeMap& effectMap = effectImporter->getMayaEffectMap (); EffectImporter::UniqueIdDependNodeMap::const_iterator it = effectMap.begin (); - String defaultShaderName = ":" + DEFAULT_SHADER_LIST; - MayaDM::DefaultShaderList defaultShaderList ( file, defaultShaderName, "", false ); - //MayaDM::ShadingEngine defaultShadingEngine ( file, defaultShadingEngineName, "", false ); + MayaDM::DefaultShaderList defaultShaderList ( file, DEFAULT_SHADER_LIST, "", false ); size_t shaderIndex = 0; while ( it != effectMap.end () ) { MayaDM::DependNode* dependNode = it->second; - String destination = ":" + DEFAULT_SHADER_LIST + "." + ATTR_SHADERS; connectAttr ( file, dependNode->getMessage (), defaultShaderList.getShaders (shaderIndex) ); ++shaderIndex; ++it; Modified: branches/nextgen/COLLADAMaya/src/COLLADAMayaVisualSceneImporter.cpp =================================================================== --- branches/nextgen/COLLADAMaya/src/COLLADAMayaVisualSceneImporter.cpp 2009-02-17 11:37:48 UTC (rev 366) +++ branches/nextgen/COLLADAMaya/src/COLLADAMayaVisualSceneImporter.cpp 2009-02-18 12:43:48 UTC (rev 367) @@ -61,6 +61,9 @@ importNode ( rootNode ); } + // Write all the node instances + writeNodeInstances (); + return true; } @@ -99,8 +102,8 @@ importTransformations ( node, transformNode ); // Import the instances. + readNodeInstances ( node ); readGeometryInstances ( node ); - readNodeInstances ( node ); readCameraInstances ( node ); readLightInstances ( node ); @@ -670,6 +673,18 @@ } // ----------------------------------- + const BaseImporter::UniqueIdVec* VisualSceneImporter::findTransformInstances ( + const COLLADAFW::UniqueId& transformId ) const + { + UniqueIdUniqueIdsMap::const_iterator it = mTransformInstancesMap.find ( transformId ); + + if ( it != mTransformInstancesMap.end () ) + return &(*it).second; + + return 0; + } + + // ----------------------------------- const BaseImporter::UniqueIdVec* VisualSceneImporter::findGeometryTransformIds ( const COLLADAFW::UniqueId& geometryId ) const { @@ -706,34 +721,65 @@ } // ----------------------------------- - bool VisualSceneImporter::readNodeInstances ( const COLLADAFW::Node* node ) + bool VisualSceneImporter::readNodeInstances ( const COLLADAFW::Node* parentNode ) { - const COLLADAFW::InstanceNodeArray& nodeInstances = node->getInstanceNodes (); + const COLLADAFW::UniqueId& parentNodeId = parentNode->getUniqueId (); + + const COLLADAFW::InstanceNodeArray& nodeInstances = parentNode->getInstanceNodes (); size_t numInstances = nodeInstances.getCount (); for ( size_t i=0; i<numInstances; ++i ) { - const COLLADAFW::InstanceNode* nodeInstance = nodeInstances [i]; - const COLLADAFW::UniqueId& childInstanceId = nodeInstance->getInstanciatedObjectId (); + // Hold the information to create this instance. + const COLLADAFW::InstanceNode* instanceNode = nodeInstances [i]; + const COLLADAFW::UniqueId& instanceNodeId = instanceNode->getInstanciatedObjectId (); - // Check if the original node is already generated! - MayaNode* mayaChildNode = findMayaTransformNode ( childInstanceId ); - String childNodeName = mayaChildNode->getName (); - - // Get the pathes. - const COLLADAFW::UniqueId& nodeId = node->getUniqueId (); - MayaNode* mayaNode = findMayaTransformNode ( 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 ); + // Push the parent node of the instanciated node in the list of instance node parents. + // The map holds for every transform node a list of all existing parent transform nodes + // (this are the nodes, which hold an instance of the current transform node). + mTransformInstancesMap [ instanceNodeId ].push_back ( parentNodeId ); } return true; } // ----------------------------------- + void VisualSceneImporter::writeNodeInstances () + { + UniqueIdUniqueIdsMap::iterator it = mTransformInstancesMap.begin (); + while ( it != mTransformInstancesMap.end() ) + { + const COLLADAFW::UniqueId& instanceNodeId = it->first; + + BaseImporter::UniqueIdVec& parentNodes = it->second; + size_t numInstances = parentNodes.size (); + for ( size_t i=0; i<numInstances; ++i ) + { + const COLLADAFW::UniqueId& parentNodeId = parentNodes [i]; + + // TODO Check if the original node is already generated! + MayaNode* mayaChildNode = findMayaTransformNode ( instanceNodeId ); + if ( mayaChildNode == 0 ) + { + MGlobal::displayError ( "The referenced transform node doesn't exist!" ); + std::cerr << "The referenced transform node doesn't exist!" << endl; + } + String childNodeName = mayaChildNode->getName (); + String childNodePath = mayaChildNode->getNodePath (); + + // Get the pathes. + MayaNode* mayaParentNode = findMayaTransformNode ( parentNodeId ); + String parentNodePath = mayaParentNode->getNodePath (); + + // parent -shape -noConnections -relative -addObject "|node1|node2" "|rootNode"; + FILE* file = getDocumentImporter ()->getFile (); + MayaDM::parentShape ( file, childNodePath, parentNodePath, false, true, true, true ); + } + + ++it; + } + } + + // ----------------------------------- bool VisualSceneImporter::readGeometryInstances ( const COLLADAFW::Node* node ) { // Get the unique id of the current node. Modified: branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLAssetLoader.h =================================================================== --- branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLAssetLoader.h 2009-02-17 11:37:48 UTC (rev 366) +++ branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLAssetLoader.h 2009-02-18 12:43:48 UTC (rev 367) @@ -139,8 +139,8 @@ virtual bool begin__unit( const unit__AttributeData& attributeData ) { - mAsset->getUnit().mLinearUnit = String ( (char*) attributeData.name ); - mAsset->getUnit().mLinearUnitMeter = attributeData.meter; + mAsset->getUnit().setLinearUnit ( String ( (char*) attributeData.name ) ); + mAsset->getUnit().setLinearUnitMeter ( 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: <jud...@us...> - 2009-02-17 12:55:21
|
Revision: 366 http://colladamaya.svn.sourceforge.net/colladamaya/?rev=366&view=rev Author: judithschenk Date: 2009-02-17 11:37:48 +0000 (Tue, 17 Feb 2009) Log Message: ----------- Bugfix on export skin controller Modified Paths: -------------- branches/nextgen/COLLADAMaya/src/COLLADAMayaVisualSceneExporter.cpp Modified: branches/nextgen/COLLADAMaya/src/COLLADAMayaVisualSceneExporter.cpp =================================================================== --- branches/nextgen/COLLADAMaya/src/COLLADAMayaVisualSceneExporter.cpp 2009-02-17 11:04:37 UTC (rev 365) +++ branches/nextgen/COLLADAMaya/src/COLLADAMayaVisualSceneExporter.cpp 2009-02-17 11:37:48 UTC (rev 366) @@ -217,6 +217,86 @@ } } + // Export type-specific information + MFn::Type type = dagPath.apiType(); + switch (type) + { + case MFn::kLookAt: + case MFn::kParentConstraint: + case MFn::kOrientConstraint: + case MFn::kConstraint: + case MFn::kAimConstraint: + case MFn::kPoleVectorConstraint: + case MFn::kPointConstraint: + case MFn::kNormalConstraint: + MGlobal::displayError ( "Export of constraints not supported: " + + MString ( sceneElement->getNodeName ().c_str () ) ); + break; + + case MFn::kAmbientLight: + case MFn::kSpotLight: + case MFn::kPointLight: + case MFn::kDirectionalLight: + break; + + case MFn::kMesh: + break; + + case MFn::kIkHandle: + if ( ExportOptions::exportJointsAndSkin() ) + { + MGlobal::displayError ( "Export of ik handles not supported: " + + MString ( sceneElement->getNodeName ().c_str () ) ); + } + break; + + case MFn::kCamera: + break; + + case MFn::kRigid: + if ( ExportOptions::exportPhysics() ) + { + MGlobal::displayError ( "Export of physics not supported: " + + MString ( sceneElement->getNodeName ().c_str () ) ); + } + break; + + case MFn::kNurbsCurve: + { + MGlobal::displayError ( "Export of spline not supported: " + + MString ( sceneElement->getNodeName ().c_str () ) ); + } + break; + case MFn::kNurbsSurface: + { + MGlobal::displayError ( "Export of nurbs not supported: " + + MString ( sceneElement->getNodeName ().c_str () ) ); + } + break; + case MFn::kEmitter: + { + MGlobal::displayError ( "Export of emitters not supported: " + + MString ( sceneElement->getNodeName ().c_str () ) ); + } + break; + case MFn::kAir: + case MFn::kDrag: + case MFn::kField: + case MFn::kGravity: + case MFn::kNewton: + case MFn::kRadial: + case MFn::kTurbulence: + case MFn::kUniform: + case MFn::kVortex: + case MFn::kVolumeAxis: + { + MGlobal::displayError ( "Could not export. Unknown node type: " + + MString ( sceneElement->getNodeName ().c_str () ) ); + } + break; + default: break; + } + // Check if the element isn't already exported if ( isLocal && !hasPreviousInstance ) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jud...@us...> - 2009-02-17 11:04:46
|
Revision: 365 http://colladamaya.svn.sourceforge.net/colladamaya/?rev=365&view=rev Author: judithschenk Date: 2009-02-17 11:04:37 +0000 (Tue, 17 Feb 2009) Log Message: ----------- Bugfix on export skin controller Modified Paths: -------------- branches/nextgen/COLLADAMaya/include/COLLADAMayaControllerExporter.h branches/nextgen/COLLADAMaya/src/COLLADAMayaControllerExporter.cpp branches/nextgen/COLLADAMaya/src/COLLADAMayaSceneElement.cpp branches/nextgen/COLLADAMaya/src/COLLADAMayaVisualSceneExporter.cpp Modified: branches/nextgen/COLLADAMaya/include/COLLADAMayaControllerExporter.h =================================================================== --- branches/nextgen/COLLADAMaya/include/COLLADAMayaControllerExporter.h 2009-02-17 08:44:52 UTC (rev 364) +++ branches/nextgen/COLLADAMaya/include/COLLADAMayaControllerExporter.h 2009-02-17 11:04:37 UTC (rev 365) @@ -305,13 +305,11 @@ /** * Retrieve the instance information for this skinned character. - * @param meshFn The current mesh object with the function set. * @param clusterFn The skinned character. * @param outputShape The output shape * @return uint The current cluster index. */ uint retrieveInstanceInformation( - const MFnMesh& meshFn, const MFnGeometryFilter& clusterFn, MDagPath& outputShape ); Modified: branches/nextgen/COLLADAMaya/src/COLLADAMayaControllerExporter.cpp =================================================================== --- branches/nextgen/COLLADAMaya/src/COLLADAMayaControllerExporter.cpp 2009-02-17 08:44:52 UTC (rev 364) +++ branches/nextgen/COLLADAMaya/src/COLLADAMayaControllerExporter.cpp 2009-02-17 11:04:37 UTC (rev 365) @@ -497,10 +497,6 @@ // Push the exported controller in the export list mExportedControllers.push_back ( controllerId ); - // Attach a function set to the controller node. - MStatus status; - MFnMesh meshFn ( controllerNode, &status ); - // Figure out which type of skin controller we currently have: mesh-centric or joint-centric bool isJointCluster = controllerNode.hasFn(MFn::kJointCluster); bool isSkinCluster = controllerNode.hasFn(MFn::kSkinClusterFilter); @@ -508,7 +504,7 @@ // Retrieve the instance information for this skinned character MFnGeometryFilter clusterFn(controllerNode); - uint clusterIndex = retrieveInstanceInformation( meshFn, clusterFn, outputShape ); + uint clusterIndex = retrieveInstanceInformation ( clusterFn, outputShape ); // Create the controller name MString mayaControllerName = ( isSkinCluster ) ? clusterFn.name() : outputShape.partialPathName(); @@ -915,12 +911,15 @@ //------------------------------------------------------ uint ControllerExporter::retrieveInstanceInformation( - const MFnMesh &fnMesh, const MFnGeometryFilter &clusterFn, MDagPath &outputShape ) { MStatus status; + // Attach a function set to the controller node. + MFnMesh fnMesh ( outputShape, &status ); + CHECK_MSTATUS (status); + uint idx = clusterFn.indexForOutputShape(outputShape.node()); if (idx == ~0u) { Modified: branches/nextgen/COLLADAMaya/src/COLLADAMayaSceneElement.cpp =================================================================== --- branches/nextgen/COLLADAMaya/src/COLLADAMayaSceneElement.cpp 2009-02-17 08:44:52 UTC (rev 364) +++ branches/nextgen/COLLADAMaya/src/COLLADAMayaSceneElement.cpp 2009-02-17 11:04:37 UTC (rev 365) @@ -34,6 +34,7 @@ , mIsLocal ( true ) , mIsForced ( false ) , mIsVisible ( false ) + , mHasJoint ( false ) , mInstantiatedSceneElement ( NULL ) {} Modified: branches/nextgen/COLLADAMaya/src/COLLADAMayaVisualSceneExporter.cpp =================================================================== --- branches/nextgen/COLLADAMaya/src/COLLADAMayaVisualSceneExporter.cpp 2009-02-17 08:44:52 UTC (rev 364) +++ branches/nextgen/COLLADAMaya/src/COLLADAMayaVisualSceneExporter.cpp 2009-02-17 11:04:37 UTC (rev 365) @@ -128,10 +128,6 @@ // The unique ID String meshId = mDocumentExporter->dagPathToColladaId ( dagPath ); -// // Attach a function set -// MFnDependencyNode fn ( dagPath.node() ); -// String nodeNameCollada = mDocumentExporter->mayaNameToColladaName ( fn.name(), true ); -// String meshId = /*GEOMETRY_ID_PRAEFIX +*/ nodeNameCollada; // The transform node MStatus status; @@ -148,7 +144,6 @@ bool isForced = sceneElement->getIsForced(); bool isVisible = sceneElement->getIsVisible(); bool isExportNode = sceneElement->getIsExportNode(); -// if ( !sceneGraph->getIsExportNode ( dagPath, isForced, isVisible ) ) return false; // Check for a file reference bool isLocal = sceneElement->getIsLocal(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rob...@us...> - 2009-02-17 08:45:07
|
Revision: 364 http://colladamaya.svn.sourceforge.net/colladamaya/?rev=364&view=rev Author: robertwuerfel Date: 2009-02-17 08:44:52 +0000 (Tue, 17 Feb 2009) Log Message: ----------- textures in framework and framework loader ( untested ) Modified Paths: -------------- branches/nextgen/COLLADAFramework/include/COLLADAFWCamera.h branches/nextgen/COLLADAFramework/include/COLLADAFWColorOrTexture.h branches/nextgen/COLLADAFramework/include/COLLADAFWEffect.h branches/nextgen/COLLADAFramework/include/COLLADAFWEffectCommon.h branches/nextgen/COLLADAFramework/include/COLLADAFWIWriter.h branches/nextgen/COLLADAFramework/include/COLLADAFWImage.h branches/nextgen/COLLADAFramework/include/COLLADAFWTypes.h branches/nextgen/COLLADAFramework/scripts/COLLADAFramework.vcproj branches/nextgen/COLLADAMax/include/COLLADAMaxDocumentImporter.h branches/nextgen/COLLADAMax/src/COLLADAMaxDocumentImporter.cpp branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLFileLoader.h branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLLibraryCamerasLoader.h branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLLibraryEffectsLoader.h branches/nextgen/COLLADASaxFrameworkLoader/scripts/COLLADASaxFrameworkLoader.vcproj branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLFileLoader.cpp branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLLibraryEffectsLoader.cpp branches/nextgen/Externals/LibXML/include/libxml/xpath.h branches/nextgen/Externals/LibXML/xmlregexp.c Added Paths: ----------- branches/nextgen/COLLADAFramework/include/COLLADAFWSampler.h branches/nextgen/COLLADAFramework/include/COLLADAFWTexture.h branches/nextgen/COLLADAFramework/src/COLLADAFWImage.cpp branches/nextgen/COLLADAFramework/src/COLLADAFWSampler.cpp branches/nextgen/COLLADAFramework/src/COLLADAFWTexture.cpp branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLLibraryImagesLoader.h branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLLibraryImagesLoader.cpp Modified: branches/nextgen/COLLADAFramework/include/COLLADAFWCamera.h =================================================================== --- branches/nextgen/COLLADAFramework/include/COLLADAFWCamera.h 2009-02-16 17:27:30 UTC (rev 363) +++ branches/nextgen/COLLADAFramework/include/COLLADAFWCamera.h 2009-02-17 08:44:52 UTC (rev 364) @@ -83,16 +83,16 @@ void setName(const COLLADAFW::String& name) { mName = name; } /** Returns the type of the camera.*/ - const CameraType& getCameraType() const { return mCameraType; } + CameraType getCameraType() const { return mCameraType; } /** Sets the type of the camera.*/ - void setCameraType( const CameraType& cameraType) { mCameraType = cameraType; } + void setCameraType( CameraType cameraType) { mCameraType = cameraType; } /** Returns the type of description used to define the perspective camera.*/ - const DescriptionType& getDescriptionType() const { return mDescriptionType; } + DescriptionType getDescriptionType() const { return mDescriptionType; } /** sets the type of description used to define the perspective camera.*/ - void setDescriptionType(const DescriptionType& descriptionType) { mDescriptionType = descriptionType; } + void setDescriptionType(DescriptionType descriptionType) { mDescriptionType = descriptionType; } /** Returns the horizontal field of view. Use only for perspective cameras.*/ double getXFov() const { return mXFovOrXMag; } Modified: branches/nextgen/COLLADAFramework/include/COLLADAFWColorOrTexture.h =================================================================== --- branches/nextgen/COLLADAFramework/include/COLLADAFWColorOrTexture.h 2009-02-16 17:27:30 UTC (rev 363) +++ branches/nextgen/COLLADAFramework/include/COLLADAFWColorOrTexture.h 2009-02-17 08:44:52 UTC (rev 364) @@ -13,7 +13,7 @@ #include "COLLADAFWPrerequisites.h" #include "COLLADAFWColor.h" -//#include "COLLADAFWTexture.h" +#include "COLLADAFWTexture.h" #include <vector> #include <map> @@ -37,64 +37,46 @@ private: Type mType; Color mColor; - //Texture mTexture; - String mSid; + Texture mTexture; public: /** Constructor to create a ColorOrTexture object that represents a color. @param color The color that should be represented. */ - ColorOrTexture ( Color color, const String& sid = "" ) + ColorOrTexture ( Color color) : mColor ( color ) , mType ( COLOR ) - , mSid ( sid ) {}; /** 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 ) : mTexture ( texture ) , mType ( TEXTURE ) - , mSid ( sid ) {}; -*/ - /** Creates an invalid CommonColorOrTextureType*/ + + /** Creates an invalid CommonColorOrTextureType*/ ColorOrTexture() : mType ( UNSPECIFIED ) {}; - /** Copy-Constructor */ - ColorOrTexture ( const ColorOrTexture& cot ) - { - mColor = cot.mColor; -// mTexture = cot.mTexture; - mType = cot.mType; - mSid = cot.mSid; - } - - /** Returns the type of the color or texture.*/ + /** 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 - { - return mSid; - } - - /** Return true if the CommonColorOrTextureType is a valid color, false otherwise*/ + /** Return true if the CommonColorOrTextureType is a valid color, false otherwise*/ bool isColor() const { return ( mType == COLOR ) && ( mColor.isValid() ); } /** 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 { @@ -115,17 +97,16 @@ } /** 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-16 17:27:30 UTC (rev 363) +++ branches/nextgen/COLLADAFramework/include/COLLADAFWEffect.h 2009-02-17 08:44:52 UTC (rev 364) @@ -18,7 +18,6 @@ #include "COLLADAFWEffectCommon.h" - namespace COLLADAFW { @@ -62,6 +61,7 @@ /** 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.*/ Modified: branches/nextgen/COLLADAFramework/include/COLLADAFWEffectCommon.h =================================================================== --- branches/nextgen/COLLADAFramework/include/COLLADAFWEffectCommon.h 2009-02-16 17:27:30 UTC (rev 363) +++ branches/nextgen/COLLADAFramework/include/COLLADAFWEffectCommon.h 2009-02-17 08:44:52 UTC (rev 364) @@ -15,12 +15,15 @@ #include "COLLADAFWColorOrTexture.h" #include "COLLADAFWPointerArray.h" +#include "COLLADAFWSampler.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 { @@ -34,6 +37,8 @@ SHADER_PHONG, SHADER_LAMBERT }; + + private: /** The shader used by the effect.*/ @@ -126,6 +131,9 @@ */ FloatOrParam mIndexOfRefraction; + /** All the samplers used as texture in the CommanEffect.*/ + SamplerPointerArray mSamplers; + public: /** Constructor. */ @@ -408,6 +416,13 @@ */ void setIndexOfRefraction( const FloatOrParam& IndexOfRefraction ) { mIndexOfRefraction = IndexOfRefraction; } + /** Returns the samplers used by the common effect.*/ + SamplerPointerArray& getSamplerPointerArray() { return mSamplers; } + + /** Returns the samplers used by the common effect.*/ + const SamplerPointerArray& getSamplerPointerArray() const { return mSamplers; } + + /** clones the effect*/ EffectCommon* clone( ) { return FW_NEW EffectCommon(*this); } Modified: branches/nextgen/COLLADAFramework/include/COLLADAFWIWriter.h =================================================================== --- branches/nextgen/COLLADAFramework/include/COLLADAFWIWriter.h 2009-02-16 17:27:30 UTC (rev 363) +++ branches/nextgen/COLLADAFramework/include/COLLADAFWIWriter.h 2009-02-17 08:44:52 UTC (rev 364) @@ -23,6 +23,7 @@ class Material; class Effect; class Camera; + class Image; class Light; @@ -81,6 +82,10 @@ @return The writer should return true, if writing succeeded, false otherwise.*/ virtual bool writeCamera( const Camera* camera ) = 0; + /** When this method is called, the writer must write the image. + @return The writer should return true, if writing succeeded, false otherwise.*/ + virtual bool writeImage( const Image* image ) = 0; + /** When this method is called, the writer must write the light. @return The writer should return true, if writing succeeded, false otherwise.*/ virtual bool writeLight( const Light* camera ) = 0; Modified: branches/nextgen/COLLADAFramework/include/COLLADAFWImage.h =================================================================== --- branches/nextgen/COLLADAFramework/include/COLLADAFWImage.h 2009-02-16 17:27:30 UTC (rev 363) +++ branches/nextgen/COLLADAFramework/include/COLLADAFWImage.h 2009-02-17 08:44:52 UTC (rev 364) @@ -1,5 +1,5 @@ /* - Copyright (c) 2008 NetAllied Systems GmbH + Copyright(c) 2008 NetAllied Systems GmbH This file is part of COLLADAFramework. @@ -12,8 +12,9 @@ #define __COLLADAFW_IMAGE_H__ #include "COLLADAFWPrerequisites.h" -#include "COLLADAFWImageSource.h" +#include "COLLADAFWObject.h" +#include "COLLADABUURI.h" namespace COLLADAFW { @@ -21,7 +22,7 @@ /** Declares the storage for the graphical representation of an object. Digital imagery comes in three main forms of data: raster, vector, and hybrid. Raster imagery comprises a - sequence of brightness or color values, called picture elements (pixels), that together form the complete + sequence of brightness or color values, called picture elements(pixels), that together form the complete picture. Vector imagery uses mathematical formulae for curves, lines, and shapes to describe a picture or drawing. Hybrid imagery combines both raster and vector information, leveraging their respective strengths, to describe the picture. @@ -30,15 +31,23 @@ by texture look-up functions to access noncolor values such as displacement, normal, or height field values. */ - class Image + class Image : public ObjectTemplate < COLLADA_TYPE::IMAGE > { + public: + enum SourceType + { + SOURCE_TYPE_URI, + SOURCE_TYPE_DATA, + SOURCE_TYPE_UNKNOWN + }; + + typedef ArrayPrimitiveType<char> CharacterArray; + private: - - /** A text string containing the unique identifier of the <image> element. This value must - be unique within the instance document. Optional. */ - String mId; + /** The source type of the image. */ + SourceType mSourceType; - /** The text string name of this element. Optional. */ + /** The name of the image*/ String mName; /** A text string value that indicates the image format. It describes the encoding of the @@ -48,14 +57,13 @@ this attribute to "JPG". Optional. */ String mFormat; - /** An integer value that indicates the height of the image in pixels. Optional. */ + /** The height of the image in pixels. */ unsigned int mHeight; - /** An integer value that indicates the width of the image in pixels. Optional. */ + /** The width of the image in pixels. */ unsigned int mWidth; - /** An integer value that indicates the depth of the image in pixels. A 2-D image has a - depth of 1, which is the default. Optional. */ + /** The depth of the image in pixels. A 2-D image has a depth of 1, which is the default. Optional. */ unsigned int mDepth; /** This specifies either embedded image data or an external image file. One of the @@ -64,71 +72,88 @@ image data. This element has no attributes or child elements. \x95 <init_from>: Contains a string of type xs:anyURI that specifies an external image file. This element has no attributes or child elements. */ - ImageSource mImageSource; + /** The URI of the image. */ + COLLADABU::URI mImageURI; + + /** Contains a sequence of hexadecimal encoded binary octets composing the embedded + image data.*/ + CharacterArray mData; + + public: - /** Constructor. */ - Image() {} + /** @param objectId The object id of the image.*/ + Image( ObjectId objectId ); /** Destructor. */ - virtual ~Image() {} + virtual ~Image(); - /** A text string containing the unique identifier of the <image> element. This value must - be unique within the instance document. Optional. */ - const String getId () const { return mId; } + /** Returns the source type of the image. */ + SourceType getSourceType() const { return mSourceType; } - /** A text string containing the unique identifier of the <image> element. This value must - be unique within the instance document. Optional. */ - void setId ( const String Id ) { mId = Id; } + /** Sets the source type of the image. */ + void setSourceType(SourceType sourceType ) { mSourceType = sourceType; } - /** The text string name of this element. Optional. */ - const String getName () const { return mName; } + /** Returns the name of the image*/ + const String& getName() const { return mName; } - /** The text string name of this element. Optional. */ - void setName ( const String Name ) { mName = Name; } + /** Returns the name of the image*/ + void setName( const String& name ) { mName = name; } /** A text string value that indicates the image format. It describes the encoding of the image in <data> or the format of the image referenced by <init_from> if it is in a nonstandard format that cannot be identified by its file extension. For example, if <data> in a COLLADA document contains the digital contents of a JPEG file, then set this attribute to "JPG". Optional. */ - const String getFormat () const { return mFormat; } + const String& getFormat() const { return mFormat; } /** A text string value that indicates the image format. It describes the encoding of the image in <data> or the format of the image referenced by <init_from> if it is in a nonstandard format that cannot be identified by its file extension. For example, if <data> in a COLLADA document contains the digital contents of a JPEG file, then set this attribute to "JPG". Optional. */ - void setFormat ( const String Format ) { mFormat = Format; } + void setFormat( const String format ) { mFormat = format; } - /** An integer value that indicates the height of the image in pixels. Optional. */ - const unsigned int getHeight () const { return mHeight; } + /** Returns the height of the image in pixels. */ + unsigned int getHeight() const { return mHeight; } - /** An integer value that indicates the height of the image in pixels. Optional. */ - void setHeight ( const unsigned int Height ) { mHeight = Height; } + /** Sets the height of the image in pixels. */ + void setHeight( unsigned int height ) { mHeight = height; } - /** An integer value that indicates the width of the image in pixels. Optional. */ - const unsigned int getWidth () const { return mWidth; } + /** Returns the width of the image in pixels. */ + unsigned int getWidth() const { return mWidth; } - /** An integer value that indicates the width of the image in pixels. Optional. */ - void setWidth ( const unsigned int Width ) { mWidth = Width; } + /** Sets the width of the image in pixels. */ + void setWidth( unsigned int width ) { mWidth = width; } - /** An integer value that indicates the depth of the image in pixels. A 2-D image has a - depth of 1, which is the default. Optional. */ - const unsigned int getDepth () const { return mDepth; } + /** Returns the depth of the image in pixels. A 2-D image has a depth of 1, which is the default.*/ + unsigned int getDepth() const { return mDepth; } - /** An integer value that indicates the depth of the image in pixels. A 2-D image has a - depth of 1, which is the default. Optional. */ - void setDepth ( const unsigned int Depth ) { mDepth = Depth; } + /** Sets the depth of the image in pixels. A 2-D image has a depth of 1, which is the default.*/ + void setDepth( unsigned int depth ) { mDepth = depth; } + /** Returns the URI of the Image */ + const COLLADABU::URI& getImageURI() const { return mImageURI; } + + /** Returns the URI of the Image */ + void setImageURI( const COLLADABU::URI& imageURI ) { mImageURI = imageURI; } + + /** Returns a sequence of hexadecimal encoded binary octets composing the embedded + image data.*/ + const CharacterArray& getData() const { return mData; } + + /** Returns a sequence of hexadecimal encoded binary octets composing the embedded + image data.*/ + CharacterArray& getData() { return mData; } + private: /** Disable default copy ctor. */ Image( const Image& pre ); /** Disable default assignment operator. */ - const Image& operator= ( const Image& pre ); + const Image& operator=( const Image& pre ); }; Added: branches/nextgen/COLLADAFramework/include/COLLADAFWSampler.h =================================================================== --- branches/nextgen/COLLADAFramework/include/COLLADAFWSampler.h (rev 0) +++ branches/nextgen/COLLADAFramework/include/COLLADAFWSampler.h 2009-02-17 08:44:52 UTC (rev 364) @@ -0,0 +1,212 @@ +/* + 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_SAMPLER_H__ +#define __COLLADAFW_SAMPLER_H__ + +#include "COLLADAFWPrerequisites.h" + +#include "COLLADAFWUniqueId.h" +#include "COLLADAFWColor.h" +#include "COLLADAFWPointerArray.h" + +namespace COLLADAFW +{ + + /** Declares the storage for the graphical representation of an object. */ + class Sampler + { + public: + /** The different sampler types. */ + enum SamplerType + { + SAMPLER_TYPE_UNSPECIFIED, + SAMPLER_TYPE_1D, + SAMPLER_TYPE_2D, + SAMPLER_TYPE_3D, + SAMPLER_TYPE_CUBE, + SAMPLER_TYPE_RECT, + SAMPLER_TYPE_DEPTH, + SAMPLER_TYPE_STATE + }; + + /** Contains the texture filter functions.*/ + enum SamplerFilter + { + SAMPLER_FILTER_UNSPECIFIED, + SAMPLER_FILTER_NONE, + SAMPLER_FILTER_NEAREST, + SAMPLER_FILTER_LINEAR, + SAMPLER_FILTER_NEAREST_MIPMAP_NEAREST, + SAMPLER_FILTER_LINEAR_MIPMAP_NEAREST, + SAMPLER_FILTER_NEAREST_MIPMAP_LINEAR, + SAMPLER_FILTER_LINEAR_MIPMAP_LINEAR + }; + + /** + Contains the texture wrap modes. + Wrap modes that affect the interpretation of s, t, and p texture + coordinates in <sampler_*> elements. The wrap mode enums map to the + following OpenGL symbols.*/ + enum WrapMode + { + WRAP_MODE_UNSPECIFIED=0, + // NONE == GL_CLAMP_TO BORDER The defined behavior for NONE is + // consistent with decal texturing where the border is black. + // Mapping this calculation to GL_CLAMP_TO_BORDER is the best + // approximation of this. + WRAP_MODE_NONE, + // WRAP == GL_REPEAT Ignores the integer part of texture coordinates, + // using only the fractional part. + WRAP_MODE_WRAP, + // MIRROR == GL_MIRRORED_REPEAT First mirrors the texture coordinate. + // The mirrored coordinate is then clamped as described for CLAMP_TO_EDGE. + WRAP_MODE_MIRROR, + // CLAMP == GL_CLAMP_TO_EDGE Clamps texture coordinates at all + // mipmap levels such that the texture filter never samples a + // border texel. Note: GL_CLAMP takes any texels beyond the + // sampling border and substitutes those texels with the border + // color. So CLAMP_TO_EDGE is more appropriate. This also works + // much better with OpenGL ES where the GL_CLAMP symbol was removed + // from the OpenGL ES specification. + WRAP_MODE_CLAMP, + // BORDER GL_CLAMP_TO_BORDER Clamps texture coordinates at all + // MIPmaps such that the texture filter always samples border + // texels for fragments whose corresponding texture coordinate + // is sufficiently far outside the range [0, 1]. + WRAP_MODE_BORDER + }; + + private: + /** The type of the current sampler. */ + SamplerType mSamplerType; + + /** The unique id of the image used as source for this sampler */ + UniqueId mSourceImageUniqueId; + + /** Texture minimization. Enumerated type fx_sampler_filter_common. + Applying a texture to a primitive implies a mapping from texture image + space to framebuffer image space. In general, this mapping involves + a reconstruction of the sampled texture image, followed by a + homogeneous warping implied by the mapping to framebuffer space, then a + filtering, followed finally by a resampling of the filtered, warped, + reconstructed image before applying it to a fragment. */ + SamplerFilter mMinFilter; + + /** Texture magnification. Enumerated type fx_sampler_filter_common. + When gamma indicates magnification, this value determines how the + texture value is obtained. */ + SamplerFilter mMagFilter; + + /** MIPmap filter. Enumerated type fx_sampler_filter_common. */ + SamplerFilter mMipFilter; + + /** Wrap modes */ + WrapMode mWrapS; + WrapMode mWrapT; + WrapMode mWrapP; + + /** When reading past the edge of the texture address space based on + the wrap modes involving clamps, this color takes over. Type + fx_color_common (four floating-point numbers in RGBA order). */ + Color mBorderColor; + + /** An xs:unsignedByte, which is the maximum number of progressive + levels that the sampler will evaluate. */ + unsigned char mMipmapMaxlevel; + + /** An xs:float, which biases the gamma (level of detail parameter) + that is used by the sampler to evaluate the MIPmap chain. */ + float mMipmapBias; + + public: + + /** Constructor. */ + Sampler(); + + /** Destructor. */ + virtual ~Sampler(); + + /** Returns the sampler type. */ + SamplerType getSamplerType ( ) { return mSamplerType; } + + /** Set the sampler type. */ + void setSamplerType ( SamplerType samplerType ) { mSamplerType = samplerType; } + + /** Returns the unique id of the image used as source for this sampler */ + const UniqueId& getSourceImage () const { return mSourceImageUniqueId; } + + /** Returns the unique id of the image used as source for this sampler */ + void setSource ( const UniqueId& sourceImageUniqueId ) { mSourceImageUniqueId = sourceImageUniqueId; } + + /** Returns min filter*/ + SamplerFilter getMinFilter() const { return mMinFilter; } + + /** Sets the min filter. */ + void setMinFilter ( SamplerFilter minFilter ) { mMinFilter = minFilter; } + + /** Returns mag filter*/ + SamplerFilter getMagFilter() const { return mMagFilter; } + + /** Sets the mag filter. */ + void setMagFilter ( SamplerFilter magFilter ) { mMagFilter = magFilter; } + + /** Returns mip filter*/ + SamplerFilter getMipFilter() const { return mMipFilter; } + + /** Sets the mip filter. */ + void setMipFilter ( SamplerFilter mipFilter ) { mMipFilter = mipFilter; } + + /** Returns the wrap mode in dimension S.*/ + WrapMode getWrapS() const { return mWrapS; } + + /** Sets the wrap mode in dimension S.*/ + void setWrapS ( WrapMode wrapS ) { mWrapS = wrapS; } + + /** Returns the wrap mode in dimension T.*/ + WrapMode getWrapT() const { return mWrapT; } + + /** Sets the wrap mode in dimension T.*/ + void setWrapT ( WrapMode wrapT ) { mWrapT = wrapT; } + + /** Returns the wrap mode in dimension P*/ + WrapMode getWrapP() const { return mWrapP; } + + /** Sets the wrap mode in dimension P.*/ + void setWrapP ( WrapMode wrapP ) { mWrapP = wrapP; } + + /** Returns the border color. */ + const Color& getBorderColor () const { return mBorderColor; } + + /** Sets the border color. */ + void setBorderColor ( const Color& borderColor ) { mBorderColor = borderColor; } + + /** Returns the maximum number of progressive levels that the sampler will evaluate. */ + unsigned char getMipmapMaxlevel () const { return mMipmapMaxlevel; } + + /** Sets the maximum number of progressive levels that the sampler will evaluate. */ + void setMipmapMaxlevel ( unsigned char mipmapMaxlevel ) { mMipmapMaxlevel = mipmapMaxlevel; } + + /** Returns the mipmap Bias.*/ + float getMipmapBias () const { return mMipmapBias; } + + /** Returns the mipmap Bias.*/ + void setMipmapBias ( float mipmapBias ) { mMipmapBias = mipmapBias; } + + Sampler* clone() { return FW_NEW Sampler(*this); } + + }; + + typedef PointerArray<Sampler> SamplerPointerArray; + + +} // namespace COLLADAFW + +#endif // __COLLADAFW_SAMPLER_H__ Added: branches/nextgen/COLLADAFramework/include/COLLADAFWTexture.h =================================================================== --- branches/nextgen/COLLADAFramework/include/COLLADAFWTexture.h (rev 0) +++ branches/nextgen/COLLADAFramework/include/COLLADAFWTexture.h 2009-02-17 08:44:52 UTC (rev 364) @@ -0,0 +1,47 @@ +/* + 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_TEXTURE_H__ +#define __COLLADAFW_TEXTURE_H__ + +#include "COLLADAFWPrerequisites.h" + +#include "COLLADAFWTypes.h" + +namespace COLLADAFW +{ + + /** TODO Documentation */ + class Texture + { + private: + /** The id of the sampler used by the texture.*/ + SamplerID mSamplerId; + + public: + + /** Constructor. */ + Texture(); + + /** Destructor. */ + virtual ~Texture(); + + /** Returns the id of the sampler.*/ + SamplerID getSamplerId() const { return mSamplerId; } + + /** Sets the id of the sampler.*/ + void setSamplerId(SamplerID samplerId) { mSamplerId = samplerId; } + + bool isValid() const { return true; } + }; + +} // namespace COLLADAFW + +#endif // __COLLADAFW_TEXTURE_H__ Modified: branches/nextgen/COLLADAFramework/include/COLLADAFWTypes.h =================================================================== --- branches/nextgen/COLLADAFramework/include/COLLADAFWTypes.h 2009-02-16 17:27:30 UTC (rev 363) +++ branches/nextgen/COLLADAFramework/include/COLLADAFWTypes.h 2009-02-17 08:44:52 UTC (rev 364) @@ -35,6 +35,11 @@ typedef unsigned long MaterialId; + + /** Data type to reference sampler. Used by texture.*/ + typedef size_t SamplerID; + + // Element Type Enum namespace COLLADA_TYPE { Modified: branches/nextgen/COLLADAFramework/scripts/COLLADAFramework.vcproj =================================================================== --- branches/nextgen/COLLADAFramework/scripts/COLLADAFramework.vcproj 2009-02-16 17:27:30 UTC (rev 363) +++ branches/nextgen/COLLADAFramework/scripts/COLLADAFramework.vcproj 2009-02-17 08:44:52 UTC (rev 364) @@ -324,6 +324,10 @@ > </File> <File + RelativePath="..\src\COLLADAFWImage.cpp" + > + </File> + <File RelativePath="..\src\COLLADAFWInstanceEffect.cpp" > </File> @@ -404,6 +408,10 @@ > </File> <File + RelativePath="..\src\COLLADAFWSampler.cpp" + > + </File> + <File RelativePath="..\src\COLLADAFWScale.cpp" > </File> @@ -412,6 +420,10 @@ > </File> <File + RelativePath="..\src\COLLADAFWTexture.cpp" + > + </File> + <File RelativePath="..\src\COLLADAFWTransformation.cpp" > </File> @@ -650,6 +662,10 @@ > </File> <File + RelativePath="..\include\COLLADAFWSampler.h" + > + </File> + <File RelativePath="..\include\COLLADAFWScale.h" > </File> @@ -702,6 +718,10 @@ > </File> <File + RelativePath="..\include\COLLADAFWTexture.h" + > + </File> + <File RelativePath="..\include\COLLADAFWTransformation.h" > </File> Added: branches/nextgen/COLLADAFramework/src/COLLADAFWImage.cpp =================================================================== --- branches/nextgen/COLLADAFramework/src/COLLADAFWImage.cpp (rev 0) +++ branches/nextgen/COLLADAFramework/src/COLLADAFWImage.cpp 2009-02-17 08:44:52 UTC (rev 364) @@ -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 "COLLADAFWImage.h" + + +namespace COLLADAFW +{ + + //------------------------------ + Image::Image( ObjectId objectId) + : ObjectTemplate< COLLADA_TYPE::IMAGE >(objectId) + , mSourceType(SOURCE_TYPE_UNKNOWN) + , mHeight(0) + , mWidth(0) + , mDepth(0) + { + } + + //------------------------------ + Image::~Image() + { + } + +} // namespace COLLADAFW Added: branches/nextgen/COLLADAFramework/src/COLLADAFWSampler.cpp =================================================================== --- branches/nextgen/COLLADAFramework/src/COLLADAFWSampler.cpp (rev 0) +++ branches/nextgen/COLLADAFramework/src/COLLADAFWSampler.cpp 2009-02-17 08:44:52 UTC (rev 364) @@ -0,0 +1,39 @@ +/* + 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 "COLLADAFWSampler.h" + + +namespace COLLADAFW +{ + + //------------------------------ + Sampler::Sampler() + : mSamplerType(SAMPLER_TYPE_UNSPECIFIED) + , mSourceImageUniqueId() + , mMinFilter( SAMPLER_FILTER_LINEAR ) + , mMagFilter( SAMPLER_FILTER_LINEAR ) + , mMipFilter( SAMPLER_FILTER_LINEAR ) + , mWrapS(WRAP_MODE_WRAP) + , mWrapT(WRAP_MODE_WRAP) + , mWrapP(WRAP_MODE_WRAP) + , mMipmapMaxlevel(255) + , mMipmapBias(0) + + { + } + + //------------------------------ + Sampler::~Sampler() + { + } + +} // namespace COLLADAFW Added: branches/nextgen/COLLADAFramework/src/COLLADAFWTexture.cpp =================================================================== --- branches/nextgen/COLLADAFramework/src/COLLADAFWTexture.cpp (rev 0) +++ branches/nextgen/COLLADAFramework/src/COLLADAFWTexture.cpp 2009-02-17 08:44:52 UTC (rev 364) @@ -0,0 +1,28 @@ +/* + 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 "COLLADAFWTexture.h" + + +namespace COLLADAFW +{ + + //------------------------------ + Texture::Texture() + { + } + + //------------------------------ + Texture::~Texture() + { + } + +} // namespace COLLADAFW Modified: branches/nextgen/COLLADAMax/include/COLLADAMaxDocumentImporter.h =================================================================== --- branches/nextgen/COLLADAMax/include/COLLADAMaxDocumentImporter.h 2009-02-16 17:27:30 UTC (rev 363) +++ branches/nextgen/COLLADAMax/include/COLLADAMaxDocumentImporter.h 2009-02-17 08:44:52 UTC (rev 364) @@ -238,6 +238,10 @@ @return True on succeeded, false otherwise.*/ virtual bool writeCamera( const COLLADAFW::Camera* camera ); + /** Writes the image. + @return True on succeeded, false otherwise.*/ + virtual bool writeImage( const COLLADAFW::Image* image ); + /** Writes the light. @return True on succeeded, false otherwise.*/ virtual bool writeLight( const COLLADAFW::Light* light ); Modified: branches/nextgen/COLLADAMax/src/COLLADAMaxDocumentImporter.cpp =================================================================== --- branches/nextgen/COLLADAMax/src/COLLADAMaxDocumentImporter.cpp 2009-02-16 17:27:30 UTC (rev 363) +++ branches/nextgen/COLLADAMax/src/COLLADAMaxDocumentImporter.cpp 2009-02-17 08:44:52 UTC (rev 364) @@ -142,6 +142,13 @@ } //--------------------------------------------------------------- + bool DocumentImporter::writeImage( const COLLADAFW::Image* image ) + { + int gg=1; + return true; + } + + //--------------------------------------------------------------- bool DocumentImporter::writeLight( const COLLADAFW::Light* light ) { LightImporter lightImporter(this, light); Modified: branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLFileLoader.h =================================================================== --- branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLFileLoader.h 2009-02-16 17:27:30 UTC (rev 363) +++ branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLFileLoader.h 2009-02-17 08:44:52 UTC (rev 364) @@ -109,6 +109,9 @@ /** Starts loading a library lights.*/ virtual bool begin__library_lights( const library_lights__AttributeData& attributeData ); + /** Starts loading a library images.*/ + virtual bool begin__library_images( const library_images__AttributeData& attributeData ); + private: /** Disable default copy ctor. */ Modified: branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLLibraryCamerasLoader.h =================================================================== --- branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLLibraryCamerasLoader.h 2009-02-16 17:27:30 UTC (rev 363) +++ branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLLibraryCamerasLoader.h 2009-02-17 08:44:52 UTC (rev 364) @@ -49,11 +49,11 @@ /** Resets all the variables used for the current camera.*/ void resetCurrentValues(); - /** Finishes loading a library effects.*/ + /** Finishes loading a library cameras.*/ virtual bool end__library_cameras(); - /** Stores camera id and name.*/ + /** Creates a new camera.*/ virtual bool begin__camera( const camera__AttributeData& attributeData ); /** Sends camera to the writer.*/ Modified: branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLLibraryEffectsLoader.h =================================================================== --- branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLLibraryEffectsLoader.h 2009-02-16 17:27:30 UTC (rev 363) +++ branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLLibraryEffectsLoader.h 2009-02-17 08:44:52 UTC (rev 364) @@ -15,9 +15,12 @@ #include "COLLADASaxFWLFilePartLoader.h" #include "COLLADAFWEffectCommon.h" +#include "COLLADAFWTypes.h" + namespace COLLADAFW { class Effect; + class Sampler; } @@ -55,6 +58,31 @@ UNKNOWN_SHADER_TYPE }; + struct Surface + { + fx_surface_type_enum surfaceType; + + /** The unique id of the image used by the surface.*/ + COLLADAFW::UniqueId imageUniqueId; + }; + + typedef std::map<String, Surface> SidSurfaceMap; + + struct SamplerInfo + { + /** The sampler.*/ + COLLADAFW::Sampler* sampler; + + /** The index of the sampler.*/ + COLLADAFW::SamplerID id; + + /** The source of the sampler.*/ + String surfaceSid; + }; + + typedef std::map<String, SamplerInfo> SidSamplerInfoMap; + + private: /** The effect currently being imported.*/ COLLADAFW::Effect* mCurrentEffect; @@ -67,7 +95,28 @@ /** The index of the next color component to read.*/ size_t mCurrentColorValueIndex; - + + /** The sid of the current new param.*/ + String mCurrentNewParamSid; + + /** The current surface.*/ + Surface mCurrentSurface; + + /** The init from string of the current surface.*/ + String mCurrentSurfaceInitFrom; + + /** Maps sids of surfaces to the surface.*/ + SidSurfaceMap mSidSurfaceMap; + + /** The source of the current sampler.*/ + String mCurrentSamplerSource; + + /** The current sampler.*/ + COLLADAFW::Sampler* mCurrentSampler; + + /** Maps sids of samplers to the samplers info.*/ + SidSamplerInfoMap mSidSamplerInfoMap; + public: /** Constructor. */ @@ -91,7 +140,55 @@ /** Set the current profile to unknown.*/ virtual bool end__profile_COMMON(); + + /** Store the sid of the new param.*/ + virtual bool begin__profile_COMMON__newparam( const profile_COMMON__newparam__AttributeData& attributeData ); + + /** Clear the sid of the new param.*/ + virtual bool end__profile_COMMON__newparam(); + + + /** Set the surface type.*/ + virtual bool begin__newparam__surface( const newparam__surface__AttributeData& attributeData ); + + /** Adds the surface to the map of surfaces.*/ + virtual bool end__newparam__surface(); + + + /** We don't need to do anything here.*/ + virtual bool begin__surface__init_from( const surface__init_from__AttributeData& attributeData ){return true;} + + /** Assign the unique id of the surface image.*/ + virtual bool end__surface__init_from(); + + /** Store data in mCurrentSurfaceInitFrom.*/ + virtual bool data__surface__init_from( const ParserChar* data, size_t length ); + + + /** Creates a new sampler2D.*/ + virtual bool begin__newparam__sampler2D(); + + /** Adds the sampler to the map of samplers.*/ + virtual bool end__newparam__sampler2D(); + + + /** We don't need to do anything here.*/ + virtual bool begin__sampler2D__source(){return true;} + + /** We don't need to do anything here.*/ + virtual bool end__sampler2D__source(){return true;} + + /** Store data in mCurrentSamplerSource.*/ + virtual bool data__sampler2D__source( const ParserChar* data, size_t length ); + + /** Resolve all the samplers and copy them to the current effect.*/ + virtual bool begin__profile_COMMON__technique( const profile_COMMON__technique__AttributeData& attributeData ); + + /** Delete all temporyry samplers.*/ + virtual bool end__profile_COMMON__technique(); + + /** Set the shader type of the current profile.*/ virtual bool begin__technique__constant(); @@ -149,6 +246,11 @@ /** Stores color data into the correct color object.*/ virtual bool data__emission__color( const double* value, size_t length ); + /** Stores texture data into the correct texture object.*/ + virtual bool begin__emission__texture( const texture__AttributeData& attributeData ); + /** We don't need to do anything here.*/ + virtual bool end__emission__texture(){return true;} + /** Sets the shader parameter type.*/ virtual bool begin__ambient__color( const ambient__color__AttributeData& attributeData ); /** Resets the shader parameter type.*/ @@ -156,6 +258,10 @@ /** Stores color data into the correct color object.*/ virtual bool data__ambient__color( const double* value, size_t length ); + /** Stores texture data into the correct texture object.*/ + virtual bool begin__ambient__texture( const texture__AttributeData& attributeData ); + /** We don't need to do anything here.*/ + virtual bool end__ambient__texture(){return true;} /** Sets the shader parameter type.*/ virtual bool begin__diffuse__color( const diffuse__color__AttributeData& attributeData ); @@ -164,6 +270,10 @@ /** Stores color data into the correct color object.*/ virtual bool data__diffuse__color( const double* value, size_t length ); + /** Stores texture data into the correct texture object.*/ + virtual bool begin__diffuse__texture( const texture__AttributeData& attributeData ); + /** We don't need to do anything here.*/ + virtual bool end__diffuse__texture(){return true;} /** Sets the shader parameter type.*/ virtual bool begin__specular__color( const specular__color__AttributeData& attributeData ); @@ -172,6 +282,11 @@ /** Stores color data into the correct color object.*/ virtual bool data__specular__color( const double* value, size_t length ); + /** Stores texture data into the correct texture object.*/ + virtual bool begin__specular__texture( const texture__AttributeData& attributeData ); + /** We don't need to do anything here.*/ + virtual bool end__specular__texture(){return true;} + /** Sets the shader parameter type.*/ virtual bool begin__reflective__color( const reflective__color__AttributeData& attributeData ); /** Resets the shader parameter type.*/ @@ -179,6 +294,11 @@ /** Stores color data into the correct color object.*/ virtual bool data__reflective__color( const double* value, size_t length ); + /** Stores texture data into the correct texture object.*/ + virtual bool begin__reflective__texture( const texture__AttributeData& attributeData ); + /** We don't need to do anything here.*/ + virtual bool end__reflective__texture(){return true;} + /** Sets the shader parameter type.*/ virtual bool begin__transparent__color( const transparent__color__AttributeData& attributeData ); /** Resets the shader parameter type.*/ @@ -186,7 +306,12 @@ /** Stores color data into the correct color object.*/ virtual bool data__transparent__color( const double* value, size_t length ); + /** Stores texture data into the correct texture object.*/ + virtual bool begin__transparent__texture( const texture__AttributeData& attributeData ); /** We don't need to do anything here.*/ + virtual bool end__transparent__texture(){return true;} + + /** 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;} @@ -227,6 +352,9 @@ /** Stores color data into the @a color object.*/ bool handleColorData( const double* value, size_t length, COLLADAFW::Color& color ); + /** Stores texture data into the @a shaderParameterType texture object.*/ + bool handleTexture( const texture__AttributeData& attributeData, ShaderParameterTypes shaderParameterType); + private: /** Disable default copy ctor. */ Added: branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLLibraryImagesLoader.h =================================================================== --- branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLLibraryImagesLoader.h (rev 0) +++ branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLLibraryImagesLoader.h 2009-02-17 08:44:52 UTC (rev 364) @@ -0,0 +1,86 @@ +/* + 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_LIBRARYIMAGESLOADER_H__ +#define __COLLADASAXFWL_LIBRARYIMAGESLOADER_H__ + +#include "COLLADASaxFWLPrerequisites.h" +#include "COLLADASaxFWLFilePartLoader.h" + +namespace COLLADAFW +{ + class Image; +} + + +namespace COLLADASaxFWL +{ + + /** Loads all the images in a library images. */ + class LibraryImagesLoader : public FilePartLoader + { + private: + /** The current image.*/ + COLLADAFW::Image* mCurrentImage; + + /** The part of the uri of the current image, already received by data__image__init_from().*/ + COLLADAFW::ArrayPrimitiveType<ParserChar> mCurrentImageURIPart; + + public: + + /** Constructor. */ + LibraryImagesLoader( IFilePartLoader* callingFilePartLoader ); + + /** Destructor. */ + virtual ~LibraryImagesLoader(); + + /** Finishes loading a library images.*/ + virtual bool end__library_images(); + + + /** Creates a new image.*/ + virtual bool begin__library_images__image( const image__AttributeData& attributeData ); + + /** Sends image to the writer.*/ + virtual bool end__library_images__image(); + + + /** Set source type.*/ + virtual bool begin__image__init_from(); + + /** Set the image uri.*/ + virtual bool end__image__init_from(); + + /** Set the image uri.*/ + virtual bool data__image__init_from( const ParserChar* data, size_t length ); + + + /** Set source type.*/ + virtual bool begin__data(); + + /** We don't need to do anything here.*/ + virtual bool end__data(){return true;} + + /** Store data in current image.*/ + virtual bool data__data( const ParserChar* data, size_t length ); + + private: + + /** Disable default copy ctor. */ + LibraryImagesLoader( const LibraryImagesLoader& pre ); + + /** Disable default assignment operator. */ + const LibraryImagesLoader& operator= ( const LibraryImagesLoader& pre ); + + }; + +} // namespace COLLADASAXFWL + +#endif // __COLLADASAXFWL_LIBRARYIMAGESLOADER_H__ Modified: branches/nextgen/COLLADASaxFrameworkLoader/scripts/COLLADASaxFrameworkLoader.vcproj =================================================================== --- branches/nextgen/COLLADASaxFrameworkLoader/scripts/COLLADASaxFrameworkLoader.vcproj 2009-02-16 17:27:30 UTC (rev 363) +++ branches/nextgen/COLLADASaxFrameworkLoader/scripts/COLLADASaxFrameworkLoader.vcproj 2009-02-17 08:44:52 UTC (rev 364) @@ -356,6 +356,10 @@ > </File> <File + RelativePath="..\src\COLLADASaxFWLLibraryImagesLoader.cpp" + > + </File> + <File RelativePath="..\src\COLLADASaxFWLLibraryLightsLoader.cpp" > </File> @@ -482,6 +486,10 @@ > </File> <File + RelativePath="..\include\COLLADASaxFWLLibraryImagesLoader.h" + > + </File> + <File RelativePath="..\include\COLLADASaxFWLLibraryLightsLoader.h" > </File> Modified: branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLFileLoader.cpp =================================================================== --- branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLFileLoader.cpp 2009-02-16 17:27:30 UTC (rev 363) +++ branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLFileLoader.cpp 2009-02-17 08:44:52 UTC (rev 364) @@ -18,6 +18,7 @@ #include "COLLADASaxFWLLibraryEffectsLoader.h" #include "COLLADASaxFWLLibraryCamerasLoader.h" #include "COLLADASaxFWLLibraryLightsLoader.h" +#include "COLLADASaxFWLLibraryImagesLoader.h" #include "COLLADASaxFWLMeshLoader.h" #include "COLLADASaxFWLGeometryLoader.h" #include "COLLADASaxFWLSaxParserErrorHandler.h" @@ -157,6 +158,18 @@ } //----------------------------- + bool FileLoader::begin__library_images( const library_images__AttributeData& attributeData ) + { + deleteFilePartLoader(); + LibraryImagesLoader* libraryImagesLoader = new LibraryImagesLoader(this); + + setPartLoader(libraryImagesLoader); + setParser(libraryImagesLoader); + return true; + } + + + //----------------------------- bool FileLoader::end__COLLADA () { writer ()->finish (); Modified: branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLLibraryEffectsLoader.cpp =================================================================== --- branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLLibraryEffectsLoader.cpp 2009-02-16 17:27:30 UTC (rev 363) +++ branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLLibraryEffectsLoader.cpp 2009-02-17 08:44:52 UTC (rev 364) @@ -13,6 +13,7 @@ #include "COLLADAFWIWriter.h" #include "COLLADAFWEffect.h" +#include "COLLADAFWImage.h" namespace COLLADASaxFWL { @@ -24,7 +25,7 @@ , mCurrentProfile(PROFILE_UNKNOWN) , mCurrentShaderParameterType(UNKNOWN_SHADER_TYPE) , mCurrentColorValueIndex(0) - + , mCurrentSampler(0) { } @@ -123,6 +124,64 @@ //------------------------------ + bool LibraryEffectsLoader::handleTexture( const texture__AttributeData& attributeData, ShaderParameterTypes shaderParameterType ) + { + switch ( mCurrentProfile ) + { + case PROFILE_COMMON: + { + COLLADAFW::ColorOrTexture* colorOrTexture = 0; + switch ( shaderParameterType ) + { + case SHADER_PARAMETER_EMISSION: + { + colorOrTexture = &mCurrentEffect->getCommonEffects().back()->getEmission(); + break; + } + case SHADER_PARAMETER_AMBIENT: + { + colorOrTexture = &mCurrentEffect->getCommonEffects().back()->getAmbient(); + break; + } + case SHADER_PARAMETER_DIFFUSE: + { + colorOrTexture = &mCurrentEffect->getCommonEffects().back()->getDiffuse(); + break; + } + case SHADER_PARAMETER_SPECULAR: + { + colorOrTexture = &mCurrentEffect->getCommonEffects().back()->getSpecular(); + break; + } + case SHADER_PARAMETER_REFLECTIVE: + { + colorOrTexture = &mCurrentEffect->getCommonEffects().back()->getReflective(); + break; + } + case SHADER_PARAMETER_TRANSPARANT: + { + colorOrTexture = &mCurrentEffect->getCommonEffects().back()->getTransparent(); + break; + } + } + + SidSamplerInfoMap::const_iterator it = mSidSamplerInfoMap.find((const char*)attributeData.texture); + if ( it == mSidSamplerInfoMap.end() ) + break; + + const SamplerInfo& samplerInfo = it->second; + + colorOrTexture->setType(COLLADAFW::ColorOrTexture::TEXTURE); + COLLADAFW::Texture& texture = colorOrTexture->getTexture(); + texture.setSamplerId( samplerInfo.id ); + break; + } + } + return true; + + } + + //------------------------------ bool LibraryEffectsLoader::begin__effect( const effect__AttributeData& attributeData ) { mCurrentEffect = FW_NEW COLLADAFW::Effect(getUniqueIdFromId(attributeData.id, COLLADAFW::Effect::ID()).getObjectId()); @@ -162,6 +221,117 @@ } //------------------------------ + bool LibraryEffectsLoader::begin__newparam__surface( const newparam__surface__AttributeData& attributeData ) + { + mCurrentSurface.surfaceType = attributeData.type; + return true; + } + + //------------------------------ + bool LibraryEffectsLoader::end__newparam__surface() + { + mSidSurfaceMap.insert(std::make_pair(mCurrentNewParamSid, mCurrentSurface)); + mCurrentSurfaceInitFrom.clear(); + return true; + } + + //------------------------------ + bool LibraryEffectsLoader::end__surface__init_from() + { + mCurrentSurface.imageUniqueId = getUniqueIdFromId((const ParserChar*)mCurrentSurfaceInitFrom.c_str(), COLLADAFW::Image::ID()); + return true; + } + + //------------------------------ + bool LibraryEffectsLoader::data__surface__init_from( const ParserChar* data, size_t length ) + { + mCurrentSurfaceInitFrom.append((const char* )data, length); + return true; + } + + //------------------------------ + bool LibraryEffectsLoader::begin__profile_COMMON__newparam( const profile_COMMON__newparam__AttributeData& attributeData ) + { + if ( attributeData.sid ) + mCurrentNewParamSid = (const char *)attributeData.sid; + return true; + } + + //------------------------------ + bool LibraryEffectsLoader::end__profile_COMMON__newparam() + { + mCurrentNewParamSid.clear(); + return true; + } + + //------------------------------ + bool LibraryEffectsLoader::begin__newparam__sampler2D() + { + mCurrentSampler = new COLLADAFW::Sampler(); + mCurrentSampler->setSamplerType( COLLADAFW::Sampler::SAMPLER_TYPE_2D ); + return true; + } + + //------------------------------ + bool LibraryEffectsLoader::end__newparam__sampler2D() + { + SamplerInfo samplerInfo; + samplerInfo.sampler = mCurrentSampler; + samplerInfo.id = 0; + samplerInfo.surfaceSid = mCurrentSamplerSource; + mSidSamplerInfoMap.insert(std::make_pair(mCurrentNewParamSid, samplerInfo)); + mCurrentSampler = 0; + mCurrentSamplerSource.clear(); + return true; + } + + //------------------------------ + bool LibraryEffectsLoader::data__sampler2D__source( const ParserChar* data, size_t length ) + { + mCurrentSamplerSource.append((const char* )data, length); + return true; + } + + + //------------------------------ + bool LibraryEffectsLoader::begin__profile_COMMON__technique( const profile_COMMON__technique__AttributeData& attributeData ) + { + COLLADAFW::EffectCommon& commonEffect = *mCurrentEffect->getCommonEffects().back(); + COLLADAFW::SamplerPointerArray& samplerArray = commonEffect.getSamplerPointerArray(); + SidSamplerInfoMap::iterator samplerIt = mSidSamplerInfoMap.begin(); + for ( ; samplerIt != mSidSamplerInfoMap.end(); ++samplerIt) + { + SamplerInfo& samplerInfo = samplerIt->second; + samplerInfo.id = samplerArray.getCount(); + COLLADAFW::Sampler* sampler = samplerInfo.sampler; + SidSurfaceMap::const_iterator surfaceIt = mSidSurfaceMap.find( samplerInfo.surfaceSid ); + if ( surfaceIt != mSidSurfaceMap.end() ) + { + const Surface& surface = surfaceIt->second; + sampler->setSource(surface.imageUniqueId); + + // copy sampler into common effect + samplerArray.append( sampler->clone() ); + } + } + return true; + } + + //------------------------------ + bool LibraryEffectsLoader::end__profile_COMMON__technique() + { + SidSamplerInfoMap::iterator samplerIt = mSidSamplerInfoMap.begin(); + for ( ; samplerIt != mSidSamplerInfoMap.end(); ++samplerIt) + { + SamplerInfo& samplerInfo = samplerIt->second; + delete samplerInfo.sampler; + } + mSidSamplerInfoMap.clear(); + mSidSurfaceMap.clear(); + return true; + } + + //------------------------------ bool LibraryEffectsLoader::begin__technique__constant() { return setCommonEffectShaderType(COLLADAFW::EffectCommon::SHADER_CONSTANT); @@ -214,7 +384,12 @@ return handleColorData(data, length); } + bool LibraryEffectsLoader::begin__emission__texture( const texture__AttributeData& attributeData ) + { + return handleTexture( attributeData, SHADER_PARAMETER_EMISSION); + } + //------------------------------ bool LibraryEffectsLoader::begin__ambient__color( const ambient__color__AttributeData& attributeData ) { @@ -236,6 +411,11 @@ return handleColorData(data, length); } + //------------------------------ + bool LibraryEffectsLoader::begin__ambient__texture( const texture__AttributeData& attributeData ) + { + return handleTexture( attributeData, SHADER_PARAMETER_AMBIENT); + } //------------------------------ bool LibraryEffectsLoader::begin__diffuse__color( const diffuse__color__AttributeData& attributeData ) @@ -258,8 +438,12 @@ return handleColorData(data, length); } + //------------------------------ + bool LibraryEffectsLoader::begin__diffuse__texture( const texture__AttributeData& attributeData ) + { + return handleTexture( attributeData, SHADER_PARAMETER_DIFFUSE); + } - //------------------------------ bool LibraryEffectsLoader::begin__specular__color( const specular__color__AttributeData& attributeData ) { @@ -281,6 +465,11 @@ return handleColorData(data, length); } + //------------------------------ + bool LibraryEffectsLoader::begin__specular__texture( const texture__AttributeData& attributeData ) + { + return handleTexture( attributeData, SHADER_PARAMETER_SPECULAR); + } //------------------------------ bool LibraryEffectsLoader::begin__reflective__color( const reflective__color__AttributeData& attributeData ) @@ -304,6 +493,12 @@ } //------------------------------ + bool LibraryEffectsLoader::begin__reflective__texture( const texture__AttributeData& attributeData ) + { + return handleTexture( attributeData, SHADER_PARAMETER_REFLECTIVE); + } + + //------------------------------ bool LibraryEffectsLoader::begin__transparent__color( const transparent__color__AttributeData& attributeData ) { mCurrentShaderParameterType = SHADER_PARAMETER_TRANSPARANT; @@ -324,6 +519,11 @@ return handleColorData(data, length); } + bool LibraryEffectsLoader::begin__transparent__texture( const texture__AttributeData& attributeData ) + { + return handleTexture( attributeData, SHADER_PARAMETER_TRANSPARANT); + } + //------------------------------ bool LibraryEffectsLoader::data__shininess__float( double value ) { @@ -352,4 +552,16 @@ return true; } + + + + + + + + + + + + } // namespace COLLADASaxFWL Added: branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLLibraryImagesLoader.cpp =================================================================== --- branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLLibraryImagesLoader.cpp (rev 0) +++ branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLLibraryImagesLoader.cpp 2009-02-17 08:44:52 UTC (rev 364) @@ -0,0 +1,109 @@ +/* + 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 "COLLADASaxFWLLibraryImagesLoader.h" + +#include "COLLADAFWImage.h" +#include "COLLADAFWIWriter.h" + + +namespace COLLADASaxFWL +{ + + //------------------------------ + LibraryImagesLoader::LibraryImagesLoader( IFilePartLoader* callingFilePartLoader ) + : FilePartLoader(callingFilePartLoader) + , mCurrentImage(0) + { + + } + + //------------------------------ + LibraryImagesLoader::~LibraryImagesLoader() + { + } + + //------------------------------ + bool LibraryImagesLoader::end__library_images() + { + finish(); + return true; + } + + //------------------------------ + bool LibraryImagesLoader::begin__library_images__image( const image__AttributeData& attributeData ) + { + mCurrentImage = FW_NEW COLLADAFW::Image( getUniqueIdFromId( attributeData.id, COLLADAFW::Image::ID()).getObjectId() ); + + if ( attributeData.name ) + mCurrentImage->setName( (const char*) attributeData.name ); + else if ( attributeData.id ) + mCurrentImage->setName( (const char*) attributeData.id ); + + if ( attributeData.format ) + mCurrentImage->setFormat( attributeData.format ); + + mCurrentImage->setHeight( (unsigned long)attributeData.height ); + mCurrentImage->setWidth( (unsigned long)attributeData.width ); + mCurrentImage->setDepth( (unsigned long)attributeData.depth ); + + return true; + } + + //------------------------------ + bool LibraryImagesLoader::end__library_images__image() + { + bool success = writer()->writeImage(mCurrentImage); + FW_DELETE mCurrentImage; + mCurrentImageURIPart.clear(); + return success; + } + + //------------------------------ + bool LibraryImagesLoader::begin__image__init_from() + { + mCurrentImage->setSourceType( COLLADAFW::Image::SOURCE_TYPE_URI ); + return true; + } + + //------------------------------ + bool LibraryImagesLoader::end__image__init_from() + { + String imageUriString( mCurrentImageURIPart.getData(), mCurrentImageURIPart.getCount() ); + COLLADABU::URI imageUri( imageUriString ); + mCurrentImage->setImageURI( imageUri ); + return true; + } + + //------------------------------ + bool LibraryImagesLoader::data__image__init_from( const ParserChar* data, size_t length ) + { + mCurrentImageURIPart.appendValues( data, length ); + return true; + } + + //------------------------------ + bool LibraryImagesLoader::begin__data() + { + mCurrentImage->setSourceType( COLLADAFW::Image::SOURCE_TYPE_DATA); + return true; + } + + //------------------------------ + bool LibraryImagesLoader::data__data( const ParserChar* data, size_t length ) + { + COLLADAFW::Image::Chara... [truncated message content] |
From: <jud...@us...> - 2009-02-16 17:27:36
|
Revision: 363 http://colladamaya.svn.sourceforge.net/colladamaya/?rev=363&view=rev Author: judithschenk Date: 2009-02-16 17:27:30 +0000 (Mon, 16 Feb 2009) Log Message: ----------- import cameras, import lights Modified Paths: -------------- branches/nextgen/COLLADAFramework/include/COLLADAFWCamera.h branches/nextgen/COLLADAFramework/src/COLLADAFWCamera.cpp branches/nextgen/COLLADAMaya/include/COLLADAMayaCameraImporter.h branches/nextgen/COLLADAMaya/include/COLLADAMayaEffectImporter.h branches/nextgen/COLLADAMaya/include/COLLADAMayaLightImporter.h branches/nextgen/COLLADAMaya/src/COLLADAMayaCameraImporter.cpp branches/nextgen/COLLADAMaya/src/COLLADAMayaDocumentImporter.cpp branches/nextgen/COLLADAMaya/src/COLLADAMayaGeometryImporter.cpp branches/nextgen/COLLADAMaya/src/COLLADAMayaLightImporter.cpp Modified: branches/nextgen/COLLADAFramework/include/COLLADAFWCamera.h =================================================================== --- branches/nextgen/COLLADAFramework/include/COLLADAFWCamera.h 2009-02-16 15:14:35 UTC (rev 362) +++ branches/nextgen/COLLADAFramework/include/COLLADAFWCamera.h 2009-02-16 17:27:30 UTC (rev 363) @@ -43,10 +43,9 @@ ASPECTRATIO_AND_X, //!< aspect ratio and xfov or xmag, respectively describe the camera ASPECTRATIO_AND_Y, //!< aspect ratio and yfov or <mag, respectivelydescribe the camera }; - - private: + /** The name of the camera*/ String mName; @@ -58,15 +57,12 @@ /** The horizontal field of view or magnification of the view.*/ double mXFovOrXMag; - bool mHasXFovOrXMag; /** The vertical field of view or magnification of the view.*/ double mYFovOrYMag; - bool mHasYFovOrYMag; /** The aspect ratio.*/ double mAspectRatio; - bool mHasAspectRatio; /** The near clipping plane.*/ double mNearClippingPlane; @@ -102,41 +98,32 @@ double getXFov() const { return mXFovOrXMag; } /** Sets the horizontal field of view. Use only for perspective cameras.*/ - void setXFov(double xFov) { mXFovOrXMag = xFov; mHasXFovOrXMag = true; } + void setXFov(double xFov) { mXFovOrXMag = xFov; } /** Returns the horizontal magnification of the view. Use only for orthographic cameras.*/ double getXMag() const { return mXFovOrXMag; } /** Sets the horizontal magnification of the view. Use only for orthographic cameras.*/ - void setXMag(double xMag) { mXFovOrXMag = xMag; mHasXFovOrXMag = true; } + void setXMag(double xMag) { mXFovOrXMag = xMag; } /** Returns the vertical field of view. Use only for perspective cameras.*/ double getYFov() const { return mYFovOrYMag; } /** Sets the vertical field of view. Use only for perspective cameras.*/ - void setYFov(double yFov) { mYFovOrYMag = yFov; mHasYFovOrYMag = true; } + void setYFov(double yFov) { mYFovOrYMag = yFov; } /** Returns the vertical magnification of the view. Use only for orthographic cameras.*/ double getYMag() const { return mYFovOrYMag; } /** Sets the vertical magnification of the view. Use only for orthographic cameras.*/ - void setYMag(double yMag) { mYFovOrYMag = yMag; mHasYFovOrYMag = true; } + void setYMag(double yMag) { mYFovOrYMag = yMag; } - /** The horizontal field of view or magnification of the view.*/ - const bool& getHasXFovOrXMag () const { return mHasXFovOrXMag; } - - /** The vertical field of view or magnification of the view.*/ - const bool& getHasYFovOrYMag () const { return mHasYFovOrYMag; } - /** Returns the aspect ratio.*/ double getAspectRatio() const { return mAspectRatio; } /** Sets the aspect ratio.*/ - void setAspectRatio(double aspectRatio) { mAspectRatio = aspectRatio; mHasAspectRatio = true; } + void setAspectRatio(double aspectRatio) { mAspectRatio = aspectRatio; } - /** The aspect ratio.*/ - const bool& getHasAspectRatio () const { return mHasAspectRatio; } - /** Returns the near clipping plane.*/ double getNearClippingPlane() const { return mNearClippingPlane; } Modified: branches/nextgen/COLLADAFramework/src/COLLADAFWCamera.cpp =================================================================== --- branches/nextgen/COLLADAFramework/src/COLLADAFWCamera.cpp 2009-02-16 15:14:35 UTC (rev 362) +++ branches/nextgen/COLLADAFramework/src/COLLADAFWCamera.cpp 2009-02-16 17:27:30 UTC (rev 363) @@ -21,11 +21,8 @@ , mCameraType(UNDEFINED_CAMERATYPE) , mDescriptionType( UNDEFINED ) , mXFovOrXMag(0) - , mHasXFovOrXMag (false) , mYFovOrYMag(0) - , mHasYFovOrYMag (false) , mAspectRatio(0) - , mHasAspectRatio (false) , mNearClippingPlane(0) , mFarClippingPlane(0) { Modified: branches/nextgen/COLLADAMaya/include/COLLADAMayaCameraImporter.h =================================================================== --- branches/nextgen/COLLADAMaya/include/COLLADAMayaCameraImporter.h 2009-02-16 15:14:35 UTC (rev 362) +++ branches/nextgen/COLLADAMaya/include/COLLADAMayaCameraImporter.h 2009-02-16 17:27:30 UTC (rev 363) @@ -65,8 +65,7 @@ */ void createCamera ( const COLLADAFW::Camera* camera, - MayaNode* mayaTransformNode, - size_t numNodeInstances ); + MayaNode* mayaTransformNode ); void setPerspectiveCameraAttributes ( const COLLADAFW::Camera* camera, Modified: branches/nextgen/COLLADAMaya/include/COLLADAMayaEffectImporter.h =================================================================== --- branches/nextgen/COLLADAMaya/include/COLLADAMayaEffectImporter.h 2009-02-16 15:14:35 UTC (rev 362) +++ branches/nextgen/COLLADAMaya/include/COLLADAMayaEffectImporter.h 2009-02-16 17:27:30 UTC (rev 363) @@ -113,7 +113,7 @@ const COLLADAFW::Color& standardColor = effect->getStandardColor (); if ( standardColor.isValid () ) - lambert->setColor ( MayaDM::float3 (standardColor.getRed (), standardColor.getGreen (), standardColor.getBlue ()) ); + lambert->setColor ( MayaDM::float3 ( (float)standardColor.getRed (), (float)standardColor.getGreen (), (float)standardColor.getBlue ()) ); const COLLADAFW::ColorOrTexture& diffuse = commonEffect->getDiffuse (); @@ -121,7 +121,7 @@ { const COLLADAFW::Color& color = diffuse.getColor (); if ( color.isValid () ) - lambert->setColor ( MayaDM::float3 (color.getRed (), color.getGreen (), color.getBlue ()) ); + lambert->setColor ( MayaDM::float3 ( (float)color.getRed (), (float)color.getGreen (), (float)color.getBlue ()) ); } else { @@ -134,7 +134,7 @@ { const COLLADAFW::Color& color = emission.getColor (); if ( color.isValid () ) - lambert->setIncandescence ( MayaDM::float3 (color.getRed (), color.getGreen (), color.getBlue ()) ); + lambert->setIncandescence ( MayaDM::float3 ( (float)color.getRed (), (float)color.getGreen (), (float)color.getBlue ()) ); } // TODO @@ -166,7 +166,7 @@ { const COLLADAFW::Color& color = transparent.getColor (); if ( color.isValid () ) - lambert->setTransparency ( MayaDM::float3 (color.getRed (), color.getGreen (), color.getBlue ()) ); + lambert->setTransparency ( MayaDM::float3 ( (float)color.getRed (), (float)color.getGreen (), (float)color.getBlue ()) ); } } Modified: branches/nextgen/COLLADAMaya/include/COLLADAMayaLightImporter.h =================================================================== --- branches/nextgen/COLLADAMaya/include/COLLADAMayaLightImporter.h 2009-02-16 15:14:35 UTC (rev 362) +++ branches/nextgen/COLLADAMaya/include/COLLADAMayaLightImporter.h 2009-02-16 17:27:30 UTC (rev 363) @@ -14,15 +14,35 @@ #include "COLLADAMayaPrerequisites.h" #include "COLLADAMayaBaseImporter.h" +#include "COLLADABUIDList.h" +#include <MayaDMSpotLight.h> +#include <MayaDMPointLight.h> + + namespace COLLADAMaya { /** TODO Documentation */ class LightImporter : BaseImporter { + private: + + /** The standard name for camera without name. */ + static const String LIGHT_NAME; + private: + /** + * The list of the unique maya light names. + */ + COLLADABU::IDList mLightIdList; + + /** + * The map holds the unique ids of the light nodes to the maya specific nodes. + */ + UniqueIdMayaNodesMap mMayaLightNodesMap; + public: /** Constructor. */ @@ -34,8 +54,31 @@ /** * Imports the data of the current light. */ - void importLight ( const COLLADAFW::Light* camera ); + void importLight ( const COLLADAFW::Light* light ); + private: + + /** + * Creates a light. + */ + void createLight ( const COLLADAFW::Light* light, MayaNode* mayaTransformNode ); + + /** + * Sets the spot light specific attributes. + */ + void setSpotLightAttributes ( + const COLLADAFW::Light* light, + MayaDM::Light* mayaLight ); + + /** + * Sets the point light specific attributes. + */ + void setPointLightAttributes ( + const COLLADAFW::Light* light, + MayaDM::Light* mayaLight ); + + MayaNode* findMayaLightNode ( const COLLADAFW::UniqueId& lightId ); + }; } // namespace COLLADAMAYA Modified: branches/nextgen/COLLADAMaya/src/COLLADAMayaCameraImporter.cpp =================================================================== --- branches/nextgen/COLLADAMaya/src/COLLADAMayaCameraImporter.cpp 2009-02-16 15:14:35 UTC (rev 362) +++ branches/nextgen/COLLADAMaya/src/COLLADAMayaCameraImporter.cpp 2009-02-16 17:27:30 UTC (rev 363) @@ -37,25 +37,19 @@ //------------------------------ void CameraImporter::importCamera ( const COLLADAFW::Camera* camera ) { - // Get the parent transform node, which reference this camera. + // Check if the camera is already imported. const COLLADAFW::UniqueId& cameraId = camera->getUniqueId (); - VisualSceneImporter* visualSceneImporter = getDocumentImporter ()->getVisualSceneImporter (); - - // Check if the camera is already imported. if ( findMayaCameraNode ( cameraId ) != 0 ) return; // Get the transform nodes, which work with this camera instance. + VisualSceneImporter* visualSceneImporter = getDocumentImporter ()->getVisualSceneImporter (); const UniqueIdVec* transformNodes = visualSceneImporter->findCameraTransformIds ( cameraId ); if ( transformNodes == 0 ) { MGlobal::displayError ( "No camera node which implements this camera!" ); std::cerr << "No camera node which implements this camera!" << endl; } - size_t numNodeInstances = transformNodes->size (); - // The index value of the current geometry instance. - size_t geometryInstanceIndex = 0; - UniqueIdVec::const_iterator nodesIter = transformNodes->begin (); while ( nodesIter != transformNodes->end () ) { @@ -71,7 +65,7 @@ if ( nodesIter == transformNodes->begin() ) { // Create the current mesh node. - createCamera ( camera, mayaTransformNode, numNodeInstances ); + createCamera ( camera, mayaTransformNode ); } else { @@ -91,8 +85,7 @@ //------------------------------ void CameraImporter::createCamera ( const COLLADAFW::Camera* camera, - MayaNode* mayaTransformNode, - size_t numNodeInstances ) + MayaNode* mayaTransformNode ) { // Create a unique name. String cameraName = camera->getName (); @@ -143,28 +136,57 @@ FILE* file = getDocumentImporter ()->getFile (); - if ( camera->getHasAspectRatio () ) + const COLLADAFW::Camera::DescriptionType& description = camera->getDescriptionType (); + switch ( description ) { - double aspectRatio = camera->getAspectRatio (); - MayaDM::editCameraAspectRatio ( file, mayaCamera.getName (), aspectRatio ); - } - else - { - double aspectRatio = camera->getXFov () / camera->getYFov (); - MayaDM::editCameraAspectRatio ( file, mayaCamera.getName (), aspectRatio ); - } + case COLLADAFW::Camera::ASPECTRATIO_AND_X: + { + double aspectRatio = camera->getAspectRatio (); + MayaDM::editCameraAspectRatio ( file, mayaCamera.getName (), aspectRatio ); - if ( camera->getHasYFovOrYMag () ) - { - double verticalFieldOfView = camera->getYFov (); - MayaDM::editCameraVerticalFieldOfView ( file, mayaCamera.getName (), verticalFieldOfView ); + double horizontalFieldOfView = camera->getXFov (); + MayaDM::editCameraHorizontalFieldOfView ( file, mayaCamera.getName (), horizontalFieldOfView ); + } + break; + case COLLADAFW::Camera::ASPECTRATIO_AND_Y: + { + double aspectRatio = camera->getAspectRatio (); + MayaDM::editCameraAspectRatio ( file, mayaCamera.getName (), aspectRatio ); + + double verticalFieldOfView = camera->getYFov (); + MayaDM::editCameraVerticalFieldOfView ( file, mayaCamera.getName (), verticalFieldOfView ); + } + break; + case COLLADAFW::Camera::SINGLE_X: + { + double horizontalFieldOfView = camera->getXFov (); + MayaDM::editCameraHorizontalFieldOfView ( file, mayaCamera.getName (), horizontalFieldOfView ); + } + break; + case COLLADAFW::Camera::SINGLE_Y: + { + double verticalFieldOfView = camera->getYFov (); + MayaDM::editCameraVerticalFieldOfView ( file, mayaCamera.getName (), verticalFieldOfView ); + } + break; + case COLLADAFW::Camera::X_AND_Y: + { + double aspectRatio = camera->getXFov () / camera->getYFov (); + MayaDM::editCameraAspectRatio ( file, mayaCamera.getName (), aspectRatio ); + + double horizontalFieldOfView = camera->getXFov (); + MayaDM::editCameraHorizontalFieldOfView ( file, mayaCamera.getName (), horizontalFieldOfView ); + + double verticalFieldOfView = camera->getYFov (); + MayaDM::editCameraVerticalFieldOfView ( file, mayaCamera.getName (), verticalFieldOfView ); + } + break; + default: + MGlobal::displayError ( "Unknown description type!" ); + std::cerr << "Unknown description type!" << endl; + break; } - if ( camera->getHasXFovOrXMag () ) - { - double horizontalFieldOfView = camera->getXFov (); - MayaDM::editCameraHorizontalFieldOfView ( file, mayaCamera.getName (), horizontalFieldOfView ); - } } //------------------------------ @@ -184,28 +206,51 @@ FILE* file = getDocumentImporter ()->getFile (); - if ( camera->getHasAspectRatio () ) + COLLADAFW::Camera::DescriptionType description = camera->getDescriptionType (); + switch ( description ) { - double aspectRatio = camera->getAspectRatio (); - MayaDM::editCameraAspectRatio ( file, mayaCamera.getName (), aspectRatio ); - } - else - { - double aspectRatio = camera->getXMag () / camera->getYMag (); - MayaDM::editCameraAspectRatio ( file, mayaCamera.getName (), aspectRatio ); - } + case COLLADAFW::Camera::ASPECTRATIO_AND_X: + { + double aspectRatio = camera->getAspectRatio (); + MayaDM::editCameraAspectRatio ( file, mayaCamera.getName (), aspectRatio ); - if ( camera->getHasYFovOrYMag () ) - { - double orthographicHeight = camera->getYMag () / 2; - MayaDM::editCameraOrthographicHeight ( file, mayaCamera.getName (), orthographicHeight ); + double orthographicWidth = camera->getXMag () / 2; + MayaDM::editCameraOrthographicWidth ( file, mayaCamera.getName (), orthographicWidth ); + } + break; + case COLLADAFW::Camera::ASPECTRATIO_AND_Y: + { + double aspectRatio = camera->getAspectRatio (); + MayaDM::editCameraAspectRatio ( file, mayaCamera.getName (), aspectRatio ); + + double orthographicHeight = camera->getYMag () / 2; + MayaDM::editCameraOrthographicHeight ( file, mayaCamera.getName (), orthographicHeight ); + } + break; + case COLLADAFW::Camera::SINGLE_X: + { + double orthographicWidth = camera->getXMag () / 2; + MayaDM::editCameraOrthographicWidth ( file, mayaCamera.getName (), orthographicWidth ); + } + break; + case COLLADAFW::Camera::SINGLE_Y: + { + double orthographicHeight = camera->getYMag () / 2; + MayaDM::editCameraOrthographicHeight ( file, mayaCamera.getName (), orthographicHeight ); + } + break; + case COLLADAFW::Camera::X_AND_Y: + { + double aspectRatio = camera->getXMag () / camera->getYMag (); + MayaDM::editCameraAspectRatio ( file, mayaCamera.getName (), aspectRatio ); + } + break; + default: + MGlobal::displayError ( "Unknown description type!" ); + std::cerr << "Unknown description type!" << endl; + break; } - if ( camera->getHasXFovOrXMag () ) - { - double orthographicWidth = camera->getXMag () / 2; - MayaDM::editCameraOrthographicWidth ( file, mayaCamera.getName (), orthographicWidth ); - } } // -------------------------------------------- @@ -215,7 +260,7 @@ if ( it != mMayaCameraNodesMap.end () ) return &(*it).second; - return NULL; + return 0; } } // namespace COLLADAMaya Modified: branches/nextgen/COLLADAMaya/src/COLLADAMayaDocumentImporter.cpp =================================================================== --- branches/nextgen/COLLADAMaya/src/COLLADAMayaDocumentImporter.cpp 2009-02-16 15:14:35 UTC (rev 362) +++ branches/nextgen/COLLADAMaya/src/COLLADAMayaDocumentImporter.cpp 2009-02-16 17:27:30 UTC (rev 363) @@ -266,10 +266,10 @@ // ':', '|', '-', '!' are replaced by '_'. const char* c = name.c_str (); - int length = name.length(); + size_t length = name.length(); char* tmp = new char[length + 1]; - for ( int i = 0; i <= length; i++ ) + for ( size_t i = 0; i <= length; i++ ) { char d = c[i]; if ( d == '.' || d == '-' || d == '|' || d == ':' || d == '/' || d == '\\' || d == '(' || d == ')' || d == '[' || d == ']' ) Modified: branches/nextgen/COLLADAMaya/src/COLLADAMayaGeometryImporter.cpp =================================================================== --- branches/nextgen/COLLADAMaya/src/COLLADAMayaGeometryImporter.cpp 2009-02-16 15:14:35 UTC (rev 362) +++ branches/nextgen/COLLADAMaya/src/COLLADAMayaGeometryImporter.cpp 2009-02-16 17:27:30 UTC (rev 363) @@ -336,9 +336,9 @@ { 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.appendVrts ( (float)converted[0] ); + meshNode.appendVrts ( (float)converted[1] ); + meshNode.appendVrts ( (float)converted[2] ); } meshNode.endVrts (); } @@ -352,9 +352,9 @@ { 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.appendVrts ( (float)converted[0] ); + meshNode.appendVrts ( (float)converted[1] ); + meshNode.appendVrts ( (float)converted[2] ); } meshNode.endVrts (); } Modified: branches/nextgen/COLLADAMaya/src/COLLADAMayaLightImporter.cpp =================================================================== --- branches/nextgen/COLLADAMaya/src/COLLADAMayaLightImporter.cpp 2009-02-16 15:14:35 UTC (rev 362) +++ branches/nextgen/COLLADAMaya/src/COLLADAMayaLightImporter.cpp 2009-02-16 17:27:30 UTC (rev 363) @@ -10,11 +10,24 @@ #include "COLLADAMayaStableHeaders.h" #include "COLLADAMayaLightImporter.h" +#include "COLLADAMayaVisualSceneImporter.h" +#include "math\COLLADABUMathUtils.h" +#include "COLLADAFWLight.h" + +#include <MayaDMCommands.h> +#include <MayaDMLight.h> +#include <MayaDMAmbientLight.h> +#include <MayaDMDirectionalLight.h> + + namespace COLLADAMaya { + const String LightImporter::LIGHT_NAME = "Light"; + + //------------------------------ LightImporter::LightImporter ( DocumentImporter* documentImporter ) : BaseImporter ( documentImporter ) @@ -27,9 +40,174 @@ } //------------------------------ - void LightImporter::importLight ( const COLLADAFW::Light* camera ) + void LightImporter::importLight ( const COLLADAFW::Light* light ) { + // Check if the camera is already imported. + const COLLADAFW::UniqueId& lightId = light->getUniqueId (); + if ( findMayaLightNode ( lightId ) != 0 ) return; + // Get the transform nodes, which work with this camera instance. + VisualSceneImporter* visualSceneImporter = getDocumentImporter ()->getVisualSceneImporter (); + const UniqueIdVec* transformNodes = visualSceneImporter->findCameraTransformIds ( lightId ); + if ( transformNodes == 0 ) + { + MGlobal::displayError ( "No camera node which implements this camera!" ); + std::cerr << "No camera node which implements this camera!" << endl; + } + + UniqueIdVec::const_iterator nodesIter = transformNodes->begin (); + while ( nodesIter != transformNodes->end () ) + { + // Get the maya node of the current transform node. + const COLLADAFW::UniqueId& transformNodeId = *nodesIter; + MayaNode* mayaTransformNode = visualSceneImporter->findMayaTransformNode ( transformNodeId ); + String transformNodeName = mayaTransformNode->getName (); + + // Get the path to the parent transform node. + String transformNodePath = mayaTransformNode->getNodePath (); + + // The first reference is a direct one, the others are instances. + if ( nodesIter == transformNodes->begin() ) + { + // Create the current mesh node. + createLight ( light, mayaTransformNode ); + } + else + { + // Get the path to the mesh. + MayaNode* mayaLightNode = findMayaLightNode ( lightId ); + String lightNodePath = mayaLightNode->getNodePath (); + + // parent -shape -noConnections -relative -addObject "|pCube1|pCubeShape1" "pCube2"; + FILE* file = getDocumentImporter ()->getFile (); + MayaDM::parentShape ( file, lightNodePath, transformNodePath, false, true, true, true ); + } + + ++nodesIter; + } } + // -------------------------------------------- + void LightImporter::createLight ( + const COLLADAFW::Light* light, + MayaNode* mayaTransformNode ) + { + // Check if the camera is already imported. + const COLLADAFW::UniqueId& lightId = light->getUniqueId (); + + // Create a unique name. + String lightName = light->getName (); + if ( COLLADABU::Utils::equals ( lightName, "" ) ) + lightName = LIGHT_NAME; + lightName = mLightIdList.addId ( lightName ); + + // Create a maya node object of the current node and push it into the map. + MayaNode mayaMeshNode ( lightId, lightName, mayaTransformNode ); + mMayaLightNodesMap [ lightId ] = mayaMeshNode; + + FILE* file = getDocumentImporter ()->getFile (); + + MayaDM::Light* mayaLight = 0; + COLLADAFW::Light::LightType lightType = light->getLightType (); + switch ( lightType ) + { + case COLLADAFW::Light::AMBIENT_LIGHT: + { + mayaLight = new MayaDM::AmbientLight ( file, lightName, mayaTransformNode->getNodePath () ); + } + break; + case COLLADAFW::Light::DIRECTIONAL_LIGHT: + { + mayaLight = new MayaDM::DirectionalLight ( file, lightName, mayaTransformNode->getNodePath () ); + } + break; + case COLLADAFW::Light::POINT_LIGHT: + { + mayaLight = new MayaDM::PointLight ( file, lightName, mayaTransformNode->getNodePath () ); + setPointLightAttributes ( light, mayaLight ); + } + break; + case COLLADAFW::Light::SPOT_LIGHT: + { + mayaLight = new MayaDM::SpotLight ( file, lightName, mayaTransformNode->getNodePath () ); + setSpotLightAttributes ( light, mayaLight ); + } + break; + default: + MGlobal::displayError ( "Unknown light type!" ); + std::cerr << "Unknown light type!" << endl; + return; + break; + } + + COLLADAFW::Color color = light->getColor (); + mayaLight->setColor ( MayaDM::float3 ( (float)color.getRed (), (float)color.getGreen (), (float)color.getBlue () ) ); + + delete mayaLight; + } + + // -------------------------------------------- + MayaNode* LightImporter::findMayaLightNode ( const COLLADAFW::UniqueId& lightId ) + { + UniqueIdMayaNodesMap::iterator it = mMayaLightNodesMap.find ( lightId ); + if ( it != mMayaLightNodesMap.end () ) + return &(*it).second; + + return 0; + } + + // -------------------------------------------- + void LightImporter::setPointLightAttributes ( + const COLLADAFW::Light* light, + MayaDM::Light* mayaLight ) + { + MayaDM::PointLight* pointLight = (MayaDM::PointLight*)mayaLight; + + // Attenuation in COLLADA is equal to Decay in Maya. + double constant = light->getConstantAttenuation (); + double linear = light->getLinearAttenuation (); + double quadratic = light->getQuadraticAttenuation (); + + // TODO If light is animated, the values have to change! + if ( quadratic > linear && quadratic > constant ) + pointLight->setDecayRate ( 2 ); + else if ( linear > constant ) + pointLight->setDecayRate ( 1 ); + else pointLight->setDecayRate ( 0 ); + } + + // -------------------------------------------- + void LightImporter::setSpotLightAttributes ( + const COLLADAFW::Light* light, + MayaDM::Light* mayaLight ) + { + MayaDM::SpotLight* spotLight = (MayaDM::SpotLight*)mayaLight; + + // Attenuation in COLLADA is equal to Decay in Maya. + double constant = light->getConstantAttenuation (); + double linear = light->getLinearAttenuation (); + double quadratic = light->getQuadraticAttenuation (); + + // TODO If light is animated, the values have to change! + if ( quadratic > linear && quadratic > constant ) + spotLight->setDecayRate ( 2 ); + else if ( linear > constant ) + spotLight->setDecayRate ( 1 ); + else spotLight->setDecayRate ( 0 ); + + // Drop-off + double dropOff; + if ( COLLADABU::Math::Utils::equals ( light->getFallOffExponent (), 0.0 ) ) dropOff = 0.0; + else dropOff = 1.0; // COLLADA 1.4 took out the fallOffScale, for some reason. + spotLight->setDropoff ( dropOff ); + + // Cone and Penumbra Angles + double fallOffAngle = light->getFallOffAngle (); + spotLight->setConeAngle ( COLLADABU::Math::Utils::degToRad ( fallOffAngle ) ); + +// double penumbraAngle = ( light->getOuterAngle() - light->getFallOffAngle() ) / 2.0f; +// spotLight->setPenumbraAngle ( COLLADABU::Math::Utils::degToRad ( penumbraAngle )); + + } + } // namespace COLLADAMaya This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jud...@us...> - 2009-02-16 15:14:40
|
Revision: 362 http://colladamaya.svn.sourceforge.net/colladamaya/?rev=362&view=rev Author: judithschenk Date: 2009-02-16 15:14:35 +0000 (Mon, 16 Feb 2009) Log Message: ----------- import cameras Modified Paths: -------------- branches/nextgen/COLLADAFramework/include/COLLADAFWCamera.h branches/nextgen/COLLADAFramework/src/COLLADAFWCamera.cpp branches/nextgen/COLLADAMaya/include/COLLADAMayaBaseImporter.h branches/nextgen/COLLADAMaya/include/COLLADAMayaCameraImporter.h branches/nextgen/COLLADAMaya/include/COLLADAMayaDocumentImporter.h branches/nextgen/COLLADAMaya/include/COLLADAMayaEffectImporter.h branches/nextgen/COLLADAMaya/include/COLLADAMayaGeometryImporter.h branches/nextgen/COLLADAMaya/include/COLLADAMayaMaterialImporter.h branches/nextgen/COLLADAMaya/include/COLLADAMayaVisualSceneImporter.h branches/nextgen/COLLADAMaya/scripts/COLLADAMaya.vcproj branches/nextgen/COLLADAMaya/src/COLLADAMayaBaseImporter.cpp branches/nextgen/COLLADAMaya/src/COLLADAMayaDocumentImporter.cpp branches/nextgen/COLLADAMaya/src/COLLADAMayaEffectImporter.cpp branches/nextgen/COLLADAMaya/src/COLLADAMayaGeometryImporter.cpp branches/nextgen/COLLADAMaya/src/COLLADAMayaMaterialImporter.cpp branches/nextgen/COLLADAMaya/src/COLLADAMayaVisualSceneImporter.cpp branches/nextgen/Externals/MayaDataModel/include/MayaDMCommands.h Added Paths: ----------- branches/nextgen/COLLADAMaya/include/COLLADAMayaLightImporter.h branches/nextgen/COLLADAMaya/src/COLLADAMayaCameraImporter.cpp branches/nextgen/COLLADAMaya/src/COLLADAMayaLightImporter.cpp Modified: branches/nextgen/COLLADAFramework/include/COLLADAFWCamera.h =================================================================== --- branches/nextgen/COLLADAFramework/include/COLLADAFWCamera.h 2009-02-13 16:37:25 UTC (rev 361) +++ branches/nextgen/COLLADAFramework/include/COLLADAFWCamera.h 2009-02-16 15:14:35 UTC (rev 362) @@ -58,13 +58,15 @@ /** The horizontal field of view or magnification of the view.*/ double mXFovOrXMag; + bool mHasXFovOrXMag; /** The vertical field of view or magnification of the view.*/ double mYFovOrYMag; + bool mHasYFovOrYMag; - /** The aspect ratio.*/ double mAspectRatio; + bool mHasAspectRatio; /** The near clipping plane.*/ double mNearClippingPlane; @@ -85,47 +87,56 @@ void setName(const COLLADAFW::String& name) { mName = name; } /** Returns the type of the camera.*/ - CameraType getCameraType() const { return mCameraType; } + const CameraType& getCameraType() const { return mCameraType; } /** Sets the type of the camera.*/ - void setCameraType( CameraType cameraType) { mCameraType = cameraType; } + void setCameraType( const CameraType& cameraType) { mCameraType = cameraType; } /** Returns the type of description used to define the perspective camera.*/ - DescriptionType getDescriptionType() const { return mDescriptionType; } + const DescriptionType& getDescriptionType() const { return mDescriptionType; } /** sets the type of description used to define the perspective camera.*/ - void setDescriptionType(DescriptionType descriptionType) { mDescriptionType = descriptionType; } + void setDescriptionType(const DescriptionType& descriptionType) { mDescriptionType = descriptionType; } /** Returns the horizontal field of view. Use only for perspective cameras.*/ double getXFov() const { return mXFovOrXMag; } /** Sets the horizontal field of view. Use only for perspective cameras.*/ - void setXFov(double xFov) { mXFovOrXMag = xFov; } + void setXFov(double xFov) { mXFovOrXMag = xFov; mHasXFovOrXMag = true; } /** Returns the horizontal magnification of the view. Use only for orthographic cameras.*/ double getXMag() const { return mXFovOrXMag; } /** Sets the horizontal magnification of the view. Use only for orthographic cameras.*/ - void setXMag(double xMag) { mXFovOrXMag = xMag; } + void setXMag(double xMag) { mXFovOrXMag = xMag; mHasXFovOrXMag = true; } /** Returns the vertical field of view. Use only for perspective cameras.*/ double getYFov() const { return mYFovOrYMag; } /** Sets the vertical field of view. Use only for perspective cameras.*/ - void setYFov(double yFov) { mYFovOrYMag = yFov; } + void setYFov(double yFov) { mYFovOrYMag = yFov; mHasYFovOrYMag = true; } /** Returns the vertical magnification of the view. Use only for orthographic cameras.*/ double getYMag() const { return mYFovOrYMag; } /** Sets the vertical magnification of the view. Use only for orthographic cameras.*/ - void setYMag(double yMag) { mYFovOrYMag = yMag; } + void setYMag(double yMag) { mYFovOrYMag = yMag; mHasYFovOrYMag = true; } + /** The horizontal field of view or magnification of the view.*/ + const bool& getHasXFovOrXMag () const { return mHasXFovOrXMag; } + + /** The vertical field of view or magnification of the view.*/ + const bool& getHasYFovOrYMag () const { return mHasYFovOrYMag; } + /** Returns the aspect ratio.*/ double getAspectRatio() const { return mAspectRatio; } /** Sets the aspect ratio.*/ - void setAspectRatio(double aspectRatio) { mAspectRatio = aspectRatio; } + void setAspectRatio(double aspectRatio) { mAspectRatio = aspectRatio; mHasAspectRatio = true; } + /** The aspect ratio.*/ + const bool& getHasAspectRatio () const { return mHasAspectRatio; } + /** Returns the near clipping plane.*/ double getNearClippingPlane() const { return mNearClippingPlane; } Modified: branches/nextgen/COLLADAFramework/src/COLLADAFWCamera.cpp =================================================================== --- branches/nextgen/COLLADAFramework/src/COLLADAFWCamera.cpp 2009-02-13 16:37:25 UTC (rev 361) +++ branches/nextgen/COLLADAFramework/src/COLLADAFWCamera.cpp 2009-02-16 15:14:35 UTC (rev 362) @@ -21,8 +21,11 @@ , mCameraType(UNDEFINED_CAMERATYPE) , mDescriptionType( UNDEFINED ) , mXFovOrXMag(0) + , mHasXFovOrXMag (false) , mYFovOrYMag(0) + , mHasYFovOrYMag (false) , mAspectRatio(0) + , mHasAspectRatio (false) , mNearClippingPlane(0) , mFarClippingPlane(0) { Modified: branches/nextgen/COLLADAMaya/include/COLLADAMayaBaseImporter.h =================================================================== --- branches/nextgen/COLLADAMaya/include/COLLADAMayaBaseImporter.h 2009-02-13 16:37:25 UTC (rev 361) +++ branches/nextgen/COLLADAMaya/include/COLLADAMayaBaseImporter.h 2009-02-16 15:14:35 UTC (rev 362) @@ -88,50 +88,13 @@ */ void toLinearUnit ( const double val0, const double val1, const double val2, COLLADABU::Math::Vector3& retVal ); - protected: - - /** 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; } - -// /** Pointer to the current dae document. */ -// daeDocument* getDaeDocument () -// { -// return mDocumentImporter->getDocumentLoader ().getDaeDocument (); -// } -// -// /** Pointer to the current dae document. */ -// const daeDocument* getDaeDocument () const -// { -// return mDocumentImporter->getDocumentLoader ().getDaeDocument (); -// } -// -// /** Returns the current document loader. */ -// COLLADADH::Loader& getDocumentLoader () -// { -// return mDocumentImporter->getDocumentLoader (); -// } -// -// /** Returns the current document loader. */ -// const COLLADADH::Loader& getDocumentLoader () const -// { -// 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 () ); - } + double toLinearUnit ( const double val ); /** * Converts the given value to the linear unit in meters. @@ -139,11 +102,16 @@ * 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 () ); - } + float toLinearUnit ( const float val ); + protected: + + /** 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; } + }; } Modified: branches/nextgen/COLLADAMaya/include/COLLADAMayaCameraImporter.h =================================================================== --- branches/nextgen/COLLADAMaya/include/COLLADAMayaCameraImporter.h 2009-02-13 16:37:25 UTC (rev 361) +++ branches/nextgen/COLLADAMaya/include/COLLADAMayaCameraImporter.h 2009-02-16 15:14:35 UTC (rev 362) @@ -17,22 +17,68 @@ #define __COLLADA_MAYA_CAMERA_IMPORTER_H__ #include "COLLADAMayaStableHeaders.h" +#include "COLLADAMayaBaseImporter.h" +#include "COLLADABUIDList.h" + +#include <MayaDMCamera.h> + + namespace COLLADAMaya { /** Declares xy */ - class CameraImporter + class CameraImporter : BaseImporter { + private: + /** The standard name for camera without name. */ + static const String CAMERA_NAME; + + private: + + /** + * The list of the unique maya camera names. + */ + COLLADABU::IDList mCameraIdList; + + /** + * The map holds the unique ids of the camera nodes to the maya specific nodes. + */ + UniqueIdMayaNodesMap mMayaCameraNodesMap; + public: /** Constructor. */ - CameraImporter () {} + CameraImporter ( DocumentImporter* documentImporter ); /** Destructor. */ - virtual ~CameraImporter () {} + virtual ~CameraImporter (); + /** + * Imports the data of the current camera. + */ + void importCamera ( const COLLADAFW::Camera* camera ); + + /** + * Imports the data of the current camera. + */ + void createCamera ( + const COLLADAFW::Camera* camera, + MayaNode* mayaTransformNode, + size_t numNodeInstances ); + + void setPerspectiveCameraAttributes ( + const COLLADAFW::Camera* camera, + MayaDM::Camera& mayaCamera ); + + void setOrthographicCameraAttributes ( + const COLLADAFW::Camera* camera, + MayaDM::Camera& mayaCamera ); + + MayaNode* findMayaCameraNode ( const COLLADAFW::UniqueId& cameraId ); + + }; } Modified: branches/nextgen/COLLADAMaya/include/COLLADAMayaDocumentImporter.h =================================================================== --- branches/nextgen/COLLADAMaya/include/COLLADAMayaDocumentImporter.h 2009-02-13 16:37:25 UTC (rev 361) +++ branches/nextgen/COLLADAMaya/include/COLLADAMayaDocumentImporter.h 2009-02-16 15:14:35 UTC (rev 362) @@ -22,10 +22,11 @@ #include "COLLADAFWIWriter.h" #include "COLLADAFWFileInfo.h" -#include "COLLADAFWVisualScene.h" -#include "COLLADAFWGeometry.h" -#include "COLLADAFWMaterial.h" -#include "COLLADAFWEffect.h" +// #include "COLLADAFWVisualScene.h" +// #include "COLLADAFWGeometry.h" +// #include "COLLADAFWMaterial.h" +// #include "COLLADAFWEffect.h" +// #include "COLLADAFWCamera.h" #include "MayaDMMesh.h" @@ -38,6 +39,8 @@ class GeometryImporter; class MaterialImporter; class EffectImporter; + class CameraImporter; + class LightImporter; /** The main importer class. This class imports all data of the scene. */ @@ -74,6 +77,8 @@ bool mSceneGraphRead; bool mGeometryRead; + bool mCameraRead; + bool mLightRead; /** Pointer to the visual scene importer. */ VisualSceneImporter* mVisualSceneImporter; @@ -87,6 +92,12 @@ /** Pointer to the geometry importer. */ EffectImporter* mEffectImporter; + /** Pointer to the camera importer. */ + CameraImporter* mCameraImporter; + + /** Pointer to the light importer. */ + LightImporter* mLightImporter; + /** The variable tells, how many times the document is read. */ size_t mNumDocumentParses; @@ -140,6 +151,14 @@ EffectImporter* getEffectImporter () { return mEffectImporter; } const EffectImporter* getEffectImporter () const { return mEffectImporter; } + /** Pointer to the camera importer. */ + CameraImporter* getCameraImporter () { return mCameraImporter; } + const CameraImporter* getCameraImporter () const { return mCameraImporter; } + + /** Pointer to the light importer. */ + LightImporter* getLightImporter () { return mLightImporter; } + const LightImporter* getLightImporter () const { return mLightImporter; } + /** This method will be called if an error in the loading process occurred and the loader cannot continue to to load. The writer should undo all operations that have been performed. @param errorMessage A message containing informations about the error that occurred. @@ -198,11 +217,12 @@ /** When this method is called, the writer must write the camera. @return The writer should return true, if writing succeeded, false otherwise.*/ - virtual bool writeCamera( const COLLADAFW::Camera* camera ) - { - return true; - } + virtual bool writeCamera( const COLLADAFW::Camera* camera ); + /** When this method is called, the writer must write the light. + @return The writer should return true, if writing succeeded, false otherwise.*/ + virtual bool writeLight( const COLLADAFW::Light* camera ); + /** * Replace offending characters by some that are supported within maya. */ Modified: branches/nextgen/COLLADAMaya/include/COLLADAMayaEffectImporter.h =================================================================== --- branches/nextgen/COLLADAMaya/include/COLLADAMayaEffectImporter.h 2009-02-13 16:37:25 UTC (rev 361) +++ branches/nextgen/COLLADAMaya/include/COLLADAMayaEffectImporter.h 2009-02-16 15:14:35 UTC (rev 362) @@ -11,12 +11,14 @@ #ifndef __COLLADAMAYA_EFFECTIMPORTER_H__ #define __COLLADAMAYA_EFFECTIMPORTER_H__ -#include "COLLADAFWPrerequisites.h" +#include "COLLADAMayaStableHeaders.h" #include "COLLADAMayaBaseImporter.h" #include "COLLADABUIDList.h" +#include "COLLADAFWEffectCommon.h" + namespace COLLADAMaya { @@ -52,7 +54,7 @@ public: /** Constructor. */ - EffectImporter ( DocumentImporter* documentImporter ); + EffectImporter ( DocumentImporter* documentImporter ); /** Destructor. */ virtual ~EffectImporter (); @@ -109,12 +111,11 @@ { // TODO Textures! - { - const COLLADAFW::Color& color = effect->getStandardColor (); - if ( color.isValid () ) - lambert->setColor ( MayaDM::float3 (color.getRed (), color.getGreen (), color.getBlue ()) ); - } + const COLLADAFW::Color& standardColor = effect->getStandardColor (); + if ( standardColor.isValid () ) + lambert->setColor ( MayaDM::float3 (standardColor.getRed (), standardColor.getGreen (), standardColor.getBlue ()) ); + const COLLADAFW::ColorOrTexture& diffuse = commonEffect->getDiffuse (); if ( diffuse.isColor () ) { @@ -122,7 +123,12 @@ if ( color.isValid () ) lambert->setColor ( MayaDM::float3 (color.getRed (), color.getGreen (), color.getBlue ()) ); } + else + { + // TODO + } + const COLLADAFW::ColorOrTexture& emission = commonEffect->getEmission (); if ( emission.isColor () ) { Modified: branches/nextgen/COLLADAMaya/include/COLLADAMayaGeometryImporter.h =================================================================== --- branches/nextgen/COLLADAMaya/include/COLLADAMayaGeometryImporter.h 2009-02-13 16:37:25 UTC (rev 361) +++ branches/nextgen/COLLADAMaya/include/COLLADAMayaGeometryImporter.h 2009-02-16 15:14:35 UTC (rev 362) @@ -117,16 +117,6 @@ CombinedIdIndicesMap mShadingEnginePrimitivesMap; /** - * The map holds for every geometry id the number of mesh - * primitive elements. - */ - - /** - * The map holds for every primitive element of every geometry - * instance the generated group id. - */ - - /** * Assign the group to the unique geometry id, the transform node * to the mesh instance and the index of the geometry's primitives. */ @@ -141,7 +131,7 @@ virtual ~GeometryImporter () {} /** Imports the geometry element. */ - bool importGeometry ( const COLLADAFW::Geometry* geometry ); + void importGeometry ( const COLLADAFW::Geometry* geometry ); /** * The map holds the unique ids of the nodes to the maya specific nodes. Added: branches/nextgen/COLLADAMaya/include/COLLADAMayaLightImporter.h =================================================================== --- branches/nextgen/COLLADAMaya/include/COLLADAMayaLightImporter.h (rev 0) +++ branches/nextgen/COLLADAMaya/include/COLLADAMayaLightImporter.h 2009-02-16 15:14:35 UTC (rev 362) @@ -0,0 +1,43 @@ +/* + 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 __COLLADAMAYA_LIGHTIMPORTER_H__ +#define __COLLADAMAYA_LIGHTIMPORTER_H__ + +#include "COLLADAMayaPrerequisites.h" +#include "COLLADAMayaBaseImporter.h" + + +namespace COLLADAMaya +{ + + /** TODO Documentation */ + class LightImporter : BaseImporter + { + private: + + public: + + /** Constructor. */ + LightImporter ( DocumentImporter* documentImporter ); + + /** Destructor. */ + virtual ~LightImporter (); + + /** + * Imports the data of the current light. + */ + void importLight ( const COLLADAFW::Light* camera ); + + }; + +} // namespace COLLADAMAYA + +#endif // __COLLADAMAYA_LIGHTIMPORTER_H__ Modified: branches/nextgen/COLLADAMaya/include/COLLADAMayaMaterialImporter.h =================================================================== --- branches/nextgen/COLLADAMaya/include/COLLADAMayaMaterialImporter.h 2009-02-13 16:37:25 UTC (rev 361) +++ branches/nextgen/COLLADAMaya/include/COLLADAMayaMaterialImporter.h 2009-02-16 15:14:35 UTC (rev 362) @@ -26,7 +26,9 @@ #include "MayaDMMaterialInfo.h" #include "MayaDMTransform.h" +#include "COLLADAFWInstanceGeometry.h" + namespace COLLADAMaya { Modified: branches/nextgen/COLLADAMaya/include/COLLADAMayaVisualSceneImporter.h =================================================================== --- branches/nextgen/COLLADAMaya/include/COLLADAMayaVisualSceneImporter.h 2009-02-13 16:37:25 UTC (rev 361) +++ branches/nextgen/COLLADAMaya/include/COLLADAMayaVisualSceneImporter.h 2009-02-16 15:14:35 UTC (rev 362) @@ -60,6 +60,18 @@ */ UniqueIdUniqueIdsMap mGeometryTransformIdsMap; + /* + * The map holds for every unique id of a camera a list of transform node unique ids. + * We need it for the creation of the camera, to set the parent transform nodes. + */ + UniqueIdUniqueIdsMap mCameraTransformIdsMap; + + /* + * The map holds for every unique id of a light a list of transform node unique ids. + * We need it for the creation of the light, to set the parent transform nodes. + */ + UniqueIdUniqueIdsMap mLightTransformIdsMap; + /** * The map holds the unique ids of the nodes to the full node pathes (contains the name). */ @@ -145,6 +157,20 @@ */ const UniqueIdVec* findGeometryTransformIds ( const COLLADAFW::UniqueId& geometryId ) const; + /* + * The map holdes for every camera (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 camera, to set the parent transform nodes. + */ + const UniqueIdVec* findCameraTransformIds ( const COLLADAFW::UniqueId& cameraId ) const; + + /* + * The map holdes for every light (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 light, to set the parent transform nodes. + */ + const UniqueIdVec* findLightTransformIds ( const COLLADAFW::UniqueId& lightId ) const; + private: /* @@ -160,6 +186,16 @@ bool readGeometryInstances ( const COLLADAFW::Node* node ); /** + * Save the transformation ids to the geometry ids. + */ + bool readCameraInstances ( const COLLADAFW::Node* node ); + + /** + * Save the transformation ids to the geometry ids. + */ + bool readLightInstances ( const COLLADAFW::Node* node ); + + /** * Read the shading engines. */ void readMaterialInstances ( Modified: branches/nextgen/COLLADAMaya/scripts/COLLADAMaya.vcproj =================================================================== --- branches/nextgen/COLLADAMaya/scripts/COLLADAMaya.vcproj 2009-02-13 16:37:25 UTC (rev 361) +++ branches/nextgen/COLLADAMaya/scripts/COLLADAMaya.vcproj 2009-02-16 15:14:35 UTC (rev 362) @@ -2675,204 +2675,12 @@ > </File> <File + RelativePath="..\src\COLLADAMayaCameraImporter.cpp" + > + </File> + <File RelativePath="..\src\COLLADAMayaDocumentImporter.cpp" > - <FileConfiguration - Name="DebugPlugin2008|Win32" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugPlugin2008|x64" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleasePlugin2008|Win32" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleasePlugin2008|x64" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugConsole2008|Win32" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugConsole2008|x64" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleaseConsole2008|Win32" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleaseConsole2008|x64" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugPlugin85|Win32" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugPlugin85|x64" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugPlugin2009|Win32" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugPlugin2009|x64" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleasePlugin2009|Win32" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleasePlugin2009|x64" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleasePlugin80|Win32" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleasePlugin80|x64" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugPlugin70|Win32" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugPlugin70|x64" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleasePlugin85|Win32" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleasePlugin85|x64" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugPlugin80|Win32" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugPlugin80|x64" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleasePlugin70|Win32" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleasePlugin70|x64" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugConsole2009|Win32" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugConsole2009|x64" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleaseConsole2009|Win32" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleaseConsole2009|x64" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> </File> <File RelativePath="..\src\COLLADAMayaEffectImporter.cpp" @@ -2881,402 +2689,14 @@ <File RelativePath="..\src\COLLADAMayaGeometryImporter.cpp" > - <FileConfiguration - Name="DebugPlugin2008|Win32" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugPlugin2008|x64" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleasePlugin2008|Win32" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleasePlugin2008|x64" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugConsole2008|Win32" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugConsole2008|x64" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleaseConsole2008|Win32" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleaseConsole2008|x64" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugPlugin85|Win32" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugPlugin85|x64" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugPlugin2009|Win32" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugPlugin2009|x64" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleasePlugin2009|Win32" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleasePlugin2009|x64" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleasePlugin80|Win32" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleasePlugin80|x64" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugPlugin70|Win32" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugPlugin70|x64" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleasePlugin85|Win32" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleasePlugin85|x64" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugPlugin80|Win32" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugPlugin80|x64" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleasePlugin70|Win32" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleasePlugin70|x64" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugConsole2009|Win32" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugConsole2009|x64" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleaseConsole2009|Win32" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleaseConsole2009|x64" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> </File> <File + RelativePath="..\src\COLLADAMayaLightImporter.cpp" + > + </File> + <File RelativePath="..\src\COLLADAMayaMaterialImporter.cpp" > - <FileConfiguration - Name="DebugPlugin2008|Win32" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugPlugin2008|x64" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleasePlugin2008|Win32" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleasePlugin2008|x64" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugConsole2008|Win32" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugConsole2008|x64" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleaseConsole2008|Win32" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleaseConsole2008|x64" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugPlugin85|Win32" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugPlugin85|x64" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugPlugin2009|Win32" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugPlugin2009|x64" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleasePlugin2009|Win32" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleasePlugin2009|x64" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleasePlugin80|Win32" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleasePlugin80|x64" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugPlugin70|Win32" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugPlugin70|x64" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleasePlugin85|Win32" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleasePlugin85|x64" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugPlugin80|Win32" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugPlugin80|x64" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleasePlugin70|Win32" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleasePlugin70|x64" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugConsole2009|Win32" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugConsole2009|x64" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleaseConsole2009|Win32" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleaseConsole2009|x64" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> </File> <File RelativePath="..\src\COLLADAMayaNode.cpp" @@ -3285,202 +2705,6 @@ <File RelativePath="..\src\COLLADAMayaVisualSceneImporter.cpp" > - <FileConfiguration - Name="DebugPlugin2008|Win32" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugPlugin2008|x64" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleasePlugin2008|Win32" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleasePlugin2008|x64" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugConsole2008|Win32" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugConsole2008|x64" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleaseConsole2008|Win32" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleaseConsole2008|x64" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugPlugin85|Win32" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugPlugin85|x64" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugPlugin2009|Win32" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugPlugin2009|x64" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleasePlugin2009|Win32" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleasePlugin2009|x64" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleasePlugin80|Win32" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleasePlugin80|x64" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugPlugin70|Win32" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugPlugin70|x64" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleasePlugin85|Win32" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleasePlugin85|x64" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugPlugin80|Win32" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugPlugin80|x64" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleasePlugin70|Win32" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleasePlugin70|x64" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugConsole2009|Win32" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DebugConsole2009|x64" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleaseConsole2009|Win32" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="ReleaseConsole2009|x64" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> </File> </Filter> </Filter> @@ -3900,7 +3124,6 @@ > <FileConfiguration Name="DebugPlugin2008|Win32" - ExcludedFromBuild="true" > <Tool Name="VCCustomBuildTool" @@ -3908,7 +3131,6 @@ </FileConfiguration> <FileConfiguration Name="DebugPlugin2008|x64" - ExcludedFromBuild="true" > <Tool Name="VCCustomBuildTool" @@ -3916,7 +3138,6 @@ </FileConfiguration> <FileConfiguration Name="ReleasePlugin2008|Win32" - ExcludedFromBuild="true" > <Tool Name="VCCustomBuildTool" @@ -3924,7 +3145,6 @@ </FileConfiguration> <FileConfiguration Name="ReleasePlugin2008|x64" - ExcludedFromBuild="true" > <Tool Name="VCCustomBuildTool" @@ -3932,7 +3152,6 @@ </FileConfiguration> <FileConfiguration Name="DebugConsole2008|Win32" - ExcludedFromBuild="true" > <Tool Name="VCCustomBuildTool" @@ -3940,7 +3159,6 @@ </FileConfiguration> <FileConfiguration Name="DebugConsole2008|x64" - ExcludedFromBuild="true" > <Tool Name="VCCustomBuildTool" @@ -3948,7 +3166,6 @@ </FileConfiguration> <FileConfiguration Name="ReleaseConsole2008|Win32" - ExcludedFromBuild="true" > <Tool Name="VCCustomBuildTool" @@ -3956,7 +3173,6 @@ </FileConfiguration> <FileConfiguration Name="ReleaseConsole2008|x64" - ExcludedFromBuild="true" > <Tool Name="VCCustomBuildTool" @@ -3964,7 +3180,6 @@ </FileConfiguration> <FileConfiguration Name="DebugPlugin85|Win32" - ExcludedFromBuild="true" > <Tool Name="VCCustomBuildTool" @@ -3972,7 +3187,6 @@ </FileConfiguration> <FileConfiguration Name="DebugPlugin85|x64" - ExcludedFromBuild="true" > <Tool Name="VCCustomBuildTool" @@ -3980,7 +3194,6 @@ </FileConfiguration> <FileConfiguration Name="DebugPlugin2009|Win32" - ExcludedFromBuild="true" > <Tool Name="VCCustomBuildTool" @@ -3988,7 +3201,6 @@ </FileConfiguration> <FileConfiguration Name="DebugPlugin2009|x64" - ExcludedFromBuild="true" > <Tool Name="VCCustomBuildTool" @@ -3996,7 +3208,6 @@ </FileConfiguration> <FileConfiguration Name="ReleasePlugin2009|Win32" - ExcludedFromBuild="true" > <Tool Name="VCCustomBuildTool" @@ -4004,7 +3215,6 @@ </FileConfiguration> <FileConfiguration Name="ReleasePlugin2009|x64" - ExcludedFromBuild="true" > <Tool Name="VCCustomBuildTool" @@ -4012,7 +3222,6 @@ </FileConfiguration> <FileConfiguration Name="ReleasePlugin80|Win32" - ExcludedFromBuild="true" > <Tool Name="VCCustomBuildTool" @@ -4020,7 +3229,6 @@ </FileConfiguration> <FileConfiguration Name="ReleasePlugin80|x64" - ExcludedFromBuild="true" > <Tool Name="VCCustomBuildTool" @@ -4028,7 +3236,6 @@ </FileConfiguration> <FileConfiguration Name="DebugPlugin70|Win32" - ExcludedFromBuild="true" > <Tool Name="VCCustomBuildTool" @@ -4036,7 +3243,6 @@ </FileConfiguration> <FileConfiguration Name="DebugPlugin70|x64" - ExcludedFromBuild="true" > <Tool Name="VCCustomBuildTool" @@ -4044,7 +3250,6 @@ </FileConfiguration> <FileConfiguration Name="ReleasePlugin85|Win32" - ExcludedFromBuild="true" > <Tool Name="VCCustomBuildTool" @@ -4052,7 +3257,6 @@ </FileConfiguration> <FileConfiguration Name="ReleasePlugin85|x64" - ExcludedFromBuild="true" > <Tool Name="VCCustomBuildTool" @@ -4060,7 +3264,6 @@ </FileConfiguration> <FileConfiguration Name="DebugPlugin80|Win32" - ExcludedFromBuild="true" > <Tool Name="VCCustomBuildTool" @@ -4068,7 +3271,6 @@ </FileConfiguration> <FileConfiguration Name="DebugPlugin80|x64" - ExcludedFromBuild="true" > <Tool Name="VCCustomBuildTool" @@ -4076,7 +3278,6 @@ </FileConfiguration> <FileConfiguration Name="ReleasePlugin70|Win32" - ExcludedFromBuild="true" > <Tool Name="VCCustomBuildTool" @@ -4084,7 +3285,6 @@ </FileConfiguration> <FileConfiguration Name="ReleasePlugin70|x64" - ExcludedFromBuild="true" > <Tool Name="VCCustomBuildTool" @@ -4092,7 +3292,6 @@ </FileConfiguration> <FileConfiguration Name="DebugConsole2009|Win32" - ExcludedFromBuild="true" > <Tool Name="VCCustomBuildTool" @@ -4100,7 +3299,6 @@ </FileConfiguration> <FileConfiguration Name="DebugConsole2009|x64" - ExcludedFromBuild="true" > <Tool Name="VCCustomBuildTool" @@ -4108,7 +3306,6 @@ </FileConfiguration> <FileConfiguration Name="ReleaseConsole2009|Win32" - ExcludedFromBuild="true" > <Tool Name="VCCustomBuildTool" @@ -4116,7 +3313,6 @@ </FileConfiguration> <FileConfiguration Name="ReleaseConsole2009|x64" - ExcludedFromBuild="true" > <Tool Name="VCCustomBuildTool" @@ -4528,6 +3724,10 @@ </FileConfiguration> </File> <File + RelativePath="..\include\COLLADAMayaLightImporter.h" + > + </File> + <File RelativePath="..\include\COLLADAMayaMaterialImporter.h" > <FileConfiguration Modified: branches/nextgen/COLLADAMaya/src/COLLADAMayaBaseImporter.cpp =================================================================== --- branches/nextgen/COLLADAMaya/src/COLLADAMayaBaseImporter.cpp 2009-02-13 16:37:25 UTC (rev 361) +++ branches/nextgen/COLLADAMaya/src/COLLADAMayaBaseImporter.cpp 2009-02-16 15:14:35 UTC (rev 362) @@ -5,6 +5,18 @@ { //----------------------------- + double BaseImporter::toLinearUnit ( const double val ) + { + return ( val * mDocumentImporter->getLinearUnitMeter () ); + } + + //----------------------------- + float BaseImporter::toLinearUnit ( const float val ) + { + return ( val * (float) mDocumentImporter->getLinearUnitMeter () ); + } + + //----------------------------- MayaDM::double3 BaseImporter::toLinearUnit ( const MayaDM::double3& val ) { if ( mDocumentImporter->getUpAxisType () == COLLADAFW::FileInfo::X_UP ) Added: branches/nextgen/COLLADAMaya/src/COLLADAMayaCameraImporter.cpp =================================================================== --- branches/nextgen/COLLADAMaya/src/COLLADAMayaCameraImporter.cpp (rev 0) +++ branches/nextgen/COLLADAMaya/src/COLLADAMayaCameraImporter.cpp 2009-02-16 15:14:35 UTC (rev 362) @@ -0,0 +1,221 @@ +/* + 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 "COLLADAMayaStableHeaders.h" +#include "COLLADAMayaCameraImporter.h" +#include "COLLADAMayaVisualSceneImporter.h" + +#include "COLLADAFWCamera.h" + +#include <MayaDMCommands.h> + + +namespace COLLADAMaya +{ + + const String CameraImporter::CAMERA_NAME = "Camera"; + + + //------------------------------ + CameraImporter::CameraImporter ( DocumentImporter* documentImporter ) + : BaseImporter ( documentImporter ) + { + } + + //------------------------------ + CameraImporter::~CameraImporter() + { + } + + //------------------------------ + void CameraImporter::importCamera ( const COLLADAFW::Camera* camera ) + { + // Get the parent transform node, which reference this camera. + const COLLADAFW::UniqueId& cameraId = camera->getUniqueId (); + VisualSceneImporter* visualSceneImporter = getDocumentImporter ()->getVisualSceneImporter (); + + // Check if the camera is already imported. + if ( findMayaCameraNode ( cameraId ) != 0 ) return; + + // Get the transform nodes, which work with this camera instance. + const UniqueIdVec* transformNodes = visualSceneImporter->findCameraTransformIds ( cameraId ); + if ( transformNodes == 0 ) + { + MGlobal::displayError ( "No camera node which implements this camera!" ); + std::cerr << "No camera node which implements this camera!" << endl; + } + size_t numNodeInstances = transformNodes->size (); + + // The index value of the current geometry instance. + size_t geometryInstanceIndex = 0; + + UniqueIdVec::const_iterator nodesIter = transformNodes->begin (); + while ( nodesIter != transformNodes->end () ) + { + // Get the maya node of the current transform node. + const COLLADAFW::UniqueId& transformNodeId = *nodesIter; + MayaNode* mayaTransformNode = visualSceneImporter->findMayaTransformNode ( transformNodeId ); + String transformNodeName = mayaTransformNode->getName (); + + // Get the path to the parent transform node. + String transformNodePath = mayaTransformNode->getNodePath (); + + // The first reference is a direct one, the others are instances. + if ( nodesIter == transformNodes->begin() ) + { + // Create the current mesh node. + createCamera ( camera, mayaTransformNode, numNodeInstances ); + } + else + { + // Get the path to the mesh. + MayaNode* mayaCameraNode = findMayaCameraNode ( cameraId ); + String cameraNodePath = mayaCameraNode->getNodePath (); + + // parent -shape -noConnections -relative -addObject "|pCube1|pCubeShape1" "pCube2"; + FILE* file = getDocumentImporter ()->getFile (); + MayaDM::parentShape ( file, cameraNodePath, transformNodePath, false, true, true, true ); + } + + ++nodesIter; + } + } + + //------------------------------ + void CameraImporter::createCamera ( + const COLLADAFW::Camera* camera, + MayaNode* mayaTransformNode, + size_t numNodeInstances ) + { + // Create a unique name. + String cameraName = camera->getName (); + if ( COLLADABU::Utils::equals ( cameraName, "" ) ) + cameraName = CAMERA_NAME; + cameraName = mCameraIdList.addId ( cameraName ); + + // Create a maya node object of the current node and push it into the map. + const COLLADAFW::UniqueId& cameraId = camera->getUniqueId (); + MayaNode mayaMeshNode ( cameraId, cameraName, mayaTransformNode ); + mMayaCameraNodesMap [ cameraId ] = mayaMeshNode; + + // Create the maya camera object and write it into the maya ascii file. + FILE* file = getDocumentImporter ()->getFile (); + MayaDM::Camera mayaCamera ( file, cameraName, mayaTransformNode->getNodePath () ); + + const COLLADAFW::Camera::CameraType& cameraType = camera->getCameraType (); + switch ( cameraType ) + { + case COLLADAFW::Camera::ORTHOGRAPHIC: + setOrthographicCameraAttributes ( camera, mayaCamera ); + break; + case COLLADAFW::Camera::PERSPECTIVE: + setPerspectiveCameraAttributes ( camera, mayaCamera ); + break; + default: + std::cerr << "Unknown camera type!" << endl; + MGlobal::displayError ( "Unknown camera type!" ); + break; + } + + } + + //------------------------------ + void CameraImporter::setPerspectiveCameraAttributes ( + const COLLADAFW::Camera* camera, + MayaDM::Camera& mayaCamera ) + { + mayaCamera.setOrthographic ( false ); + + double nearClipPlane = camera->getNearClippingPlane (); + nearClipPlane = toLinearUnit ( nearClipPlane ); + mayaCamera.setNearClipPlane ( nearClipPlane ); + + double farClipPlane = camera->getFarClippingPlane (); + farClipPlane = toLinearUnit ( farClipPlane ); + mayaCamera.setFarClipPlane ( farClipPlane ); + + FILE* file = getDocumentImporter ()->getFile (); + + if ( camera->getHasAspectRatio () ) + { + double aspectRatio = camera->getAspectRatio (); + MayaDM::editCameraAspectRatio ( file, mayaCamera.getName (), aspectRatio ); + } + else + { + double aspectRatio = camera->getXFov () / camera->getYFov (); + MayaDM::editCameraAspectRatio ( file, mayaCamera.getName (), aspectRatio ); + } + + if ( camera->getHasYFovOrYMag () ) + { + double verticalFieldOfView = camera->getYFov (); + MayaDM::editCameraVerticalFieldOfView ( file, mayaCamera.getName (), verticalFieldOfView ); + } + + if ( camera->getHasXFovOrXMag () ) + { + double horizontalFieldOfView = camera->getXFov (); + MayaDM::editCameraHorizontalFieldOfView ( file, mayaCamera.getName (), horizontalFieldOfView ); + } + } + + //------------------------------ + void CameraImporter::setOrthographicCameraAttributes ( + const COLLADAFW::Camera* camera, + MayaDM::Camera& mayaCamera ) + { + mayaCamera.setOrthographic ( true ); + + double nearClipPlane = camera->getNearClippingPlane (); + nearClipPlane = toLinearUnit ( nearClipPlane ); + mayaCamera.setNearClipPlane ( nearClipPlane ); + + double farClipPlane = camera->getFarClippingPlane (); + farClipPlane = toLinearUnit ( farClipPlane ); + mayaCamera.setFarClipPlane ( farClipPlane ); + + FILE* file = getDocumentImporter ()->getFile (); + + if ( camera->getHasAspectRatio () ) + { + double aspectRatio = camera->getAspectRatio (); + MayaDM::editCameraAspectRatio ( file, mayaCamera.getName (), aspectRatio ); + } + else + { + double aspectRatio = camera->getXMag () / camera->getYMag (); + MayaDM::editCameraAspectRatio ( file, mayaCamera.getName (), aspectRatio ); + } + + if ( camera->getHasYFovOrYMag () ) + { + double orthographicHeight = camera->getYMag () / 2; + MayaDM::editCameraOrthographicHeight ( file, mayaCamera.getName (), orthographicHeight ); + } + + if ( camera->getHasXFovOrXMag () ) + { + double orthographicWidth = camera->getXMag () / 2; + MayaDM::editCameraOrthographicWidth ( file, mayaCamera.getName (), orthographicWidth ); + } + } + + // -------------------------------------------- + MayaNode* CameraImporter::findMayaCameraNode ( const COLLADAFW::UniqueId& cameraId ) + { + UniqueIdMayaNodesMap::iterator it = mMayaCameraNodesMap.find ( cameraId ); + if ( it != mMayaCameraNodesMap.end () ) + return &(*it).second; + + return NULL; + } + +} // namespace COLLADAMaya Modified: branches/nextgen/COLLADAMaya/src/COLLADAMayaDocumentImporter.cpp =================================================================== --- branches/nextgen/COLLADAMaya/src/COLLADAMayaDocumentImporter.cpp 2009-02-13 16:37:25 UTC (rev 361) +++ branches/nextgen/COLLADAMaya/src/COLLADAMayaDocumentImporter.cpp 2009-02-16 15:14:35 UTC (rev 362) @@ -21,6 +21,7 @@ #include "COLLADAMayaEffectImporter.h" #include "COLLADAMayaGeometryImporter.h" #include "COLLADAMayaCameraImporter.h" +#include "COLLADAMayaLightImporter.h" #include "COLLADAMayaVisualSceneImporter.h" #include "COLLADAMayaVisualSceneImporter.h" @@ -47,10 +48,14 @@ , mGeometryImporter (0) , mMaterialImporter (0) , mEffectImporter (0) + , mCameraImporter (0) + , mLightImporter (0) , mSceneGraphWritten (false) , mAssetWritten (false) , mSceneGraphRead (false) , mGeometryRead (false) + , mCameraRead (false) + , mLightRead (false) , mLinearUnitMeter (1) , mNumDocumentParses (0) { @@ -75,6 +80,8 @@ mGeometryImporter = new GeometryImporter ( this ); mMaterialImporter = new MaterialImporter ( this ); mEffectImporter = new EffectImporter ( this ); + mCameraImporter = new CameraImporter ( this ); + mLightImporter = new LightImporter ( this ); // Get the sceneID (assign a name to the scene) MString sceneName = MFileIO::currentFile (); @@ -91,6 +98,8 @@ delete mGeometryImporter; delete mMaterialImporter; delete mEffectImporter; + delete mCameraImporter; + delete mLightImporter; } //----------------------------- @@ -316,10 +325,12 @@ mAssetWritten = true; - if ( mSceneGraphRead || mGeometryRead ) + if ( mSceneGraphRead || mGeometryRead || mCameraRead || mLightRead ) { mSceneGraphRead = false; mGeometryRead = false; + mCameraRead = false; + mLightRead = false; readColladaDocument (); } @@ -344,9 +355,11 @@ mVisualSceneImporter->importVisualScene ( visualScene ); mSceneGraphWritten = true; - if ( mGeometryRead ) + if ( mGeometryRead || mCameraRead || mLightRead ) { mGeometryRead = false; + mCameraRead = false; + mLightRead = false; readColladaDocument (); } @@ -403,4 +416,42 @@ return true; } + //----------------------------- + bool DocumentImporter::writeCamera ( const COLLADAFW::Camera* camera ) + { + // Order: asset, scene graph, others + if ( !mAssetWritten || !mSceneGraphWritten ) + { + mCameraRead = true; + return true; + } + + // Create the file, if not already done. + if ( mFile == 0 ) start(); + + // Import the data. + mCameraImporter->importCamera ( camera ); + + return true; + } + + //----------------------------- + bool DocumentImporter::writeLight ( const COLLADAFW::Light* camera ) + { + // Order: asset, scene graph, others + if ( !mAssetWritten || !mSceneGraphWritten ) + { + mLightRead = true; + return true; + } + + // Create the file, if not already done. + if ( mFile == 0 ) start(); + + // Import the data. + mLightImporter->importLight ( camera ); + + return true; + } + } \ No newline at end of file Modified: branches/nextgen/COLLADAMaya/src/COLLADAMayaEffectImporter.cpp =================================================================== --- branches/nextgen/COLLADAMaya/src/COLLADAMayaEffectImporter.cpp 2009-02-13 16:37:25 UTC (rev 361) +++ branches/nextgen/COLLADAMaya/src/COLLADAMayaEffectImporter.cpp 2009-02-16 15:14:35 UTC (rev 362) @@ -15,7 +15,9 @@ #include "MayaDMBlinn.h" #include "MayaDMPhong.h" +#include "COLLADAFWEffect.h" + namespace COLLADAMaya { Modified: branches/nextgen/COLLADAMaya/src/COLLADAMayaGeometryImporter.cpp =================================================================== --- branches/nextgen/COLLADAMaya/src/COLLADAMayaGeometryImporter.cpp 2009-02-13 16:37:25 UTC (rev 361) +++ branches/nextgen/COLLADAMaya/src/COLLADAMayaGeometryImporter.cpp 2009-02-16 15:14:35 UTC (rev 362) @@ -37,7 +37,7 @@ { const String GeometryImporter::GEOMETRY_NAME = "Geometry"; - const String GeometryImporter::GROUPID_NAME = "GroupId1"; + const String GeometryImporter::GROUPID_NAME = "GroupId"; // -------------------------------------------- @@ -46,13 +46,13 @@ {} // -------------------------------------------- - bool GeometryImporter::importGeometry ( const COLLADAFW::Geometry* geometry ) + void GeometryImporter::importGeometry ( const COLLADAFW::Geometry* geometry ) { - if ( geometry == 0 ) return false; + if ( geometry == 0 ) return; ... [truncated message content] |
From: <jud...@us...> - 2009-02-13 16:37:30
|
Revision: 361 http://colladamaya.svn.sourceforge.net/colladamaya/?rev=361&view=rev Author: judithschenk Date: 2009-02-13 16:37:25 +0000 (Fri, 13 Feb 2009) Log Message: ----------- COLLADAMaya: material import: multiple uvsets, multiple shader engines, multiple primitives Modified Paths: -------------- branches/nextgen/COLLADAMaya/include/COLLADAMayaEffectImporter.h branches/nextgen/COLLADAMaya/src/COLLADAMayaEffectImporter.cpp Modified: branches/nextgen/COLLADAMaya/include/COLLADAMayaEffectImporter.h =================================================================== --- branches/nextgen/COLLADAMaya/include/COLLADAMayaEffectImporter.h 2009-02-13 16:28:30 UTC (rev 360) +++ branches/nextgen/COLLADAMaya/include/COLLADAMayaEffectImporter.h 2009-02-13 16:37:25 UTC (rev 361) @@ -78,8 +78,22 @@ void appendEffect ( const COLLADAFW::UniqueId& id, MayaDM::DependNode* effectNode ); /** - * Imports a lambert shader effect. + * Imports a blinn shader effect. */ + void importBlinnShader ( + const COLLADAFW::Effect* effect, + const COLLADAFW::EffectCommon* commonEffect ); + + /** + * Imports a phong shader effect. + */ + void importPhongShader ( + const COLLADAFW::Effect* effect, + const COLLADAFW::EffectCommon* commonEffect ); + + /** + * Imports a lambert shader effect. + */ void importLambertShader ( const COLLADAFW::Effect* effect, const COLLADAFW::EffectCommon* commonEffect ); @@ -93,6 +107,8 @@ const COLLADAFW::Effect* effect, const COLLADAFW::EffectCommon* commonEffect ) { + // TODO Textures! + { const COLLADAFW::Color& color = effect->getStandardColor (); if ( color.isValid () ) Modified: branches/nextgen/COLLADAMaya/src/COLLADAMayaEffectImporter.cpp =================================================================== --- branches/nextgen/COLLADAMaya/src/COLLADAMayaEffectImporter.cpp 2009-02-13 16:28:30 UTC (rev 360) +++ branches/nextgen/COLLADAMaya/src/COLLADAMayaEffectImporter.cpp 2009-02-13 16:37:25 UTC (rev 361) @@ -12,6 +12,8 @@ #include "COLLADAMayaEffectImporter.h" #include "MayaDMLambert.h" +#include "MayaDMBlinn.h" +#include "MayaDMPhong.h" namespace COLLADAMaya @@ -55,10 +57,13 @@ switch ( shaderType ) { case COLLADAFW::EffectCommon::SHADER_BLINN: + importBlinnShader ( effect, commonEffect ); break; case COLLADAFW::EffectCommon::SHADER_CONSTANT: + // TODO break; case COLLADAFW::EffectCommon::SHADER_PHONG: + importPhongShader ( effect, commonEffect ); break; case COLLADAFW::EffectCommon::SHADER_LAMBERT: importLambertShader ( effect, commonEffect ); @@ -74,6 +79,58 @@ } //------------------------------ + void EffectImporter::importBlinnShader ( + const COLLADAFW::Effect* effect, + const COLLADAFW::EffectCommon* commonEffect ) + { + // Get the material name. + String effectName ( effect->getName () ); + if ( COLLADABU::Utils::equals ( effectName, COLLADABU::Utils::EMPTY_STRING ) ) + effectName = EFFECT_NAME; + effectName = DocumentImporter::frameworkNameToMayaName ( effectName ); + effectName = mEffectIdList.addId ( effectName ); + + const COLLADAFW::UniqueId& effectId = effect->getUniqueId (); + mMayaEffectNamesMap [effectId] = effectName; + + // Write the effect into the maya ascii file. + FILE* file = getDocumentImporter ()->getFile (); + MayaDM::Blinn* blinn = new MayaDM::Blinn ( file, effectName ); + + // Import the shader attributes. + importShaderAttributes ( blinn, effect, commonEffect ); + + // Push it into the map. + appendEffect ( effectId, blinn ); + } + + //------------------------------ + void EffectImporter::importPhongShader ( + const COLLADAFW::Effect* effect, + const COLLADAFW::EffectCommon* commonEffect ) + { + // Get the material name. + String effectName ( effect->getName () ); + if ( COLLADABU::Utils::equals ( effectName, COLLADABU::Utils::EMPTY_STRING ) ) + effectName = EFFECT_NAME; + effectName = DocumentImporter::frameworkNameToMayaName ( effectName ); + effectName = mEffectIdList.addId ( effectName ); + + const COLLADAFW::UniqueId& effectId = effect->getUniqueId (); + mMayaEffectNamesMap [effectId] = effectName; + + // Write the effect into the maya ascii file. + FILE* file = getDocumentImporter ()->getFile (); + MayaDM::Phong* phong = new MayaDM::Phong ( file, effectName ); + + // Import the shader attributes. + importShaderAttributes ( phong, effect, commonEffect ); + + // Push it into the map. + appendEffect ( effectId, phong ); + } + + //------------------------------ void EffectImporter::importLambertShader ( const COLLADAFW::Effect* effect, const COLLADAFW::EffectCommon* commonEffect ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jud...@us...> - 2009-02-13 16:28:41
|
Revision: 360 http://colladamaya.svn.sourceforge.net/colladamaya/?rev=360&view=rev Author: judithschenk Date: 2009-02-13 16:28:30 +0000 (Fri, 13 Feb 2009) Log Message: ----------- COLLADAMaya: material import: multiple uvsets, multiple shader engines, multiple primitives Modified Paths: -------------- branches/nextgen/COLLADAFramework/src/COLLADAFWColor.cpp branches/nextgen/COLLADAMaya/include/COLLADAMayaDocumentExporter.h branches/nextgen/COLLADAMaya/include/COLLADAMayaDocumentImporter.h branches/nextgen/COLLADAMaya/include/COLLADAMayaEffectImporter.h branches/nextgen/COLLADAMaya/include/COLLADAMayaGeometryImporter.h branches/nextgen/COLLADAMaya/include/COLLADAMayaMaterialImporter.h branches/nextgen/COLLADAMaya/scripts/COLLADAMaya.vcproj branches/nextgen/COLLADAMaya/src/COLLADAMayaDocumentExporter.cpp branches/nextgen/COLLADAMaya/src/COLLADAMayaDocumentImporter.cpp branches/nextgen/COLLADAMaya/src/COLLADAMayaEffectImporter.cpp branches/nextgen/COLLADAMaya/src/COLLADAMayaGeometryImporter.cpp branches/nextgen/COLLADAMaya/src/COLLADAMayaMaterialImporter.cpp branches/nextgen/COLLADAMaya/src/COLLADAMayaVisualSceneExporter.cpp branches/nextgen/COLLADAMaya/src/COLLADAMayaVisualSceneImporter.cpp branches/nextgen/Externals/MayaDataModel/include/MayaDMAbstractBaseCreate.h branches/nextgen/Externals/MayaDataModel/include/MayaDMAbstractBaseNurbsConversion.h branches/nextgen/Externals/MayaDataModel/include/MayaDMAddDoubleLinear.h branches/nextgen/Externals/MayaDataModel/include/MayaDMAddMatrix.h branches/nextgen/Externals/MayaDataModel/include/MayaDMAimConstraint.h branches/nextgen/Externals/MayaDataModel/include/MayaDMAirField.h branches/nextgen/Externals/MayaDataModel/include/MayaDMAlignCurve.h branches/nextgen/Externals/MayaDataModel/include/MayaDMAlignSurface.h branches/nextgen/Externals/MayaDataModel/include/MayaDMAmbientLight.h branches/nextgen/Externals/MayaDataModel/include/MayaDMAngleBetween.h branches/nextgen/Externals/MayaDataModel/include/MayaDMAnimBlend.h branches/nextgen/Externals/MayaDataModel/include/MayaDMAnimBlendInOut.h branches/nextgen/Externals/MayaDataModel/include/MayaDMAnimClip.h branches/nextgen/Externals/MayaDataModel/include/MayaDMAnimCurve.h branches/nextgen/Externals/MayaDataModel/include/MayaDMAnimCurveTA.h branches/nextgen/Externals/MayaDataModel/include/MayaDMAnimCurveTL.h branches/nextgen/Externals/MayaDataModel/include/MayaDMAnimCurveTT.h branches/nextgen/Externals/MayaDataModel/include/MayaDMAnimCurveTU.h branches/nextgen/Externals/MayaDataModel/include/MayaDMAnimCurveUA.h branches/nextgen/Externals/MayaDataModel/include/MayaDMAnimCurveUL.h branches/nextgen/Externals/MayaDataModel/include/MayaDMAnimCurveUT.h branches/nextgen/Externals/MayaDataModel/include/MayaDMAnimCurveUU.h branches/nextgen/Externals/MayaDataModel/include/MayaDMAnisotropic.h branches/nextgen/Externals/MayaDataModel/include/MayaDMAnnotationShape.h branches/nextgen/Externals/MayaDataModel/include/MayaDMArcLengthDimension.h branches/nextgen/Externals/MayaDataModel/include/MayaDMAreaLight.h branches/nextgen/Externals/MayaDataModel/include/MayaDMArrayMapper.h branches/nextgen/Externals/MayaDataModel/include/MayaDMAttachCurve.h branches/nextgen/Externals/MayaDataModel/include/MayaDMAttachSurface.h branches/nextgen/Externals/MayaDataModel/include/MayaDMAudio.h branches/nextgen/Externals/MayaDataModel/include/MayaDMAvgCurves.h branches/nextgen/Externals/MayaDataModel/include/MayaDMAvgNurbsSurfacePoints.h branches/nextgen/Externals/MayaDataModel/include/MayaDMAvgSurfacePoints.h branches/nextgen/Externals/MayaDataModel/include/MayaDMBakeSet.h branches/nextgen/Externals/MayaDataModel/include/MayaDMBaseGeometryVarGroup.h branches/nextgen/Externals/MayaDataModel/include/MayaDMBaseLattice.h branches/nextgen/Externals/MayaDataModel/include/MayaDMBaseShadingSwitch.h branches/nextgen/Externals/MayaDataModel/include/MayaDMBevel.h branches/nextgen/Externals/MayaDataModel/include/MayaDMBevelPlus.h branches/nextgen/Externals/MayaDataModel/include/MayaDMBirailSrf.h branches/nextgen/Externals/MayaDataModel/include/MayaDMBlend.h branches/nextgen/Externals/MayaDataModel/include/MayaDMBlendColorSets.h branches/nextgen/Externals/MayaDataModel/include/MayaDMBlendColors.h branches/nextgen/Externals/MayaDataModel/include/MayaDMBlendDevice.h branches/nextgen/Externals/MayaDataModel/include/MayaDMBlendShape.h branches/nextgen/Externals/MayaDataModel/include/MayaDMBlendTwoAttr.h branches/nextgen/Externals/MayaDataModel/include/MayaDMBlendWeighted.h branches/nextgen/Externals/MayaDataModel/include/MayaDMBlindDataTemplate.h branches/nextgen/Externals/MayaDataModel/include/MayaDMBlinn.h branches/nextgen/Externals/MayaDataModel/include/MayaDMBoneLattice.h branches/nextgen/Externals/MayaDataModel/include/MayaDMBoolean.h branches/nextgen/Externals/MayaDataModel/include/MayaDMBoundary.h branches/nextgen/Externals/MayaDataModel/include/MayaDMBoundaryBase.h branches/nextgen/Externals/MayaDataModel/include/MayaDMBrownian.h branches/nextgen/Externals/MayaDataModel/include/MayaDMBrush.h branches/nextgen/Externals/MayaDataModel/include/MayaDMBulge.h branches/nextgen/Externals/MayaDataModel/include/MayaDMBump2d.h branches/nextgen/Externals/MayaDataModel/include/MayaDMBump3d.h branches/nextgen/Externals/MayaDataModel/include/MayaDMCacheBase.h branches/nextgen/Externals/MayaDataModel/include/MayaDMCacheBlend.h branches/nextgen/Externals/MayaDataModel/include/MayaDMCacheFile.h branches/nextgen/Externals/MayaDataModel/include/MayaDMCamera.h branches/nextgen/Externals/MayaDataModel/include/MayaDMCameraView.h branches/nextgen/Externals/MayaDataModel/include/MayaDMCgfxShader.h branches/nextgen/Externals/MayaDataModel/include/MayaDMCharacter.h branches/nextgen/Externals/MayaDataModel/include/MayaDMCharacterMap.h branches/nextgen/Externals/MayaDataModel/include/MayaDMCharacterOffset.h branches/nextgen/Externals/MayaDataModel/include/MayaDMChecker.h branches/nextgen/Externals/MayaDataModel/include/MayaDMChoice.h branches/nextgen/Externals/MayaDataModel/include/MayaDMChooser.h branches/nextgen/Externals/MayaDataModel/include/MayaDMClamp.h branches/nextgen/Externals/MayaDataModel/include/MayaDMClipLibrary.h branches/nextgen/Externals/MayaDataModel/include/MayaDMClipScheduler.h branches/nextgen/Externals/MayaDataModel/include/MayaDMCloseCurve.h branches/nextgen/Externals/MayaDataModel/include/MayaDMCloseSurface.h branches/nextgen/Externals/MayaDataModel/include/MayaDMClosestPointOnMesh.h branches/nextgen/Externals/MayaDataModel/include/MayaDMClosestPointOnSurface.h branches/nextgen/Externals/MayaDataModel/include/MayaDMCloth.h branches/nextgen/Externals/MayaDataModel/include/MayaDMCloud.h branches/nextgen/Externals/MayaDataModel/include/MayaDMCluster.h branches/nextgen/Externals/MayaDataModel/include/MayaDMClusterHandle.h branches/nextgen/Externals/MayaDataModel/include/MayaDMCommands.h branches/nextgen/Externals/MayaDataModel/include/MayaDMCondition.h branches/nextgen/Externals/MayaDataModel/include/MayaDMConstraint.h branches/nextgen/Externals/MayaDataModel/include/MayaDMContainer.h branches/nextgen/Externals/MayaDataModel/include/MayaDMContrast.h branches/nextgen/Externals/MayaDataModel/include/MayaDMControlPoint.h branches/nextgen/Externals/MayaDataModel/include/MayaDMCopyColorSet.h branches/nextgen/Externals/MayaDataModel/include/MayaDMCopyUVSet.h branches/nextgen/Externals/MayaDataModel/include/MayaDMCrater.h branches/nextgen/Externals/MayaDataModel/include/MayaDMCreateColorSet.h branches/nextgen/Externals/MayaDataModel/include/MayaDMCreateUVSet.h branches/nextgen/Externals/MayaDataModel/include/MayaDMCurveFromMesh.h branches/nextgen/Externals/MayaDataModel/include/MayaDMCurveFromMeshCoM.h branches/nextgen/Externals/MayaDataModel/include/MayaDMCurveFromMeshEdge.h branches/nextgen/Externals/MayaDataModel/include/MayaDMCurveFromSubdiv.h branches/nextgen/Externals/MayaDataModel/include/MayaDMCurveFromSubdivEdge.h branches/nextgen/Externals/MayaDataModel/include/MayaDMCurveFromSubdivFace.h branches/nextgen/Externals/MayaDataModel/include/MayaDMCurveFromSurface.h branches/nextgen/Externals/MayaDataModel/include/MayaDMCurveFromSurfaceBnd.h branches/nextgen/Externals/MayaDataModel/include/MayaDMCurveFromSurfaceCoS.h branches/nextgen/Externals/MayaDataModel/include/MayaDMCurveFromSurfaceIso.h branches/nextgen/Externals/MayaDataModel/include/MayaDMCurveInfo.h branches/nextgen/Externals/MayaDataModel/include/MayaDMCurveIntersect.h branches/nextgen/Externals/MayaDataModel/include/MayaDMCurveNormalizer.h branches/nextgen/Externals/MayaDataModel/include/MayaDMCurveNormalizerAngle.h branches/nextgen/Externals/MayaDataModel/include/MayaDMCurveNormalizerLinear.h branches/nextgen/Externals/MayaDataModel/include/MayaDMCurveRange.h branches/nextgen/Externals/MayaDataModel/include/MayaDMCurveShape.h branches/nextgen/Externals/MayaDataModel/include/MayaDMCurveVarGroup.h branches/nextgen/Externals/MayaDataModel/include/MayaDMDagNode.h branches/nextgen/Externals/MayaDataModel/include/MayaDMDagPose.h branches/nextgen/Externals/MayaDataModel/include/MayaDMDefaultLightList.h branches/nextgen/Externals/MayaDataModel/include/MayaDMDefaultRenderUtilityList.h branches/nextgen/Externals/MayaDataModel/include/MayaDMDefaultShaderList.h branches/nextgen/Externals/MayaDataModel/include/MayaDMDefaultTextureList.h branches/nextgen/Externals/MayaDataModel/include/MayaDMDeformBend.h branches/nextgen/Externals/MayaDataModel/include/MayaDMDeformFlare.h branches/nextgen/Externals/MayaDataModel/include/MayaDMDeformFunc.h branches/nextgen/Externals/MayaDataModel/include/MayaDMDeformSine.h branches/nextgen/Externals/MayaDataModel/include/MayaDMDeformSquash.h branches/nextgen/Externals/MayaDataModel/include/MayaDMDeformTwist.h branches/nextgen/Externals/MayaDataModel/include/MayaDMDeformWave.h branches/nextgen/Externals/MayaDataModel/include/MayaDMDeformableShape.h branches/nextgen/Externals/MayaDataModel/include/MayaDMDeleteColorSet.h branches/nextgen/Externals/MayaDataModel/include/MayaDMDeleteComponent.h branches/nextgen/Externals/MayaDataModel/include/MayaDMDeleteUVSet.h branches/nextgen/Externals/MayaDataModel/include/MayaDMDependNode.h branches/nextgen/Externals/MayaDataModel/include/MayaDMDetachCurve.h branches/nextgen/Externals/MayaDataModel/include/MayaDMDetachSurface.h branches/nextgen/Externals/MayaDataModel/include/MayaDMDimensionShape.h branches/nextgen/Externals/MayaDataModel/include/MayaDMDirectedDisc.h branches/nextgen/Externals/MayaDataModel/include/MayaDMDirectionalLight.h branches/nextgen/Externals/MayaDataModel/include/MayaDMDiskCache.h branches/nextgen/Externals/MayaDataModel/include/MayaDMDisplacementShader.h branches/nextgen/Externals/MayaDataModel/include/MayaDMDisplayLayer.h branches/nextgen/Externals/MayaDataModel/include/MayaDMDisplayLayerManager.h branches/nextgen/Externals/MayaDataModel/include/MayaDMDistanceBetween.h branches/nextgen/Externals/MayaDataModel/include/MayaDMDistanceDimShape.h branches/nextgen/Externals/MayaDataModel/include/MayaDMDof.h branches/nextgen/Externals/MayaDataModel/include/MayaDMDoubleShadingSwitch.h branches/nextgen/Externals/MayaDataModel/include/MayaDMDpBirailSrf.h branches/nextgen/Externals/MayaDataModel/include/MayaDMDragField.h branches/nextgen/Externals/MayaDataModel/include/MayaDMDropoffLocator.h branches/nextgen/Externals/MayaDataModel/include/MayaDMDynBase.h branches/nextgen/Externals/MayaDataModel/include/MayaDMDynGlobals.h branches/nextgen/Externals/MayaDataModel/include/MayaDMDynamicConstraint.h branches/nextgen/Externals/MayaDataModel/include/MayaDMEntity.h branches/nextgen/Externals/MayaDataModel/include/MayaDMEnvBall.h branches/nextgen/Externals/MayaDataModel/include/MayaDMEnvChrome.h branches/nextgen/Externals/MayaDataModel/include/MayaDMEnvCube.h branches/nextgen/Externals/MayaDataModel/include/MayaDMEnvFacade.h branches/nextgen/Externals/MayaDataModel/include/MayaDMEnvFog.h branches/nextgen/Externals/MayaDataModel/include/MayaDMEnvSky.h branches/nextgen/Externals/MayaDataModel/include/MayaDMEnvSphere.h branches/nextgen/Externals/MayaDataModel/include/MayaDMEnvironmentFog.h branches/nextgen/Externals/MayaDataModel/include/MayaDMExplodeNurbsShell.h branches/nextgen/Externals/MayaDataModel/include/MayaDMExpression.h branches/nextgen/Externals/MayaDataModel/include/MayaDMExtendCurve.h branches/nextgen/Externals/MayaDataModel/include/MayaDMExtendSurface.h branches/nextgen/Externals/MayaDataModel/include/MayaDMExtrude.h branches/nextgen/Externals/MayaDataModel/include/MayaDMFacade.h branches/nextgen/Externals/MayaDataModel/include/MayaDMFfBlendSrf.h branches/nextgen/Externals/MayaDataModel/include/MayaDMFfBlendSrfObsolete.h branches/nextgen/Externals/MayaDataModel/include/MayaDMFfFilletSrf.h branches/nextgen/Externals/MayaDataModel/include/MayaDMFfd.h branches/nextgen/Externals/MayaDataModel/include/MayaDMField.h branches/nextgen/Externals/MayaDataModel/include/MayaDMFile.h branches/nextgen/Externals/MayaDataModel/include/MayaDMFilletCurve.h branches/nextgen/Externals/MayaDataModel/include/MayaDMFilter.h branches/nextgen/Externals/MayaDataModel/include/MayaDMFilterClosestSample.h branches/nextgen/Externals/MayaDataModel/include/MayaDMFilterEuler.h branches/nextgen/Externals/MayaDataModel/include/MayaDMFilterResample.h branches/nextgen/Externals/MayaDataModel/include/MayaDMFilterSimplify.h branches/nextgen/Externals/MayaDataModel/include/MayaDMFitBspline.h branches/nextgen/Externals/MayaDataModel/include/MayaDMFlexorShape.h branches/nextgen/Externals/MayaDataModel/include/MayaDMFlow.h branches/nextgen/Externals/MayaDataModel/include/MayaDMFluidEmitter.h branches/nextgen/Externals/MayaDataModel/include/MayaDMFluidShape.h branches/nextgen/Externals/MayaDataModel/include/MayaDMFluidTexture2D.h branches/nextgen/Externals/MayaDataModel/include/MayaDMFluidTexture3D.h branches/nextgen/Externals/MayaDataModel/include/MayaDMFollicle.h branches/nextgen/Externals/MayaDataModel/include/MayaDMFourByFourMatrix.h branches/nextgen/Externals/MayaDataModel/include/MayaDMFractal.h branches/nextgen/Externals/MayaDataModel/include/MayaDMFrameCache.h branches/nextgen/Externals/MayaDataModel/include/MayaDMFurAttractors.h branches/nextgen/Externals/MayaDataModel/include/MayaDMFurCurveAttractors.h branches/nextgen/Externals/MayaDataModel/include/MayaDMFurDescription.h branches/nextgen/Externals/MayaDataModel/include/MayaDMFurFeedback.h branches/nextgen/Externals/MayaDataModel/include/MayaDMFurGlobals.h branches/nextgen/Externals/MayaDataModel/include/MayaDMFurPointOnMeshInfo.h branches/nextgen/Externals/MayaDataModel/include/MayaDMFurPointOnSubd.h branches/nextgen/Externals/MayaDataModel/include/MayaDMGammaCorrect.h branches/nextgen/Externals/MayaDataModel/include/MayaDMGeoConnectable.h branches/nextgen/Externals/MayaDataModel/include/MayaDMGeoConnector.h branches/nextgen/Externals/MayaDataModel/include/MayaDMGeometryConstraint.h branches/nextgen/Externals/MayaDataModel/include/MayaDMGeometryFilter.h branches/nextgen/Externals/MayaDataModel/include/MayaDMGeometryShape.h branches/nextgen/Externals/MayaDataModel/include/MayaDMGeometryVarGroup.h branches/nextgen/Externals/MayaDataModel/include/MayaDMGlobalCacheControl.h branches/nextgen/Externals/MayaDataModel/include/MayaDMGlobalStitch.h branches/nextgen/Externals/MayaDataModel/include/MayaDMGranite.h branches/nextgen/Externals/MayaDataModel/include/MayaDMGravityField.h branches/nextgen/Externals/MayaDataModel/include/MayaDMGrid.h branches/nextgen/Externals/MayaDataModel/include/MayaDMGroupId.h branches/nextgen/Externals/MayaDataModel/include/MayaDMGroupParts.h branches/nextgen/Externals/MayaDataModel/include/MayaDMGuide.h branches/nextgen/Externals/MayaDataModel/include/MayaDMHairConstraint.h branches/nextgen/Externals/MayaDataModel/include/MayaDMHairSystem.h branches/nextgen/Externals/MayaDataModel/include/MayaDMHairTubeShader.h branches/nextgen/Externals/MayaDataModel/include/MayaDMHardenPoint.h branches/nextgen/Externals/MayaDataModel/include/MayaDMHardwareRenderGlobals.h branches/nextgen/Externals/MayaDataModel/include/MayaDMHeightField.h branches/nextgen/Externals/MayaDataModel/include/MayaDMHikEffector.h branches/nextgen/Externals/MayaDataModel/include/MayaDMHikFloorContactMarker.h branches/nextgen/Externals/MayaDataModel/include/MayaDMHikGroundPlane.h branches/nextgen/Externals/MayaDataModel/include/MayaDMHikHandle.h branches/nextgen/Externals/MayaDataModel/include/MayaDMHikSolver.h branches/nextgen/Externals/MayaDataModel/include/MayaDMHistorySwitch.h branches/nextgen/Externals/MayaDataModel/include/MayaDMHoldMatrix.h branches/nextgen/Externals/MayaDataModel/include/MayaDMHsvToRgb.h branches/nextgen/Externals/MayaDataModel/include/MayaDMHwReflectionMap.h branches/nextgen/Externals/MayaDataModel/include/MayaDMHwRenderGlobals.h branches/nextgen/Externals/MayaDataModel/include/MayaDMHwShader.h branches/nextgen/Externals/MayaDataModel/include/MayaDMHyperGraphInfo.h branches/nextgen/Externals/MayaDataModel/include/MayaDMHyperLayout.h branches/nextgen/Externals/MayaDataModel/include/MayaDMHyperView.h branches/nextgen/Externals/MayaDataModel/include/MayaDMIkEffector.h branches/nextgen/Externals/MayaDataModel/include/MayaDMIkHandle.h branches/nextgen/Externals/MayaDataModel/include/MayaDMIkMCsolver.h branches/nextgen/Externals/MayaDataModel/include/MayaDMIkPASolver.h branches/nextgen/Externals/MayaDataModel/include/MayaDMIkRPsolver.h branches/nextgen/Externals/MayaDataModel/include/MayaDMIkSCsolver.h branches/nextgen/Externals/MayaDataModel/include/MayaDMIkSolver.h branches/nextgen/Externals/MayaDataModel/include/MayaDMIkSplineSolver.h branches/nextgen/Externals/MayaDataModel/include/MayaDMIkSystem.h branches/nextgen/Externals/MayaDataModel/include/MayaDMImagePlane.h branches/nextgen/Externals/MayaDataModel/include/MayaDMImplicitBox.h branches/nextgen/Externals/MayaDataModel/include/MayaDMImplicitCone.h branches/nextgen/Externals/MayaDataModel/include/MayaDMImplicitSphere.h branches/nextgen/Externals/MayaDataModel/include/MayaDMInsertKnotCurve.h branches/nextgen/Externals/MayaDataModel/include/MayaDMInsertKnotSurface.h branches/nextgen/Externals/MayaDataModel/include/MayaDMInstancer.h branches/nextgen/Externals/MayaDataModel/include/MayaDMIntersectSurface.h branches/nextgen/Externals/MayaDataModel/include/MayaDMJiggle.h branches/nextgen/Externals/MayaDataModel/include/MayaDMJoint.h branches/nextgen/Externals/MayaDataModel/include/MayaDMJointCluster.h branches/nextgen/Externals/MayaDataModel/include/MayaDMJointFfd.h branches/nextgen/Externals/MayaDataModel/include/MayaDMJointLattice.h branches/nextgen/Externals/MayaDataModel/include/MayaDMLambert.h branches/nextgen/Externals/MayaDataModel/include/MayaDMLattice.h branches/nextgen/Externals/MayaDataModel/include/MayaDMLayeredShader.h branches/nextgen/Externals/MayaDataModel/include/MayaDMLayeredTexture.h branches/nextgen/Externals/MayaDataModel/include/MayaDMLeastSquaresModifier.h branches/nextgen/Externals/MayaDataModel/include/MayaDMLeather.h branches/nextgen/Externals/MayaDataModel/include/MayaDMLight.h branches/nextgen/Externals/MayaDataModel/include/MayaDMLightFog.h branches/nextgen/Externals/MayaDataModel/include/MayaDMLightInfo.h branches/nextgen/Externals/MayaDataModel/include/MayaDMLightLinker.h branches/nextgen/Externals/MayaDataModel/include/MayaDMLightList.h branches/nextgen/Externals/MayaDataModel/include/MayaDMLineModifier.h branches/nextgen/Externals/MayaDataModel/include/MayaDMLocator.h branches/nextgen/Externals/MayaDataModel/include/MayaDMLodGroup.h branches/nextgen/Externals/MayaDataModel/include/MayaDMLodThresholds.h branches/nextgen/Externals/MayaDataModel/include/MayaDMLoft.h branches/nextgen/Externals/MayaDataModel/include/MayaDMLookAt.h branches/nextgen/Externals/MayaDataModel/include/MayaDMLuminance.h branches/nextgen/Externals/MayaDataModel/include/MayaDMMakeCircularArc.h branches/nextgen/Externals/MayaDataModel/include/MayaDMMakeGroup.h branches/nextgen/Externals/MayaDataModel/include/MayaDMMakeIllustratorCurves.h branches/nextgen/Externals/MayaDataModel/include/MayaDMMakeNurbCircle.h branches/nextgen/Externals/MayaDataModel/include/MayaDMMakeNurbCone.h branches/nextgen/Externals/MayaDataModel/include/MayaDMMakeNurbCube.h branches/nextgen/Externals/MayaDataModel/include/MayaDMMakeNurbCylinder.h branches/nextgen/Externals/MayaDataModel/include/MayaDMMakeNurbPlane.h branches/nextgen/Externals/MayaDataModel/include/MayaDMMakeNurbSphere.h branches/nextgen/Externals/MayaDataModel/include/MayaDMMakeNurbTorus.h branches/nextgen/Externals/MayaDataModel/include/MayaDMMakeNurbsSquare.h branches/nextgen/Externals/MayaDataModel/include/MayaDMMakeTextCurves.h branches/nextgen/Externals/MayaDataModel/include/MayaDMMakeThreePointCircularArc.h branches/nextgen/Externals/MayaDataModel/include/MayaDMMakeTwoPointCircularArc.h branches/nextgen/Externals/MayaDataModel/include/MayaDMMarble.h branches/nextgen/Externals/MayaDataModel/include/MayaDMMaterialFacade.h branches/nextgen/Externals/MayaDataModel/include/MayaDMMaterialInfo.h branches/nextgen/Externals/MayaDataModel/include/MayaDMMentalrayIblShape.h branches/nextgen/Externals/MayaDataModel/include/MayaDMMentalrayTexture.h branches/nextgen/Externals/MayaDataModel/include/MayaDMMesh.h branches/nextgen/Externals/MayaDataModel/include/MayaDMMeshVarGroup.h branches/nextgen/Externals/MayaDataModel/include/MayaDMMotionPath.h branches/nextgen/Externals/MayaDataModel/include/MayaDMMountain.h branches/nextgen/Externals/MayaDataModel/include/MayaDMMovie.h branches/nextgen/Externals/MayaDataModel/include/MayaDMMpBirailSrf.h branches/nextgen/Externals/MayaDataModel/include/MayaDMMultDoubleLinear.h branches/nextgen/Externals/MayaDataModel/include/MayaDMMultMatrix.h branches/nextgen/Externals/MayaDataModel/include/MayaDMMultilisterLight.h branches/nextgen/Externals/MayaDataModel/include/MayaDMMultiplyDivide.h branches/nextgen/Externals/MayaDataModel/include/MayaDMMute.h branches/nextgen/Externals/MayaDataModel/include/MayaDMNCloth.h branches/nextgen/Externals/MayaDataModel/include/MayaDMNComponent.h branches/nextgen/Externals/MayaDataModel/include/MayaDMNParticle.h branches/nextgen/Externals/MayaDataModel/include/MayaDMNRigid.h branches/nextgen/Externals/MayaDataModel/include/MayaDMNetwork.h branches/nextgen/Externals/MayaDataModel/include/MayaDMNewtonField.h branches/nextgen/Externals/MayaDataModel/include/MayaDMNoise.h branches/nextgen/Externals/MayaDataModel/include/MayaDMNonAmbientLightShapeNode.h branches/nextgen/Externals/MayaDataModel/include/MayaDMNonExtendedLightShapeNode.h branches/nextgen/Externals/MayaDataModel/include/MayaDMNonLinear.h branches/nextgen/Externals/MayaDataModel/include/MayaDMNormalConstraint.h branches/nextgen/Externals/MayaDataModel/include/MayaDMNucleus.h branches/nextgen/Externals/MayaDataModel/include/MayaDMNurbsCurve.h branches/nextgen/Externals/MayaDataModel/include/MayaDMNurbsDimShape.h branches/nextgen/Externals/MayaDataModel/include/MayaDMNurbsSurface.h branches/nextgen/Externals/MayaDataModel/include/MayaDMNurbsTessellate.h branches/nextgen/Externals/MayaDataModel/include/MayaDMNurbsToSubdiv.h branches/nextgen/Externals/MayaDataModel/include/MayaDMNurbsToSubdivProc.h branches/nextgen/Externals/MayaDataModel/include/MayaDMObjectAttrFilter.h branches/nextgen/Externals/MayaDataModel/include/MayaDMObjectBinFilter.h branches/nextgen/Externals/MayaDataModel/include/MayaDMObjectFilter.h branches/nextgen/Externals/MayaDataModel/include/MayaDMObjectMultiFilter.h branches/nextgen/Externals/MayaDataModel/include/MayaDMObjectNameFilter.h branches/nextgen/Externals/MayaDataModel/include/MayaDMObjectRenderFilter.h branches/nextgen/Externals/MayaDataModel/include/MayaDMObjectScriptFilter.h branches/nextgen/Externals/MayaDataModel/include/MayaDMObjectSet.h branches/nextgen/Externals/MayaDataModel/include/MayaDMObjectTypeFilter.h branches/nextgen/Externals/MayaDataModel/include/MayaDMOcean.h branches/nextgen/Externals/MayaDataModel/include/MayaDMOceanShader.h branches/nextgen/Externals/MayaDataModel/include/MayaDMOffsetCos.h branches/nextgen/Externals/MayaDataModel/include/MayaDMOffsetCurve.h branches/nextgen/Externals/MayaDataModel/include/MayaDMOffsetSurface.h branches/nextgen/Externals/MayaDataModel/include/MayaDMOldBlindDataBase.h branches/nextgen/Externals/MayaDataModel/include/MayaDMOpticalFX.h branches/nextgen/Externals/MayaDataModel/include/MayaDMOrientConstraint.h branches/nextgen/Externals/MayaDataModel/include/MayaDMOrientationMarker.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPairBlend.h branches/nextgen/Externals/MayaDataModel/include/MayaDMParamDimension.h branches/nextgen/Externals/MayaDataModel/include/MayaDMParentConstraint.h branches/nextgen/Externals/MayaDataModel/include/MayaDMParentTessellate.h branches/nextgen/Externals/MayaDataModel/include/MayaDMParticle.h branches/nextgen/Externals/MayaDataModel/include/MayaDMParticleAgeMapper.h branches/nextgen/Externals/MayaDataModel/include/MayaDMParticleCloud.h branches/nextgen/Externals/MayaDataModel/include/MayaDMParticleColorMapper.h branches/nextgen/Externals/MayaDataModel/include/MayaDMParticleIncandMapper.h branches/nextgen/Externals/MayaDataModel/include/MayaDMParticleSamplerInfo.h branches/nextgen/Externals/MayaDataModel/include/MayaDMParticleTranspMapper.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPartition.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPassMatrix.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPfxGeometry.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPfxHair.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPfxToon.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPhong.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPhongE.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPlace2dTexture.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPlace3dTexture.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPlanarTrimSurface.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPlane.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPlusMinusAverage.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPointConstraint.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPointEmitter.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPointLight.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPointMatrixMult.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPointOnCurveInfo.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPointOnSurfaceInfo.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPoleVectorConstraint.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyAppend.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyAppendVertex.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyAutoProj.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyAverageVertex.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyBase.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyBevel.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyBlindData.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyBoolOp.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyBridgeEdge.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyChipOff.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyCloseBorder.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyCollapseEdge.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyCollapseF.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyColorDel.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyColorMod.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyColorPerVertex.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyCone.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyCopyUV.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyCrease.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyCreaseEdge.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyCreateFace.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyCreator.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyCube.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyCut.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyCylProj.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyCylinder.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyDelEdge.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyDelFacet.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyDelVertex.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyDuplicateEdge.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyExtrudeEdge.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyExtrudeFace.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyExtrudeVertex.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyFlipEdge.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyFlipUV.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyHelix.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyLayoutUV.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyMapCut.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyMapDel.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyMapSew.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyMapSewMove.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyMergeEdge.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyMergeFace.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyMergeUV.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyMergeVert.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyMirror.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyModifier.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyModifierUV.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyModifierWorld.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyMoveEdge.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyMoveFace.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyMoveFacetUV.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyMoveUV.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyMoveVertex.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyNormal.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyNormalPerVertex.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyNormalizeUV.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyOptUvs.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyPipe.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyPlanarProj.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyPlane.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyPlatonicSolid.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyPoke.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyPrimitive.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyPrimitiveMisc.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyPrism.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyProj.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyPyramid.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyQuad.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyReduce.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolySeparate.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolySewEdge.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolySmooth.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolySmoothFace.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolySmoothProxy.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolySoftEdge.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolySphProj.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolySphere.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolySplit.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolySplitEdge.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolySplitRing.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolySplitVert.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyStraightenUVBorder.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolySubdEdge.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolySubdFace.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyToSubdiv.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyTorus.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyTransfer.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyTriangulate.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyTweak.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyTweakUV.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyUnite.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyWedgeFace.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPositionMarker.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPostProcessList.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPrimitive.h branches/nextgen/Externals/MayaDataModel/include/MayaDMProjectCurve.h branches/nextgen/Externals/MayaDataModel/include/MayaDMProjectTangent.h branches/nextgen/Externals/MayaDataModel/include/MayaDMProjection.h branches/nextgen/Externals/MayaDataModel/include/MayaDMProxyManager.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPsdFileTex.h branches/nextgen/Externals/MayaDataModel/include/MayaDMQuadShadingSwitch.h branches/nextgen/Externals/MayaDataModel/include/MayaDMRadialField.h branches/nextgen/Externals/MayaDataModel/include/MayaDMRamp.h branches/nextgen/Externals/MayaDataModel/include/MayaDMRampShader.h branches/nextgen/Externals/MayaDataModel/include/MayaDMRbfSrf.h branches/nextgen/Externals/MayaDataModel/include/MayaDMRebuildCurve.h branches/nextgen/Externals/MayaDataModel/include/MayaDMRebuildSurface.h branches/nextgen/Externals/MayaDataModel/include/MayaDMRecord.h branches/nextgen/Externals/MayaDataModel/include/MayaDMReference.h branches/nextgen/Externals/MayaDataModel/include/MayaDMReflect.h branches/nextgen/Externals/MayaDataModel/include/MayaDMRemapColor.h branches/nextgen/Externals/MayaDataModel/include/MayaDMRemapHsv.h branches/nextgen/Externals/MayaDataModel/include/MayaDMRemapValue.h branches/nextgen/Externals/MayaDataModel/include/MayaDMRenderBox.h branches/nextgen/Externals/MayaDataModel/include/MayaDMRenderCone.h branches/nextgen/Externals/MayaDataModel/include/MayaDMRenderGlobals.h branches/nextgen/Externals/MayaDataModel/include/MayaDMRenderGlobalsList.h branches/nextgen/Externals/MayaDataModel/include/MayaDMRenderLayer.h branches/nextgen/Externals/MayaDataModel/include/MayaDMRenderLayerManager.h branches/nextgen/Externals/MayaDataModel/include/MayaDMRenderLight.h branches/nextgen/Externals/MayaDataModel/include/MayaDMRenderQuality.h branches/nextgen/Externals/MayaDataModel/include/MayaDMRenderRect.h branches/nextgen/Externals/MayaDataModel/include/MayaDMRenderSphere.h branches/nextgen/Externals/MayaDataModel/include/MayaDMResolution.h branches/nextgen/Externals/MayaDataModel/include/MayaDMResultCurve.h branches/nextgen/Externals/MayaDataModel/include/MayaDMResultCurveTimeToAngular.h branches/nextgen/Externals/MayaDataModel/include/MayaDMResultCurveTimeToLinear.h branches/nextgen/Externals/MayaDataModel/include/MayaDMResultCurveTimeToTime.h branches/nextgen/Externals/MayaDataModel/include/MayaDMResultCurveTimeToUnitless.h branches/nextgen/Externals/MayaDataModel/include/MayaDMReverse.h branches/nextgen/Externals/MayaDataModel/include/MayaDMReverseCurve.h branches/nextgen/Externals/MayaDataModel/include/MayaDMReverseSurface.h branches/nextgen/Externals/MayaDataModel/include/MayaDMRevolve.h branches/nextgen/Externals/MayaDataModel/include/MayaDMRevolvedPrimitive.h branches/nextgen/Externals/MayaDataModel/include/MayaDMRgbToHsv.h branches/nextgen/Externals/MayaDataModel/include/MayaDMRigidBody.h branches/nextgen/Externals/MayaDataModel/include/MayaDMRigidConstraint.h branches/nextgen/Externals/MayaDataModel/include/MayaDMRigidSolver.h branches/nextgen/Externals/MayaDataModel/include/MayaDMRock.h branches/nextgen/Externals/MayaDataModel/include/MayaDMRoundConstantRadius.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSampler.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSamplerInfo.h branches/nextgen/Externals/MayaDataModel/include/MayaDMScaleConstraint.h branches/nextgen/Externals/MayaDataModel/include/MayaDMScript.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSculpt.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSelectionListOperator.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSetRange.h branches/nextgen/Externals/MayaDataModel/include/MayaDMShaderGlow.h branches/nextgen/Externals/MayaDataModel/include/MayaDMShadingEngine.h branches/nextgen/Externals/MayaDataModel/include/MayaDMShadingMap.h branches/nextgen/Externals/MayaDataModel/include/MayaDMShape.h branches/nextgen/Externals/MayaDataModel/include/MayaDMShellTessellate.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSimpleVolumeShader.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSingleShadingSwitch.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSketchPlane.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSkinCluster.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSmear.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSmoothCurve.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSmoothTangentSrf.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSnapshot.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSnapshotShape.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSnow.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSoftMod.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSoftModHandle.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSolidFractal.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSpBirailSrf.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSpotLight.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSpring.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSquareSrf.h branches/nextgen/Externals/MayaDataModel/include/MayaDMStencil.h branches/nextgen/Externals/MayaDataModel/include/MayaDMStitchAsNurbsShell.h branches/nextgen/Externals/MayaDataModel/include/MayaDMStitchSrf.h branches/nextgen/Externals/MayaDataModel/include/MayaDMStroke.h branches/nextgen/Externals/MayaDataModel/include/MayaDMStrokeGlobals.h branches/nextgen/Externals/MayaDataModel/include/MayaDMStucco.h branches/nextgen/Externals/MayaDataModel/include/MayaDMStudioClearCoat.h branches/nextgen/Externals/MayaDataModel/include/MayaDMStyleCurve.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSubCurve.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSubSurface.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSubdAddTopology.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSubdAutoProj.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSubdBase.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSubdBlindData.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSubdCleanTopology.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSubdHierBlind.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSubdLayoutUV.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSubdMapCut.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSubdMapSewMove.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSubdModifier.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSubdModifierUV.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSubdModifierWorld.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSubdPlanarProj.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSubdTweak.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSubdTweakUV.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSubdiv.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSubdivCollapse.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSubdivComponentId.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSubdivReverseFaces.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSubdivSurfaceVarGroup.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSubdivToNurbs.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSubdivToPoly.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSurfaceInfo.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSurfaceLuminance.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSurfaceSampler.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSurfaceShader.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSurfaceShape.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSurfaceVarGroup.h branches/nextgen/Externals/MayaDataModel/include/MayaDMTangentConstraint.h branches/nextgen/Externals/MayaDataModel/include/MayaDMTexture2d.h branches/nextgen/Externals/MayaDataModel/include/MayaDMTexture3d.h branches/nextgen/Externals/MayaDataModel/include/MayaDMTextureBakeSet.h branches/nextgen/Externals/MayaDataModel/include/MayaDMTextureEnv.h branches/nextgen/Externals/MayaDataModel/include/MayaDMTextureToGeom.h branches/nextgen/Externals/MayaDataModel/include/MayaDMTime.h branches/nextgen/Externals/MayaDataModel/include/MayaDMTimeFunction.h branches/nextgen/Externals/MayaDataModel/include/MayaDMTimeToUnitConversion.h branches/nextgen/Externals/MayaDataModel/include/MayaDMToonLineAttributes.h branches/nextgen/Externals/MayaDataModel/include/MayaDMTransferAttributes.h branches/nextgen/Externals/MayaDataModel/include/MayaDMTransform.h branches/nextgen/Externals/MayaDataModel/include/MayaDMTransformGeometry.h branches/nextgen/Externals/MayaDataModel/include/MayaDMTrim.h branches/nextgen/Externals/MayaDataModel/include/MayaDMTrimWithBoundaries.h branches/nextgen/Externals/MayaDataModel/include/MayaDMTripleShadingSwitch.h branches/nextgen/Externals/MayaDataModel/include/MayaDMTurbulenceField.h branches/nextgen/Externals/MayaDataModel/include/MayaDMTweak.h branches/nextgen/Externals/MayaDataModel/include/MayaDMUniformField.h branches/nextgen/Externals/MayaDataModel/include/MayaDMUnitConversion.h branches/nextgen/Externals/MayaDataModel/include/MayaDMUnitToTimeConversion.h branches/nextgen/Externals/MayaDataModel/include/MayaDMUnknown.h branches/nextgen/Externals/MayaDataModel/include/MayaDMUnknownDag.h branches/nextgen/Externals/MayaDataModel/include/MayaDMUnknownTransform.h branches/nextgen/Externals/MayaDataModel/include/MayaDMUntrim.h branches/nextgen/Externals/MayaDataModel/include/MayaDMUseBackground.h branches/nextgen/Externals/MayaDataModel/include/MayaDMUvChooser.h branches/nextgen/Externals/MayaDataModel/include/MayaDMVectorProduct.h branches/nextgen/Externals/MayaDataModel/include/MayaDMVectorRenderGlobals.h branches/nextgen/Externals/MayaDataModel/include/MayaDMVertexBakeSet.h branches/nextgen/Externals/MayaDataModel/include/MayaDMVolumeAxisField.h branches/nextgen/Externals/MayaDataModel/include/MayaDMVolumeFog.h branches/nextgen/Externals/MayaDataModel/include/MayaDMVolumeLight.h branches/nextgen/Externals/MayaDataModel/include/MayaDMVolumeNoise.h branches/nextgen/Externals/MayaDataModel/include/MayaDMVolumeShader.h branches/nextgen/Externals/MayaDataModel/include/MayaDMVortexField.h branches/nextgen/Externals/MayaDataModel/include/MayaDMWater.h branches/nextgen/Externals/MayaDataModel/include/MayaDMWeightGeometryFilter.h branches/nextgen/Externals/MayaDataModel/include/MayaDMWire.h branches/nextgen/Externals/MayaDataModel/include/MayaDMWood.h branches/nextgen/Externals/MayaDataModel/include/MayaDMWrap.h branches/nextgen/Externals/MayaDataModel/include/MayaDMWtAddMatrix.h Modified: branches/nextgen/COLLADAFramework/src/COLLADAFWColor.cpp =================================================================== --- branches/nextgen/COLLADAFramework/src/COLLADAFWColor.cpp 2009-02-13 13:39:16 UTC (rev 359) +++ branches/nextgen/COLLADAFramework/src/COLLADAFWColor.cpp 2009-02-13 16:28:30 UTC (rev 360) @@ -32,12 +32,12 @@ //--------------------------------------------------------------- bool Color::isValid() const { - if (!( mR >= 0 && mR <= 1 ) && + if (!(( mR >= 0 && mR <= 1 ) && ( mG >= 0 && mG <= 1 ) && ( mB >= 0 && mB <= 1 ) && - ( mA >= 0 && mA <= 1 )) + ( mA >= 0 && mA <= 1 ))) { - assert("Current color is not valid!"); +// assert("Current color is not valid!"); return false; } Modified: branches/nextgen/COLLADAMaya/include/COLLADAMayaDocumentExporter.h =================================================================== --- branches/nextgen/COLLADAMaya/include/COLLADAMayaDocumentExporter.h 2009-02-13 13:39:16 UTC (rev 359) +++ branches/nextgen/COLLADAMaya/include/COLLADAMayaDocumentExporter.h 2009-02-13 16:28:30 UTC (rev 360) @@ -258,13 +258,6 @@ */ void endExport(); - /** - * Makes a valid NCName from the given string. - * @param ncName Any string. - * @return COLLADAMaya::String A valid NCName. - */ - static String checkNCName(const String &ncName); - private: /** Exports the asset. */ Modified: branches/nextgen/COLLADAMaya/include/COLLADAMayaDocumentImporter.h =================================================================== --- branches/nextgen/COLLADAMaya/include/COLLADAMayaDocumentImporter.h 2009-02-13 13:39:16 UTC (rev 359) +++ branches/nextgen/COLLADAMaya/include/COLLADAMayaDocumentImporter.h 2009-02-13 16:28:30 UTC (rev 360) @@ -203,6 +203,11 @@ return true; } + /** + * Replace offending characters by some that are supported within maya. + */ + static String frameworkNameToMayaName ( const String& name ); + private: /** Imports the current scene. */ Modified: branches/nextgen/COLLADAMaya/include/COLLADAMayaEffectImporter.h =================================================================== --- branches/nextgen/COLLADAMaya/include/COLLADAMayaEffectImporter.h 2009-02-13 13:39:16 UTC (rev 359) +++ branches/nextgen/COLLADAMaya/include/COLLADAMayaEffectImporter.h 2009-02-13 16:28:30 UTC (rev 360) @@ -25,8 +25,7 @@ { public: - typedef std::map<COLLADAFW::UniqueId, MayaDM::DependNode*> UniqueIdMayaDependNodeMap; - typedef std::map<COLLADAFW::UniqueId, std::vector<MayaDM::DependNode*>> UniqueIdDependNodesMap; + typedef std::map<COLLADAFW::UniqueId, MayaDM::DependNode*> UniqueIdDependNodeMap; private: @@ -48,13 +47,8 @@ /** * The map holds the maya effect objects. */ - UniqueIdMayaDependNodeMap mMayaEffectMap; + UniqueIdDependNodeMap mMayaEffectMap; - /** - * One effect can have multiple materials. But one material just one effect. - */ - UniqueIdDependNodesMap mEffectMaterialsMap; - public: /** Constructor. */ @@ -71,28 +65,89 @@ */ MayaDM::DependNode* findMayaEffect ( const COLLADAFW::UniqueId& val ) const; - private: - /** * The map holds the maya material objects. */ - const UniqueIdMayaDependNodeMap& getMayaEffectMap () const { return mMayaEffectMap; } + const UniqueIdDependNodeMap& getMayaEffectMap () const { return mMayaEffectMap; } + private: + /** * The map holds the maya material objects. */ void appendEffect ( const COLLADAFW::UniqueId& id, MayaDM::DependNode* effectNode ); /** - * One effect can have multiple materials. But one material just one effect. - */ - const UniqueIdDependNodesMap getEffectMaterialsMap () const { return mEffectMaterialsMap; } + * Imports a lambert shader effect. + */ + void importLambertShader ( + const COLLADAFW::Effect* effect, + const COLLADAFW::EffectCommon* commonEffect ); /** - * Imports a lambert shader effect. + * Imports the shader attributes. */ - void importLambertShader ( const COLLADAFW::Effect* effect ); + template<class T> + void importShaderAttributes ( + T* lambert, + const COLLADAFW::Effect* effect, + const COLLADAFW::EffectCommon* commonEffect ) + { + { + const COLLADAFW::Color& color = effect->getStandardColor (); + if ( color.isValid () ) + lambert->setColor ( MayaDM::float3 (color.getRed (), color.getGreen (), color.getBlue ()) ); + } + const COLLADAFW::ColorOrTexture& diffuse = commonEffect->getDiffuse (); + if ( diffuse.isColor () ) + { + const COLLADAFW::Color& color = diffuse.getColor (); + if ( color.isValid () ) + lambert->setColor ( MayaDM::float3 (color.getRed (), color.getGreen (), color.getBlue ()) ); + } + + const COLLADAFW::ColorOrTexture& emission = commonEffect->getEmission (); + if ( emission.isColor () ) + { + const COLLADAFW::Color& color = emission.getColor (); + if ( color.isValid () ) + lambert->setIncandescence ( MayaDM::float3 (color.getRed (), color.getGreen (), color.getBlue ()) ); + } + + // TODO + commonEffect->getIndexOfRefraction (); + + const COLLADAFW::ColorOrTexture& reflective = commonEffect->getReflective (); + if ( reflective.isColor () ) + { + const COLLADAFW::Color& color = reflective.getColor (); + // TODO + } + + // TODO + commonEffect->getReflectivity (); + commonEffect->getShininess (); + + const COLLADAFW::ColorOrTexture& specular = commonEffect->getSpecular (); + if ( specular.isColor () ) + { + const COLLADAFW::Color& color = specular.getColor (); + // TODO + } + + // TODO + commonEffect->getTransparency (); + + const COLLADAFW::ColorOrTexture& transparent = commonEffect->getTransparent(); + if ( transparent.isColor () ) + { + const COLLADAFW::Color& color = transparent.getColor (); + if ( color.isValid () ) + lambert->setTransparency ( MayaDM::float3 (color.getRed (), color.getGreen (), color.getBlue ()) ); + } + } + /** Disable default copy ctor. */ EffectImporter( const EffectImporter& pre ); Modified: branches/nextgen/COLLADAMaya/include/COLLADAMayaGeometryImporter.h =================================================================== --- branches/nextgen/COLLADAMaya/include/COLLADAMayaGeometryImporter.h 2009-02-13 13:39:16 UTC (rev 359) +++ branches/nextgen/COLLADAMaya/include/COLLADAMayaGeometryImporter.h 2009-02-13 16:28:30 UTC (rev 360) @@ -27,6 +27,7 @@ #include "MayaDMTypes.h" #include "MayaDMMesh.h" +#include "MayaDMGroupId.h" #include <vector> @@ -43,6 +44,50 @@ /** The standard name for geometry without name. */ static const String GEOMETRY_NAME; + /** The standard name for a maya group. */ + static const String GROUPID_NAME; + + public: + + /** + * Assign the group to the unique geometry id, the transform node + * to the mesh instance and the index of the geometry's primitives. + */ + class GroupIdAssignment + { + private: + MayaDM::GroupId mGroupId; + COLLADAFW::UniqueId mGeometryId; + size_t mGeometryInstanceIndex; + size_t mPrimitiveIndex; + public: + GroupIdAssignment () {} + GroupIdAssignment ( + MayaDM::GroupId& groupId, + const COLLADAFW::UniqueId& geometryId, + const size_t geometryInstanceIndex, + const size_t primitiveIndex ) + : mGroupId (groupId) + , mGeometryId (geometryId) + , mGeometryInstanceIndex (geometryInstanceIndex) + , mPrimitiveIndex (primitiveIndex) + {} + virtual ~GroupIdAssignment () {} + + const MayaDM::GroupId& getGroupId () const { return mGroupId; } + void setGroupId ( MayaDM::GroupId& val ) { mGroupId = val; } + + const COLLADAFW::UniqueId& getGeometryId () const { return mGeometryId; } + void setGeometryId ( const COLLADAFW::UniqueId& val ) { mGeometryId = val; } + + const size_t getGeometryInstanceIndex () const { return mGeometryInstanceIndex; } + void setGeometryInstanceIndex ( const size_t val ) { mGeometryInstanceIndex = val; } + + const size_t getPrimitiveIndex () const { return mPrimitiveIndex; } + void setPrimitiveIndex ( const size_t val ) { mPrimitiveIndex = val; } + }; + typedef std::vector<GroupIdAssignment> GroupIdAssignments; + private: /** @@ -50,6 +95,11 @@ */ COLLADABU::IDList mMeshNodeIdList; + /** + * The list of the unique maya group id names. + */ + COLLADABU::IDList mGroupIdList; + /** * The map holds the unique ids of the geometry nodes to the maya specific nodes. */ @@ -66,6 +116,22 @@ */ CombinedIdIndicesMap mShadingEnginePrimitivesMap; + /** + * The map holds for every geometry id the number of mesh + * primitive elements. + */ + + /** + * The map holds for every primitive element of every geometry + * instance the generated group id. + */ + + /** + * Assign the group to the unique geometry id, the transform node + * to the mesh instance and the index of the geometry's primitives. + */ + GroupIdAssignments mGroupIdAssignments; + public: /** Constructor. */ @@ -106,6 +172,12 @@ const COLLADAFW::UniqueId& geometryId, const COLLADAFW::MaterialId shadingEngineId ); + /** + * Assign the group to the unique geometry id, the transform node + * to the mesh instance and the index of the geometry's primitives. + */ + const GroupIdAssignments& getGroupIdAssignments () const { return mGroupIdAssignments; } + private: /** @@ -122,6 +194,13 @@ size_t numNodeInstances ); /** + * Create maya group ids for every mesh primitive (if there is more than one). + */ + void createGroupNodes ( + const COLLADAFW::Mesh* mesh, + const size_t geometryInstanceIndex ); + + /** * Create the object group instances and the object groups and write it into the maya file. */ void writeObjectGroups ( Modified: branches/nextgen/COLLADAMaya/include/COLLADAMayaMaterialImporter.h =================================================================== --- branches/nextgen/COLLADAMaya/include/COLLADAMayaMaterialImporter.h 2009-02-13 13:39:16 UTC (rev 359) +++ branches/nextgen/COLLADAMaya/include/COLLADAMayaMaterialImporter.h 2009-02-13 16:28:30 UTC (rev 360) @@ -45,6 +45,11 @@ /** The standard name for a material without name. */ static const String MATERIAL_NAME; + /** The name of maya's default shader list. */ + static const String DEFAULT_SHADER_LIST; + static const String DEFAULT_SHADING_ENGINE; + static const String ATTR_SHADERS; + public: typedef std::map<COLLADAFW::UniqueId, MayaDM::DependNode*> UniqueIdMayaMaterialMap; @@ -68,17 +73,14 @@ : mShadingEngine ( shadingEngine ) , mMaterialInfo ( materialInfo ) {} - virtual ~ShadingData() {} + virtual ~ShadingData() + { + delete mShadingEngine; + delete mMaterialInfo; + } MayaDM::ShadingEngine* getShadingEngine () const { return mShadingEngine; } MayaDM::MaterialInfo* getMaterialInfo () const { return mMaterialInfo; } - - private: - /** Disable default copy ctor. */ - ShadingData( const ShadingData& pre ); - /** Disable default assignment operator. */ - const ShadingData& operator= ( const ShadingData& pre ); - }; typedef std::map<COLLADAFW::UniqueId, ShadingData*> ShadingDataMap; @@ -143,7 +145,7 @@ /** * The map holds for every shader engine a list of geometry ids, which use this shader engine. */ - ShadingEngineBindingMap mShadingEngineGeometryInstancesMap; + ShadingEngineBindingMap mShadingEngineBindingMap; public: @@ -151,7 +153,7 @@ MaterialImporter ( DocumentImporter* documentImporter ); /** Destructor. */ - virtual ~MaterialImporter () {} + virtual ~MaterialImporter (); /** Imports the given material. */ bool importMaterial ( const COLLADAFW::Material* material ); @@ -165,7 +167,6 @@ /** Writes the connection attributes into the maya ascii file. */ void writeConnections (); - void connectGeometries (); /** * The map holds the maya material objects. */ @@ -176,7 +177,18 @@ /** Connect the material with the shading engine and the material info. */ void connectShadingEngines (); + /** Connect the material with the depending geometries. */ + void connectGeometries (); + + /** If there are... [truncated message content] |
From: <rob...@us...> - 2009-02-13 13:39:25
|
Revision: 359 http://colladamaya.svn.sourceforge.net/colladamaya/?rev=359&view=rev Author: robertwuerfel Date: 2009-02-13 13:39:16 +0000 (Fri, 13 Feb 2009) Log Message: ----------- add light to framework, loader and max plugin Modified Paths: -------------- branches/nextgen/COLLADAFramework/include/COLLADAFWCamera.h branches/nextgen/COLLADAFramework/include/COLLADAFWIWriter.h branches/nextgen/COLLADAFramework/include/COLLADAFWNode.h branches/nextgen/COLLADAFramework/scripts/COLLADAFramework.vcproj branches/nextgen/COLLADAMax/include/COLLADAMaxDocumentImporter.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/COLLADAMaxNodeImporter.cpp branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLFileLoader.h branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLNodeLoader.h branches/nextgen/COLLADASaxFrameworkLoader/scripts/COLLADASaxFrameworkLoader.vcproj branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLFileLoader.cpp branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLNodeLoader.cpp branches/nextgen/GeneratedSaxParser/src/GeneratedSaxParserLibxmlSaxParser.cpp Added Paths: ----------- branches/nextgen/COLLADAFramework/include/COLLADAFWInstanceLight.h branches/nextgen/COLLADAFramework/include/COLLADAFWLight.h branches/nextgen/COLLADAFramework/src/COLLADAFWLight.cpp branches/nextgen/COLLADAMax/include/COLLADAMaxLightImporter.h branches/nextgen/COLLADAMax/src/COLLADAMaxLightImporter.cpp branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLLibraryLightsLoader.h branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLLibraryLightsLoader.cpp Modified: branches/nextgen/COLLADAFramework/include/COLLADAFWCamera.h =================================================================== --- branches/nextgen/COLLADAFramework/include/COLLADAFWCamera.h 2009-02-12 16:03:53 UTC (rev 358) +++ branches/nextgen/COLLADAFramework/include/COLLADAFWCamera.h 2009-02-13 13:39:16 UTC (rev 359) @@ -72,8 +72,7 @@ /** The far clipping plane.*/ double mFarClippingPlane; public: - /** - @param objectId The object id of the camera.*/ + /** @param objectId The object id of the camera.*/ Camera( ObjectId objectId ); /** Destructor. */ Modified: branches/nextgen/COLLADAFramework/include/COLLADAFWIWriter.h =================================================================== --- branches/nextgen/COLLADAFramework/include/COLLADAFWIWriter.h 2009-02-12 16:03:53 UTC (rev 358) +++ branches/nextgen/COLLADAFramework/include/COLLADAFWIWriter.h 2009-02-13 13:39:16 UTC (rev 359) @@ -23,6 +23,7 @@ class Material; class Effect; class Camera; + class Light; /** Class that needs to be implemented by a writer. @@ -80,6 +81,10 @@ @return The writer should return true, if writing succeeded, false otherwise.*/ virtual bool writeCamera( const Camera* camera ) = 0; + /** When this method is called, the writer must write the light. + @return The writer should return true, if writing succeeded, false otherwise.*/ + virtual bool writeLight( const Light* camera ) = 0; + private: /** Disable default copy ctor. */ Added: branches/nextgen/COLLADAFramework/include/COLLADAFWInstanceLight.h =================================================================== --- branches/nextgen/COLLADAFramework/include/COLLADAFWInstanceLight.h (rev 0) +++ branches/nextgen/COLLADAFramework/include/COLLADAFWInstanceLight.h 2009-02-13 13:39:16 UTC (rev 359) @@ -0,0 +1,29 @@ +/* + 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_INSTANCELIGHT_H__ +#define __COLLADAFW_INSTANCELIGHT_H__ + +#include "COLLADAFWPrerequisites.h" +#include "COLLADAFWSceneGraphInstance.h" +#include "COLLADAFWPointerArray.h" + +namespace COLLADAFW +{ + + /** Instantiates a node within a scene graph.*/ + typedef SceneGraphInstance InstanceLight; + + typedef ArrayPrimitiveType<InstanceNode*> InstanceLightArray; + typedef PointerArray<InstanceNode> InstanceLightPointerArray; + +} // namespace COLLADAFW + +#endif // __COLLADAFW_INSTANCELIGHT_H__ Added: branches/nextgen/COLLADAFramework/include/COLLADAFWLight.h =================================================================== --- branches/nextgen/COLLADAFramework/include/COLLADAFWLight.h (rev 0) +++ branches/nextgen/COLLADAFramework/include/COLLADAFWLight.h 2009-02-13 13:39:16 UTC (rev 359) @@ -0,0 +1,144 @@ +/* + 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_LIGHT_H__ +#define __COLLADAFW_LIGHT_H__ + +#include "COLLADAFWPrerequisites.h" +#include "COLLADAFWObject.h" +#include "COLLADAFWColor.h" + + +namespace COLLADAFW +{ + + /** A light of one of the types: ambient, directional, point, spot. + Formula for attenuation: + A = constant_attenuation + ( D * linear_attenuation ) + ( D^2 * quadratic_attenuation )*/ + class Light : public ObjectTemplate < COLLADA_TYPE::LIGHT > + { + public: + /** All possible types of light*/ + enum LightType + { + UNDEFINED, + AMBIENT_LIGHT, + DIRECTIONAL_LIGHT, + POINT_LIGHT, + SPOT_LIGHT + }; + + private: + /** The name of the light.*/ + String mName; + + /** The type of the light.*/ + LightType mLightType; + + /** The color of the light. Has only rgb values, no alpha. + Used by all light types.*/ + Color mColor; + + /** The constant coefficient in the attenuation formula. + Used by point and spot lights.*/ + double mConstantAttenuation; + + /** The linear coefficient in the attenuation formula. + Used by point and spot lights.*/ + double mLinearAttenuation; + + /** The quadratic coefficient in the attenuation formula. + Used by point and spot lights.*/ + double mQuadraticAttenuation; + + /** The fall off angle. + Used by spot and lights.*/ + double mFallOffAngle; + + /** The fall off exponent. + Used by spot and lights.*/ + double mFallOffExponent; + + public: + /** @param objectId The object id of the camera.*/ + Light( ObjectId objectId ); + + /** Destructor. */ + virtual ~Light(); + + /** Returns name of the light.*/ + const COLLADAFW::String& getName() const { return mName; } + + /** Sets name of the light.*/ + void setName(const COLLADAFW::String& name) { mName = name; } + + /** Returns the type of the light.*/ + LightType getLightType() const { return mLightType; } + + /** Sets the type of the light.*/ + void setLightType(LightType lightType) { mLightType = lightType; } + + /** Returns the color of the light. Has only rgb values, no alpha. + Used by all light types.*/ + const Color& getColor() const { return mColor; } + + /** Returns the color of the light. Has only rgb values, no alpha. + Used by all light types.*/ + Color& getColor() { return mColor; } + + /** Sets the color of the light. Has only rgb values, no alpha. + Used by all light types.*/ + void setColor(const Color& color) { mColor = color; } + + /** Returns the constant coefficient in the attenuation formula. + Used by point and spot lights.*/ + double getConstantAttenuation() const { return mConstantAttenuation; } + + /** Sets the constant coefficient in the attenuation formula. + Used by point and spot lights.*/ + void setConstantAttenuation(double constantAttenuation) { mConstantAttenuation = constantAttenuation; } + + /** Returns the linear coefficient in the attenuation formula. + Used by point and spot lights.*/ + double getLinearAttenuation() const { return mLinearAttenuation; } + + /** Sets the linear coefficient in the attenuation formula. + Used by point and spot lights.*/ + void setLinearAttenuation(double linearAttenuation) { mLinearAttenuation = linearAttenuation; } + + /** Returns the quadratic coefficient in the attenuation formula. + Used by point and spot lights.*/ + double getQuadraticAttenuation() const { return mQuadraticAttenuation; } + + /** Sets the quadratic coefficient in the attenuation formula. + Used by point and spot lights.*/ + void setQuadraticAttenuation(double quadraticAttenuation) { mQuadraticAttenuation = quadraticAttenuation; } + + /** Returns fall off angle. + Used by spot and lights.*/ + double getFallOffAngle() const { return mFallOffAngle; } + + /** Sets fall off angle. + Used by spot and lights.*/ + void setFallOffAngle(double fallOffAngl) { mFallOffAngle = fallOffAngl; } + + /** Returns fall off exponent. + Used by spot and lights.*/ + double getFallOffExponent() const { return mFallOffExponent; } + + /** Sets fall off exponent. + Used by spot and lights.*/ + void setFallOffExponent(double fallOffAngl) { mFallOffExponent = fallOffAngl; } + + }; + +} // namespace COLLADAFW + +#endif // __COLLADAFW_LIGHT_H__ Modified: branches/nextgen/COLLADAFramework/include/COLLADAFWNode.h =================================================================== --- branches/nextgen/COLLADAFramework/include/COLLADAFWNode.h 2009-02-12 16:03:53 UTC (rev 358) +++ branches/nextgen/COLLADAFramework/include/COLLADAFWNode.h 2009-02-13 13:39:16 UTC (rev 359) @@ -17,6 +17,7 @@ #include "COLLADAFWInstanceGeometry.h" #include "COLLADAFWInstanceNode.h" #include "COLLADAFWInstanceCamera.h" +#include "COLLADAFWInstanceLight.h" #include "COLLADAFWArrayPrimitiveType.h" #include "COLLADAFWPointerArray.h" @@ -74,6 +75,9 @@ /** List of all instance cameras of this node. Array and contents will be delete in destructor.*/ InstanceCameraPointerArray mInstanceCameras; + /** List of all instance cameras of this node. Array and contents will be delete in destructor.*/ + InstanceLightPointerArray mInstanceLights; + /** List of all child nodes. Array and contents will be delete in destructor.*/ NodePointerArray mChildNodes; @@ -121,6 +125,12 @@ /** List of all instance cameras of this camera.*/ const InstanceCameraPointerArray& getInstanceCameras() const { return mInstanceCameras; } + /** List of all instance cameras of this camera.*/ + InstanceLightPointerArray& getInstanceLights() { return mInstanceLights; } + + /** List of all instance cameras of this camera.*/ + const InstanceLightPointerArray& getInstanceLights() const { return mInstanceLights; } + /** Get list of all child nodes.*/ NodePointerArray& getChildNodes() { return mChildNodes; } Modified: branches/nextgen/COLLADAFramework/scripts/COLLADAFramework.vcproj =================================================================== --- branches/nextgen/COLLADAFramework/scripts/COLLADAFramework.vcproj 2009-02-12 16:03:53 UTC (rev 358) +++ branches/nextgen/COLLADAFramework/scripts/COLLADAFramework.vcproj 2009-02-13 13:39:16 UTC (rev 359) @@ -336,6 +336,10 @@ > </File> <File + RelativePath="..\src\COLLADAFWLight.cpp" + > + </File> + <File RelativePath="..\src\COLLADAFWLoaderUtils.cpp" > </File> @@ -522,6 +526,10 @@ > </File> <File + RelativePath="..\include\COLLADAFWInstanceLight.h" + > + </File> + <File RelativePath="..\include\COLLADAFWInstanceMaterial.h" > </File> @@ -538,6 +546,10 @@ > </File> <File + RelativePath="..\include\COLLADAFWLight.h" + > + </File> + <File RelativePath="..\include\COLLADAFWLoaderUtils.h" > </File> Added: branches/nextgen/COLLADAFramework/src/COLLADAFWLight.cpp =================================================================== --- branches/nextgen/COLLADAFramework/src/COLLADAFWLight.cpp (rev 0) +++ branches/nextgen/COLLADAFramework/src/COLLADAFWLight.cpp 2009-02-13 13:39:16 UTC (rev 359) @@ -0,0 +1,36 @@ +/* + 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 "COLLADAFWLight.h" + + +namespace COLLADAFW +{ + + //------------------------------ + Light::Light( ObjectId objectId ) + : ObjectTemplate< COLLADA_TYPE::LIGHT >(objectId) + , mLightType(UNDEFINED) + , mColor() + , mConstantAttenuation(1) + , mLinearAttenuation(0) + , mQuadraticAttenuation(0) + , mFallOffAngle(180) + , mFallOffExponent(0) + { + } + + //------------------------------ + Light::~Light() + { + } + +} // namespace COLLADAFW Modified: branches/nextgen/COLLADAMax/include/COLLADAMaxDocumentImporter.h =================================================================== --- branches/nextgen/COLLADAMax/include/COLLADAMaxDocumentImporter.h 2009-02-12 16:03:53 UTC (rev 358) +++ branches/nextgen/COLLADAMax/include/COLLADAMaxDocumentImporter.h 2009-02-13 13:39:16 UTC (rev 359) @@ -23,7 +23,9 @@ #include "COLLADAFWIWriter.h" #include "COLLADAFWMaterial.h" #include "COLLADAFWEffect.h" +#include "COLLADAFWColor.h" #include "COLLADAFWInstanceGeometry.h" + #include <list> //#include "dummy.h" @@ -111,6 +113,12 @@ /** File path of the COLLADA document to import.*/ NativeString mImportFilePath; + /** The accumulated ambient color.*/ + COLLADAFW::Color mAmbientColor; + + /** The number of ambient colors already added.*/ + size_t mNumberOfAmbientColors; + /** A dummy helper, that is used for nodes that do not have an object assigned to.*/ DummyObject* mDummyObject; @@ -182,6 +190,15 @@ /** Returns the max interface.*/ ImpInterface* getMaxImportInterface() { return mMaxImportInterface; } + /** Returns the accumulated ambient color.*/ + const COLLADAFW::Color& getAmbientColor() const { return mAmbientColor; } + + /** Returns the number of accumulated ambient colors.*/ + size_t getNumberOfAmbientColors() const { return mNumberOfAmbientColors; } + + /** Adds @a ambientColor to the total ambient color.*/ + void addAmbientColor( const COLLADAFW::Color& ambientColor); + /** Deletes the entire scene. @param errorMessage A message containing informations about the error that occurred. */ @@ -221,8 +238,10 @@ @return True on succeeded, false otherwise.*/ virtual bool writeCamera( const COLLADAFW::Camera* camera ); + /** Writes the light. + @return True on succeeded, false otherwise.*/ + virtual bool writeLight( const COLLADAFW::Light* light ); - private: /** Disable default copy ctor. */ DocumentImporter( const DocumentImporter& pre ); Modified: branches/nextgen/COLLADAMax/include/COLLADAMaxImporterBase.h =================================================================== --- branches/nextgen/COLLADAMax/include/COLLADAMaxImporterBase.h 2009-02-12 16:03:53 UTC (rev 358) +++ branches/nextgen/COLLADAMax/include/COLLADAMaxImporterBase.h 2009-02-13 13:39:16 UTC (rev 359) @@ -62,6 +62,9 @@ /** Destructor. */ virtual ~ImporterBase(); + /** Returns the document importer.*/ + DocumentImporter* getDocumentImporter() { return mDocumentImporter; } + /** Returns the max interface.*/ Interface* getMaxInterface(); Added: branches/nextgen/COLLADAMax/include/COLLADAMaxLightImporter.h =================================================================== --- branches/nextgen/COLLADAMax/include/COLLADAMaxLightImporter.h (rev 0) +++ branches/nextgen/COLLADAMax/include/COLLADAMaxLightImporter.h 2009-02-13 13:39:16 UTC (rev 359) @@ -0,0 +1,73 @@ +/* +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_LIGHTIMPORTER_H__ +#define __COLLADAMAX_LIGHTIMPORTER_H__ + +#include "COLLADAMaxPrerequisites.h" +#include "COLLADAMaxImporterBase.h" + +class GenLight; + +namespace COLLADAFW +{ + class Light; +}; + + +namespace COLLADAMax +{ + + /** Imports a light into the max scene. */ + class LightImporter : public ImporterBase + { + private: + /** The light to import.*/ + const COLLADAFW::Light* mLight; + + public: + + /** Constructor. */ + LightImporter( DocumentImporter* documentImporter, const COLLADAFW::Light* light ); + + /** Destructor. */ + virtual ~LightImporter(); + + /** Performs the import of the light. + @return True on success, false otherwise.*/ + bool import(); + + /** Creates a new light from @a camera and returns a pointer to it. */ + GenLight* createLight( const COLLADAFW::Light* light ); + + /** creates and adds an ambient light to the document. Since such a light is global + i does not have to added to the scene.*/ + void createAndAddAmbientLight( const COLLADAFW::Light* light ); + + private: + + /** Disable default copy ctor. */ + LightImporter( const LightImporter& pre ); + + /** Disable default assignment operator. */ + const LightImporter& operator= ( const LightImporter& pre ); + + }; + +} // namespace COLLADAMAX + +#endif // __COLLADAMAX_LIGHTIMPORTER_H__ Modified: branches/nextgen/COLLADAMax/include/COLLADAMaxNodeImporter.h =================================================================== --- branches/nextgen/COLLADAMax/include/COLLADAMaxNodeImporter.h 2009-02-12 16:03:53 UTC (rev 358) +++ branches/nextgen/COLLADAMax/include/COLLADAMaxNodeImporter.h 2009-02-13 13:39:16 UTC (rev 359) @@ -69,6 +69,8 @@ /** Imports all the instance cameras in @a instanceGeometryArray and attaches them to @a parentImportNode.*/ bool importInstanceCameras( const COLLADAFW::InstanceCameraPointerArray& instanceCameraArray, ImpNode* parentImportNode ); + /** Imports all the instance lights in @a instanceGeometryArray and attaches them to @a parentImportNode.*/ + bool importInstanceLights( const COLLADAFW::InstanceLightPointerArray& instanceLightArray, ImpNode* parentImportNode ); /** Imports the first instance of type Instance in @a node. A new INode is created, that references the instantiated geometry and has the properties of @a node (name, transformation). The new INode @@ -84,13 +86,18 @@ Use this member, if a node has exactly one instance geometry.*/ ImpNode* importInstanceGeometry( const COLLADAFW::Node* node, ImpNode* parentImportNode ); - /** Imports the first instance camera in @a node. It is assumed that @a node has at least one instance camera. A new INode is created, that references the instantiated camera and has the properties of @a node (name, transformation). The new INode is attached to @a parentImportNode. Use this member, if a node has exactly one instance camera.*/ ImpNode* importInstanceCamera( const COLLADAFW::Node* node, ImpNode* parentImportNode ); + /** Imports the first instance light in @a node. It is assumed that @a node has at least one + instance light. A new INode is created, that references the instantiated light and has the + properties of @a node (name, transformation). The new INode is attached to @a parentImportNode. + Use this member, if a node has exactly one instance light.*/ + ImpNode* importInstanceLight( const COLLADAFW::Node* node, ImpNode* parentImportNode ); + /** Imports all the instance nodes in @a instanceNodeArray and attaches them to @a parentImportNode.*/ bool importInstanceNodes( const COLLADAFW::InstanceNodePointerArray& instanceNodeArray, ImpNode* parentImportNode ); Modified: branches/nextgen/COLLADAMax/scripts/COLLADAMax.vcproj =================================================================== --- branches/nextgen/COLLADAMax/scripts/COLLADAMax.vcproj 2009-02-12 16:03:53 UTC (rev 358) +++ branches/nextgen/COLLADAMax/scripts/COLLADAMax.vcproj 2009-02-13 13:39:16 UTC (rev 359) @@ -27,7 +27,7 @@ > <Tool Name="VCPreBuildEventTool" - CommandLine="echo off

set F=..\include\COLLADAMaxVersionInfo.h


echo Generating %F% 


echo #ifndef __COLLADAMAX_VERSIONINFO_H__ > %F%
echo #define __COLLADAMAX_VERSIONINFO_H__ >> %F%

echo. >> %F%

echo #include "COLLADAMaxPrerequisites.h" >> %F%

echo. >> %F%

echo namespace COLLADAMax >> %F%

echo { >> %F%


FOR /f %%A in ('svnversion ..\..\ ') do set REVISION=%%A


echo const String CURRENT_REVISION = "%REVISION%"; >> %F%
echo const String CURRENT_PLATFORM = "$(PlatformName)"; >> %F%
echo const String CURRENT_CONFIGURATION = "$(ConfigurationName)"; >> %F%

echo } >> %F%

echo. >> %F%

echo #endif // __COLLADAMAX_VERSIONINFO_H__ >> %F%

" + CommandLine="echo off

set F=..\include\COLLADAMaxVersionInfo.h


echo Generating %F%


echo #ifndef __COLLADAMAX_VERSIONINFO_H__ > %F%
echo #define __COLLADAMAX_VERSIONINFO_H__ >> %F%

echo. >> %F%

echo #include "COLLADAMaxPrerequisites.h" >> %F%

echo. >> %F%

echo namespace COLLADAMax >> %F%

echo { >> %F%


FOR /f %%A in ('svnversion ..\..\ ') do set REVISION=%%A


echo const String CURRENT_REVISION = "%REVISION%"; >> %F%
echo const String CURRENT_PLATFORM = "$(PlatformName)"; >> %F%
echo const String CURRENT_CONFIGURATION = "$(ConfigurationName)"; >> %F%

echo } >> %F%

echo. >> %F%

echo #endif // __COLLADAMAX_VERSIONINFO_H__ >> %F%

" /> <Tool Name="VCCustomBuildTool" @@ -113,7 +113,7 @@ > <Tool Name="VCPreBuildEventTool" - CommandLine="echo off

set F=..\include\COLLADAMaxVersionInfo.h


echo Generating %F% 


echo #ifndef __COLLADAMAX_VERSIONINFO_H__ > %F%
echo #define __COLLADAMAX_VERSIONINFO_H__ >> %F%

echo. >> %F%

echo #include "COLLADAMaxPrerequisites.h" >> %F%

echo. >> %F%

echo namespace COLLADAMax >> %F%

echo { >> %F%


FOR /f %%A in ('svnversion ..\..\ ') do set REVISION=%%A


echo const String CURRENT_REVISION = "%REVISION%"; >> %F%
echo const String CURRENT_PLATFORM = "$(PlatformName)"; >> %F%
echo const String CURRENT_CONFIGURATION = "$(ConfigurationName)"; >> %F%

echo } >> %F%

echo. >> %F%

echo #endif // __COLLADAMAX_VERSIONINFO_H__ >> %F%

" + CommandLine="echo off

set F=..\include\COLLADAMaxVersionInfo.h


echo Generating %F%


echo #ifndef __COLLADAMAX_VERSIONINFO_H__ > %F%
echo #define __COLLADAMAX_VERSIONINFO_H__ >> %F%

echo. >> %F%

echo #include "COLLADAMaxPrerequisites.h" >> %F%

echo. >> %F%

echo namespace COLLADAMax >> %F%

echo { >> %F%


FOR /f %%A in ('svnversion ..\..\ ') do set REVISION=%%A


echo const String CURRENT_REVISION = "%REVISION%"; >> %F%
echo const String CURRENT_PLATFORM = "$(PlatformName)"; >> %F%
echo const String CURRENT_CONFIGURATION = "$(ConfigurationName)"; >> %F%

echo } >> %F%

echo. >> %F%

echo #endif // __COLLADAMAX_VERSIONINFO_H__ >> %F%

" /> <Tool Name="VCCustomBuildTool" @@ -201,7 +201,7 @@ > <Tool Name="VCPreBuildEventTool" - CommandLine="echo off

set F=..\include\COLLADAMaxVersionInfo.h


echo Generating %F% 


echo #ifndef __COLLADAMAX_VERSIONINFO_H__ > %F%
echo #define __COLLADAMAX_VERSIONINFO_H__ >> %F%

echo. >> %F%

echo #include "COLLADAMaxPrerequisites.h" >> %F%

echo. >> %F%

echo namespace COLLADAMax >> %F%

echo { >> %F%


FOR /f %%A in ('svnversion ..\..\ ') do set REVISION=%%A


echo const String CURRENT_REVISION = "%REVISION%"; >> %F%
echo const String CURRENT_PLATFORM = "$(PlatformName)"; >> %F%
echo const String CURRENT_CONFIGURATION = "$(ConfigurationName)"; >> %F%

echo } >> %F%

echo. >> %F%

echo #endif // __COLLADAMAX_VERSIONINFO_H__ >> %F%

" + CommandLine="echo off

set F=..\include\COLLADAMaxVersionInfo.h


echo Generating %F%


echo #ifndef __COLLADAMAX_VERSIONINFO_H__ > %F%
echo #define __COLLADAMAX_VERSIONINFO_H__ >> %F%

echo. >> %F%

echo #include "COLLADAMaxPrerequisites.h" >> %F%

echo. >> %F%

echo namespace COLLADAMax >> %F%

echo { >> %F%


FOR /f %%A in ('svnversion ..\..\ ') do set REVISION=%%A


echo const String CURRENT_REVISION = "%REVISION%"; >> %F%
echo const String CURRENT_PLATFORM = "$(PlatformName)"; >> %F%
echo const String CURRENT_CONFIGURATION = "$(ConfigurationName)"; >> %F%

echo } >> %F%

echo. >> %F%

echo #endif // __COLLADAMAX_VERSIONINFO_H__ >> %F%

" /> <Tool Name="VCCustomBuildTool" @@ -290,7 +290,7 @@ > <Tool Name="VCPreBuildEventTool" - CommandLine="echo off

set F=..\include\COLLADAMaxVersionInfo.h


echo Generating %F% 


echo #ifndef __COLLADAMAX_VERSIONINFO_H__ > %F%
echo #define __COLLADAMAX_VERSIONINFO_H__ >> %F%

echo. >> %F%

echo #include "COLLADAMaxPrerequisites.h" >> %F%

echo. >> %F%

echo namespace COLLADAMax >> %F%

echo { >> %F%


FOR /f %%A in ('svnversion ..\..\ ') do set REVISION=%%A


echo const String CURRENT_REVISION = "%REVISION%"; >> %F%
echo const String CURRENT_PLATFORM = "$(PlatformName)"; >> %F%
echo const String CURRENT_CONFIGURATION = "$(ConfigurationName)"; >> %F%

echo } >> %F%

echo. >> %F%

echo #endif // __COLLADAMAX_VERSIONINFO_H__ >> %F%

" + CommandLine="echo off

set F=..\include\COLLADAMaxVersionInfo.h


echo Generating %F%


echo #ifndef __COLLADAMAX_VERSIONINFO_H__ > %F%
echo #define __COLLADAMAX_VERSIONINFO_H__ >> %F%

echo. >> %F%

echo #include "COLLADAMaxPrerequisites.h" >> %F%

echo. >> %F%

echo namespace COLLADAMax >> %F%

echo { >> %F%


FOR /f %%A in ('svnversion ..\..\ ') do set REVISION=%%A


echo const String CURRENT_REVISION = "%REVISION%"; >> %F%
echo const String CURRENT_PLATFORM = "$(PlatformName)"; >> %F%
echo const String CURRENT_CONFIGURATION = "$(ConfigurationName)"; >> %F%

echo } >> %F%

echo. >> %F%

echo #endif // __COLLADAMAX_VERSIONINFO_H__ >> %F%

" /> <Tool Name="VCCustomBuildTool" @@ -379,7 +379,7 @@ > <Tool Name="VCPreBuildEventTool" - CommandLine="echo off

set F=..\include\COLLADAMaxVersionInfo.h


echo Generating %F% 


echo #ifndef __COLLADAMAX_VERSIONINFO_H__ > %F%
echo #define __COLLADAMAX_VERSIONINFO_H__ >> %F%

echo. >> %F%

echo #include "COLLADAMaxPrerequisites.h" >> %F%

echo. >> %F%

echo namespace COLLADAMax >> %F%

echo { >> %F%


FOR /f %%A in ('svnversion ..\..\ ') do set REVISION=%%A


echo const String CURRENT_REVISION = "%REVISION%"; >> %F%
echo const String CURRENT_PLATFORM = "$(PlatformName)"; >> %F%
echo const String CURRENT_CONFIGURATION = "$(ConfigurationName)"; >> %F%

echo } >> %F%

echo. >> %F%

echo #endif // __COLLADAMAX_VERSIONINFO_H__ >> %F%

" + CommandLine="echo off

set F=..\include\COLLADAMaxVersionInfo.h


echo Generating %F%


echo #ifndef __COLLADAMAX_VERSIONINFO_H__ > %F%
echo #define __COLLADAMAX_VERSIONINFO_H__ >> %F%

echo. >> %F%

echo #include "COLLADAMaxPrerequisites.h" >> %F%

echo. >> %F%

echo namespace COLLADAMax >> %F%

echo { >> %F%


FOR /f %%A in ('svnversion ..\..\ ') do set REVISION=%%A


echo const String CURRENT_REVISION = "%REVISION%"; >> %F%
echo const String CURRENT_PLATFORM = "$(PlatformName)"; >> %F%
echo const String CURRENT_CONFIGURATION = "$(ConfigurationName)"; >> %F%

echo } >> %F%

echo. >> %F%

echo #endif // __COLLADAMAX_VERSIONINFO_H__ >> %F%

" /> <Tool Name="VCCustomBuildTool" @@ -465,7 +465,7 @@ > <Tool Name="VCPreBuildEventTool" - CommandLine="echo off

set F=..\include\COLLADAMaxVersionInfo.h


echo Generating %F% 


echo #ifndef __COLLADAMAX_VERSIONINFO_H__ > %F%
echo #define __COLLADAMAX_VERSIONINFO_H__ >> %F%

echo. >> %F%

echo #include "COLLADAMaxPrerequisites.h" >> %F%

echo. >> %F%

echo namespace COLLADAMax >> %F%

echo { >> %F%


FOR /f %%A in ('svnversion ..\..\ ') do set REVISION=%%A


echo const String CURRENT_REVISION = "%REVISION%"; >> %F%
echo const String CURRENT_PLATFORM = "$(PlatformName)"; >> %F%
echo const String CURRENT_CONFIGURATION = "$(ConfigurationName)"; >> %F%

echo } >> %F%

echo. >> %F%

echo #endif // __COLLADAMAX_VERSIONINFO_H__ >> %F%

" + CommandLine="echo off

set F=..\include\COLLADAMaxVersionInfo.h


echo Generating %F%


echo #ifndef __COLLADAMAX_VERSIONINFO_H__ > %F%
echo #define __COLLADAMAX_VERSIONINFO_H__ >> %F%

echo. >> %F%

echo #include "COLLADAMaxPrerequisites.h" >> %F%

echo. >> %F%

echo namespace COLLADAMax >> %F%

echo { >> %F%


FOR /f %%A in ('svnversion ..\..\ ') do set REVISION=%%A


echo const String CURRENT_REVISION = "%REVISION%"; >> %F%
echo const String CURRENT_PLATFORM = "$(PlatformName)"; >> %F%
echo const String CURRENT_CONFIGURATION = "$(ConfigurationName)"; >> %F%

echo } >> %F%

echo. >> %F%

echo #endif // __COLLADAMAX_VERSIONINFO_H__ >> %F%

" /> <Tool Name="VCCustomBuildTool" @@ -553,7 +553,7 @@ > <Tool Name="VCPreBuildEventTool" - CommandLine="echo off

set F=..\include\COLLADAMaxVersionInfo.h


echo Generating %F% 


echo #ifndef __COLLADAMAX_VERSIONINFO_H__ > %F%
echo #define __COLLADAMAX_VERSIONINFO_H__ >> %F%

echo. >> %F%

echo #include "COLLADAMaxPrerequisites.h" >> %F%

echo. >> %F%

echo namespace COLLADAMax >> %F%

echo { >> %F%


FOR /f %%A in ('svnversion ..\..\ ') do set REVISION=%%A


echo const String CURRENT_REVISION = "%REVISION%"; >> %F%
echo const String CURRENT_PLATFORM = "$(PlatformName)"; >> %F%
echo const String CURRENT_CONFIGURATION = "$(ConfigurationName)"; >> %F%

echo } >> %F%

echo. >> %F%

echo #endif // __COLLADAMAX_VERSIONINFO_H__ >> %F%

" + CommandLine="echo off

set F=..\include\COLLADAMaxVersionInfo.h


echo Generating %F%


echo #ifndef __COLLADAMAX_VERSIONINFO_H__ > %F%
echo #define __COLLADAMAX_VERSIONINFO_H__ >> %F%

echo. >> %F%

echo #include "COLLADAMaxPrerequisites.h" >> %F%

echo. >> %F%

echo namespace COLLADAMax >> %F%

echo { >> %F%


FOR /f %%A in ('svnversion ..\..\ ') do set REVISION=%%A


echo const String CURRENT_REVISION = "%REVISION%"; >> %F%
echo const String CURRENT_PLATFORM = "$(PlatformName)"; >> %F%
echo const String CURRENT_CONFIGURATION = "$(ConfigurationName)"; >> %F%

echo } >> %F%

echo. >> %F%

echo #endif // __COLLADAMAX_VERSIONINFO_H__ >> %F%

" /> <Tool Name="VCCustomBuildTool" @@ -642,7 +642,7 @@ > <Tool Name="VCPreBuildEventTool" - CommandLine="echo off

set F=..\include\COLLADAMaxVersionInfo.h


echo Generating %F% 


echo #ifndef __COLLADAMAX_VERSIONINFO_H__ > %F%
echo #define __COLLADAMAX_VERSIONINFO_H__ >> %F%

echo. >> %F%

echo #include "COLLADAMaxPrerequisites.h" >> %F%

echo. >> %F%

echo namespace COLLADAMax >> %F%

echo { >> %F%


FOR /f %%A in ('svnversion ..\..\ ') do set REVISION=%%A


echo const String CURRENT_REVISION = "%REVISION%"; >> %F%
echo const String CURRENT_PLATFORM = "$(PlatformName)"; >> %F%
echo const String CURRENT_CONFIGURATION = "$(ConfigurationName)"; >> %F%

echo } >> %F%

echo. >> %F%

echo #endif // __COLLADAMAX_VERSIONINFO_H__ >> %F%

" + CommandLine="echo off

set F=..\include\COLLADAMaxVersionInfo.h


echo Generating %F%


echo #ifndef __COLLADAMAX_VERSIONINFO_H__ > %F%
echo #define __COLLADAMAX_VERSIONINFO_H__ >> %F%

echo. >> %F%

echo #include "COLLADAMaxPrerequisites.h" >> %F%

echo. >> %F%

echo namespace COLLADAMax >> %F%

echo { >> %F%


FOR /f %%A in ('svnversion ..\..\ ') do set REVISION=%%A


echo const String CURRENT_REVISION = "%REVISION%"; >> %F%
echo const String CURRENT_PLATFORM = "$(PlatformName)"; >> %F%
echo const String CURRENT_CONFIGURATION = "$(ConfigurationName)"; >> %F%

echo } >> %F%

echo. >> %F%

echo #endif // __COLLADAMAX_VERSIONINFO_H__ >> %F%

" /> <Tool Name="VCCustomBuildTool" @@ -732,7 +732,7 @@ > <Tool Name="VCPreBuildEventTool" - CommandLine="echo off

set F=..\include\COLLADAMaxVersionInfo.h


echo Generating %F% 


echo #ifndef __COLLADAMAX_VERSIONINFO_H__ > %F%
echo #define __COLLADAMAX_VERSIONINFO_H__ >> %F%

echo. >> %F%

echo #include "COLLADAMaxPrerequisites.h" >> %F%

echo. >> %F%

echo namespace COLLADAMax >> %F%

echo { >> %F%


FOR /f %%A in ('svnversion ..\..\ ') do set REVISION=%%A


echo const String CURRENT_REVISION = "%REVISION%"; >> %F%
echo const String CURRENT_PLATFORM = "$(PlatformName)"; >> %F%
echo const String CURRENT_CONFIGURATION = "$(ConfigurationName)"; >> %F%

echo } >> %F%

echo. >> %F%

echo #endif // __COLLADAMAX_VERSIONINFO_H__ >> %F%

" + CommandLine="echo off

set F=..\include\COLLADAMaxVersionInfo.h


echo Generating %F%


echo #ifndef __COLLADAMAX_VERSIONINFO_H__ > %F%
echo #define __COLLADAMAX_VERSIONINFO_H__ >> %F%

echo. >> %F%

echo #include "COLLADAMaxPrerequisites.h" >> %F%

echo. >> %F%

echo namespace COLLADAMax >> %F%

echo { >> %F%


FOR /f %%A in ('svnversion ..\..\ ') do set REVISION=%%A


echo const String CURRENT_REVISION = "%REVISION%"; >> %F%
echo const String CURRENT_PLATFORM = "$(PlatformName)"; >> %F%
echo const String CURRENT_CONFIGURATION = "$(ConfigurationName)"; >> %F%

echo } >> %F%

echo. >> %F%

echo #endif // __COLLADAMAX_VERSIONINFO_H__ >> %F%

" /> <Tool Name="VCCustomBuildTool" @@ -821,7 +821,7 @@ > <Tool Name="VCPreBuildEventTool" - CommandLine="echo off

set F=..\include\COLLADAMaxVersionInfo.h


echo Generating %F% 


echo #ifndef __COLLADAMAX_VERSIONINFO_H__ > %F%
echo #define __COLLADAMAX_VERSIONINFO_H__ >> %F%

echo. >> %F%

echo #include "COLLADAMaxPrerequisites.h" >> %F%

echo. >> %F%

echo namespace COLLADAMax >> %F%

echo { >> %F%


FOR /f %%A in ('svnversion ..\..\ ') do set REVISION=%%A


echo const String CURRENT_REVISION = "%REVISION%"; >> %F%
echo const String CURRENT_PLATFORM = "$(PlatformName)"; >> %F%
echo const String CURRENT_CONFIGURATION = "$(ConfigurationName)"; >> %F%

echo } >> %F%

echo. >> %F%

echo #endif // __COLLADAMAX_VERSIONINFO_H__ >> %F%

" + CommandLine="echo off

set F=..\include\COLLADAMaxVersionInfo.h


echo Generating %F%


echo #ifndef __COLLADAMAX_VERSIONINFO_H__ > %F%
echo #define __COLLADAMAX_VERSIONINFO_H__ >> %F%

echo. >> %F%

echo #include "COLLADAMaxPrerequisites.h" >> %F%

echo. >> %F%

echo namespace COLLADAMax >> %F%

echo { >> %F%


FOR /f %%A in ('svnversion ..\..\ ') do set REVISION=%%A


echo const String CURRENT_REVISION = "%REVISION%"; >> %F%
echo const String CURRENT_PLATFORM = "$(PlatformName)"; >> %F%
echo const String CURRENT_CONFIGURATION = "$(ConfigurationName)"; >> %F%

echo } >> %F%

echo. >> %F%

echo #endif // __COLLADAMAX_VERSIONINFO_H__ >> %F%

" /> <Tool Name="VCCustomBuildTool" @@ -910,7 +910,7 @@ > <Tool Name="VCPreBuildEventTool" - CommandLine="echo off

set F=..\include\COLLADAMaxVersionInfo.h


echo Generating %F% 


echo #ifndef __COLLADAMAX_VERSIONINFO_H__ > %F%
echo #define __COLLADAMAX_VERSIONINFO_H__ >> %F%

echo. >> %F%

echo #include "COLLADAMaxPrerequisites.h" >> %F%

echo. >> %F%

echo namespace COLLADAMax >> %F%

echo { >> %F%


FOR /f %%A in ('svnversion ..\..\ ') do set REVISION=%%A


echo const String CURRENT_REVISION = "%REVISION%"; >> %F%
echo const String CURRENT_PLATFORM = "$(PlatformName)"; >> %F%
echo const String CURRENT_CONFIGURATION = "$(ConfigurationName)"; >> %F%

echo } >> %F%

echo. >> %F%

echo #endif // __COLLADAMAX_VERSIONINFO_H__ >> %F%

" + CommandLine="echo off

set F=..\include\COLLADAMaxVersionInfo.h


echo Generating %F%


echo #ifndef __COLLADAMAX_VERSIONINFO_H__ > %F%
echo #define __COLLADAMAX_VERSIONINFO_H__ >> %F%

echo. >> %F%

echo #include "COLLADAMaxPrerequisites.h" >> %F%

echo. >> %F%

echo namespace COLLADAMax >> %F%

echo { >> %F%


FOR /f %%A in ('svnversion ..\..\ ') do set REVISION=%%A


echo const String CURRENT_REVISION = "%REVISION%"; >> %F%
echo const String CURRENT_PLATFORM = "$(PlatformName)"; >> %F%
echo const String CURRENT_CONFIGURATION = "$(ConfigurationName)"; >> %F%

echo } >> %F%

echo. >> %F%

echo #endif // __COLLADAMAX_VERSIONINFO_H__ >> %F%

" /> <Tool Name="VCCustomBuildTool" @@ -996,7 +996,7 @@ > <Tool Name="VCPreBuildEventTool" - CommandLine="echo off

set F=..\include\COLLADAMaxVersionInfo.h


echo Generating %F% 


echo #ifndef __COLLADAMAX_VERSIONINFO_H__ > %F%
echo #define __COLLADAMAX_VERSIONINFO_H__ >> %F%

echo. >> %F%

echo #include "COLLADAMaxPrerequisites.h" >> %F%

echo. >> %F%

echo namespace COLLADAMax >> %F%

echo { >> %F%


FOR /f %%A in ('svnversion ..\..\ ') do set REVISION=%%A


echo const String CURRENT_REVISION = "%REVISION%"; >> %F%
echo const String CURRENT_PLATFORM = "$(PlatformName)"; >> %F%
echo const String CURRENT_CONFIGURATION = "$(ConfigurationName)"; >> %F%

echo } >> %F%

echo. >> %F%

echo #endif // __COLLADAMAX_VERSIONINFO_H__ >> %F%

" + CommandLine="echo off

set F=..\include\COLLADAMaxVersionInfo.h


echo Generating %F%


echo #ifndef __COLLADAMAX_VERSIONINFO_H__ > %F%
echo #define __COLLADAMAX_VERSIONINFO_H__ >> %F%

echo. >> %F%

echo #include "COLLADAMaxPrerequisites.h" >> %F%

echo. >> %F%

echo namespace COLLADAMax >> %F%

echo { >> %F%


FOR /f %%A in ('svnversion ..\..\ ') do set REVISION=%%A


echo const String CURRENT_REVISION = "%REVISION%"; >> %F%
echo const String CURRENT_PLATFORM = "$(PlatformName)"; >> %F%
echo const String CURRENT_CONFIGURATION = "$(ConfigurationName)"; >> %F%

echo } >> %F%

echo. >> %F%

echo #endif // __COLLADAMAX_VERSIONINFO_H__ >> %F%

" /> <Tool Name="VCCustomBuildTool" @@ -1083,7 +1083,7 @@ > <Tool Name="VCPreBuildEventTool" - CommandLine="echo off

set F=..\include\COLLADAMaxVersionInfo.h


echo Generating %F% 


echo #ifndef __COLLADAMAX_VERSIONINFO_H__ > %F%
echo #define __COLLADAMAX_VERSIONINFO_H__ >> %F%

echo. >> %F%

echo #include "COLLADAMaxPrerequisites.h" >> %F%

echo. >> %F%

echo namespace COLLADAMax >> %F%

echo { >> %F%


FOR /f %%A in ('svnversion ..\..\ ') do set REVISION=%%A


echo const String CURRENT_REVISION = "%REVISION%"; >> %F%
echo const String CURRENT_PLATFORM = "$(PlatformName)"; >> %F%
echo const String CURRENT_CONFIGURATION = "$(ConfigurationName)"; >> %F%

echo } >> %F%

echo. >> %F%

echo #endif // __COLLADAMAX_VERSIONINFO_H__ >> %F%

" + CommandLine="echo off

set F=..\include\COLLADAMaxVersionInfo.h


echo Generating %F%


echo #ifndef __COLLADAMAX_VERSIONINFO_H__ > %F%
echo #define __COLLADAMAX_VERSIONINFO_H__ >> %F%

echo. >> %F%

echo #include "COLLADAMaxPrerequisites.h" >> %F%

echo. >> %F%

echo namespace COLLADAMax >> %F%

echo { >> %F%


FOR /f %%A in ('svnversion ..\..\ ') do set REVISION=%%A


echo const String CURRENT_REVISION = "%REVISION%"; >> %F%
echo const String CURRENT_PLATFORM = "$(PlatformName)"; >> %F%
echo const String CURRENT_CONFIGURATION = "$(ConfigurationName)"; >> %F%

echo } >> %F%

echo. >> %F%

echo #endif // __COLLADAMAX_VERSIONINFO_H__ >> %F%

" /> <Tool Name="VCCustomBuildTool" @@ -1169,7 +1169,7 @@ > <Tool Name="VCPreBuildEventTool" - CommandLine="echo off

set F=..\include\COLLADAMaxVersionInfo.h


echo Generating %F% 


echo #ifndef __COLLADAMAX_VERSIONINFO_H__ > %F%
echo #define __COLLADAMAX_VERSIONINFO_H__ >> %F%

echo. >> %F%

echo #include "COLLADAMaxPrerequisites.h" >> %F%

echo. >> %F%

echo namespace COLLADAMax >> %F%

echo { >> %F%


FOR /f %%A in ('svnversion ..\..\ ') do set REVISION=%%A


echo const String CURRENT_REVISION = "%REVISION%"; >> %F%
echo const String CURRENT_PLATFORM = "$(PlatformName)"; >> %F%
echo const String CURRENT_CONFIGURATION = "$(ConfigurationName)"; >> %F%

echo } >> %F%

echo. >> %F%

echo #endif // __COLLADAMAX_VERSIONINFO_H__ >> %F%

" + CommandLine="echo off

set F=..\include\COLLADAMaxVersionInfo.h


echo Generating %F%


echo #ifndef __COLLADAMAX_VERSIONINFO_H__ > %F%
echo #define __COLLADAMAX_VERSIONINFO_H__ >> %F%

echo. >> %F%

echo #include "COLLADAMaxPrerequisites.h" >> %F%

echo. >> %F%

echo namespace COLLADAMax >> %F%

echo { >> %F%


FOR /f %%A in ('svnversion ..\..\ ') do set REVISION=%%A


echo const String CURRENT_REVISION = "%REVISION%"; >> %F%
echo const String CURRENT_PLATFORM = "$(PlatformName)"; >> %F%
echo const String CURRENT_CONFIGURATION = "$(ConfigurationName)"; >> %F%

echo } >> %F%

echo. >> %F%

echo #endif // __COLLADAMAX_VERSIONINFO_H__ >> %F%

" /> <Tool Name="VCCustomBuildTool" @@ -1257,7 +1257,7 @@ > <Tool Name="VCPreBuildEventTool" - CommandLine="echo off

set F=..\include\COLLADAMaxVersionInfo.h


echo Generating %F% 


echo #ifndef __COLLADAMAX_VERSIONINFO_H__ > %F%
echo #define __COLLADAMAX_VERSIONINFO_H__ >> %F%

echo. >> %F%

echo #include "COLLADAMaxPrerequisites.h" >> %F%

echo. >> %F%

echo namespace COLLADAMax >> %F%

echo { >> %F%


FOR /f %%A in ('svnversion ..\..\ ') do set REVISION=%%A


echo const String CURRENT_REVISION = "%REVISION%"; >> %F%
echo const String CURRENT_PLATFORM = "$(PlatformName)"; >> %F%
echo const String CURRENT_CONFIGURATION = "$(ConfigurationName)"; >> %F%

echo } >> %F%

echo. >> %F%

echo #endif // __COLLADAMAX_VERSIONINFO_H__ >> %F%

" + CommandLine="echo off

set F=..\include\COLLADAMaxVersionInfo.h


echo Generating %F%


echo #ifndef __COLLADAMAX_VERSIONINFO_H__ > %F%
echo #define __COLLADAMAX_VERSIONINFO_H__ >> %F%

echo. >> %F%

echo #include "COLLADAMaxPrerequisites.h" >> %F%

echo. >> %F%

echo namespace COLLADAMax >> %F%

echo { >> %F%


FOR /f %%A in ('svnversion ..\..\ ') do set REVISION=%%A


echo const String CURRENT_REVISION = "%REVISION%"; >> %F%
echo const String CURRENT_PLATFORM = "$(PlatformName)"; >> %F%
echo const String CURRENT_CONFIGURATION = "$(ConfigurationName)"; >> %F%

echo } >> %F%

echo. >> %F%

echo #endif // __COLLADAMAX_VERSIONINFO_H__ >> %F%

" /> <Tool Name="VCCustomBuildTool" @@ -1346,7 +1346,7 @@ > <Tool Name="VCPreBuildEventTool" - CommandLine="echo off

set F=..\include\COLLADAMaxVersionInfo.h


echo Generating %F% 


echo #ifndef __COLLADAMAX_VERSIONINFO_H__ > %F%
echo #define __COLLADAMAX_VERSIONINFO_H__ >> %F%

echo. >> %F%

echo #include "COLLADAMaxPrerequisites.h" >> %F%

echo. >> %F%

echo namespace COLLADAMax >> %F%

echo { >> %F%


FOR /f %%A in ('svnversion ..\..\ ') do set REVISION=%%A


echo const String CURRENT_REVISION = "%REVISION%"; >> %F%
echo const String CURRENT_PLATFORM = "$(PlatformName)"; >> %F%
echo const String CURRENT_CONFIGURATION = "$(ConfigurationName)"; >> %F%

echo } >> %F%

echo. >> %F%

echo #endif // __COLLADAMAX_VERSIONINFO_H__ >> %F%

" + CommandLine="echo off

set F=..\include\COLLADAMaxVersionInfo.h


echo Generating %F%


echo #ifndef __COLLADAMAX_VERSIONINFO_H__ > %F%
echo #define __COLLADAMAX_VERSIONINFO_H__ >> %F%

echo. >> %F%

echo #include "COLLADAMaxPrerequisites.h" >> %F%

echo. >> %F%

echo namespace COLLADAMax >> %F%

echo { >> %F%


FOR /f %%A in ('svnversion ..\..\ ') do set REVISION=%%A


echo const String CURRENT_REVISION = "%REVISION%"; >> %F%
echo const String CURRENT_PLATFORM = "$(PlatformName)"; >> %F%
echo const String CURRENT_CONFIGURATION = "$(ConfigurationName)"; >> %F%

echo } >> %F%

echo. >> %F%

echo #endif // __COLLADAMAX_VERSIONINFO_H__ >> %F%

" /> <Tool Name="VCCustomBuildTool" @@ -2107,6 +2107,10 @@ > </File> <File + RelativePath="..\src\COLLADAMaxLightImporter.cpp" + > + </File> + <File RelativePath="..\src\COLLADAMaxMaterialCreator.cpp" > </File> @@ -2293,6 +2297,10 @@ > </File> <File + RelativePath="..\include\COLLADAMaxLightImporter.h" + > + </File> + <File RelativePath="..\include\COLLADAMaxMaterialCreator.h" > </File> Modified: branches/ne... [truncated message content] |
From: <jud...@us...> - 2009-02-12 16:03:56
|
Revision: 358 http://colladamaya.svn.sourceforge.net/colladamaya/?rev=358&view=rev Author: judithschenk Date: 2009-02-12 16:03:53 +0000 (Thu, 12 Feb 2009) Log Message: ----------- no tabs Modified Paths: -------------- branches/nextgen/Externals/MayaDataModel/include/MayaDMCommands.h Modified: branches/nextgen/Externals/MayaDataModel/include/MayaDMCommands.h =================================================================== --- branches/nextgen/Externals/MayaDataModel/include/MayaDMCommands.h 2009-02-12 15:16:39 UTC (rev 357) +++ branches/nextgen/Externals/MayaDataModel/include/MayaDMCommands.h 2009-02-12 16:03:53 UTC (rev 358) @@ -23,7 +23,7 @@ bool relative = false, bool removeObject = false, bool shape = false, bool world = false ) { - fprintf ( file, " parent" ); + fprintf ( file, "parent" ); if ( absolute ) fprintf ( file, " -a" ); if ( addObject ) fprintf ( file, " -add" ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rob...@us...> - 2009-02-12 15:16:41
|
Revision: 357 http://colladamaya.svn.sourceforge.net/colladamaya/?rev=357&view=rev Author: robertwuerfel Date: 2009-02-12 15:16:39 +0000 (Thu, 12 Feb 2009) Log Message: ----------- fix bug in libxml parser Modified Paths: -------------- branches/nextgen/GeneratedSaxParser/src/GeneratedSaxParserLibxmlSaxParser.cpp Modified: branches/nextgen/GeneratedSaxParser/src/GeneratedSaxParserLibxmlSaxParser.cpp =================================================================== --- branches/nextgen/GeneratedSaxParser/src/GeneratedSaxParserLibxmlSaxParser.cpp 2009-02-12 14:35:47 UTC (rev 356) +++ branches/nextgen/GeneratedSaxParser/src/GeneratedSaxParserLibxmlSaxParser.cpp 2009-02-12 15:16:39 UTC (rev 357) @@ -58,8 +58,6 @@ //-------------------------------------------------------------------- LibxmlSaxParser::~LibxmlSaxParser() { - if (mParserContext) - xmlFreeParserCtxt(mParserContext); } bool LibxmlSaxParser::parseFile( const char* fileName ) @@ -85,7 +83,15 @@ initializeParserContext(); xmlParseDocument(mParserContext); - // xmlFreeParserCtxt(mParserContext); + mParserContext->sax = 0; + + if ( mParserContext->myDoc ) + { + xmlFreeDoc(mParserContext->myDoc); + mParserContext->myDoc = 0; + } + + xmlFreeParserCtxt(mParserContext); mParserContext = 0; 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-12 14:35:58
|
Revision: 356 http://colladamaya.svn.sourceforge.net/colladamaya/?rev=356&view=rev Author: judithschenk Date: 2009-02-12 14:35:47 +0000 (Thu, 12 Feb 2009) Log Message: ----------- UniqueId: compare operator; Framework: Management of ids and names; COLLADAMaya: material import; Modified Paths: -------------- branches/nextgen/COLLADAFramework/include/COLLADAFWGeometry.h branches/nextgen/COLLADAFramework/include/COLLADAFWUniqueId.h branches/nextgen/COLLADAFramework/src/COLLADAFWUniqueId.cpp branches/nextgen/COLLADAMaya/include/COLLADAMayaBaseImporter.h branches/nextgen/COLLADAMaya/include/COLLADAMayaDocumentImporter.h branches/nextgen/COLLADAMaya/include/COLLADAMayaEffectImporter.h branches/nextgen/COLLADAMaya/include/COLLADAMayaGeometryImporter.h branches/nextgen/COLLADAMaya/include/COLLADAMayaMaterialImporter.h branches/nextgen/COLLADAMaya/include/COLLADAMayaVisualSceneImporter.h branches/nextgen/COLLADAMaya/src/COLLADAMayaDocumentImporter.cpp branches/nextgen/COLLADAMaya/src/COLLADAMayaEffectImporter.cpp branches/nextgen/COLLADAMaya/src/COLLADAMayaGeometryImporter.cpp branches/nextgen/COLLADAMaya/src/COLLADAMayaMaterialImporter.cpp branches/nextgen/COLLADAMaya/src/COLLADAMayaVisualSceneImporter.cpp branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLLibraryMaterialsLoader.cpp Modified: branches/nextgen/COLLADAFramework/include/COLLADAFWGeometry.h =================================================================== --- branches/nextgen/COLLADAFramework/include/COLLADAFWGeometry.h 2009-02-12 14:18:55 UTC (rev 355) +++ branches/nextgen/COLLADAFramework/include/COLLADAFWGeometry.h 2009-02-12 14:35:47 UTC (rev 356) @@ -49,10 +49,6 @@ private: - /** A text string containing the unique identifier of the <geometry> element. This - value must be unique within the instance document. Optional. */ - String mId; - /** A text string containing the name of the <geometry> element. Optional. */ String mName; Modified: branches/nextgen/COLLADAFramework/include/COLLADAFWUniqueId.h =================================================================== --- branches/nextgen/COLLADAFramework/include/COLLADAFWUniqueId.h 2009-02-12 14:18:55 UTC (rev 355) +++ branches/nextgen/COLLADAFramework/include/COLLADAFWUniqueId.h 2009-02-12 14:35:47 UTC (rev 356) @@ -54,6 +54,8 @@ bool operator<(const UniqueId& rhs) const; + bool operator==(const UniqueId& uid) const; + }; } // namespace COLLADAFW Modified: branches/nextgen/COLLADAFramework/src/COLLADAFWUniqueId.cpp =================================================================== --- branches/nextgen/COLLADAFramework/src/COLLADAFWUniqueId.cpp 2009-02-12 14:18:55 UTC (rev 355) +++ branches/nextgen/COLLADAFramework/src/COLLADAFWUniqueId.cpp 2009-02-12 14:35:47 UTC (rev 356) @@ -17,11 +17,12 @@ const UniqueId UniqueId::INVALID = UniqueId(); - //-------------------------------------------------------------------- + //------------------------------- UniqueId::~UniqueId() { } + //------------------------------- bool UniqueId::operator<( const UniqueId& rhs ) const { if ( mClassId < rhs.mClassId ) @@ -38,4 +39,13 @@ return false; } + + //------------------------------- + bool UniqueId::operator== ( const UniqueId& uid ) const + { + if (mClassId != uid.getClassId ()) return false; + if (mObjectId != uid.getObjectId ()) return false; + return true; + } + } // namespace COLLADAFW Modified: branches/nextgen/COLLADAMaya/include/COLLADAMayaBaseImporter.h =================================================================== --- branches/nextgen/COLLADAMaya/include/COLLADAMayaBaseImporter.h 2009-02-12 14:18:55 UTC (rev 355) +++ branches/nextgen/COLLADAMaya/include/COLLADAMayaBaseImporter.h 2009-02-12 14:35:47 UTC (rev 356) @@ -33,8 +33,22 @@ { public: + typedef std::set<const COLLADAFW::UniqueId> UniqueIdSet; + + typedef std::map<COLLADAFW::UniqueId, COLLADAFW::UniqueId> UniqueIdUniqueIdMap; typedef std::map<COLLADAFW::UniqueId, String> UniqueIdNamesMap; + typedef std::vector<const COLLADAFW::UniqueId> UniqueIdVec; + typedef std::map<COLLADAFW::UniqueId, UniqueIdVec> UniqueIdUniqueIdsMap; + + typedef std::map<COLLADAFW::UniqueId, MayaNode> UniqueIdMayaNodesMap; + typedef std::map<COLLADAFW::UniqueId, MayaDM::Mesh> UniqueIdMayaDMMeshMap; + + typedef std::pair<COLLADAFW::UniqueId,COLLADAFW::MaterialId> CombinedId; + typedef std::vector<size_t> IndicesVector; + typedef std::map<CombinedId, IndicesVector> CombinedIdIndicesMap; + + private: /** Pointer to the current document importer. */ Modified: branches/nextgen/COLLADAMaya/include/COLLADAMayaDocumentImporter.h =================================================================== --- branches/nextgen/COLLADAMaya/include/COLLADAMayaDocumentImporter.h 2009-02-12 14:18:55 UTC (rev 355) +++ branches/nextgen/COLLADAMaya/include/COLLADAMayaDocumentImporter.h 2009-02-12 14:35:47 UTC (rev 356) @@ -40,11 +40,6 @@ class EffectImporter; - typedef std::map<COLLADAFW::UniqueId, std::set<const COLLADAFW::UniqueId>> UniqueIdUniqueIdsMap; - typedef std::map<COLLADAFW::UniqueId, MayaNode> UniqueIdMayaNodesMap; - typedef std::map<COLLADAFW::UniqueId, MayaDM::Mesh> UniqueIdMayaDMMeshMap; - - /** The main importer class. This class imports all data of the scene. */ class DocumentImporter : public COLLADAFW::IWriter { @@ -76,7 +71,6 @@ bool mAssetWritten; bool mSceneGraphWritten; - bool mGeometryWritten; bool mSceneGraphRead; bool mGeometryRead; @@ -94,7 +88,7 @@ EffectImporter* mEffectImporter; /** The variable tells, how many times the document is read. */ - size_t mDocumentReads; + size_t mNumDocumentParses; public: @@ -202,6 +196,13 @@ @return The writer should return true, if writing succeeded, false otherwise.*/ virtual bool writeEffect ( const COLLADAFW::Effect* effect ); + /** When this method is called, the writer must write the camera. + @return The writer should return true, if writing succeeded, false otherwise.*/ + virtual bool writeCamera( const COLLADAFW::Camera* camera ) + { + return true; + } + private: /** Imports the current scene. */ Modified: branches/nextgen/COLLADAMaya/include/COLLADAMayaEffectImporter.h =================================================================== --- branches/nextgen/COLLADAMaya/include/COLLADAMayaEffectImporter.h 2009-02-12 14:18:55 UTC (rev 355) +++ branches/nextgen/COLLADAMaya/include/COLLADAMayaEffectImporter.h 2009-02-12 14:35:47 UTC (rev 356) @@ -69,12 +69,14 @@ /** * The map holds the maya material objects. */ - const UniqueIdMayaDependNodeMap& getMayaEffectMap () const { return mMayaEffectMap; } + MayaDM::DependNode* findMayaEffect ( const COLLADAFW::UniqueId& val ) const; + private: + /** * The map holds the maya material objects. */ - MayaDM::DependNode* findMayaEffect ( const COLLADAFW::UniqueId& val ) const; + const UniqueIdMayaDependNodeMap& getMayaEffectMap () const { return mMayaEffectMap; } /** * The map holds the maya material objects. @@ -86,9 +88,6 @@ */ const UniqueIdDependNodesMap getEffectMaterialsMap () const { return mEffectMaterialsMap; } - - private: - /** * Imports a lambert shader effect. */ Modified: branches/nextgen/COLLADAMaya/include/COLLADAMayaGeometryImporter.h =================================================================== --- branches/nextgen/COLLADAMaya/include/COLLADAMayaGeometryImporter.h 2009-02-12 14:18:55 UTC (rev 355) +++ branches/nextgen/COLLADAMaya/include/COLLADAMayaGeometryImporter.h 2009-02-12 14:35:47 UTC (rev 356) @@ -43,13 +43,15 @@ /** The standard name for geometry without name. */ static const String GEOMETRY_NAME; + private: + /** * The list of the unique maya mesh node names. */ COLLADABU::IDList mMeshNodeIdList; /** - * The map holds the unique ids of the nodes to the maya specific nodes. + * The map holds the unique ids of the geometry nodes to the maya specific nodes. */ UniqueIdMayaNodesMap mMayaMeshNodesMap; @@ -58,6 +60,12 @@ */ UniqueIdMayaDMMeshMap mMayaDMMeshNodesMap; + /** + * The map holds for every geometry's shading engine a list of + * the index values of the geometry's primitives. + */ + CombinedIdIndicesMap mShadingEnginePrimitivesMap; + public: /** Constructor. */ @@ -72,26 +80,42 @@ /** * The map holds the unique ids of the nodes to the maya specific nodes. */ - const MayaNode* getMayaMeshNode ( const COLLADAFW::UniqueId& uniqueId ) const; + const MayaNode* findMayaMeshNode ( 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 ); + MayaNode* findMayaMeshNode ( const COLLADAFW::UniqueId& uniqueId ); - MayaDM::Mesh* getMayaDMMeshNode ( const COLLADAFW::UniqueId& uniqueId ); - const MayaDM::Mesh* getMayaDMMeshNode ( const COLLADAFW::UniqueId& uniqueId ) const; + /** + * The map holds the unique ids of the nodes to the specific nodes. + */ + MayaDM::Mesh* findMayaDMMeshNode ( const COLLADAFW::UniqueId& uniqueId ); + /** + * The map holds the unique ids of the nodes to the specific nodes. + */ + const MayaDM::Mesh* findMayaDMMeshNode ( const COLLADAFW::UniqueId& uniqueId ) const; + + /** + * Returns a pointer to the vector of indices of the given geometry and shading engine. + * The map holds for every geometry's shading engine a list of the index values of the + * geometry's primitives. + */ + std::vector<size_t>* getShadingEnginePrimitiveIndices ( + const COLLADAFW::UniqueId& geometryId, + const COLLADAFW::MaterialId shadingEngineId ); + private: /** - * Imports the data of the current mesh element. - */ + * Imports the data of the current mesh element. + */ void importMesh ( const COLLADAFW::Mesh* mesh ); /** - * Writes the geometry of the current mesh. - */ + * Writes the geometry of the current mesh. + */ void createMesh ( const COLLADAFW::Mesh* mesh, MayaNode* parentMayaNode, @@ -255,6 +279,23 @@ const std::map<COLLADAFW::Edge,size_t>& edgeIndicesMap, int& edgeIndex ); + /** + * The map holds for every geometry's shading engine a list of + * the index values of the geometry's primitives. + */ + void setShadingEnginePrimitiveIndex ( + const COLLADAFW::UniqueId& geometryId, + const COLLADAFW::MaterialId shadingEngineId, + const size_t primitiveIndex ); + + /** + * Fills the ShadingEnginePrimitivesMap. Used to create the connections between the + * shading engines and the geometries. + * The map holds for every geometry's shading engine a list of the index values of the + * geometry's primitives. + */ + void setMeshPrimitiveShadingEngines ( const COLLADAFW::Mesh* mesh ); + }; } Modified: branches/nextgen/COLLADAMaya/include/COLLADAMayaMaterialImporter.h =================================================================== --- branches/nextgen/COLLADAMaya/include/COLLADAMayaMaterialImporter.h 2009-02-12 14:18:55 UTC (rev 355) +++ branches/nextgen/COLLADAMaya/include/COLLADAMayaMaterialImporter.h 2009-02-12 14:35:47 UTC (rev 356) @@ -22,6 +22,9 @@ #include "COLLADABUIDList.h" #include "MayaDMDependNode.h" +#include "MayaDMShadingEngine.h" +#include "MayaDMMaterialInfo.h" +#include "MayaDMTransform.h" namespace COLLADAMaya @@ -30,15 +33,80 @@ /** Declares the importer class for import materials. */ class MaterialImporter : public BaseImporter { + + private: + + /** The standard name for a shading engine. */ + static const String SHADING_ENGINE_NAME; + + /** The standard name for a material info. */ + static const String MATERIAL_INFO_NAME; + + /** The standard name for a material without name. */ + static const String MATERIAL_NAME; + public: typedef std::map<COLLADAFW::UniqueId, MayaDM::DependNode*> UniqueIdMayaMaterialMap; private: - /** The standard name for a material without name. */ - static const String MATERIAL_NAME; + /** + * The maya shading engine and material info. + */ + class ShadingData + { + private: + MayaDM::ShadingEngine* mShadingEngine; + MayaDM::MaterialInfo* mMaterialInfo; + public: + ShadingData () : mShadingEngine (0), mMaterialInfo (0) {} + ShadingData ( + MayaDM::ShadingEngine* shadingEngine, + MayaDM::MaterialInfo* materialInfo ) + : mShadingEngine ( shadingEngine ) + , mMaterialInfo ( materialInfo ) + {} + virtual ~ShadingData() {} + + MayaDM::ShadingEngine* getShadingEngine () const { return mShadingEngine; } + MayaDM::MaterialInfo* getMaterialInfo () const { return mMaterialInfo; } + + private: + /** Disable default copy ctor. */ + ShadingData( const ShadingData& pre ); + /** Disable default assignment operator. */ + const ShadingData& operator= ( const ShadingData& pre ); + + }; + typedef std::map<COLLADAFW::UniqueId, ShadingData*> ShadingDataMap; + + /** + * The binding of a geometry instance to a material. + */ + class ShadingBinding + { + private: + COLLADAFW::UniqueId mGeometryId; + COLLADAFW::UniqueId mTransformNodeId; + COLLADAFW::UniqueId mMaterialId; + + public: + ShadingBinding () {} + virtual ~ShadingBinding () {} + + const COLLADAFW::UniqueId& getGeometryId () const { return mGeometryId; } + void setGeometryId ( const COLLADAFW::UniqueId& val ) { mGeometryId = val; } + + const COLLADAFW::UniqueId& getTransformNodeId () const { return mTransformNodeId; } + void setTransformNodeId ( const COLLADAFW::UniqueId& val ) { mTransformNodeId = val; } + + const COLLADAFW::UniqueId& getMaterialId () const { return mMaterialId; } + void setMaterialId ( const COLLADAFW::UniqueId& val ) { mMaterialId = val; } + }; + typedef std::map<COLLADAFW::MaterialId, std::set<ShadingBinding*>> ShadingEngineBindingMap; + private: /** @@ -56,6 +124,27 @@ */ UniqueIdMayaMaterialMap mMayaMaterialMap; + /** + * The map holds the unique effect ids to a material id. + */ + UniqueIdUniqueIdMap mMaterialIdEffectIdMap; + + /** + * The list of the unique maya shading engine names. + */ + COLLADABU::IDList mShadingEngineIdList; + COLLADABU::IDList mMaterialInfoIdList; + + /** + * The map with the unique ids of the shading engine to the shading engines itself. + */ + ShadingDataMap mShaderDataMap; + + /** + * The map holds for every shader engine a list of geometry ids, which use this shader engine. + */ + ShadingEngineBindingMap mShadingEngineGeometryInstancesMap; + public: /** Constructor. */ @@ -67,22 +156,73 @@ /** Imports the given material. */ bool importMaterial ( const COLLADAFW::Material* material ); + /** Write the shader data into the maya file. */ + void writeShaderData ( + const COLLADAFW::InstanceGeometry::MaterialBinding& materialBinding, + const COLLADAFW::UniqueId& transformNodeId, + const COLLADAFW::InstanceGeometry* instanceGeometry ); + + /** Writes the connection attributes into the maya ascii file. */ + void writeConnections (); + + void connectGeometries (); /** * The map holds the maya material objects. */ - const UniqueIdMayaMaterialMap& getMayaMaterialMap () const { return mMayaMaterialMap; } + MayaDM::DependNode* findMayaMaterial ( const COLLADAFW::UniqueId& val ) const; + private: + + /** Connect the material with the shading engine and the material info. */ + void connectShadingEngines (); + /** * The map holds the maya material objects. */ - MayaDM::DependNode* findMayaMaterial ( const COLLADAFW::UniqueId& val ) const; + const UniqueIdMayaMaterialMap& getMayaMaterialMap () const { return mMayaMaterialMap; } /** * The map holds the maya material objects. */ void appendMaterial ( const COLLADAFW::UniqueId& id, MayaDM::DependNode* materialNode ); + /** + * The list of the unique maya shading engine names. + */ + const COLLADABU::IDList& getShadingEngineIdList () const { return mShadingEngineIdList; } + /** + * The map with the unique ids of the shading engine to the shading engines itself. + */ + const ShadingDataMap& getShadingEnginesMap () const { return mShaderDataMap; } + + /** + * The map with the unique ids of the shading engine to the shading engines itself. + */ + ShadingData* findShaderData ( const COLLADAFW::UniqueId& val ); + + /** + * Returns the effect id of the material. + */ + const COLLADAFW::UniqueId* findEffectId ( const COLLADAFW::UniqueId& materialId ); + + /** + * The map with the unique ids of the shading engine to the shading engines itself. + */ + void appendShaderData ( + const COLLADAFW::UniqueId& uniqueMaterialId, + MayaDM::ShadingEngine* shadingEngine, + MayaDM::MaterialInfo* materialInfo ); + + /** + * Find the index of the transform node of the current geometry instance. + * This is the geometry instance index we use to set the current connection to. + */ + size_t getGeometryInstanceIndex ( + const COLLADAFW::UniqueId& geometryId, + const COLLADAFW::UniqueId& transformNodeId ); + + }; } Modified: branches/nextgen/COLLADAMaya/include/COLLADAMayaVisualSceneImporter.h =================================================================== --- branches/nextgen/COLLADAMaya/include/COLLADAMayaVisualSceneImporter.h 2009-02-12 14:18:55 UTC (rev 355) +++ branches/nextgen/COLLADAMaya/include/COLLADAMayaVisualSceneImporter.h 2009-02-12 14:35:47 UTC (rev 356) @@ -21,8 +21,6 @@ #include "COLLADAMayaNode.h" #include "MayaDMTransform.h" -#include "MayaDMShadingEngine.h" -#include "MayaDMMaterialInfo.h" #include "COLLADAFWVisualScene.h" #include "COLLADAFWSkew.h" @@ -46,46 +44,9 @@ private: - class ShaderData - { - private: - MayaDM::ShadingEngine* mShadingEngine; - MayaDM::MaterialInfo* mMaterialInfo; - - public: - ShaderData () : mShadingEngine (0), mMaterialInfo (0) {} - ShaderData ( - MayaDM::ShadingEngine* shadingEngine, - MayaDM::MaterialInfo* materialInfo ) - : mShadingEngine ( shadingEngine ) - , mMaterialInfo ( materialInfo ) - {} - virtual ~ShaderData() {} - - MayaDM::ShadingEngine* getShadingEngine () const { return mShadingEngine; } - MayaDM::MaterialInfo* getMaterialInfo () const { return mMaterialInfo; } - - private: - /** Disable default copy ctor. */ - ShaderData( const ShaderData& pre ); - /** Disable default assignment operator. */ - const ShaderData& operator= ( const ShaderData& pre ); - - }; - - typedef std::map<COLLADAFW::MaterialId, ShaderData*> ShaderDataMap; - - private: - /** The standard name for a transform node without name. */ static const String TRANSFORM_NODE_NAME; - /** The standard name for a shading engine. */ - static const String SHADING_ENGINE_NAME; - - /** The standard name for a material info. */ - static const String MATERIAL_INFO_NAME; - private: /** @@ -104,17 +65,6 @@ */ UniqueIdMayaNodesMap mMayaTransformNodesMap; - /** - * The list of the unique maya shading engine names. - */ - COLLADABU::IDList mShadingEngineIdList; - COLLADABU::IDList mMaterialInfoIdList; - - /** - * The map with the unique ids of the shading engine to the shading engines itself. - */ - ShaderDataMap mShaderDataMap; - /* * Helper class, to handle the transformations. */ @@ -181,20 +131,19 @@ /** * 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; + const MayaNode* findMayaTransformNode ( 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 ); + MayaNode* findMayaTransformNode ( 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 std::set<const COLLADAFW::UniqueId>* getGeometryTransformIds ( - const COLLADAFW::UniqueId& geometryId ) const; + const UniqueIdVec* findGeometryTransformIds ( const COLLADAFW::UniqueId& geometryId ) const; private: @@ -208,14 +157,14 @@ /** * Save the transformation ids to the geometry ids. */ - bool readGeometryInstances ( - const COLLADAFW::Node* node, - MayaDM::Transform* transformNode ); + bool readGeometryInstances ( const COLLADAFW::Node* node ); /** * Read the shading engines. */ - void readMaterialInstances ( const COLLADAFW::InstanceGeometry* instanceGeometry ); + void readMaterialInstances ( + const COLLADAFW::UniqueId& transformNodeId, + const COLLADAFW::InstanceGeometry* instanceGeometry ); /** * Handle the node instances. @@ -276,29 +225,6 @@ */ void skewValuesToMayaMatrix ( const COLLADAFW::Skew* skew, MMatrix& matrix ) const; - /** - * The list of the unique maya shading engine names. - */ - const COLLADABU::IDList& getShadingEngineIdList () const { return mShadingEngineIdList; } - - /** - * The map with the unique ids of the shading engine to the shading engines itself. - */ - const ShaderDataMap& getShadingEnginesMap () const { return mShaderDataMap; } - - /** - * The map with the unique ids of the shading engine to the shading engines itself. - */ - ShaderData* findShaderData ( const COLLADAFW::MaterialId& val ); - - /** - * The map with the unique ids of the shading engine to the shading engines itself. - */ - void appendShaderData ( - const COLLADAFW::MaterialId& val, - MayaDM::ShadingEngine* shadingEngine, - MayaDM::MaterialInfo* materialInfo ); - }; } Modified: branches/nextgen/COLLADAMaya/src/COLLADAMayaDocumentImporter.cpp =================================================================== --- branches/nextgen/COLLADAMaya/src/COLLADAMayaDocumentImporter.cpp 2009-02-12 14:18:55 UTC (rev 355) +++ branches/nextgen/COLLADAMaya/src/COLLADAMayaDocumentImporter.cpp 2009-02-12 14:35:47 UTC (rev 356) @@ -47,13 +47,12 @@ , mGeometryImporter (0) , mMaterialImporter (0) , mEffectImporter (0) - , mSceneGraphWritten ( false ) - , mGeometryWritten ( false ) - , mAssetWritten ( false ) - , mSceneGraphRead ( false ) - , mGeometryRead ( false ) + , mSceneGraphWritten (false) + , mAssetWritten (false) + , mSceneGraphRead (false) + , mGeometryRead (false) , mLinearUnitMeter (1) - , mDocumentReads (0) + , mNumDocumentParses (0) { } @@ -172,19 +171,86 @@ void DocumentImporter::finish () { // If the last read is ready, we can write the connections and close the file. - --mDocumentReads; - if ( mDocumentReads == 0 ) + --mNumDocumentParses; + if ( mNumDocumentParses == 0 ) { - // TODO After the read of the collada document, + // TODO After the complete read of the collada document, // the connections can be written into the maya file. + mMaterialImporter->writeConnections (); - // Close the file - if ( mFile != 0 ) fclose ( mFile ); + closeMayaAsciiFile (); } } //----------------------------- + void DocumentImporter::readColladaDocument () + { + COLLADASaxFWL::Loader loader; + COLLADAFW::Root root ( &loader, this ); + String filename = getColladaFilename (); + String fileUriString = URI::nativePathToUri ( filename ); + + ++mNumDocumentParses; + root.loadDocument ( fileUriString ); + } + + //----------------------------- + const COLLADABU::URI& DocumentImporter::getMayaAsciiFileURI () const + { + return mMayaAsciiFileURI; + } + + //----------------------------- + 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::writeGlobalAsset ( const COLLADAFW::FileInfo* asset ) { if ( mAssetWritten ) return true; @@ -195,13 +261,13 @@ // 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 () ); + // 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() ); + // 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 () ); @@ -213,15 +279,15 @@ mLinearUnitMeter = unit.mLinearUnitMeter; mUpAxisType = asset->getUpAxisType (); -// 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 () ); + // 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; @@ -238,21 +304,19 @@ //----------------------------- bool DocumentImporter::writeVisualScene ( const COLLADAFW::VisualScene* visualScene ) { - bool retValue = false; - // Order: asset, scene graph, geometry if ( !mAssetWritten ) { mSceneGraphRead = true; return true; } - if ( mSceneGraphWritten ) return true; // Create the file, if not already done. if ( mFile == 0 ) start(); - retValue = mVisualSceneImporter->importVisualScene ( visualScene ); + // Import the data. + mVisualSceneImporter->importVisualScene ( visualScene ); mSceneGraphWritten = true; if ( mGeometryRead ) @@ -261,14 +325,12 @@ readColladaDocument (); } - return retValue; + return true; } //----------------------------- bool DocumentImporter::writeGeometry ( const COLLADAFW::Geometry* geometry ) { - bool retValue = false; - // Order: asset, scene graph, geometry if ( !mAssetWritten || !mSceneGraphWritten ) { @@ -279,112 +341,41 @@ // Create the file, if not already done. if ( mFile == 0 ) start(); - retValue = mGeometryImporter->importGeometry ( geometry ); - mGeometryWritten = true; + // Import the data. + mGeometryImporter->importGeometry ( geometry ); - return retValue; + return true; } //----------------------------- - void DocumentImporter::readColladaDocument () - { - COLLADASaxFWL::Loader loader; - COLLADAFW::Root root ( &loader, this ); - String filename = getColladaFilename (); - String fileUriString = URI::nativePathToUri ( filename ); - - ++mDocumentReads; - root.loadDocument ( fileUriString ); - } - - //----------------------------- - const COLLADABU::URI& DocumentImporter::getMayaAsciiFileURI () const - { - return mMayaAsciiFileURI; - } - - //----------------------------- - 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; + return true; } //----------------------------- bool DocumentImporter::writeMaterial ( const COLLADAFW::Material* material ) { - bool retValue = false; - // Create the file, if not already done. if ( mFile == 0 ) start(); - retValue = mMaterialImporter->importMaterial ( material ); - mGeometryWritten = true; + // Import the data. + mMaterialImporter->importMaterial ( material ); - return retValue; + return true; } //----------------------------- bool DocumentImporter::writeEffect ( const COLLADAFW::Effect* effect ) { - bool retValue = false; - // Create the file, if not already done. if ( mFile == 0 ) start(); - retValue = mEffectImporter->importEffect ( effect ); - mGeometryWritten = true; + // Import the data. + mEffectImporter->importEffect ( effect ); - return retValue; + return true; } } \ No newline at end of file Modified: branches/nextgen/COLLADAMaya/src/COLLADAMayaEffectImporter.cpp =================================================================== --- branches/nextgen/COLLADAMaya/src/COLLADAMayaEffectImporter.cpp 2009-02-12 14:18:55 UTC (rev 355) +++ branches/nextgen/COLLADAMaya/src/COLLADAMayaEffectImporter.cpp 2009-02-12 14:35:47 UTC (rev 356) @@ -31,6 +31,11 @@ //------------------------------ bool EffectImporter::importEffect ( const COLLADAFW::Effect* effect ) { + // Check if the current effect is already imported. + const COLLADAFW::UniqueId& effectId = effect->getUniqueId (); + if ( findMayaEffect ( effectId ) != 0 ) return false; + + // Create the maya effect in depend on the shader type. const COLLADAFW::CommonEffectPointerArray& commonEffects = effect->getCommonEffects (); size_t numCommonEffects = commonEffects.getCount (); for ( size_t i=0; i<numCommonEffects; ++i ) @@ -72,27 +77,12 @@ const COLLADAFW::Color& color = effect->getStandardColor (); + // Write the effect into the maya ascii file. FILE* file = getDocumentImporter ()->getFile (); MayaDM::Lambert* lambert = new MayaDM::Lambert ( file, effectName ); + // Push it into the map. appendEffect ( effectId, lambert ); - - // TODO - // Find all geometries, which use this effect and create the connections. - MaterialImporter* materialImporter = getDocumentImporter ()->getMaterialImporter (); -// std::vector<COLLADAFW::UniqueId>& materials = materialImporter->findEffectMaterials ( effectId ); -// -// // Iterate over the materials and get all geometries, which use it. -// size_t numMaterials = materials.size (); -// for ( size_t i=0; i<numMaterials; ++i ) -// { -// COLLADAFW::UniqueId& materialId = materials [i]; -// -// // Get the geometries, which use this material -// VisualSceneImporter* visualSceneImporter = getDocumentImporter ()->getVisualSceneImporter (); -// visualSceneImporter->f -// } - } // -------------------------- @@ -112,4 +102,5 @@ mMayaEffectMap [id] = effectNode; } + } // namespace COLLADAMaya Modified: branches/nextgen/COLLADAMaya/src/COLLADAMayaGeometryImporter.cpp =================================================================== --- branches/nextgen/COLLADAMaya/src/COLLADAMayaGeometryImporter.cpp 2009-02-12 14:18:55 UTC (rev 355) +++ branches/nextgen/COLLADAMaya/src/COLLADAMayaGeometryImporter.cpp 2009-02-12 14:35:47 UTC (rev 356) @@ -49,6 +49,10 @@ { if ( geometry == 0 ) return false; + // Check if the current geometry is already imported. + const COLLADAFW::UniqueId& geometryId = geometry->getUniqueId (); + if ( findMayaMeshNode ( geometryId ) != 0 ) return false; + COLLADAFW::Geometry::GeometryType type = geometry->getType (); switch ( type ) { @@ -80,36 +84,33 @@ const COLLADAFW::UniqueId& geometryId = mesh->getUniqueId (); // Get the transform node of the current mesh. - DocumentImporter* documentImporter = getDocumentImporter (); - VisualSceneImporter* visualSceneImporter = documentImporter->getVisualSceneImporter (); + VisualSceneImporter* visualSceneImporter = getDocumentImporter ()->getVisualSceneImporter (); // Get all visual scene nodes, which use this geometry and make the parent connections. - const std::set<const COLLADAFW::UniqueId>* transformNodesSet = - visualSceneImporter->getGeometryTransformIds ( geometryId ); + const UniqueIdVec* transformNodes = visualSceneImporter->findGeometryTransformIds ( geometryId ); + size_t numNodeInstances = transformNodes->size (); - size_t numNodeInstances = transformNodesSet->size (); - std::set<const COLLADAFW::UniqueId>::const_iterator nodesIter = transformNodesSet->begin (); - while ( nodesIter != transformNodesSet->end () ) + UniqueIdVec::const_iterator nodesIter = transformNodes->begin (); + while ( nodesIter != transformNodes->end () ) { // Get the maya node of the current transform node. const COLLADAFW::UniqueId& transformNodeUniqueId = *nodesIter; - MayaNode* mayaTransformNode = visualSceneImporter->getMayaTransformNode ( transformNodeUniqueId ); + MayaNode* mayaTransformNode = visualSceneImporter->findMayaTransformNode ( transformNodeUniqueId ); String transformNodeName = mayaTransformNode->getName (); + // Get the path to the parent transform node. + String transformNodePath = mayaTransformNode->getNodePath (); + // The first reference is a direct one, the others are instances. - if ( nodesIter == transformNodesSet->begin() ) + if ( nodesIter == transformNodes->begin() ) { // Create the current mesh node. createMesh ( mesh, mayaTransformNode, numNodeInstances ); } else { - // 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 ); + // Get the path to the mesh. + MayaNode* mayaMeshNode = findMayaMeshNode ( geometryId ); String meshNodePath = mayaMeshNode->getNodePath (); // parent -shape -noConnections -relative -addObject "|pCube1|pCubeShape1" "pCube2"; @@ -147,7 +148,7 @@ MayaDM::Mesh meshNode ( file, meshName, transformNodePath ); mMayaDMMeshNodesMap [uniqueId] = meshNode; - // TODO Writes the object groups for every mesh primitive and + // Writes the object groups for every mesh primitive and // gets all shader engines, which are used by the primitive elements of the mesh. writeObjectGroups ( mesh, meshNode, numNodeInstances ); @@ -184,6 +185,10 @@ // Write the face informations of all primitive elements into the maya file. writeFaces ( mesh, edgeIndicesMap, meshNode ); + + // Fills the ShadingEnginePrimitivesMap. Used to create the connections between the + // shading engines and the geometries. + setMeshPrimitiveShadingEngines ( mesh ); } // -------------------------------------------- @@ -236,19 +241,31 @@ meshNode.setObjectGrpCompList ( j, i, componentList ); } } + } - for ( size_t i=0; i<meshPrimitivesCount; ++i ) + // -------------------------------------------- + void GeometryImporter::setMeshPrimitiveShadingEngines ( const COLLADAFW::Mesh* mesh ) + { + const COLLADAFW::UniqueId& geometryId = mesh->getUniqueId (); + + // We have to go through every mesh primitive. + const COLLADAFW::MeshPrimitiveArray& meshPrimitives = mesh->getMeshPrimitives (); + size_t meshPrimitivesCount = meshPrimitives.getCount (); + + for ( size_t primitiveIndex=0; primitiveIndex<meshPrimitivesCount; ++primitiveIndex ) { // Get the current primitive element. - const COLLADAFW::MeshPrimitive* meshPrimitive = meshPrimitives [ i ]; + const COLLADAFW::MeshPrimitive* meshPrimitive = meshPrimitives [ primitiveIndex ]; // Get the shader engine id. - String shaderEngineName = meshPrimitive->getMaterial (); - COLLADAFW::MaterialId shaderEngineId = meshPrimitive->getMaterialId (); + String shadingEngineName = meshPrimitive->getMaterial (); + COLLADAFW::MaterialId shadingEngineId = meshPrimitive->getMaterialId (); - - // Look for the - + // Fills the ShadingEnginePrimitivesMap. Used to create the connections between the + // shading engines and the geometries. + // The map holds for every geometry's shading engine a list of the index values of the + // geometry's primitives. + setShadingEnginePrimitiveIndex ( geometryId, shadingEngineId, primitiveIndex ); } } @@ -633,8 +650,7 @@ // Iterate over the grouped vertices and get the edges for every group. COLLADAFW::Trifans* trifans = (COLLADAFW::Trifans*) primitiveElement; - COLLADAFW::Trifans::VertexCountArray& vertexCountArray = - trifans->getGroupedVerticesVertexCountArray (); + COLLADAFW::Trifans::VertexCountArray& vertexCountArray = trifans->getGroupedVerticesVertexCountArray (); size_t groupedVertexElementsCount = vertexCountArray.getCount (); for ( size_t groupedVerticesIndex=0; groupedVerticesIndex<groupedVertexElementsCount; ++groupedVerticesIndex ) { @@ -1159,7 +1175,7 @@ } // -------------------------------------------- - const MayaNode* GeometryImporter::getMayaMeshNode ( const COLLADAFW::UniqueId& uniqueId ) const + const MayaNode* GeometryImporter::findMayaMeshNode ( const COLLADAFW::UniqueId& uniqueId ) const { UniqueIdMayaNodesMap::const_iterator it = mMayaMeshNodesMap.find ( uniqueId ); if ( it != mMayaMeshNodesMap.end () ) @@ -1169,7 +1185,7 @@ } // -------------------------------------------- - MayaNode* GeometryImporter::getMayaMeshNode ( const COLLADAFW::UniqueId& uniqueId ) + MayaNode* GeometryImporter::findMayaMeshNode ( const COLLADAFW::UniqueId& uniqueId ) { UniqueIdMayaNodesMap::iterator it = mMayaMeshNodesMap.find ( uniqueId ); if ( it != mMayaMeshNodesMap.end () ) @@ -1179,7 +1195,7 @@ } // -------------------------------------------- - const MayaDM::Mesh* GeometryImporter::getMayaDMMeshNode ( const COLLADAFW::UniqueId& uniqueId ) const + const MayaDM::Mesh* GeometryImporter::findMayaDMMeshNode ( const COLLADAFW::UniqueId& uniqueId ) const { UniqueIdMayaDMMeshMap::const_iterator it = mMayaDMMeshNodesMap.find ( uniqueId ); if ( it != mMayaDMMeshNodesMap.end () ) @@ -1189,7 +1205,7 @@ } // -------------------------------------------- - MayaDM::Mesh* GeometryImporter::getMayaDMMeshNode ( const COLLADAFW::UniqueId& uniqueId ) + MayaDM::Mesh* GeometryImporter::findMayaDMMeshNode ( const COLLADAFW::UniqueId& uniqueId ) { UniqueIdMayaDMMeshMap::iterator it = mMayaDMMeshNodesMap.find ( uniqueId ); if ( it != mMayaDMMeshNodesMap.end () ) @@ -1238,4 +1254,27 @@ } } + // -------------------------------------------- + std::vector<size_t>* GeometryImporter::getShadingEnginePrimitiveIndices ( + const COLLADAFW::UniqueId& geometryId, + const COLLADAFW::MaterialId shadingEngineId ) + { + CombinedId combinedId ( geometryId, shadingEngineId ); + CombinedIdIndicesMap::iterator it = mShadingEnginePrimitivesMap.find ( combinedId ); + if ( it == mShadingEnginePrimitivesMap.end () ) + { + return 0; + } + return &it->second; + } + + // -------------------------------------------- + void GeometryImporter::setShadingEnginePrimitiveIndex ( + const COLLADAFW::UniqueId& geometryId, + const COLLADAFW::MaterialId shadingEngineId, + const size_t primitiveIndex ) + { + CombinedId combinedId ( geometryId, shadingEngineId ); + mShadingEnginePrimitivesMap [combinedId].push_back ( primitiveIndex ); + } } \ No newline at end of file Modified: branches/nextgen/COLLADAMaya/src/COLLADAMayaMaterialImporter.cpp =================================================================== --- branches/nextgen/COLLADAMaya/src/COLLADAMayaMaterialImporter.cpp 2009-02-12 14:18:55 UTC (rev 355) +++ branches/nextgen/COLLADAMaya/src/COLLADAMayaMaterialImporter.cpp 2009-02-12 14:35:47 UTC (rev 356) @@ -16,13 +16,21 @@ #include "COLLADAMayaStableHeaders.h" #include "COLLADAMayaMaterialImporter.h" #include "COLLADAMayaEffectImporter.h" +#include "COLLADAMayaGeometryImporter.h" +#include "COLLADAMayaVisualSceneImporter.h" +#include "MayaDMMesh.h" +#include "MayaDMLambert.h" + namespace COLLADAMaya { const String MaterialImporter::MATERIAL_NAME = "Material"; + const String MaterialImporter::SHADING_ENGINE_NAME = "ShadingEngine"; + const String MaterialImporter::MATERIAL_INFO_NAME = "MaterialInfo"; + //------------------------------ MaterialImporter::MaterialImporter ( DocumentImporter* documentImporter ) : BaseImporter ( documentImporter ) @@ -31,408 +39,30 @@ // -------------------------- bool MaterialImporter::importMaterial ( const COLLADAFW::Material* material ) { + // Check if the current material is already imported. + const COLLADAFW::UniqueId& materialId = material->getUniqueId (); + if ( findMayaMaterial ( materialId ) != 0 ) return false; + // Get the material name. String materialName ( material->getName () ); if ( COLLADABU::Utils::equals ( materialName, COLLADABU::Utils::EMPTY_STRING ) ) materialName = MATERIAL_NAME; materialName = mMaterialIdList.addId ( materialName ); - const COLLADAFW::UniqueId& materialId = material->getUniqueId (); + // Store the material name. mMayaMaterialNamesMap [materialId] = materialName; - // Get the effect + // Store the effect id of the current material id. const COLLADAFW::UniqueId& effectId = material->getInstantiatedEffect (); - EffectImporter* effectImporter = getDocumentImporter ()->getEffectImporter (); + mMaterialIdEffectIdMap [materialId] = effectId; - effectImporter->findMayaEffect ( effectId ); - - // - - -// daeString elementName = material.getElementName(); -// xsNCName materialName = material.getName(); -// daeString materialTypeName = material.getTypeName(); -// xsID materialId = material.getId(); -// -// domInstance_effectRef instEffect = material.getInstance_effect(); -// domInstance_effect* effect1 = instEffect.cast(); -// xsNCName effectSid = effect1->getSid(); -// xsAnyURI effectUrl = effect1->getUrl(); -// -// if ( instEffect ) -// { -// domEffect* effect = daeSafeCast<domEffect>( instEffect->getUrl().getElement() ); -// if ( effect ) -// { -// // Determine the Maya type for this standard material shader -// MFn::Type mayaShaderType; -// -// COLLADADH::EffectUtil::ShaderType shaderType; -// shaderType = COLLADADH::EffectUtil::getShaderType ( effect ); -// switch ( shaderType ) -// { -// case COLLADADH::EffectUtil::CONSTANT: mayaShaderType = MFn::kSurfaceShader; break; -// case COLLADADH::EffectUtil::PHONG: mayaShaderType = MFn::kPhong; break; -// case COLLADADH::EffectUtil::BLINN: mayaShaderType = MFn::kBlinn; break; -// case COLLADADH::EffectUtil::LAMBERT: mayaShaderType = MFn::kLambert; break; -// default: mayaShaderType = MFn::kLambert; -// } -// -// // Create the shader node -// xsID effectId = effect->getId(); -// MObject shader = ShaderHelper::createShader ( mayaShaderType, effectId ); -// MFnDependencyNode shaderFn ( shader ); -// MFnLambertShader lambertFn ( shader ); -// -// // Read in the color/factor parameters, according to the material type. -// if ( shader.hasFn ( MFn::kSurfaceShader ) ) -// { -// // importConstantShader (...); -// -// // Emission color / Incandescence -// domFx_color_common emission = COLLADADH::EffectUtil::getEmissiveColor ( effect, shaderType ); -// -// // CONSTANT material: has only one interesting color parameter, for emission. -// MColor outColor ( (float)emission.get(0), (float)emission.get(1), (float)emission.get(2), (float)emission.get(3) ); -// DagHelper::setPlugValue ( shader, ATTR_OUT_COLOR, outColor ); -// // ANIM->AddPlugAnimation(shader, "outColor", *emissionColor, kColour); -// -// // Transparency / Opaque -// domCommon_transparent_typeRef transparentTypeRef = -// COLLADADH::EffectUtil::getTransparent ( effect, shaderType ); -// -// domCommon_color_or_texture_type_complexType::domColorRef domTransColorObj; -// domTransColorObj = transparentTypeRef->getColor(); -// domFx_color_common& domTransColor = domTransColorObj->getValue(); -// if ( domTransColor.getCount() < 4 ) domTransColor.set4 ( 0, 0, 0, 1 ); -// MColor transColor ( (float)domTransColor.get(0), (float)domTransColor.get(1), (float)domTransColor.get(2), (float)domTransColor.get(3) ); -// -// float transparency = COLLADADH::EffectUtil::getTransparency ( effect ); -// domFx_opaque_enum opaque = transparentTypeRef->getOpaque(); -// const char* transparencyOutput; -// switch ( opaque ) -// { -// case FX_OPAQUE_ENUM_RGB_ZERO: -// DagHelper::setPlugValue ( shader, ATTR_OUT_TRANSPARENCY, transColor * transparency ); -// //ANIM->AddPlugAnimation(shader, "outTransparency", *translucencyColor, kColour); -// transparencyOutput = "outColor"; // For any subsequent textures. -// break; -// case FX_OPAQUE_ENUM_A_ONE: -// default: -// MColor transyColor; -// transyColor.r = transyColor.g = transyColor.b = 1.0f - ( transColor.a ) * transparency; -// DagHelper::setPlugValue ( shader, ATTR_OUT_TRANSPARENCY, transyColor ); -// transparencyOutput = "outTransparency"; // For any subsequent textures. -// break; -// } -// -// // TODO -// // PROCESS_BUCKET(FUDaeTextureChannel::EMISSION); -// // CONNECT_TEXTURES("outColor", "outColor"); -// // -// // PROCESS_BUCKET(FUDaeTextureChannel::TRANSPARENT); -// // if (textures.size() == 1 && effectStandard->GetTransparencyMode() == FCDEffectStandard::A_ONE) -// // { -// // // Import any animation on the translucency factor -// // MObject textureNode = textures.front().frontObject; -// // ANIM->AddPlugAnimation(textureNode, "alphaGain", *translucencyFactor, kSingle, NULL); -// // } -// // CONNECT_TEXTURES(transparencyOutput, "outTransparency"); -// } -// else -// { -// // TODO -// // if (effectStandard->IsRefractive()) -// // { -// // lambertFn.setRefractiveIndex(*refraction); -// // ANIM->AddPlugAnimation(shader, "refractiveIndex", *refraction, kSingle); -// // CDagHelper::SetPlugValue(shader, "refractions", true); -// // } -// -// // Diffuse -// domFx_color_common diffuse = COLLADADH::EffectUtil::getDiffuseColor( effect, shaderType ); -// MColor diffColor ( (float)diffuse.get(0), (float)diffuse.get(1), (float)diffuse.get(2), (float)diffuse.get(3) ); -// lambertFn.setColor ( diffColor ); -// //ANIM->AddPlugAnimation(shader, "color", *diffuseColor, kColour); -// lambertFn.setDiffuseCoeff (1.0f); -// -// // Emission color / Incandescence -// domFx_color_common emission = COLLADADH::EffectUtil::getEmissiveColor ( effect, shaderType ); -// //mMaterialEmission.Set(emission.get(0), emission.get(1), emission.get(2), emission.get(3)); -// lambertFn.setIncandescence ( MColor ( (float)emission.get(0), (float)emission.get(1), (float)emission.get(2), (float)emission.get(3) ) ); -// -// // Ambient -// domFx_color_common ambient = COLLADADH::EffectUtil::getAmbientColor ( effect, shaderType ); -// MColor ambientColor ( (float)ambient.get(0), (float)ambient.get(1), (float)ambient.get(2), (float)ambient.get(3) ); -// lambertFn.setAmbientColor ( ambientColor ); -// //ANIM->AddPlugAnimation(shader, "ambientColor", *ambientColor, kColour); -// -// // Transparency / Opaque -// domCommon_transparent_typeRef transparentTypeRef = -// COLLADADH::EffectUtil::getTransparent ( effect, shaderType ); -// -// domCommon_color_or_texture_type_complexType::domColorRef domTransColorObj; -// domTransColorObj = transparentTypeRef->getColor(); -// domFx_color_common& domTransColor = domTransColorObj->getValue(); -// if ( domTransColor.getCount() < 4 ) domTransColor.set4 ( 0, 0, 0, 1 ); -// MColor transColor ( (float)domTransColor.get(0), (float)domTransColor.get(1), (float)domTransColor.get(2), (float)domTransColor.get(3) ); -// -// float transparency = COLLADADH::EffectUtil::getTransparency ( effect ); -// domFx_opaque_enum opaque = transparentTypeRef->getOpaque(); -// const char* transparencyOutput; -// switch ( opaque ) -// { -// case FX_OPAQUE_ENUM_RGB_ZERO: -// DagHelper::setPlugValue ( shader, ATTR_OUT_TRANSPARENCY, transColor * transparency ); -// //ANIM->AddPlugAnimation(shader, "outTransparency", *translucencyColor, kColour); -// transparencyOutput = "outColor"; // For any subsequent textures. -// break; -// case FX_OPAQUE_ENUM_A_ONE: -// default: -// MColor transyColor; -// transyColor.r = transyColor.g = transyColor.b = 1.0f - ( transColor.a ) * transparency; -// DagHelper::setPlugValue ( shader, ATTR_OUT_TRANSPARENCY, transyColor ); -// transparencyOutput = "outTransparency"; // For any subsequent textures. -// break; -// } -// -// // // Phong shader parameters -// // if (shader.hasFn(MFn::kPhong)) -// // { -// // -// // phongFn.setSpecularColor(MConvert::ToMColor(*specularColor) * *sp... [truncated message content] |
From: <rob...@us...> - 2009-02-12 14:19:03
|
Revision: 355 http://colladamaya.svn.sourceforge.net/colladamaya/?rev=355&view=rev Author: robertwuerfel Date: 2009-02-12 14:18:55 +0000 (Thu, 12 Feb 2009) Log Message: ----------- complete FREE non animated camera Modified Paths: -------------- branches/nextgen/COLLADAFramework/include/COLLADAFWCamera.h branches/nextgen/COLLADAFramework/include/COLLADAFWLookat.h branches/nextgen/COLLADAFramework/include/COLLADAFWSceneGraphInstance.h branches/nextgen/COLLADAMax/include/COLLADAMaxColladaPlugin.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/COLLADAMaxCameraExporter.cpp branches/nextgen/COLLADAMax/src/COLLADAMaxColladaPlugin.cpp branches/nextgen/COLLADAMax/src/COLLADAMaxDllEntry.cpp branches/nextgen/COLLADAMax/src/COLLADAMaxDocumentExporter.cpp 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/COLLADAMaya/src/COLLADAMayaVisualSceneImporter.cpp branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLLibraryCamerasLoader.cpp branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLMeshLoader.cpp branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLNodeLoader.cpp Added Paths: ----------- branches/nextgen/COLLADAMax/include/COLLADAMaxCameraImporter.h branches/nextgen/COLLADAMax/src/COLLADAMaxCameraImporter.cpp Modified: branches/nextgen/COLLADAFramework/include/COLLADAFWCamera.h =================================================================== --- branches/nextgen/COLLADAFramework/include/COLLADAFWCamera.h 2009-02-11 15:30:41 UTC (rev 354) +++ branches/nextgen/COLLADAFramework/include/COLLADAFWCamera.h 2009-02-12 14:18:55 UTC (rev 355) @@ -21,7 +21,7 @@ /** Camera class. The camera is either a perspective or an orthographic camera. The CameraType indicates of which type the camera is which. For perspective cameras mXFovOrXMag and mYFovOrYMag store the horizontal or vertical field of view, - for perspective cameras mXFovOrXMag and mYFovOrYMag store the horizontal or vertical magnification of the view.*/ + for orthographic cameras mXFovOrXMag and mYFovOrYMag store the horizontal or vertical magnification of the view.*/ class Camera : public ObjectTemplate < COLLADA_TYPE::CAMERA > { public: @@ -33,7 +33,7 @@ PERSPECTIVE }; - /** Defines which values are used to describe the perspective camera.*/ + /** Defines which values are used to describe the camera.*/ enum DescriptionType { UNDEFINED, //!< The perspective camera object is invalid @@ -97,18 +97,30 @@ /** sets the type of description used to define the perspective camera.*/ void setDescriptionType(DescriptionType descriptionType) { mDescriptionType = descriptionType; } - /** Returns the horizontal field of view or magnification of the view.*/ - double getXFovOrXMag() const { return mXFovOrXMag; } + /** Returns the horizontal field of view. Use only for perspective cameras.*/ + double getXFov() const { return mXFovOrXMag; } - /** Sets the horizontal field of view or magnification of the view.*/ - void setXFovOrXMag(double xFov) { mXFovOrXMag = xFov; } + /** Sets the horizontal field of view. Use only for perspective cameras.*/ + void setXFov(double xFov) { mXFovOrXMag = xFov; } - /** Returns the vertical field of view or magnification of the view.*/ - double getYFovOrYMag() const { return mYFovOrYMag; } + /** Returns the horizontal magnification of the view. Use only for orthographic cameras.*/ + double getXMag() const { return mXFovOrXMag; } - /** Sets the vertical field of view or magnification of the view.*/ - void setYFovOrYMag(double yFov) { mYFovOrYMag = yFov; } + /** Sets the horizontal magnification of the view. Use only for orthographic cameras.*/ + void setXMag(double xMag) { mXFovOrXMag = xMag; } + /** Returns the vertical field of view. Use only for perspective cameras.*/ + double getYFov() const { return mYFovOrYMag; } + + /** Sets the vertical field of view. Use only for perspective cameras.*/ + void setYFov(double yFov) { mYFovOrYMag = yFov; } + + /** Returns the vertical magnification of the view. Use only for orthographic cameras.*/ + double getYMag() const { return mYFovOrYMag; } + + /** Sets the vertical magnification of the view. Use only for orthographic cameras.*/ + void setYMag(double yMag) { mYFovOrYMag = yMag; } + /** Returns the aspect ratio.*/ double getAspectRatio() const { return mAspectRatio; } Modified: branches/nextgen/COLLADAFramework/include/COLLADAFWLookat.h =================================================================== --- branches/nextgen/COLLADAFramework/include/COLLADAFWLookat.h 2009-02-11 15:30:41 UTC (rev 354) +++ branches/nextgen/COLLADAFramework/include/COLLADAFWLookat.h 2009-02-12 14:18:55 UTC (rev 355) @@ -36,10 +36,10 @@ COLLADABU::Math::Vector3 mEyePosition; /** The target of the viewer. Defines the pitch and the yaw of the transform. */ - COLLADABU::Math::Vector3 mInterestPosition; + COLLADABU::Math::Vector3 mInterestPointPosition; /** The up-axis of the viewer. Defines the roll of the transform. */ - COLLADABU::Math::Vector3 mUpPosition; + COLLADABU::Math::Vector3 mUpAxisDirection; public: @@ -57,14 +57,14 @@ void setEyePosition ( COLLADABU::Math::Vector3& val ) { mEyePosition = val; } /** The target of the viewer. Defines the pitch and the yaw of the transform. */ - COLLADABU::Math::Vector3& getInterestPosition () { return mInterestPosition; } - const COLLADABU::Math::Vector3& getInterestPosition () const { return mInterestPosition; } - void setInterestPosition ( COLLADABU::Math::Vector3& val ) { mInterestPosition = val; } + COLLADABU::Math::Vector3& getInterestPointPosition () { return mInterestPointPosition; } + const COLLADABU::Math::Vector3& getInterestPointPosition () const { return mInterestPointPosition; } + void setInterestPointPosition ( COLLADABU::Math::Vector3& val ) { mInterestPointPosition = val; } /** The up-axis of the viewer. Defines the roll of the transform. */ - COLLADABU::Math::Vector3& getUpPosition () { return mUpPosition; } - const COLLADABU::Math::Vector3& getUpPosition () const { return mUpPosition; } - void setUpPosition ( COLLADABU::Math::Vector3& val ) { mUpPosition = val; } + COLLADABU::Math::Vector3& getUpAxisDirection () { return mUpAxisDirection; } + const COLLADABU::Math::Vector3& getUpAxisDirection () const { return mUpAxisDirection; } + void setUpAxisDirection ( COLLADABU::Math::Vector3& val ) { mUpAxisDirection = val; } /** Clones the lookat.*/ virtual Lookat* clone() const { return new Lookat(*this); } Modified: branches/nextgen/COLLADAFramework/include/COLLADAFWSceneGraphInstance.h =================================================================== --- branches/nextgen/COLLADAFramework/include/COLLADAFWSceneGraphInstance.h 2009-02-11 15:30:41 UTC (rev 354) +++ branches/nextgen/COLLADAFramework/include/COLLADAFWSceneGraphInstance.h 2009-02-12 14:18:55 UTC (rev 355) @@ -13,6 +13,7 @@ #include "COLLADAFWPrerequisites.h" #include "COLLADAFWUniqueId.h" +#include "COLLADAFWPointerArray.h" namespace COLLADAFW @@ -50,15 +51,11 @@ virtual SceneGraphInstance* clone() const { return new SceneGraphInstance(*this); } - private: - /** Disable default copy ctor. */ -// SceneGraphInstance( const SceneGraphInstance& pre ); - /** Disable default assignment operator. */ -// const SceneGraphInstance& operator= ( const SceneGraphInstance& pre ); - }; + typedef PointerArray<SceneGraphInstance> SceneGraphInstancePointerArray; + } // namespace COLLADAFW #endif // __COLLADAFW_SCENEGRAPHINSTANCE_H__ Added: branches/nextgen/COLLADAMax/include/COLLADAMaxCameraImporter.h =================================================================== --- branches/nextgen/COLLADAMax/include/COLLADAMaxCameraImporter.h (rev 0) +++ branches/nextgen/COLLADAMax/include/COLLADAMaxCameraImporter.h 2009-02-12 14:18:55 UTC (rev 355) @@ -0,0 +1,71 @@ +/* +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_CAMERAIMPORTER_H__ +#define __COLLADAMAX_CAMERAIMPORTER_H__ + +#include "COLLADAMaxPrerequisites.h" +#include "COLLADAMaxImporterBase.h" + + +class GenCamera; + +namespace COLLADAFW +{ + class Camera; +}; + + +namespace COLLADAMax +{ + + /** Imports a camera into the max scene */ + class CameraImporter : public ImporterBase + { + private: + /** The camera to import.*/ + const COLLADAFW::Camera* mCamera; + + public: + + /** Constructor. */ + CameraImporter( DocumentImporter* documentImporter, const COLLADAFW::Camera* camera ); + + /** Destructor. */ + virtual ~CameraImporter(); + + /** Performs the import of the camera. + @return True on success, false otherwise.*/ + bool import(); + + /** Creates a new GenCamera from @a camera and returns a pointer to it. */ + GenCamera* createCamera( const COLLADAFW::Camera* camera ); + + + private: + + /** Disable default copy ctor. */ + CameraImporter( const CameraImporter& pre ); + + /** Disable default assignment operator. */ + const CameraImporter& operator= ( const CameraImporter& pre ); + + }; + +} // namespace COLLADAMAX + +#endif // __COLLADAMAX_CAMERAIMPORTER_H__ Modified: branches/nextgen/COLLADAMax/include/COLLADAMaxColladaPlugin.h =================================================================== --- branches/nextgen/COLLADAMax/include/COLLADAMaxColladaPlugin.h 2009-02-11 15:30:41 UTC (rev 354) +++ branches/nextgen/COLLADAMax/include/COLLADAMaxColladaPlugin.h 2009-02-12 14:18:55 UTC (rev 355) @@ -18,6 +18,11 @@ static const String OTHERMESSAGE1; static const String OTHERMESSAGE2; + static const String REVISION_STRING; + static const String PLATFORM_STRING; + static const String CONFIGURATION_STRING; + + static const String FATALERROR; Modified: branches/nextgen/COLLADAMax/include/COLLADAMaxDocumentImporter.h =================================================================== --- branches/nextgen/COLLADAMax/include/COLLADAMaxDocumentImporter.h 2009-02-11 15:30:41 UTC (rev 354) +++ branches/nextgen/COLLADAMax/include/COLLADAMaxDocumentImporter.h 2009-02-12 14:18:55 UTC (rev 355) @@ -97,7 +97,10 @@ /** List of inode inode pairs.*/ typedef std::vector<std::pair<INode*, INode*>> INodeINodePairList; + /** Maps an object to its name.*/ + typedef std::map<Object*, String > ObjectObjectNameMap; + private: /** Max interface.*/ Interface* mMaxInterface; @@ -158,6 +161,9 @@ an inode is cloned, the cloned one and itself should be added to that list.*/ INodeINodePairList mClonedINodeOriginalINodePairList; + /** Maps an object to its name. Whenever an object is created, add it with its name to this map.*/ + ObjectObjectNameMap mObjectObjectNameMap; + public: /** Constructor . @param maxInterface The max interface. @@ -266,6 +272,10 @@ When ever an inode is cloned, the cloned one and itself should be added to that list.*/ INodeINodePairList& getClonedINodeOriginalINodePairList() { return mClonedINodeOriginalINodePairList; } + /** Returns the map, that maps an object to its name. Whenever an object is created, add it with + its name to this map.*/ + ObjectObjectNameMap& getObjectObjectNameMap() { return mObjectObjectNameMap; } + friend class ImporterBase; }; Modified: branches/nextgen/COLLADAMax/include/COLLADAMaxGeometryImporter.h =================================================================== --- branches/nextgen/COLLADAMax/include/COLLADAMaxGeometryImporter.h 2009-02-11 15:30:41 UTC (rev 354) +++ branches/nextgen/COLLADAMax/include/COLLADAMaxGeometryImporter.h 2009-02-12 14:18:55 UTC (rev 355) @@ -99,10 +99,6 @@ - /** Performs all operations to ensure that the geometry is referenced by the all nodes - 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.*/ Modified: branches/nextgen/COLLADAMax/include/COLLADAMaxImporterBase.h =================================================================== --- branches/nextgen/COLLADAMax/include/COLLADAMaxImporterBase.h 2009-02-11 15:30:41 UTC (rev 354) +++ branches/nextgen/COLLADAMax/include/COLLADAMaxImporterBase.h 2009-02-12 14:18:55 UTC (rev 355) @@ -45,6 +45,9 @@ /** The base class of all importer classes. It provides methods used by all importer classes.*/ class ImporterBase { + public: + static const String EMPTY_STRING; + private: /** The collada importer the importer belongs to.*/ DocumentImporter* mDocumentImporter; @@ -71,6 +74,12 @@ /** Returns collada importer the importer belongs to.*/ DocumentImporter* getColladaImporter() { return mDocumentImporter; } + /** Performs all operations to ensure that the object is referenced by the all nodes + that need to reference it. + @tparam FWObject The framework object class of the framework object that became object */ + template<class FWObject> + bool handleObjectReferences( FWObject* fWobject, Object* object ); + /** Adds an UniqueId-Object INode pair to the UniqueIdObjectINodeMap. An Object INode is an INode that references an object. For nodes that reference an object that has not already been loaded this method should be called.*/ @@ -130,6 +139,10 @@ /** Adds the @pair clonedNode and @a originalNode to the list of cloned and original inodes.*/ void addClonedINodeOriginalINodePair(INode* clonedNode, INode* originalNode); + /** Adds an object object-name pair to the ObejctObjectNameMap. Whenever an object is created, + add it using this method.*/ + void addObjectObjectNamePair( Object* object, const String& name); + /** 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); @@ -165,6 +178,9 @@ When ever an inode is cloned, the cloned one and itself should be added to that list.*/ const DocumentImporter::INodeINodePairList& getClonedINodeOriginalINodePairList(); + /** Returns the name of @a object.*/ + const String& getObjectNameByObject( Object* object ) const; + private: /** Disable default copy ctor. */ @@ -175,6 +191,36 @@ }; + + + //------------------------------ + template<class FWObject> + bool ImporterBase::handleObjectReferences( FWObject* fWobject, Object* object ) + { + const COLLADAFW::UniqueId& uniqueID = fWobject->getUniqueId(); + + const String& objectName = fWobject->getName(); + addUniqueIdObjectPair(uniqueID, object); + if ( !objectName.empty() ) + addObjectObjectNamePair(object, objectName); + + INodeList objectNodeList; + getObjectINodesByUniqueId(uniqueID, objectNodeList); + for ( size_t i = 0, count = objectNodeList.size(); i<count; ++i) + { + INode* maxNode = objectNodeList[i]; + TCHAR* name = maxNode->GetName(); + if ( !name || !(*name) ) + maxNode->SetName( (char *)objectName.c_str()); + maxNode->SetObjectRef(object); + } + + return true; + } + + + + } // namespace COLLADAMAX #endif // __COLLADAMAX_IMPORTERBASE_H__ Modified: branches/nextgen/COLLADAMax/include/COLLADAMaxNodeImporter.h =================================================================== --- branches/nextgen/COLLADAMax/include/COLLADAMaxNodeImporter.h 2009-02-11 15:30:41 UTC (rev 354) +++ branches/nextgen/COLLADAMax/include/COLLADAMaxNodeImporter.h 2009-02-12 14:18:55 UTC (rev 355) @@ -24,6 +24,8 @@ #include "COLLADAFWNode.h" #include "Math/COLLADABUMathMatrix4.h" + +class INode; namespace COLLADAFW { }; @@ -56,15 +58,39 @@ /** Imports all nodes in @a nodeArray and attaches them to @a parentImportNode.*/ bool importNodes(const COLLADAFW::NodePointerArray& nodeArray, ImpNode* parentImportNode); + /** Imports all the instances in @a instanceArray and attaches them to @a parentImportNode.*/ + template<class Instance, + void (NodeImporter::*postProcess)( INode*, Instance* )> + bool importInstances( const COLLADAFW::PointerArray<Instance>& instanceArray, ImpNode* parentImportNode ); + /** Imports all the instance geometries in @a instanceGeometryArray and attaches them to @a parentImportNode.*/ bool importInstanceGeometries( const COLLADAFW::InstanceGeometryPointerArray& instanceGeometryArray, ImpNode* parentImportNode ); + /** Imports all the instance cameras in @a instanceGeometryArray and attaches them to @a parentImportNode.*/ + bool importInstanceCameras( const COLLADAFW::InstanceCameraPointerArray& instanceCameraArray, ImpNode* parentImportNode ); + + + /** Imports the first instance of type Instance in @a node. A new INode is created, that references + the instantiated geometry and has the properties of @a node (name, transformation). The new INode + is attached to @a parentImportNode. Use this member, if a node has exactly one instance.*/ + template<class Instance, + const COLLADAFW::PointerArray<Instance>& (COLLADAFW::Node::*getInstances)()const, + void (NodeImporter::*postProcess)( INode*, Instance* )> + ImpNode* importInstance( const COLLADAFW::Node* node, ImpNode* parentImportNode ); + /** Imports the first instance geometry in @a node. It is assumed that @a node has at least one instance geometry. A new INode is created, that references the instantiated geometry and has the properties of @a node (name, transformation). The new INode is attached to @a parentImportNode. Use this member, if a node has exactly one instance geometry.*/ ImpNode* importInstanceGeometry( const COLLADAFW::Node* node, ImpNode* parentImportNode ); + + /** Imports the first instance camera in @a node. It is assumed that @a node has at least one + instance camera. A new INode is created, that references the instantiated camera and has the + properties of @a node (name, transformation). The new INode is attached to @a parentImportNode. + Use this member, if a node has exactly one instance camera.*/ + ImpNode* importInstanceCamera( const COLLADAFW::Node* node, ImpNode* parentImportNode ); + /** Imports all the instance nodes in @a instanceNodeArray and attaches them to @a parentImportNode.*/ bool importInstanceNodes( const COLLADAFW::InstanceNodePointerArray& instanceNodeArray, ImpNode* parentImportNode ); Modified: branches/nextgen/COLLADAMax/scripts/COLLADAMax.vcproj =================================================================== --- branches/nextgen/COLLADAMax/scripts/COLLADAMax.vcproj 2009-02-11 15:30:41 UTC (rev 354) +++ branches/nextgen/COLLADAMax/scripts/COLLADAMax.vcproj 2009-02-12 14:18:55 UTC (rev 355) @@ -2075,6 +2075,10 @@ Name="importer" > <File + RelativePath="..\src\COLLADAMaxCameraImporter.cpp" + > + </File> + <File RelativePath="..\src\COLLADAMaxColladaImporter.cpp" > </File> @@ -2257,6 +2261,10 @@ Name="importer" > <File + RelativePath="..\include\COLLADAMaxCameraImporter.h" + > + </File> + <File RelativePath="..\include\COLLADAMaxColladaImporter.h" > </File> Modified: branches/nextgen/COLLADAMax/src/COLLADAMaxCameraExporter.cpp =================================================================== --- branches/nextgen/COLLADAMax/src/COLLADAMaxCameraExporter.cpp 2009-02-11 15:30:41 UTC (rev 354) +++ branches/nextgen/COLLADAMax/src/COLLADAMaxCameraExporter.cpp 2009-02-12 14:18:55 UTC (rev 355) @@ -134,7 +134,6 @@ if ( camera ) { - if ( mDocumentExporter->isExportedObject(ObjectIdentifier(camera)) ) return; Added: branches/nextgen/COLLADAMax/src/COLLADAMaxCameraImporter.cpp =================================================================== --- branches/nextgen/COLLADAMax/src/COLLADAMaxCameraImporter.cpp (rev 0) +++ branches/nextgen/COLLADAMax/src/COLLADAMaxCameraImporter.cpp 2009-02-12 14:18:55 UTC (rev 355) @@ -0,0 +1,125 @@ +/* +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 "COLLADAMaxCameraImporter.h" + +#include "COLLADAFWCamera.h" + +#include <max.h> + +namespace COLLADAMax +{ + + //------------------------------ + CameraImporter::CameraImporter( DocumentImporter* documentImporter, const COLLADAFW::Camera* camera ) + : ImporterBase(documentImporter) + , mCamera(camera) + { + } + + //------------------------------ + CameraImporter::~CameraImporter() + { + } + + //------------------------------ + bool CameraImporter::import() + { + GenCamera* maxCamera = createCamera(mCamera); + + handleObjectReferences(mCamera, maxCamera); + + return true; + } + + //------------------------------ + GenCamera* CameraImporter::createCamera( const COLLADAFW::Camera* camera ) + { + // TODO TARGETED_CAMERA + GenCamera* maxCamera = getMaxImportInterface()->CreateCameraObject( FREE_CAMERA ); + + float targetDistance = 100; // we don't have a target, therefore we need to set anything + maxCamera->SetTDist(0, targetDistance); + + if (camera->getCameraType() == COLLADAFW::Camera::PERSPECTIVE) + { + // Perspective camera + maxCamera->SetOrtho(FALSE); + switch ( camera->getDescriptionType() ) + { + case COLLADAFW::Camera::SINGLE_X: + case COLLADAFW::Camera::X_AND_Y: + case COLLADAFW::Camera::ASPECTRATIO_AND_X: + maxCamera->SetFOVType(0); + maxCamera->SetFOV(0, COLLADABU::Math::Utils::degToRadF( (float)camera->getXFov())); + break; + case COLLADAFW::Camera::SINGLE_Y: + case COLLADAFW::Camera::ASPECTRATIO_AND_Y: + { + float aspectRatio = getMaxInterface()->GetRendImageAspect(); + maxCamera->SetFOVType(1); + float yfov = COLLADABU::Math::Utils::degToRadF( (float)camera->getYFov()); + float xfov = 2 * atan( aspectRatio * tan(yfov/2)); + maxCamera->SetFOV(0, xfov); + break; + } + } + } + else + { + // Orthographic camera + maxCamera->SetOrtho(TRUE); + + // Consider only the correct magnification and the target distance, + // which is kept constant, to calculate the FOV. + switch ( camera->getDescriptionType() ) + { + case COLLADAFW::Camera::SINGLE_X: + case COLLADAFW::Camera::X_AND_Y: + case COLLADAFW::Camera::ASPECTRATIO_AND_X: + { + maxCamera->SetFOVType(0); + float fov = 2 * (float)atan( camera->getXMag()/targetDistance ); + maxCamera->SetFOV(0, fov); + break; + } + case COLLADAFW::Camera::SINGLE_Y: + case COLLADAFW::Camera::ASPECTRATIO_AND_Y: + { + float aspectRatio = getMaxInterface()->GetRendImageAspect(); + maxCamera->SetFOVType(1); + float yfov = 2 * (float)atan( camera->getYMag()/targetDistance ); + float xfov = 2 * atan( aspectRatio * tan(yfov/2)); + maxCamera->SetFOV(0, xfov ); + break; + } + } + } + + // Common camera parameters: nearZ, farZ + // The "Far Clip " animatable parameter intentionally has an extra space in the definition. + maxCamera->SetClipDist(0, CAM_HITHER_CLIP, (float)camera->getNearClippingPlane()); + maxCamera->SetClipDist(0, CAM_YON_CLIP, (float)camera->getFarClippingPlane()); + maxCamera->SetManualClip(TRUE); + maxCamera->Enable(TRUE); + + return maxCamera; + } + + +} // namespace COLLADAMax Modified: branches/nextgen/COLLADAMax/src/COLLADAMaxColladaPlugin.cpp =================================================================== --- branches/nextgen/COLLADAMax/src/COLLADAMaxColladaPlugin.cpp 2009-02-11 15:30:41 UTC (rev 354) +++ branches/nextgen/COLLADAMax/src/COLLADAMaxColladaPlugin.cpp 2009-02-12 14:18:55 UTC (rev 355) @@ -1,6 +1,8 @@ #include "COLLADAMaxStableHeaders.h" #include "COLLADAMaxCOLLADAPlugin.h" +#include "COLLADAMaxVersionInfo.h" + namespace COLLADAMax { @@ -12,7 +14,11 @@ const String COLLADAPlugin::OTHERMESSAGE1 = ""; const String COLLADAPlugin::OTHERMESSAGE2 = ""; + const String COLLADAPlugin::REVISION_STRING = (CURRENT_REVISION.empty() ? "" : String("Revision: ") + CURRENT_REVISION); + const String COLLADAPlugin::PLATFORM_STRING = String("Platform: ") + CURRENT_PLATFORM; + const String COLLADAPlugin::CONFIGURATION_STRING = String("Configuration: ") + CURRENT_CONFIGURATION; + const String COLLADAPlugin::FATALERROR = "Fatal Error: exception caught."; const unsigned int COLLADAPlugin::PLUGINVERSION = 400; Modified: branches/nextgen/COLLADAMax/src/COLLADAMaxDllEntry.cpp =================================================================== --- branches/nextgen/COLLADAMax/src/COLLADAMaxDllEntry.cpp 2009-02-11 15:30:41 UTC (rev 354) +++ branches/nextgen/COLLADAMax/src/COLLADAMaxDllEntry.cpp 2009-02-12 14:18:55 UTC (rev 355) @@ -22,10 +22,15 @@ #include "COLLADAMaxColladaExporter.h" #include "COLLADAMaxColladaImporter.h" +#include "COLLADAMaxColladaPlugin.h" + +#include "COLLADAMaxVersionInfo.h" + HINSTANCE hInstance; int controlsInit = FALSE; -static const COLLADAMax::String LIBDESCRIPTION = "COLLADAMax NextGen"; +static const COLLADAMax::String LIBDESCRIPTION = "COLLADAMax NextGen" + + (COLLADAMax::COLLADAPlugin::REVISION_STRING.empty() ? "" : (COLLADAMax::String(" ") + COLLADAMax::COLLADAPlugin::REVISION_STRING)); BOOL WINAPI DllMain ( HINSTANCE hinstDLL, ULONG fdwReason, LPVOID UNUSED ( lpvReserved ) ) { Modified: branches/nextgen/COLLADAMax/src/COLLADAMaxDocumentExporter.cpp =================================================================== --- branches/nextgen/COLLADAMax/src/COLLADAMaxDocumentExporter.cpp 2009-02-11 15:30:41 UTC (rev 354) +++ branches/nextgen/COLLADAMax/src/COLLADAMaxDocumentExporter.cpp 2009-02-12 14:18:55 UTC (rev 355) @@ -28,8 +28,9 @@ #include "COLLADAMaxImageExporter.h" #include "COLLADAMaxCameraExporter.h" #include "COLLADAMaxLightExporter.h" -#include "COLLADAMaxVersionInfo.h" +#include "COLLADAMaxColladaPlugin.h" + #include "COLLADASWAsset.h" #include "COLLADASWScene.h" #include "COLLADASWConstants.h" @@ -41,10 +42,10 @@ const String DocumentExporter::SCENE_ID = "MaxScene"; - const String DocumentExporter::AUTHORING_TOOL = String("COLLADAMax Next Gen") + - (CURRENT_REVISION.empty() ? "" : String("; Revision: ") + CURRENT_REVISION) + - String("; Platform: ") + CURRENT_PLATFORM + - String("; Configuration: ") + CURRENT_CONFIGURATION; + const String DocumentExporter::AUTHORING_TOOL = String("COLLADAMax NextGen") + + (COLLADAPlugin::REVISION_STRING.empty() ? "" : String("; ") + COLLADAPlugin::REVISION_STRING) + + String("; ") + COLLADAPlugin::PLATFORM_STRING + + String("; ") + COLLADAPlugin::CONFIGURATION_STRING; //--------------------------------------------------------------- Modified: branches/nextgen/COLLADAMax/src/COLLADAMaxDocumentImporter.cpp =================================================================== --- branches/nextgen/COLLADAMax/src/COLLADAMaxDocumentImporter.cpp 2009-02-11 15:30:41 UTC (rev 354) +++ branches/nextgen/COLLADAMax/src/COLLADAMaxDocumentImporter.cpp 2009-02-12 14:18:55 UTC (rev 355) @@ -23,6 +23,7 @@ #include "COLLADAMaxMaterialImporter.h" #include "COLLADAMaxMaterialCreator.h" #include "COLLADAMaxEffectImporter.h" +#include "COLLADAMaxCameraImporter.h" #include "COLLADAMaxFWLErrorHandler.h" #include "COLLADAFWLibraryNodes.h" @@ -111,7 +112,8 @@ //--------------------------------------------------------------- bool DocumentImporter::writeCamera( const COLLADAFW::Camera* camera ) { - return true; + CameraImporter cameraImporter(this, camera); + return cameraImporter.import(); } } // namespace COLLADAMax Modified: branches/nextgen/COLLADAMax/src/COLLADAMaxGeometryImporter.cpp =================================================================== --- branches/nextgen/COLLADAMax/src/COLLADAMaxGeometryImporter.cpp 2009-02-11 15:30:41 UTC (rev 354) +++ branches/nextgen/COLLADAMax/src/COLLADAMaxGeometryImporter.cpp 2009-02-12 14:18:55 UTC (rev 355) @@ -95,7 +95,7 @@ triangleMesh.InvalidateGeomCache(); triangleMesh.InvalidateTopologyCache(); - handleReferences(mesh, triangleObject); + handleObjectReferences(mesh, triangleObject); return true; } @@ -390,7 +390,7 @@ //polygonMesh.InvalidateGeomCache(); - handleReferences(mesh, polygonObject); + handleObjectReferences(mesh, polygonObject); return true; } @@ -707,21 +707,7 @@ return true; } - //------------------------------ - bool GeometryImporter::handleReferences( COLLADAFW::Geometry* geometry, Object* object ) - { - const COLLADAFW::UniqueId& uniqueID = geometry->getUniqueId(); - addUniqueIdObjectPair(uniqueID, object); - - INodeList objectNodeList; - getObjectINodesByUniqueId(uniqueID, objectNodeList); - for ( size_t i = 0, count = objectNodeList.size(); i<count; ++i) - objectNodeList[i]->SetObjectRef(object); - - return true; - } - //------------------------------ void GeometryImporter::createFWMaterialIdMaxMtlIdMap( const COLLADAFW::MeshPrimitiveArray& primitiveArray, DocumentImporter::FWMaterialIdMaxMtlIdMap& materialMap ) { Modified: branches/nextgen/COLLADAMax/src/COLLADAMaxImporterBase.cpp =================================================================== --- branches/nextgen/COLLADAMax/src/COLLADAMaxImporterBase.cpp 2009-02-11 15:30:41 UTC (rev 354) +++ branches/nextgen/COLLADAMax/src/COLLADAMaxImporterBase.cpp 2009-02-12 14:18:55 UTC (rev 355) @@ -24,6 +24,8 @@ namespace COLLADAMax { + const String ImporterBase::EMPTY_STRING = ""; + ImporterBase::ImporterBase( DocumentImporter* documentImporter) : mDocumentImporter(documentImporter) { @@ -52,6 +54,7 @@ return mDocumentImporter->getDummyObject(); } + //------------------------------ void ImporterBase::addUniqueIdObjectINodePair( const COLLADAFW::UniqueId& uniqueId, INode* node ) { @@ -168,6 +171,13 @@ } //------------------------------ + void ImporterBase::addObjectObjectNamePair( Object* object, const String& name ) + { + DocumentImporter::ObjectObjectNameMap& objectObjectNameMap = mDocumentImporter->getObjectObjectNameMap(); + objectObjectNameMap.insert(std::pair<Object*, String>(object, name)); + } + + //------------------------------ Object* ImporterBase::getObjectByUniqueId( const COLLADAFW::UniqueId& uniqueId ) { const DocumentImporter::UniqueIdObjectMap& uniqueIdObjectMap = mDocumentImporter->getUniqueIdObjectMap(); @@ -246,8 +256,21 @@ return mDocumentImporter->getGeometryMaterialIdMapMap()[uniqueId]; } + //------------------------------ const DocumentImporter::INodeINodePairList& ImporterBase::getClonedINodeOriginalINodePairList() { return mDocumentImporter->getClonedINodeOriginalINodePairList(); } + + //------------------------------ + const String& ImporterBase::getObjectNameByObject( Object* object ) const + { + const DocumentImporter::ObjectObjectNameMap& objectObjectNameMap = mDocumentImporter->getObjectObjectNameMap(); + DocumentImporter::ObjectObjectNameMap::const_iterator it = objectObjectNameMap.find(object); + if ( it == objectObjectNameMap.end() ) + return EMPTY_STRING; + else + return it->second; + } + } // namespace COLLADAMax Modified: branches/nextgen/COLLADAMax/src/COLLADAMaxNodeImporter.cpp =================================================================== --- branches/nextgen/COLLADAMax/src/COLLADAMaxNodeImporter.cpp 2009-02-11 15:30:41 UTC (rev 354) +++ branches/nextgen/COLLADAMax/src/COLLADAMaxNodeImporter.cpp 2009-02-12 14:18:55 UTC (rev 355) @@ -59,7 +59,7 @@ //------------------------------ void NodeImporter::setNodeProperties( const COLLADAFW::Node* node, ImpNode* importNode) { - String newNodeName = node->getName(); + const String& newNodeName = node->getName(); if ( !newNodeName.empty() ) importNode->SetName(newNodeName.c_str()); @@ -69,17 +69,17 @@ Matrix3 maxTransformationMatrix; Matrix4ToMaxMatrix3(maxTransformationMatrix, transformationMatrix); importNode->SetTransform(0, maxTransformationMatrix); - } //------------------------------ ImpNode* NodeImporter::importNode( const COLLADAFW::Node* node, ImpNode* parentImportNode ) { - bool singleGeometryInstance = node->getInstanceGeometries().getCount() == 1; + bool singleInstance = (node->getInstanceGeometries().getCount() + + node->getInstanceCameras().getCount() ) == 1; ImpNode* newImportNode = 0; const COLLADAFW::UniqueId& nodeUniqueId = node->getUniqueId(); - if ( !singleGeometryInstance ) + if ( !singleInstance ) { newImportNode = getMaxImportInterface()->CreateNode(); @@ -89,11 +89,16 @@ RefResult res = newImportNode->Reference(getDummyObject()); importInstanceGeometries(node->getInstanceGeometries(), newImportNode); + importInstanceCameras(node->getInstanceCameras(), newImportNode); importNodes(node->getChildNodes(), newImportNode); } else { newImportNode = importInstanceGeometry( node, parentImportNode ); + if ( !newImportNode ) + newImportNode = importInstanceCamera( node, parentImportNode ); + + assert(newImportNode); importNodes(node->getChildNodes(), newImportNode); } @@ -131,15 +136,17 @@ } //------------------------------ - bool NodeImporter::importInstanceGeometries( const COLLADAFW::InstanceGeometryPointerArray& instanceGeometryArray, ImpNode* parentImportNode ) + template<class Instance, + void (NodeImporter::*postProcess)( INode*, Instance* )> + bool NodeImporter::importInstances( const COLLADAFW::PointerArray<Instance>& instanceArray, ImpNode* parentImportNode ) { - for ( size_t i = 0, count = instanceGeometryArray.getCount(); i < count; ++i) + for ( size_t i = 0, count = instanceArray.getCount(); i < count; ++i) { - COLLADAFW::InstanceGeometry* instanceGeometry = instanceGeometryArray[i]; + Instance* instance = instanceArray[i]; ImpNode* newImportNode = getMaxImportInterface()->CreateNode(); INode* newNode = newImportNode->GetINode(); - const COLLADAFW::UniqueId& uniqueId = instanceGeometry->getInstanciatedObjectId(); + const COLLADAFW::UniqueId& uniqueId = instance->getInstanciatedObjectId(); Object* object = getObjectByUniqueId(uniqueId); if ( object ) @@ -150,37 +157,63 @@ { newImportNode->Reference( getDummyObject() ); } - const COLLADAFW::UniqueId& instanceGeometryUniqueId = instanceGeometry->getInstanciatedObjectId(); + const COLLADAFW::UniqueId& instanceUniqueId = instance->getInstanciatedObjectId(); // Store mapping between unique ids and nodes referencing the corresponding object. // Used to clone nodes - addObjectINodeUniqueIdPair(newNode, instanceGeometryUniqueId); + addObjectINodeUniqueIdPair(newNode, instanceUniqueId); // Used to resolve instancing of objects - addUniqueIdObjectINodePair(instanceGeometryUniqueId, newNode); + addUniqueIdObjectINodePair(instanceUniqueId, newNode); INode* parentNode = parentImportNode->GetINode(); parentNode->AttachChild(newNode, FALSE); - // Store the information about material bindings - storeMaterialBindings(newNode, instanceGeometry); + // post process the creation + if ( postProcess ) + (this->*postProcess)(newNode, instance); } return true; } + //------------------------------ - ImpNode* NodeImporter::importInstanceGeometry( const COLLADAFW::Node* node, ImpNode* parentImportNode ) + bool NodeImporter::importInstanceGeometries( const COLLADAFW::InstanceGeometryPointerArray& instanceGeometryArray, ImpNode* parentImportNode ) { + return importInstances<COLLADAFW::InstanceGeometry, &NodeImporter::storeMaterialBindings>(instanceGeometryArray, parentImportNode); + } + + + //------------------------------ + bool NodeImporter::importInstanceCameras( const COLLADAFW::InstanceCameraPointerArray& instanceCameraArray, ImpNode* parentImportNode ) + { + return importInstances<COLLADAFW::InstanceCamera, 0>(instanceCameraArray, parentImportNode); + } + + //------------------------------ + template<class Instance, + const COLLADAFW::PointerArray<Instance>& (COLLADAFW::Node::*getInstances)()const, + void (NodeImporter::*postProcess)( INode*, Instance* )> + ImpNode* NodeImporter::importInstance( const COLLADAFW::Node* node, ImpNode* parentImportNode ) + { + const COLLADAFW::PointerArray<Instance>& instances = (node->*getInstances)(); + if ( instances.getCount() != 1 ) + return 0; + ImpNode* newImportNode = getMaxImportInterface()->CreateNode(); setNodeProperties(node, newImportNode); INode* newNode = newImportNode->GetINode(); - COLLADAFW::InstanceGeometry* instanceGeometry = node->getInstanceGeometries()[0]; + Instance* instanceGeometry = instances[0]; const COLLADAFW::UniqueId& uniqueId = instanceGeometry->getInstanciatedObjectId(); Object* object = getObjectByUniqueId(uniqueId); if ( object ) { newImportNode->Reference(object); + const String& objectName = getObjectNameByObject(object); + + if ( node->getName().empty() && !objectName.empty() ) + newImportNode->SetName( objectName.c_str() ); } else { @@ -196,14 +229,27 @@ INode* parentNode = parentImportNode->GetINode(); parentNode->AttachChild(newNode, FALSE); - // Store the information about material bindings - storeMaterialBindings(newNode, instanceGeometry); + // post process the creation + if ( postProcess ) + (this->*postProcess)(newNode, instanceGeometry); return newImportNode; } + //------------------------------ + ImpNode* NodeImporter::importInstanceGeometry( const COLLADAFW::Node* node, ImpNode* parentImportNode ) + { + return importInstance<COLLADAFW::InstanceGeometry, &COLLADAFW::Node::getInstanceGeometries, &NodeImporter::storeMaterialBindings>(node, parentImportNode); + } + //------------------------------ + ImpNode* NodeImporter::importInstanceCamera( const COLLADAFW::Node* node, ImpNode* parentImportNode ) + { + return importInstance<COLLADAFW::InstanceCamera, &COLLADAFW::Node::getInstanceCameras, 0>(node, parentImportNode); + } + + //------------------------------ bool NodeImporter::importInstanceNodes( const COLLADAFW::InstanceNodePointerArray& instanceNodeArray, ImpNode* parentImportNode ) { for ( size_t i = 0, count = instanceNodeArray.getCount(); i < count; ++i) Modified: branches/nextgen/COLLADAMaya/src/COLLADAMayaVisualSceneImporter.cpp =================================================================== --- branches/nextgen/COLLADAMaya/src/COLLADAMayaVisualSceneImporter.cpp 2009-02-11 15:30:41 UTC (rev 354) +++ branches/nextgen/COLLADAMaya/src/COLLADAMayaVisualSceneImporter.cpp 2009-02-12 14:18:55 UTC (rev 355) @@ -365,9 +365,9 @@ /** The position of the object. */ COLLADABU::Math::Vector3& eyePosition = lookat->getEyePosition (); /** The position of the interest point. */ - COLLADABU::Math::Vector3& interestPosition = lookat->getInterestPosition (); + COLLADABU::Math::Vector3& interestPosition = lookat->getInterestPointPosition(); /** The direction that points up. */ - COLLADABU::Math::Vector3& upPosition = lookat->getUpPosition (); + COLLADABU::Math::Vector3& upPosition = lookat->getUpAxisDirection(); // TODO Do anything with this values! Modified: branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLLibraryCamerasLoader.cpp =================================================================== --- branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLLibraryCamerasLoader.cpp 2009-02-11 15:30:41 UTC (rev 354) +++ branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLLibraryCamerasLoader.cpp 2009-02-12 14:18:55 UTC (rev 355) @@ -113,7 +113,7 @@ //------------------------------ bool LibraryCamerasLoader::data__xfov( double value ) { - mCurrentCamera->setXFovOrXMag( value ); + mCurrentCamera->setXFov( value ); mCurrentCameraHasX = true; return true; } @@ -121,8 +121,8 @@ //------------------------------ bool LibraryCamerasLoader::data__yfov( double value ) { - mCurrentCamera->setYFovOrYMag( value ); - mCurrentCameraHasX = true; + mCurrentCamera->setYFov( value ); + mCurrentCameraHasY = true; return true; } @@ -130,7 +130,7 @@ //------------------------------ bool LibraryCamerasLoader::data__xmag( double value ) { - mCurrentCamera->setXFovOrXMag( value ); + mCurrentCamera->setXMag( value ); mCurrentCameraHasX = true; return true; } @@ -138,8 +138,8 @@ //------------------------------ bool LibraryCamerasLoader::data__ymag( double value ) { - mCurrentCamera->setYFovOrYMag( value ); - mCurrentCameraHasX = true; + mCurrentCamera->setYMag( value ); + mCurrentCameraHasY = true; return true; } Modified: branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLMeshLoader.cpp =================================================================== --- branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLMeshLoader.cpp 2009-02-11 15:30:41 UTC (rev 354) +++ branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLMeshLoader.cpp 2009-02-12 14:18:55 UTC (rev 355) @@ -50,7 +50,10 @@ , mTexCoordList (0) , mColorList (0) { - mMesh->setName ( geometryName ); + if ( !geometryName.empty() ) + mMesh->setName ( geometryName ); + else if ( !geometryId.empty() ) + mMesh->setName ( geometryId ); } Modified: branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLNodeLoader.cpp =================================================================== --- branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLNodeLoader.cpp 2009-02-11 15:30:41 UTC (rev 354) +++ branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLNodeLoader.cpp 2009-02-12 14:18:55 UTC (rev 355) @@ -299,8 +299,8 @@ assert(lookat); COLLADABU::Math::Vector3& eyePosition = lookat->getEyePosition (); - COLLADABU::Math::Vector3& interestPosition = lookat->getInterestPosition (); - COLLADABU::Math::Vector3& upPosition = lookat->getUpPosition (); + COLLADABU::Math::Vector3& interestPointPosition = lookat->getInterestPointPosition (); + COLLADABU::Math::Vector3& upAxisDirection = lookat->getUpAxisDirection (); size_t i = 0; if ( i < length && mTransformationNumbersReceived < 3 ) @@ -315,7 +315,7 @@ { for ( size_t j=0; j<3 && i<length; ++j, ++i ) { - interestPosition[j] = data[i]; + interestPointPosition[j] = data[i]; mTransformationNumbersReceived++; } } @@ -323,7 +323,7 @@ { for ( size_t j=0; j<3 && i<length; ++j, ++i ) { - upPosition[j] = data[i]; + upAxisDirection[j] = data[i]; mTransformationNumbersReceived++; } } @@ -403,7 +403,7 @@ COLLADAFW::UniqueId instantiatedCameraUniqueId = getUniqueIdFromUrl( attributeData.url, COLLADAFW::Camera::ID() ); COLLADAFW::InstanceCamera* instanceCamera = FW_NEW COLLADAFW::InstanceCamera(instantiatedCameraUniqueId); - currentNode->getInstanceNodes().append(instanceCamera); + currentNode->getInstanceCameras().append(instanceCamera); 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-11 15:30:49
|
Revision: 354 http://colladamaya.svn.sourceforge.net/colladamaya/?rev=354&view=rev Author: robertwuerfel Date: 2009-02-11 15:30:41 +0000 (Wed, 11 Feb 2009) Log Message: ----------- complete import of camera into frame work (untested) Modified Paths: -------------- branches/nextgen/COLLADAFramework/include/COLLADAFWNode.h branches/nextgen/COLLADAFramework/scripts/COLLADAFramework.vcproj branches/nextgen/COLLADAMax/include/COLLADAMaxNodeImporter.h branches/nextgen/COLLADAMax/src/COLLADAMaxNodeImporter.cpp branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLLibraryCamerasLoader.h branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLNodeLoader.h branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLLibraryCamerasLoader.cpp branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLNodeLoader.cpp Added Paths: ----------- branches/nextgen/COLLADAFramework/include/COLLADAFWInstanceCamera.h Added: branches/nextgen/COLLADAFramework/include/COLLADAFWInstanceCamera.h =================================================================== --- branches/nextgen/COLLADAFramework/include/COLLADAFWInstanceCamera.h (rev 0) +++ branches/nextgen/COLLADAFramework/include/COLLADAFWInstanceCamera.h 2009-02-11 15:30:41 UTC (rev 354) @@ -0,0 +1,30 @@ +/* + 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_INSTANCECAMERA_H__ +#define __COLLADAFW_INSTANCECAMERA_H__ + +#include "COLLADAFWPrerequisites.h" +#include "COLLADAFWSceneGraphInstance.h" +#include "COLLADAFWPointerArray.h" + + +namespace COLLADAFW +{ + + /** Instantiates a node within a scene graph.*/ + typedef SceneGraphInstance InstanceCamera; + + typedef ArrayPrimitiveType<InstanceNode*> InstanceCameraArray; + typedef PointerArray<InstanceNode> InstanceCameraPointerArray; + +} // namespace COLLADAFW + +#endif // __COLLADAFW_INSTANCECAMERA_H__ Modified: branches/nextgen/COLLADAFramework/include/COLLADAFWNode.h =================================================================== --- branches/nextgen/COLLADAFramework/include/COLLADAFWNode.h 2009-02-11 13:19:06 UTC (rev 353) +++ branches/nextgen/COLLADAFramework/include/COLLADAFWNode.h 2009-02-11 15:30:41 UTC (rev 354) @@ -16,6 +16,7 @@ #include "COLLADAFWTransformation.h" #include "COLLADAFWInstanceGeometry.h" #include "COLLADAFWInstanceNode.h" +#include "COLLADAFWInstanceCamera.h" #include "COLLADAFWArrayPrimitiveType.h" #include "COLLADAFWPointerArray.h" @@ -70,6 +71,9 @@ /** List of all instance nodes of this node. Array and contents will be delete in destructor.*/ InstanceNodePointerArray mInstanceNodes; + /** List of all instance cameras of this node. Array and contents will be delete in destructor.*/ + InstanceCameraPointerArray mInstanceCameras; + /** List of all child nodes. Array and contents will be delete in destructor.*/ NodePointerArray mChildNodes; @@ -111,6 +115,12 @@ /** List of all instance nodes of this node.*/ const InstanceNodePointerArray& getInstanceNodes() const { return mInstanceNodes; } + /** List of all instance cameras of this camera.*/ + InstanceCameraPointerArray& getInstanceCameras() { return mInstanceCameras; } + + /** List of all instance cameras of this camera.*/ + const InstanceCameraPointerArray& getInstanceCameras() const { return mInstanceCameras; } + /** Get list of all child nodes.*/ NodePointerArray& getChildNodes() { return mChildNodes; } Modified: branches/nextgen/COLLADAFramework/scripts/COLLADAFramework.vcproj =================================================================== --- branches/nextgen/COLLADAFramework/scripts/COLLADAFramework.vcproj 2009-02-11 13:19:06 UTC (rev 353) +++ branches/nextgen/COLLADAFramework/scripts/COLLADAFramework.vcproj 2009-02-11 15:30:41 UTC (rev 354) @@ -510,6 +510,10 @@ > </File> <File + RelativePath="..\include\COLLADAFWInstanceCamera.h" + > + </File> + <File RelativePath="..\include\COLLADAFWInstanceEffect.h" > </File> Modified: branches/nextgen/COLLADAMax/include/COLLADAMaxNodeImporter.h =================================================================== --- branches/nextgen/COLLADAMax/include/COLLADAMaxNodeImporter.h 2009-02-11 13:19:06 UTC (rev 353) +++ branches/nextgen/COLLADAMax/include/COLLADAMaxNodeImporter.h 2009-02-11 15:30:41 UTC (rev 354) @@ -63,7 +63,7 @@ instance geometry. A new INode is created, that references the instantiated geometry and has the properties of @a node (name, transformation). The new INode is attached to @a parentImportNode. Use this member, if a node has exactly one instance geometry.*/ - ImpNode* importInstanceGeometrie( const COLLADAFW::Node* node, ImpNode* parentImportNode ); + ImpNode* importInstanceGeometry( const COLLADAFW::Node* node, ImpNode* parentImportNode ); /** Imports all the instance nodes in @a instanceNodeArray and attaches them to @a parentImportNode.*/ bool importInstanceNodes( const COLLADAFW::InstanceNodePointerArray& instanceNodeArray, ImpNode* parentImportNode ); Modified: branches/nextgen/COLLADAMax/src/COLLADAMaxNodeImporter.cpp =================================================================== --- branches/nextgen/COLLADAMax/src/COLLADAMaxNodeImporter.cpp 2009-02-11 13:19:06 UTC (rev 353) +++ branches/nextgen/COLLADAMax/src/COLLADAMaxNodeImporter.cpp 2009-02-11 15:30:41 UTC (rev 354) @@ -93,7 +93,7 @@ } else { - newImportNode = importInstanceGeometrie( node, parentImportNode ); + newImportNode = importInstanceGeometry( node, parentImportNode ); importNodes(node->getChildNodes(), newImportNode); } @@ -168,7 +168,7 @@ } //------------------------------ - ImpNode* NodeImporter::importInstanceGeometrie( const COLLADAFW::Node* node, ImpNode* parentImportNode ) + ImpNode* NodeImporter::importInstanceGeometry( const COLLADAFW::Node* node, ImpNode* parentImportNode ) { ImpNode* newImportNode = getMaxImportInterface()->CreateNode(); setNodeProperties(node, newImportNode); Modified: branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLLibraryCamerasLoader.h =================================================================== --- branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLLibraryCamerasLoader.h 2009-02-11 13:19:06 UTC (rev 353) +++ branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLLibraryCamerasLoader.h 2009-02-11 15:30:41 UTC (rev 354) @@ -73,18 +73,22 @@ /** We don't need to do anything here.*/ virtual bool end__optics__technique_common(){return true;} - /** Create an orthographic camera. Not yet implemented.*/ - virtual bool begin__orthographic(){return true;} - virtual bool end__orthographic(){return true;} - /** Create an orthographic camera.*/ + /** Set camera type to perspective.*/ virtual bool begin__perspective(); /** We don't need to do anything here.*/ virtual bool end__perspective(){return true;} + /** Set camera type to orthographic.*/ + virtual bool begin__orthographic(); + /** We don't need to do anything here.*/ + virtual bool end__orthographic(){return true;} + + + /** We don't need to do anything here.*/ virtual bool begin__xfov( const xfov__AttributeData& attributeData ){return true;} /** We don't need to do anything here.*/ @@ -105,6 +109,26 @@ /** We don't need to do anything here.*/ + virtual bool begin__xmag( const xmag__AttributeData& attributeData ){return true;} + + /** We don't need to do anything here.*/ + virtual bool end__xmag(){return true;} + + /** Stores the xmag of the current camera.*/ + virtual bool data__xmag( double value ); + + + /** We don't need to do anything here.*/ + virtual bool begin__ymag( const ymag__AttributeData& attributeData ){return true;} + + /** We don't need to do anything here.*/ + virtual bool end__ymag(){return true;} + + /** Stores the ymag of the current camera.*/ + virtual bool data__ymag( double value ); + + + /** We don't need to do anything here.*/ virtual bool begin__perspective__aspect_ratio( const aspect_ratio__AttributeData& attributeData ){return true;} /** We don't need to do anything here.*/ @@ -135,6 +159,36 @@ /** We don't need to do anything here.*/ + virtual bool begin__orthographic__aspect_ratio( const aspect_ratio__AttributeData& attributeData ){return true;} + + /** We don't need to do anything here.*/ + virtual bool end__orthographic__aspect_ratio(){return true;} + + /** Stores the aspect ratio of the current camera.*/ + virtual bool data__orthographic__aspect_ratio( double value ); + + + /** We don't need to do anything here.*/ + virtual bool begin__orthographic__znear( const znear__AttributeData& attributeData ){return true;} + + /** We don't need to do anything here.*/ + virtual bool end__orthographic__znear(){return true;} + + /** Stores the near clipping plane of the current camera.*/ + virtual bool data__orthographic__znear( double value ); + + + /** We don't need to do anything here.*/ + virtual bool begin__orthographic__zfar( const zfar__AttributeData& attributeData ){return true;} + + /** We don't need to do anything here.*/ + virtual bool end__orthographic__zfar(){return true;} + + /** Stores the far clipping plane of the current camera.*/ + virtual bool data__orthographic__zfar( double value ); + + + /** We don't need to do anything here.*/ virtual bool begin__imager(){return true;} /** We don't need to do anything here.*/ Modified: branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLNodeLoader.h =================================================================== --- branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLNodeLoader.h 2009-02-11 13:19:06 UTC (rev 353) +++ branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLNodeLoader.h 2009-02-11 15:30:41 UTC (rev 354) @@ -176,10 +176,16 @@ /** 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(); + /** We don't need to do anything here.*/ + virtual bool end__instance_node(){return true;} + /** Appends the instance camera to the current node.*/ + virtual bool begin__instance_camera( const instance_camera__AttributeData& attributeData ); + + /** We don't need to do anything here.*/ + virtual bool end__instance_camera(){return true;} + }; } // namespace COLLADASAXFWL Modified: branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLLibraryCamerasLoader.cpp =================================================================== --- branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLLibraryCamerasLoader.cpp 2009-02-11 13:19:06 UTC (rev 353) +++ branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLLibraryCamerasLoader.cpp 2009-02-11 15:30:41 UTC (rev 354) @@ -64,6 +64,32 @@ //------------------------------ bool LibraryCamerasLoader::end__camera() { + // we need to determine the description type + // X = 1, Y = 2, aspect ratio = 4 + int descriptionType = (mCurrentCameraHasX ? 1 : 0) + + (mCurrentCameraHasY ? 2 : 0) + + (mCurrentCameraHasAspectRatio ? 4 : 0); + switch ( descriptionType ) + { + case 1: + mCurrentCamera->setDescriptionType(COLLADAFW::Camera::SINGLE_X); + break; + case 2: + mCurrentCamera->setDescriptionType(COLLADAFW::Camera::SINGLE_Y); + break; + case 3: + mCurrentCamera->setDescriptionType(COLLADAFW::Camera::X_AND_Y); + break; + case 5: + mCurrentCamera->setDescriptionType(COLLADAFW::Camera::ASPECTRATIO_AND_X); + break; + case 6: + mCurrentCamera->setDescriptionType(COLLADAFW::Camera::ASPECTRATIO_AND_Y); + break; + default: + mCurrentCamera->setDescriptionType(COLLADAFW::Camera::UNDEFINED); + } + bool success = writer()->writeCamera(mCurrentCamera); FW_DELETE mCurrentCamera; resetCurrentValues(); @@ -78,9 +104,17 @@ } //------------------------------ + bool LibraryCamerasLoader::begin__orthographic() + { + mCurrentCamera->setCameraType(COLLADAFW::Camera::ORTHOGRAPHIC); + return true; + } + + //------------------------------ bool LibraryCamerasLoader::data__xfov( double value ) { mCurrentCamera->setXFovOrXMag( value ); + mCurrentCameraHasX = true; return true; } @@ -88,27 +122,71 @@ bool LibraryCamerasLoader::data__yfov( double value ) { mCurrentCamera->setYFovOrYMag( value ); + mCurrentCameraHasX = true; return true; } + //------------------------------ + bool LibraryCamerasLoader::data__xmag( double value ) + { + mCurrentCamera->setXFovOrXMag( value ); + mCurrentCameraHasX = true; + return true; + } + + //------------------------------ + bool LibraryCamerasLoader::data__ymag( double value ) + { + mCurrentCamera->setYFovOrYMag( value ); + mCurrentCameraHasX = true; + return true; + } + + //------------------------------ bool LibraryCamerasLoader::data__perspective__aspect_ratio( double value ) { mCurrentCamera->setAspectRatio(value); + mCurrentCameraHasAspectRatio = true; return true; } + //------------------------------ bool LibraryCamerasLoader::data__perspective__znear( double value ) { mCurrentCamera->setNearClippingPlane(value); return true; } + //------------------------------ bool LibraryCamerasLoader::data__perspective__zfar( double value ) { mCurrentCamera->setFarClippingPlane(value); return true; } + //------------------------------ + bool LibraryCamerasLoader::data__orthographic__aspect_ratio( double value ) + { + mCurrentCamera->setAspectRatio(value); + mCurrentCameraHasAspectRatio = true; + return true; + } + //------------------------------ + bool LibraryCamerasLoader::data__orthographic__znear( double value ) + { + mCurrentCamera->setNearClippingPlane(value); + return true; + } + + //------------------------------ + bool LibraryCamerasLoader::data__orthographic__zfar( double value ) + { + mCurrentCamera->setFarClippingPlane(value); + return true; + } + + + } // namespace COLLADASaxFWL Modified: branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLNodeLoader.cpp =================================================================== --- branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLNodeLoader.cpp 2009-02-11 13:19:06 UTC (rev 353) +++ branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLNodeLoader.cpp 2009-02-11 15:30:41 UTC (rev 354) @@ -21,6 +21,7 @@ #include "COLLADAFWMatrix.h" #include "COLLADAFWGeometry.h" #include "COLLADAFWMaterial.h" +#include "COLLADAFWCamera.h" namespace COLLADASaxFWL @@ -388,17 +389,23 @@ COLLADAFW::Node* currentNode = mNodeStack.top(); COLLADAFW::UniqueId instantiatedNodeUniqueId = getUniqueIdFromUrl( attributeData.url, COLLADAFW::Node::ID() ); - COLLADAFW::InstanceNode* instanceNode = new COLLADAFW::InstanceNode(instantiatedNodeUniqueId); + COLLADAFW::InstanceNode* instanceNode = FW_NEW COLLADAFW::InstanceNode(instantiatedNodeUniqueId); currentNode->getInstanceNodes().append(instanceNode); return true; } + //------------------------------ - bool NodeLoader::end__instance_node() + bool NodeLoader::begin__instance_camera( const instance_camera__AttributeData& attributeData ) { + COLLADAFW::Node* currentNode = mNodeStack.top(); + COLLADAFW::UniqueId instantiatedCameraUniqueId = getUniqueIdFromUrl( attributeData.url, COLLADAFW::Camera::ID() ); + + COLLADAFW::InstanceCamera* instanceCamera = FW_NEW COLLADAFW::InstanceCamera(instantiatedCameraUniqueId); + currentNode->getInstanceNodes().append(instanceCamera); + 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-11 13:19:15
|
Revision: 353 http://colladamaya.svn.sourceforge.net/colladamaya/?rev=353&view=rev Author: robertwuerfel Date: 2009-02-11 13:19:06 +0000 (Wed, 11 Feb 2009) Log Message: ----------- add information about revision and platform to dae files exported add camera to framework and loader (still incomplete) Modified Paths: -------------- branches/nextgen/COLLADAFramework/include/COLLADAFWIWriter.h branches/nextgen/COLLADAFramework/scripts/COLLADAFramework.vcproj branches/nextgen/COLLADAMax/BUILD branches/nextgen/COLLADAMax/include/COLLADAMaxDocumentExporter.h branches/nextgen/COLLADAMax/include/COLLADAMaxDocumentImporter.h branches/nextgen/COLLADAMax/scripts/COLLADAMax.vcproj branches/nextgen/COLLADAMax/src/COLLADAMaxDocumentExporter.cpp branches/nextgen/COLLADAMax/src/COLLADAMaxDocumentImporter.cpp branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLFileLoader.h branches/nextgen/COLLADASaxFrameworkLoader/scripts/COLLADASaxFrameworkLoader.vcproj branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLFileLoader.cpp Added Paths: ----------- branches/nextgen/COLLADAFramework/include/COLLADAFWCamera.h branches/nextgen/COLLADAFramework/src/COLLADAFWCamera.cpp branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLLibraryCamerasLoader.h branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLLibraryCamerasLoader.cpp Property Changed: ---------------- branches/nextgen/COLLADAMax/include/ Added: branches/nextgen/COLLADAFramework/include/COLLADAFWCamera.h =================================================================== --- branches/nextgen/COLLADAFramework/include/COLLADAFWCamera.h (rev 0) +++ branches/nextgen/COLLADAFramework/include/COLLADAFWCamera.h 2009-02-11 13:19:06 UTC (rev 353) @@ -0,0 +1,134 @@ +/* + 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_CAMERA_H__ +#define __COLLADAFW_CAMERA_H__ + +#include "COLLADAFWPrerequisites.h" +#include "COLLADAFWObject.h" + + +namespace COLLADAFW +{ + + /** Camera class. The camera is either a perspective or an orthographic camera. + The CameraType indicates of which type the camera is which. + For perspective cameras mXFovOrXMag and mYFovOrYMag store the horizontal or vertical field of view, + for perspective cameras mXFovOrXMag and mYFovOrYMag store the horizontal or vertical magnification of the view.*/ + class Camera : public ObjectTemplate < COLLADA_TYPE::CAMERA > + { + public: + /** The type of the camera.*/ + enum CameraType + { + UNDEFINED_CAMERATYPE, + ORTHOGRAPHIC, + PERSPECTIVE + }; + + /** Defines which values are used to describe the perspective camera.*/ + enum DescriptionType + { + UNDEFINED, //!< The perspective camera object is invalid + SINGLE_X, //!< Only xfov or xmag, respectively describes the camera + SINGLE_Y, //!< Only yfov or ymag, respectively describes the camera + X_AND_Y, //!< xfov and yfov or xmag and ymag, respectively describe the camera + ASPECTRATIO_AND_X, //!< aspect ratio and xfov or xmag, respectively describe the camera + ASPECTRATIO_AND_Y, //!< aspect ratio and yfov or <mag, respectivelydescribe the camera + }; + + + + private: + /** The name of the camera*/ + String mName; + + /** The type of the camera*/ + CameraType mCameraType; + + /** The type of description used to define the perspective camera.*/ + DescriptionType mDescriptionType; + + /** The horizontal field of view or magnification of the view.*/ + double mXFovOrXMag; + + /** The vertical field of view or magnification of the view.*/ + double mYFovOrYMag; + + + /** The aspect ratio.*/ + double mAspectRatio; + + /** The near clipping plane.*/ + double mNearClippingPlane; + + /** The far clipping plane.*/ + double mFarClippingPlane; + public: + /** + @param objectId The object id of the camera.*/ + Camera( ObjectId objectId ); + + /** Destructor. */ + virtual ~Camera(); + + /** Returns the name of the camera.*/ + const COLLADAFW::String& getName() const { return mName; } + + /** Sets the name of the camera.*/ + void setName(const COLLADAFW::String& name) { mName = name; } + + /** Returns the type of the camera.*/ + CameraType getCameraType() const { return mCameraType; } + + /** Sets the type of the camera.*/ + void setCameraType( CameraType cameraType) { mCameraType = cameraType; } + + /** Returns the type of description used to define the perspective camera.*/ + DescriptionType getDescriptionType() const { return mDescriptionType; } + + /** sets the type of description used to define the perspective camera.*/ + void setDescriptionType(DescriptionType descriptionType) { mDescriptionType = descriptionType; } + + /** Returns the horizontal field of view or magnification of the view.*/ + double getXFovOrXMag() const { return mXFovOrXMag; } + + /** Sets the horizontal field of view or magnification of the view.*/ + void setXFovOrXMag(double xFov) { mXFovOrXMag = xFov; } + + /** Returns the vertical field of view or magnification of the view.*/ + double getYFovOrYMag() const { return mYFovOrYMag; } + + /** Sets the vertical field of view or magnification of the view.*/ + void setYFovOrYMag(double yFov) { mYFovOrYMag = yFov; } + + /** Returns the aspect ratio.*/ + double getAspectRatio() const { return mAspectRatio; } + + /** Sets the aspect ratio.*/ + void setAspectRatio(double aspectRatio) { mAspectRatio = aspectRatio; } + + /** Returns the near clipping plane.*/ + double getNearClippingPlane() const { return mNearClippingPlane; } + + /** Sets the near clipping plane.*/ + void setNearClippingPlane(double nearClippingPlane) { mNearClippingPlane = nearClippingPlane; } + + /** Returns the far clipping plane.*/ + double getFarClippingPlane() const { return mFarClippingPlane; } + + /** Sets the far clipping plane.*/ + void setFarClippingPlane(double farClippingPlane) { mFarClippingPlane = farClippingPlane; } + + }; + +} // namespace COLLADAFW + +#endif // __COLLADAFW_CAMERA_H__ Modified: branches/nextgen/COLLADAFramework/include/COLLADAFWIWriter.h =================================================================== --- branches/nextgen/COLLADAFramework/include/COLLADAFWIWriter.h 2009-02-11 11:00:27 UTC (rev 352) +++ branches/nextgen/COLLADAFramework/include/COLLADAFWIWriter.h 2009-02-11 13:19:06 UTC (rev 353) @@ -22,6 +22,7 @@ class LibraryNodes; class Material; class Effect; + class Camera; /** Class that needs to be implemented by a writer. @@ -75,6 +76,10 @@ @return The writer should return true, if writing succeeded, false otherwise.*/ virtual bool writeEffect( const Effect* effect ) = 0; + /** When this method is called, the writer must write the camera. + @return The writer should return true, if writing succeeded, false otherwise.*/ + virtual bool writeCamera( const Camera* camera ) = 0; + private: /** Disable default copy ctor. */ Modified: branches/nextgen/COLLADAFramework/scripts/COLLADAFramework.vcproj =================================================================== --- branches/nextgen/COLLADAFramework/scripts/COLLADAFramework.vcproj 2009-02-11 11:00:27 UTC (rev 352) +++ branches/nextgen/COLLADAFramework/scripts/COLLADAFramework.vcproj 2009-02-11 13:19:06 UTC (rev 353) @@ -296,6 +296,10 @@ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" > <File + RelativePath="..\src\COLLADAFWCamera.cpp" + > + </File> + <File RelativePath="..\src\COLLADAFWColor.cpp" > </File> @@ -438,6 +442,10 @@ > </File> <File + RelativePath="..\include\COLLADAFWCamera.h" + > + </File> + <File RelativePath="..\include\COLLADAFWCode.h" > </File> Added: branches/nextgen/COLLADAFramework/src/COLLADAFWCamera.cpp =================================================================== --- branches/nextgen/COLLADAFramework/src/COLLADAFWCamera.cpp (rev 0) +++ branches/nextgen/COLLADAFramework/src/COLLADAFWCamera.cpp 2009-02-11 13:19:06 UTC (rev 353) @@ -0,0 +1,36 @@ +/* + 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 "COLLADAFWCamera.h" + + +namespace COLLADAFW +{ + + //------------------------------ + Camera::Camera( ObjectId objectId) + : ObjectTemplate< COLLADA_TYPE::CAMERA >(objectId) + , mCameraType(UNDEFINED_CAMERATYPE) + , mDescriptionType( UNDEFINED ) + , mXFovOrXMag(0) + , mYFovOrYMag(0) + , mAspectRatio(0) + , mNearClippingPlane(0) + , mFarClippingPlane(0) + { + } + + //------------------------------ + Camera::~Camera() + { + } + +} // namespace COLLADAFW Modified: branches/nextgen/COLLADAMax/BUILD =================================================================== --- branches/nextgen/COLLADAMax/BUILD 2009-02-11 11:00:27 UTC (rev 352) +++ branches/nextgen/COLLADAMax/BUILD 2009-02-11 13:19:06 UTC (rev 353) @@ -15,7 +15,11 @@ - MS Visual Studio 2005. +- SVN comand line tool, especially svnversion (optional) + Available at http://subversion.tigris.org/ + svnversion must be in your path + Building: --------- Before you can start to build you need to set three environment variables. The MAX_PATH* variable Property changes on: branches/nextgen/COLLADAMax/include ___________________________________________________________________ Added: svn:ignore + COLLADAMaxVersionInfo.h Modified: branches/nextgen/COLLADAMax/include/COLLADAMaxDocumentExporter.h =================================================================== --- branches/nextgen/COLLADAMax/include/COLLADAMaxDocumentExporter.h 2009-02-11 11:00:27 UTC (rev 352) +++ branches/nextgen/COLLADAMax/include/COLLADAMaxDocumentExporter.h 2009-02-11 13:19:06 UTC (rev 353) @@ -88,6 +88,8 @@ /** The id of the @a \<scene\> element.*/ static const String SCENE_ID; + static const String AUTHORING_TOOL; + /** A map, that hold all already exported objects with their ids*/ ObjectExportNodeMap mExportedObjects; Modified: branches/nextgen/COLLADAMax/include/COLLADAMaxDocumentImporter.h =================================================================== --- branches/nextgen/COLLADAMax/include/COLLADAMaxDocumentImporter.h 2009-02-11 11:00:27 UTC (rev 352) +++ branches/nextgen/COLLADAMax/include/COLLADAMaxDocumentImporter.h 2009-02-11 13:19:06 UTC (rev 353) @@ -40,6 +40,7 @@ class UniqueId; class LibraryNodes; class Node; + class Camera; } namespace COLLADAMax @@ -210,6 +211,11 @@ @return True on succeeded, false otherwise.*/ virtual bool writeEffect( const COLLADAFW::Effect* effect ); + /** Writes the camera. + @return True on succeeded, false otherwise.*/ + virtual bool writeCamera( const COLLADAFW::Camera* camera ); + + private: /** Disable default copy ctor. */ Modified: branches/nextgen/COLLADAMax/scripts/COLLADAMax.vcproj =================================================================== --- branches/nextgen/COLLADAMax/scripts/COLLADAMax.vcproj 2009-02-11 11:00:27 UTC (rev 352) +++ branches/nextgen/COLLADAMax/scripts/COLLADAMax.vcproj 2009-02-11 13:19:06 UTC (rev 353) @@ -27,6 +27,7 @@ > <Tool Name="VCPreBuildEventTool" + CommandLine="echo off

set F=..\include\COLLADAMaxVersionInfo.h


echo Generating %F% 


echo #ifndef __COLLADAMAX_VERSIONINFO_H__ > %F%
echo #define __COLLADAMAX_VERSIONINFO_H__ >> %F%

echo. >> %F%

echo #include "COLLADAMaxPrerequisites.h" >> %F%

echo. >> %F%

echo namespace COLLADAMax >> %F%

echo { >> %F%


FOR /f %%A in ('svnversion ..\..\ ') do set REVISION=%%A


echo const String CURRENT_REVISION = "%REVISION%"; >> %F%
echo const String CURRENT_PLATFORM = "$(PlatformName)"; >> %F%
echo const String CURRENT_CONFIGURATION = "$(ConfigurationName)"; >> %F%

echo } >> %F%

echo. >> %F%

echo #endif // __COLLADAMAX_VERSIONINFO_H__ >> %F%

" /> <Tool Name="VCCustomBuildTool" @@ -69,6 +70,7 @@ Name="VCLinkerTool" AdditionalDependencies="COLLADABaseUtils-d.lib COLLADAFramework-d.lib COLLADAStreamWriter-d.lib COLLADASaxFrameworkLoader-d.lib GeneratedSaxParser-d.lib maxutil.lib core.lib paramblk2.lib geom.lib bmm.lib mesh.lib mnmath.lib poly.lib" OutputFile="$(OutDir)\$(ProjectName)New.dle" + Version="0.8.3" LinkIncremental="2" AdditionalLibraryDirectories=""$(MAX_SDK_PATH9)/lib";"..\..\COLLADABaseUtils\lib\win\$(PlatformName)";"..\..\COLLADAFramework\lib\win\$(PlatformName)";"..\..\COLLADAStreamWriter\lib\win\$(PlatformName)";"..\..\GeneratedSaxParser\lib\win\$(PlatformName)";"..\..\COLLADASaxFrameworkLoader\lib\win\$(PlatformName)";"$(BOOST_LIB_PATH)"" IgnoreDefaultLibraryNames=" " @@ -111,6 +113,7 @@ > <Tool Name="VCPreBuildEventTool" + CommandLine="echo off

set F=..\include\COLLADAMaxVersionInfo.h


echo Generating %F% 


echo #ifndef __COLLADAMAX_VERSIONINFO_H__ > %F%
echo #define __COLLADAMAX_VERSIONINFO_H__ >> %F%

echo. >> %F%

echo #include "COLLADAMaxPrerequisites.h" >> %F%

echo. >> %F%

echo namespace COLLADAMax >> %F%

echo { >> %F%


FOR /f %%A in ('svnversion ..\..\ ') do set REVISION=%%A


echo const String CURRENT_REVISION = "%REVISION%"; >> %F%
echo const String CURRENT_PLATFORM = "$(PlatformName)"; >> %F%
echo const String CURRENT_CONFIGURATION = "$(ConfigurationName)"; >> %F%

echo } >> %F%

echo. >> %F%

echo #endif // __COLLADAMAX_VERSIONINFO_H__ >> %F%

" /> <Tool Name="VCCustomBuildTool" @@ -154,6 +157,7 @@ Name="VCLinkerTool" AdditionalDependencies="COLLADABaseUtils-d.lib COLLADAFramework-d.lib COLLADAStreamWriter-d.lib COLLADASaxFrameworkLoader-d.lib GeneratedSaxParser-d.lib maxutil.lib core.lib paramblk2.lib geom.lib bmm.lib mesh.lib mnmath.lib poly.lib" OutputFile="$(OutDir)\$(ProjectName)New.dle" + Version="0.8.3" LinkIncremental="2" AdditionalLibraryDirectories=""$(MAX_SDK_PATH9)/x64/lib";"..\..\COLLADABaseUtils\lib\win\$(PlatformName)";"..\..\COLLADAFramework\lib\win\$(PlatformName)";"..\..\COLLADAStreamWriter\lib\win\$(PlatformName)";"..\..\GeneratedSaxParser\lib\win\$(PlatformName)";"..\..\COLLADASaxFrameworkLoader\lib\win\$(PlatformName)";"$(BOOST_LIB64_PATH)"" IgnoreDefaultLibraryNames=" " @@ -197,6 +201,7 @@ > <Tool Name="VCPreBuildEventTool" + CommandLine="echo off

set F=..\include\COLLADAMaxVersionInfo.h


echo Generating %F% 


echo #ifndef __COLLADAMAX_VERSIONINFO_H__ > %F%
echo #define __COLLADAMAX_VERSIONINFO_H__ >> %F%

echo. >> %F%

echo #include "COLLADAMaxPrerequisites.h" >> %F%

echo. >> %F%

echo namespace COLLADAMax >> %F%

echo { >> %F%


FOR /f %%A in ('svnversion ..\..\ ') do set REVISION=%%A


echo const String CURRENT_REVISION = "%REVISION%"; >> %F%
echo const String CURRENT_PLATFORM = "$(PlatformName)"; >> %F%
echo const String CURRENT_CONFIGURATION = "$(ConfigurationName)"; >> %F%

echo } >> %F%

echo. >> %F%

echo #endif // __COLLADAMAX_VERSIONINFO_H__ >> %F%

" /> <Tool Name="VCCustomBuildTool" @@ -239,6 +244,7 @@ Name="VCLinkerTool" AdditionalDependencies="COLLADABaseUtils.lib COLLADAFramework.lib COLLADAStreamWriter.lib COLLADASaxFrameworkLoader.lib GeneratedSaxParser.lib maxutil.lib core.lib paramblk2.lib geom.lib bmm.lib mesh.lib mnmath.lib poly.lib" OutputFile="$(OutDir)\$(ProjectName)New.dle" + Version="0.8.3" LinkIncremental="1" AdditionalLibraryDirectories=""$(MAX_SDK_PATH9)/lib";"..\..\COLLADABaseUtils\lib\win\$(PlatformName)";"..\..\COLLADAFramework\lib\win\$(PlatformName)";"..\..\COLLADAStreamWriter\lib\win\$(PlatformName)";"..\..\GeneratedSaxParser\lib\win\$(PlatformName)";"..\..\COLLADASaxFrameworkLoader\lib\win\$(PlatformName)";"$(BOOST_LIB_PATH)"" IgnoreDefaultLibraryNames=" " @@ -284,6 +290,7 @@ > <Tool Name="VCPreBuildEventTool" + CommandLine="echo off

set F=..\include\COLLADAMaxVersionInfo.h


echo Generating %F% 


echo #ifndef __COLLADAMAX_VERSIONINFO_H__ > %F%
echo #define __COLLADAMAX_VERSIONINFO_H__ >> %F%

echo. >> %F%

echo #include "COLLADAMaxPrerequisites.h" >> %F%

echo. >> %F%

echo namespace COLLADAMax >> %F%

echo { >> %F%


FOR /f %%A in ('svnversion ..\..\ ') do set REVISION=%%A


echo const String CURRENT_REVISION = "%REVISION%"; >> %F%
echo const String CURRENT_PLATFORM = "$(PlatformName)"; >> %F%
echo const String CURRENT_CONFIGURATION = "$(ConfigurationName)"; >> %F%

echo } >> %F%

echo. >> %F%

echo #endif // __COLLADAMAX_VERSIONINFO_H__ >> %F%

" /> <Tool Name="VCCustomBuildTool" @@ -327,6 +334,7 @@ Name="VCLinkerTool" AdditionalDependencies="COLLADABaseUtils.lib COLLADAFramework.lib COLLADAStreamWriter.lib COLLADASaxFrameworkLoader.lib GeneratedSaxParser.lib maxutil.lib core.lib paramblk2.lib geom.lib bmm.lib mesh.lib mnmath.lib poly.lib" OutputFile="$(OutDir)\$(ProjectName)New.dle" + Version="0.8.3" LinkIncremental="1" AdditionalLibraryDirectories=""$(MAX_SDK_PATH9)/x64/lib";"..\..\COLLADABaseUtils\lib\win\$(PlatformName)";"..\..\COLLADAFramework\lib\win\$(PlatformName)";"..\..\COLLADAStreamWriter\lib\win\$(PlatformName)";"..\..\GeneratedSaxParser\lib\win\$(PlatformName)";"..\..\COLLADASaxFrameworkLoader\lib\win\$(PlatformName)";"$(BOOST_LIB64_PATH)"" IgnoreDefaultLibraryNames=" " @@ -371,6 +379,7 @@ > <Tool Name="VCPreBuildEventTool" + CommandLine="echo off

set F=..\include\COLLADAMaxVersionInfo.h


echo Generating %F% 


echo #ifndef __COLLADAMAX_VERSIONINFO_H__ > %F%
echo #define __COLLADAMAX_VERSIONINFO_H__ >> %F%

echo. >> %F%

echo #include "COLLADAMaxPrerequisites.h" >> %F%

echo. >> %F%

echo namespace COLLADAMax >> %F%

echo { >> %F%


FOR /f %%A in ('svnversion ..\..\ ') do set REVISION=%%A


echo const String CURRENT_REVISION = "%REVISION%"; >> %F%
echo const String CURRENT_PLATFORM = "$(PlatformName)"; >> %F%
echo const String CURRENT_CONFIGURATION = "$(ConfigurationName)"; >> %F%

echo } >> %F%

echo. >> %F%

echo #endif // __COLLADAMAX_VERSIONINFO_H__ >> %F%

" /> <Tool Name="VCCustomBuildTool" @@ -413,6 +422,7 @@ Name="VCLinkerTool" AdditionalDependencies="COLLADABaseUtils-d.lib COLLADAFramework-d.lib COLLADAStreamWriter-d.lib COLLADASaxFrameworkLoader-d.lib GeneratedSaxParser-d.lib maxutil.lib core.lib paramblk2.lib geom.lib bmm.lib mesh.lib mnmath.lib poly.lib" OutputFile="$(OutDir)\$(ProjectName)New.dle" + Version="0.8.3" LinkIncremental="2" AdditionalLibraryDirectories=""$(MAX_SDK_PATH2009)/lib";"..\..\COLLADABaseUtils\lib\win\$(PlatformName)";"..\..\COLLADAFramework\lib\win\$(PlatformName)";"..\..\COLLADAStreamWriter\lib\win\$(PlatformName)";"..\..\GeneratedSaxParser\lib\win\$(PlatformName)";"..\..\COLLADASaxFrameworkLoader\lib\win\$(PlatformName)";"$(BOOST_LIB_PATH)"" IgnoreDefaultLibraryNames=" " @@ -455,6 +465,7 @@ > <Tool Name="VCPreBuildEventTool" + CommandLine="echo off

set F=..\include\COLLADAMaxVersionInfo.h


echo Generating %F% 


echo #ifndef __COLLADAMAX_VERSIONINFO_H__ > %F%
echo #define __COLLADAMAX_VERSIONINFO_H__ >> %F%

echo. >> %F%

echo #include "COLLADAMaxPrerequisites.h" >> %F%

echo. >> %F%

echo namespace COLLADAMax >> %F%

echo { >> %F%


FOR /f %%A in ('svnversion ..\..\ ') do set REVISION=%%A


echo const String CURRENT_REVISION = "%REVISION%"; >> %F%
echo const String CURRENT_PLATFORM = "$(PlatformName)"; >> %F%
echo const String CURRENT_CONFIGURATION = "$(ConfigurationName)"; >> %F%

echo } >> %F%

echo. >> %F%

echo #endif // __COLLADAMAX_VERSIONINFO_H__ >> %F%

" /> <Tool Name="VCCustomBuildTool" @@ -498,6 +509,7 @@ Name="VCLinkerTool" AdditionalDependencies="COLLADABaseUtils-d.lib COLLADAFramework-d.lib COLLADAStreamWriter-d.lib COLLADASaxFrameworkLoader-d.lib GeneratedSaxParser-d.lib maxutil.lib core.lib paramblk2.lib geom.lib bmm.lib mesh.lib mnmath.lib poly.lib" OutputFile="$(OutDir)\$(ProjectName)New.dle" + Version="0.8.3" LinkIncremental="2" AdditionalLibraryDirectories=""$(MAX_SDK_PATH2009)/x64/lib";"..\..\COLLADABaseUtils\lib\win\$(PlatformName)";"..\..\COLLADAFramework\lib\win\$(PlatformName)";"..\..\COLLADAStreamWriter\lib\win\$(PlatformName)";"..\..\GeneratedSaxParser\lib\win\$(PlatformName)";"..\..\COLLADASaxFrameworkLoader\lib\win\$(PlatformName)";"$(BOOST_LIB64_PATH)"" IgnoreDefaultLibraryNames=" " @@ -541,6 +553,7 @@ > <Tool Name="VCPreBuildEventTool" + CommandLine="echo off

set F=..\include\COLLADAMaxVersionInfo.h


echo Generating %F% 


echo #ifndef __COLLADAMAX_VERSIONINFO_H__ > %F%
echo #define __COLLADAMAX_VERSIONINFO_H__ >> %F%

echo. >> %F%

echo #include "COLLADAMaxPrerequisites.h" >> %F%

echo. >> %F%

echo namespace COLLADAMax >> %F%

echo { >> %F%


FOR /f %%A in ('svnversion ..\..\ ') do set REVISION=%%A


echo const String CURRENT_REVISION = "%REVISION%"; >> %F%
echo const String CURRENT_PLATFORM = "$(PlatformName)"; >> %F%
echo const String CURRENT_CONFIGURATION = "$(ConfigurationName)"; >> %F%

echo } >> %F%

echo. >> %F%

echo #endif // __COLLADAMAX_VERSIONINFO_H__ >> %F%

" /> <Tool Name="VCCustomBuildTool" @@ -583,6 +596,7 @@ Name="VCLinkerTool" AdditionalDependencies="COLLADABaseUtils.lib COLLADAFramework.lib COLLADAStreamWriter.lib COLLADASaxFrameworkLoader.lib GeneratedSaxParser.lib maxutil.lib core.lib paramblk2.lib geom.lib bmm.lib mesh.lib mnmath.lib poly.lib" OutputFile="$(OutDir)\$(ProjectName)New.dle" + Version="0.8.3" LinkIncremental="1" AdditionalLibraryDirectories=""$(MAX_SDK_PATH2009)/lib";"..\..\COLLADABaseUtils\lib\win\$(PlatformName)";"..\..\COLLADAFramework\lib\win\$(PlatformName)";"..\..\COLLADAStreamWriter\lib\win\$(PlatformName)";"..\..\GeneratedSaxParser\lib\win\$(PlatformName)";"..\..\COLLADASaxFrameworkLoader\lib\win\$(PlatformName)";"$(BOOST_LIB_PATH)"" IgnoreDefaultLibraryNames=" " @@ -628,6 +642,7 @@ > <Tool Name="VCPreBuildEventTool" + CommandLine="echo off

set F=..\include\COLLADAMaxVersionInfo.h


echo Generating %F% 


echo #ifndef __COLLADAMAX_VERSIONINFO_H__ > %F%
echo #define __COLLADAMAX_VERSIONINFO_H__ >> %F%

echo. >> %F%

echo #include "COLLADAMaxPrerequisites.h" >> %F%

echo. >> %F%

echo namespace COLLADAMax >> %F%

echo { >> %F%


FOR /f %%A in ('svnversion ..\..\ ') do set REVISION=%%A


echo const String CURRENT_REVISION = "%REVISION%"; >> %F%
echo const String CURRENT_PLATFORM = "$(PlatformName)"; >> %F%
echo const String CURRENT_CONFIGURATION = "$(ConfigurationName)"; >> %F%

echo } >> %F%

echo. >> %F%

echo #endif // __COLLADAMAX_VERSIONINFO_H__ >> %F%

" /> <Tool Name="VCCustomBuildTool" @@ -671,6 +686,7 @@ Name="VCLinkerTool" AdditionalDependencies="COLLADABaseUtils.lib COLLADAFramework.lib COLLADAStreamWriter.lib COLLADASaxFrameworkLoader.lib GeneratedSaxParser.lib maxutil.lib core.lib paramblk2.lib geom.lib bmm.lib mesh.lib mnmath.lib poly.lib" OutputFile="$(OutDir)\$(ProjectName)New.dle" + Version="0.8.3" LinkIncremental="1" AdditionalLibraryDirectories=""$(MAX_SDK_PATH2009)/x64/lib";"..\..\COLLADABaseUtils\lib\win\$(PlatformName)";"..\..\COLLADAFramework\lib\win\$(PlatformName)";"..\..\COLLADAStreamWriter\lib\win\$(PlatformName)";"..\..\GeneratedSaxParser\lib\win\$(PlatformName)";"..\..\COLLADASaxFrameworkLoader\lib\win\$(PlatformName)";"$(BOOST_LIB64_PATH)"" IgnoreDefaultLibraryNames=" " @@ -716,6 +732,7 @@ > <Tool Name="VCPreBuildEventTool" + CommandLine="echo off

set F=..\include\COLLADAMaxVersionInfo.h


echo Generating %F% 


echo #ifndef __COLLADAMAX_VERSIONINFO_H__ > %F%
echo #define __COLLADAMAX_VERSIONINFO_H__ >> %F%

echo. >> %F%

echo #include "COLLADAMaxPrerequisites.h" >> %F%

echo. >> %F%

echo namespace COLLADAMax >> %F%

echo { >> %F%


FOR /f %%A in ('svnversion ..\..\ ') do set REVISION=%%A


echo const String CURRENT_REVISION = "%REVISION%"; >> %F%
echo const String CURRENT_PLATFORM = "$(PlatformName)"; >> %F%
echo const String CURRENT_CONFIGURATION = "$(ConfigurationName)"; >> %F%

echo } >> %F%

echo. >> %F%

echo #endif // __COLLADAMAX_VERSIONINFO_H__ >> %F%

" /> <Tool Name="VCCustomBuildTool" @@ -758,6 +775,7 @@ Name="VCLinkerTool" AdditionalDependencies="COLLADABaseUtils.lib COLLADAFramework.lib COLLADAStreamWriter.lib COLLADASaxFrameworkLoader.lib GeneratedSaxParser.lib maxutil.lib core.lib paramblk2.lib geom.lib bmm.lib mesh.lib mnmath.lib poly.lib" OutputFile="$(OutDir)\$(ProjectName)New.dle" + Version="0.8.3" LinkIncremental="1" AdditionalLibraryDirectories=""$(MAX_SDK_PATH2008)/lib";"..\..\COLLADABaseUtils\lib\win\$(PlatformName)";"..\..\COLLADAFramework\lib\win\$(PlatformName)";"..\..\COLLADAStreamWriter\lib\win\$(PlatformName)";"..\..\GeneratedSaxParser\lib\win\$(PlatformName)";"..\..\COLLADASaxFrameworkLoader\lib\win\$(PlatformName)";"$(BOOST_LIB_PATH)"" IgnoreDefaultLibraryNames=" " @@ -803,6 +821,7 @@ > <Tool Name="VCPreBuildEventTool" + CommandLine="echo off

set F=..\include\COLLADAMaxVersionInfo.h


echo Generating %F% 


echo #ifndef __COLLADAMAX_VERSIONINFO_H__ > %F%
echo #define __COLLADAMAX_VERSIONINFO_H__ >> %F%

echo. >> %F%

echo #include "COLLADAMaxPrerequisites.h" >> %F%

echo. >> %F%

echo namespace COLLADAMax >> %F%

echo { >> %F%


FOR /f %%A in ('svnversion ..\..\ ') do set REVISION=%%A


echo const String CURRENT_REVISION = "%REVISION%"; >> %F%
echo const String CURRENT_PLATFORM = "$(PlatformName)"; >> %F%
echo const String CURRENT_CONFIGURATION = "$(ConfigurationName)"; >> %F%

echo } >> %F%

echo. >> %F%

echo #endif // __COLLADAMAX_VERSIONINFO_H__ >> %F%

" /> <Tool Name="VCCustomBuildTool" @@ -846,6 +865,7 @@ Name="VCLinkerTool" AdditionalDependencies="COLLADABaseUtils.lib COLLADAFramework.lib COLLADAStreamWriter.lib COLLADASaxFrameworkLoader.lib GeneratedSaxParser.lib maxutil.lib core.lib paramblk2.lib geom.lib bmm.lib mesh.lib mnmath.lib poly.lib" OutputFile="$(OutDir)\$(ProjectName)New.dle" + Version="0.8.3" LinkIncremental="1" AdditionalLibraryDirectories=""$(MAX_SDK_PATH2008)/x64/lib";"..\..\COLLADABaseUtils\lib\win\$(PlatformName)";"..\..\COLLADAFramework\lib\win\$(PlatformName)";"..\..\COLLADAStreamWriter\lib\win\$(PlatformName)";"..\..\GeneratedSaxParser\lib\win\$(PlatformName)";"..\..\COLLADASaxFrameworkLoader\lib\win\$(PlatformName)";"$(BOOST_LIB64_PATH)"" IgnoreDefaultLibraryNames=" " @@ -890,6 +910,7 @@ > <Tool Name="VCPreBuildEventTool" + CommandLine="echo off

set F=..\include\COLLADAMaxVersionInfo.h


echo Generating %F% 


echo #ifndef __COLLADAMAX_VERSIONINFO_H__ > %F%
echo #define __COLLADAMAX_VERSIONINFO_H__ >> %F%

echo. >> %F%

echo #include "COLLADAMaxPrerequisites.h" >> %F%

echo. >> %F%

echo namespace COLLADAMax >> %F%

echo { >> %F%


FOR /f %%A in ('svnversion ..\..\ ') do set REVISION=%%A


echo const String CURRENT_REVISION = "%REVISION%"; >> %F%
echo const String CURRENT_PLATFORM = "$(PlatformName)"; >> %F%
echo const String CURRENT_CONFIGURATION = "$(ConfigurationName)"; >> %F%

echo } >> %F%

echo. >> %F%

echo #endif // __COLLADAMAX_VERSIONINFO_H__ >> %F%

" /> <Tool Name="VCCustomBuildTool" @@ -932,6 +953,7 @@ Name="VCLinkerTool" AdditionalDependencies="COLLADABaseUtils-d.lib COLLADAFramework-d.lib COLLADAStreamWriter-d.lib COLLADASaxFrameworkLoader-d.lib GeneratedSaxParser-d.lib maxutil.lib core.lib paramblk2.lib geom.lib bmm.lib mesh.lib mnmath.lib poly.lib" OutputFile="$(OutDir)\$(ProjectName)New.dle" + Version="0.8.3" LinkIncremental="2" AdditionalLibraryDirectories=""$(MAX_SDK_PATH2008)/lib";"..\..\COLLADABaseUtils\lib\win\$(PlatformName)";"..\..\COLLADAFramework\lib\win\$(PlatformName)";"..\..\COLLADAStreamWriter\lib\win\$(PlatformName)";"..\..\GeneratedSaxParser\lib\win\$(PlatformName)";"..\..\COLLADASaxFrameworkLoader\lib\win\$(PlatformName)";"$(BOOST_LIB_PATH)"" IgnoreDefaultLibraryNames=" " @@ -974,6 +996,7 @@ > <Tool Name="VCPreBuildEventTool" + CommandLine="echo off

set F=..\include\COLLADAMaxVersionInfo.h


echo Generating %F% 


echo #ifndef __COLLADAMAX_VERSIONINFO_H__ > %F%
echo #define __COLLADAMAX_VERSIONINFO_H__ >> %F%

echo. >> %F%

echo #include "COLLADAMaxPrerequisites.h" >> %F%

echo. >> %F%

echo namespace COLLADAMax >> %F%

echo { >> %F%


FOR /f %%A in ('svnversion ..\..\ ') do set REVISION=%%A


echo const String CURRENT_REVISION = "%REVISION%"; >> %F%
echo const String CURRENT_PLATFORM = "$(PlatformName)"; >> %F%
echo const String CURRENT_CONFIGURATION = "$(ConfigurationName)"; >> %F%

echo } >> %F%

echo. >> %F%

echo #endif // __COLLADAMAX_VERSIONINFO_H__ >> %F%

" /> <Tool Name="VCCustomBuildTool" @@ -1017,6 +1040,7 @@ Name="VCLinkerTool" AdditionalDependencies="COLLADABaseUtils-d.lib COLLADAFramework-d.lib COLLADAStreamWriter-d.lib COLLADASaxFrameworkLoader-d.lib GeneratedSaxParser-d.lib maxutil.lib core.lib paramblk2.lib geom.lib bmm.lib mesh.lib mnmath.lib poly.lib" OutputFile="$(OutDir)\$(ProjectName)New.dle" + Version="0.8.3" LinkIncremental="2" AdditionalLibraryDirectories=""$(MAX_SDK_PATH2008)/x64/lib";"..\..\COLLADABaseUtils\lib\win\$(PlatformName)";"..\..\COLLADAFramework\lib\win\$(PlatformName)";"..\..\COLLADAStreamWriter\lib\win\$(PlatformName)";"..\..\GeneratedSaxParser\lib\win\$(PlatformName)";"..\..\COLLADASaxFrameworkLoader\lib\win\$(PlatformName)";"$(BOOST_LIB64_PATH)"" IgnoreDefaultLibraryNames=" " @@ -1059,6 +1083,7 @@ > <Tool Name="VCPreBuildEventTool" + CommandLine="echo off

set F=..\include\COLLADAMaxVersionInfo.h


echo Generating %F% 


echo #ifndef __COLLADAMAX_VERSIONINFO_H__ > %F%
echo #define __COLLADAMAX_VERSIONINFO_H__ >> %F%

echo. >> %F%

echo #include "COLLADAMaxPrerequisites.h" >> %F%

echo. >> %F%

echo namespace COLLADAMax >> %F%

echo { >> %F%


FOR /f %%A in ('svnversion ..\..\ ') do set REVISION=%%A


echo const String CURRENT_REVISION = "%REVISION%"; >> %F%
echo const String CURRENT_PLATFORM = "$(PlatformName)"; >> %F%
echo const String CURRENT_CONFIGURATION = "$(ConfigurationName)"; >> %F%

echo } >> %F%

echo. >> %F%

echo #endif // __COLLADAMAX_VERSIONINFO_H__ >> %F%

" /> <Tool Name="VCCustomBuildTool" @@ -1101,6 +1126,7 @@ Name="VCLinkerTool" AdditionalDependencies="COLLADABaseUtils-d.lib COLLADAFramework-d.lib COLLADAStreamWriter-d.lib COLLADASaxFrameworkLoader-d.lib GeneratedSaxParser-d.lib maxutil.lib core.lib paramblk2.lib geom.lib bmm.lib mesh.lib mnmath.lib poly.lib" OutputFile="$(OutDir)\$(ProjectName)New.dle" + Version="0.8.3" LinkIncremental="2" AdditionalLibraryDirectories=""$(MAX_SDK_PATH8)/lib";"..\..\COLLADABaseUtils\lib\win\$(PlatformName)";"..\..\COLLADAFramework\lib\win\$(PlatformName)";"..\..\COLLADAStreamWriter\lib\win\$(PlatformName)";"..\..\GeneratedSaxParser\lib\win\$(PlatformName)";"..\..\COLLADASaxFrameworkLoader\lib\win\$(PlatformName)";"$(BOOST_LIB_PATH)"" IgnoreDefaultLibraryNames=" " @@ -1143,6 +1169,7 @@ > <Tool Name="VCPreBuildEventTool" + CommandLine="echo off

set F=..\include\COLLADAMaxVersionInfo.h


echo Generating %F% 


echo #ifndef __COLLADAMAX_VERSIONINFO_H__ > %F%
echo #define __COLLADAMAX_VERSIONINFO_H__ >> %F%

echo. >> %F%

echo #include "COLLADAMaxPrerequisites.h" >> %F%

echo. >> %F%

echo namespace COLLADAMax >> %F%

echo { >> %F%


FOR /f %%A in ('svnversion ..\..\ ') do set REVISION=%%A


echo const String CURRENT_REVISION = "%REVISION%"; >> %F%
echo const String CURRENT_PLATFORM = "$(PlatformName)"; >> %F%
echo const String CURRENT_CONFIGURATION = "$(ConfigurationName)"; >> %F%

echo } >> %F%

echo. >> %F%

echo #endif // __COLLADAMAX_VERSIONINFO_H__ >> %F%

" /> <Tool Name="VCCustomBuildTool" @@ -1186,6 +1213,7 @@ Name="VCLinkerTool" AdditionalDependencies="COLLADABaseUtils-d.lib COLLADAFramework-d.lib COLLADAStreamWriter-d.lib COLLADASaxFrameworkLoader-d.lib GeneratedSaxParser-d.lib maxutil.lib core.lib paramblk2.lib geom.lib bmm.lib mesh.lib mnmath.lib poly.lib" OutputFile="$(OutDir)\$(ProjectName)New.dle" + Version="0.8.3" LinkIncremental="2" AdditionalLibraryDirectories=""$(MAX_SDK_PATH9)/x64/lib";"..\..\COLLADABaseUtils\lib\win\$(PlatformName)";"..\..\COLLADAFramework\lib\win\$(PlatformName)";"..\..\COLLADAStreamWriter\lib\win\$(PlatformName)";"..\..\GeneratedSaxParser\lib\win\$(PlatformName)";"..\..\COLLADASaxFrameworkLoader\lib\win\$(PlatformName)";"$(BOOST_LIB64_PATH)"" IgnoreDefaultLibraryNames=" " @@ -1229,6 +1257,7 @@ > <Tool Name="VCPreBuildEventTool" + CommandLine="echo off

set F=..\include\COLLADAMaxVersionInfo.h


echo Generating %F% 


echo #ifndef __COLLADAMAX_VERSIONINFO_H__ > %F%
echo #define __COLLADAMAX_VERSIONINFO_H__ >> %F%

echo. >> %F%

echo #include "COLLADAMaxPrerequisites.h" >> %F%

echo. >> %F%

echo namespace COLLADAMax >> %F%

echo { >> %F%


FOR /f %%A in ('svnversion ..\..\ ') do set REVISION=%%A


echo const String CURRENT_REVISION = "%REVISION%"; >> %F%
echo const String CURRENT_PLATFORM = "$(PlatformName)"; >> %F%
echo const String CURRENT_CONFIGURATION = "$(ConfigurationName)"; >> %F%

echo } >> %F%

echo. >> %F%

echo #endif // __COLLADAMAX_VERSIONINFO_H__ >> %F%

" /> <Tool Name="VCCustomBuildTool" @@ -1271,6 +1300,7 @@ Name="VCLinkerTool" AdditionalDependencies="COLLADABaseUtils.lib COLLADAFramework.lib COLLADAStreamWriter.lib COLLADASaxFrameworkLoader.lib GeneratedSaxParser.lib maxutil.lib core.lib paramblk2.lib geom.lib bmm.lib mesh.lib mnmath.lib poly.lib" OutputFile="$(OutDir)\$(ProjectName)New.dle" + Version="0.8.3" LinkIncremental="1" AdditionalLibraryDirectories=""$(MAX_SDK_PATH8)/lib";"..\..\COLLADABaseUtils\lib\win\$(PlatformName)";"..\..\COLLADAFramework\lib\win\$(PlatformName)";"..\..\COLLADAStreamWriter\lib\win\$(PlatformName)";"..\..\GeneratedSaxParser\lib\win\$(PlatformName)";"..\..\COLLADASaxFrameworkLoader\lib\win\$(PlatformName)";"$(BOOST_LIB_PATH)"" IgnoreDefaultLibraryNames=" " @@ -1316,6 +1346,7 @@ > <Tool Name="VCPreBuildEventTool" + CommandLine="echo off

set F=..\include\COLLADAMaxVersionInfo.h


echo Generating %F% 


echo #ifndef __COLLADAMAX_VERSIONINFO_H__ > %F%
echo #define __COLLADAMAX_VERSIONINFO_H__ >> %F%

echo. >> %F%

echo #include "COLLADAMaxPrerequisites.h" >> %F%

echo. >> %F%

echo namespace COLLADAMax >> %F%

echo { >> %F%


FOR /f %%A in ('svnversion ..\..\ ') do set REVISION=%%A


echo const String CURRENT_REVISION = "%REVISION%"; >> %F%
echo const String CURRENT_PLATFORM = "$(PlatformName)"; >> %F%
echo const String CURRENT_CONFIGURATION = "$(ConfigurationName)"; >> %F%

echo } >> %F%

echo. >> %F%

echo #endif // __COLLADAMAX_VERSIONINFO_H__ >> %F%

" /> <Tool Name="VCCustomBuildTool" @@ -1359,6 +1390,7 @@ Name="VCLinkerTool" AdditionalDependencies="COLLADABaseUtils.lib COLLADAFramework.lib COLLADAStreamWriter.lib COLLADASaxFrameworkLoader.lib GeneratedSaxParser.lib maxutil.lib core.lib paramblk2.lib geom.lib bmm.lib mesh.lib mnmath.lib poly.lib" OutputFile="$(OutDir)\$(ProjectName)New.dle" + Version="0.8.3" LinkIncremental="1" AdditionalLibraryDirectories=""$(MAX_SDK_PATH9)/x64/lib";"..\..\COLLADABaseUtils\lib\win\$(PlatformName)";"..\..\COLLADAFramework\lib\win\$(PlatformName)";"..\..\COLLADAStreamWriter\lib\win\$(PlatformName)";"..\..\GeneratedSaxParser\lib\win\$(PlatformName)";"..\..\COLLADASaxFrameworkLoader\lib\win\$(PlatformName)";"$(BOOST_LIB64_PATH)"" IgnoreDefaultLibraryNames=" " Modified: branches/nextgen/COLLADAMax/src/COLLADAMaxDocumentExporter.cpp =================================================================== --- branches/nextgen/COLLADAMax/src/COLLADAMaxDocumentExporter.cpp 2009-02-11 11:00:27 UTC (rev 352) +++ branches/nextgen/COLLADAMax/src/COLLADAMaxDocumentExporter.cpp 2009-02-11 13:19:06 UTC (rev 353) @@ -28,6 +28,7 @@ #include "COLLADAMaxImageExporter.h" #include "COLLADAMaxCameraExporter.h" #include "COLLADAMaxLightExporter.h" +#include "COLLADAMaxVersionInfo.h" #include "COLLADASWAsset.h" #include "COLLADASWScene.h" @@ -40,6 +41,12 @@ const String DocumentExporter::SCENE_ID = "MaxScene"; + const String DocumentExporter::AUTHORING_TOOL = String("COLLADAMax Next Gen") + + (CURRENT_REVISION.empty() ? "" : String("; Revision: ") + CURRENT_REVISION) + + String("; Platform: ") + CURRENT_PLATFORM + + String("; Configuration: ") + CURRENT_CONFIGURATION; + + //--------------------------------------------------------------- DocumentExporter::DocumentExporter ( Interface * i, const NativeString &filepath, COLLADABU::IDList& xRefExportFileNames ) : @@ -148,7 +155,7 @@ if ( !maxFileUri.getPathFile().empty() ) asset.getContributor().mSourceData = maxFileUri.getURIString(); - asset.getContributor().mAuthoringTool = "COLLADAMax"; + asset.getContributor().mAuthoringTool = AUTHORING_TOOL; // set *system* unit information Modified: branches/nextgen/COLLADAMax/src/COLLADAMaxDocumentImporter.cpp =================================================================== --- branches/nextgen/COLLADAMax/src/COLLADAMaxDocumentImporter.cpp 2009-02-11 11:00:27 UTC (rev 352) +++ branches/nextgen/COLLADAMax/src/COLLADAMaxDocumentImporter.cpp 2009-02-11 13:19:06 UTC (rev 353) @@ -108,4 +108,10 @@ return effectImporter.import(); } + //--------------------------------------------------------------- + bool DocumentImporter::writeCamera( const COLLADAFW::Camera* camera ) + { + return true; + } + } // namespace COLLADAMax Modified: branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLFileLoader.h =================================================================== --- branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLFileLoader.h 2009-02-11 11:00:27 UTC (rev 352) +++ branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLFileLoader.h 2009-02-11 13:19:06 UTC (rev 353) @@ -103,6 +103,8 @@ /** Starts loading a library effects.*/ virtual bool begin__library_effects( const library_effects__AttributeData& attributeData ); + /** Starts loading a library cameras.*/ + virtual bool begin__library_cameras( const library_cameras__AttributeData& attributeData ); private: Added: branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLLibraryCamerasLoader.h =================================================================== --- branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLLibraryCamerasLoader.h (rev 0) +++ branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLLibraryCamerasLoader.h 2009-02-11 13:19:06 UTC (rev 353) @@ -0,0 +1,155 @@ +/* + 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_LIBRARYCAMERASLOADER_H__ +#define __COLLADASAXFWL_LIBRARYCAMERASLOADER_H__ + +#include "COLLADASaxFWLPrerequisites.h" +#include "COLLADASaxFWLFilePartLoader.h" + +namespace COLLADAFW +{ + class Camera; +} + +namespace COLLADASaxFWL +{ + + /** Loads all the cameras in a library cameras. */ + class LibraryCamerasLoader : public FilePartLoader + { + private: + /** The current camera.*/ + COLLADAFW::Camera* mCurrentCamera; + + /** The current camera has xfov or xmag ( depending on optics ).*/ + bool mCurrentCameraHasX; + + /** The current camera has yfov or ymag ( depending on optics ).*/ + bool mCurrentCameraHasY; + + /** The current camera has apect ratio.*/ + bool mCurrentCameraHasAspectRatio; + + public: + + /** Constructor. */ + LibraryCamerasLoader( IFilePartLoader* callingFilePartLoader ); + + /** Destructor. */ + virtual ~LibraryCamerasLoader(); + + /** Resets all the variables used for the current camera.*/ + void resetCurrentValues(); + + /** Finishes loading a library effects.*/ + virtual bool end__library_cameras(); + + + /** Stores camera id and name.*/ + virtual bool begin__camera( const camera__AttributeData& attributeData ); + + /** Sends camera to the writer.*/ + virtual bool end__camera(); + + + /** We don't need to do anything here.*/ + virtual bool begin__optics(){return true;} + + /** We don't need to do anything here.*/ + virtual bool end__optics(){return true;} + + + /** We don't need to do anything here.*/ + virtual bool begin__optics__technique_common(){return true;} + + /** We don't need to do anything here.*/ + virtual bool end__optics__technique_common(){return true;} + + /** Create an orthographic camera. Not yet implemented.*/ + virtual bool begin__orthographic(){return true;} + virtual bool end__orthographic(){return true;} + + /** Create an orthographic camera.*/ + virtual bool begin__perspective(); + + /** We don't need to do anything here.*/ + virtual bool end__perspective(){return true;} + + + /** We don't need to do anything here.*/ + virtual bool begin__xfov( const xfov__AttributeData& attributeData ){return true;} + + /** We don't need to do anything here.*/ + virtual bool end__xfov(){return true;} + + /** Stores the xfov of the current camera.*/ + virtual bool data__xfov( double value ); + + + /** We don't need to do anything here.*/ + virtual bool begin__yfov( const yfov__AttributeData& attributeData ){return true;} + + /** We don't need to do anything here.*/ + virtual bool end__yfov(){return true;} + + /** Stores the yfov of the current camera.*/ + virtual bool data__yfov( double value ); + + + /** We don't need to do anything here.*/ + virtual bool begin__perspective__aspect_ratio( const aspect_ratio__AttributeData& attributeData ){return true;} + + /** We don't need to do anything here.*/ + virtual bool end__perspective__aspect_ratio(){return true;} + + /** Stores the aspect ratio of the current camera.*/ + virtual bool data__perspective__aspect_ratio( double value ); + + + /** We don't need to do anything here.*/ + virtual bool begin__perspective__znear( const znear__AttributeData& attributeData ){return true;} + + /** We don't need to do anything here.*/ + virtual bool end__perspective__znear(){return true;} + + /** Stores the near clipping plane of the current camera.*/ + virtual bool data__perspective__znear( double value ); + + + /** We don't need to do anything here.*/ + virtual bool begin__perspective__zfar( const zfar__AttributeData& attributeData ){return true;} + + /** We don't need to do anything here.*/ + virtual bool end__perspective__zfar(){return true;} + + /** Stores the far clipping plane of the current camera.*/ + virtual bool data__perspective__zfar( double value ); + + + /** We don't need to do anything here.*/ + virtual bool begin__imager(){return true;} + + /** We don't need to do anything here.*/ + virtual bool end__imager(){return true;} + + private: + + /** Disable default copy ctor. */ + LibraryCamerasLoader( const LibraryCamerasLoader& pre ); + + /** Disable default assignment operator. */ + const LibraryCamerasLoader& operator= ( const LibraryCamerasLoader& pre ); + + }; + +} // namespace COLLADASAXFWL + +#endif // __COLLADASAXFWL_LIBRARYCAMERASLOADER_H__ Modified: branches/nextgen/COLLADASaxFrameworkLoader/scripts/COLLADASaxFrameworkLoader.vcproj =================================================================== --- branches/nextgen/COLLADASaxFrameworkLoader/scripts/COLLADASaxFrameworkLoader.vcproj 2009-02-11 11:00:27 UTC (rev 352) +++ branches/nextgen/COLLADASaxFrameworkLoader/scripts/COLLADASaxFrameworkLoader.vcproj 2009-02-11 13:19:06 UTC (rev 353) @@ -348,6 +348,10 @@ > </File> <File + RelativePath="..\src\COLLADASaxFWLLibraryCamerasLoader.cpp" + > + </File> + <File RelativePath="..\src\COLLADASaxFWLLibraryEffectsLoader.cpp" > </File> @@ -466,6 +470,10 @@ > </File> <File + RelativePath="..\include\COLLADASaxFWLLibraryCamerasLoader.h" + > + </File> + <File RelativePath="..\include\COLLADASaxFWLLibraryEffectsLoader.h" > </File> Modified: branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLFileLoader.cpp =================================================================== --- branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLFileLoader.cpp 2009-02-11 11:00:27 UTC (rev 352) +++ branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLFileLoader.cpp 2009-02-11 13:19:06 UTC (rev 353) @@ -16,6 +16,7 @@ #include "COLLADASaxFWLLibraryNodesLoader.h" #include "COLLADASaxFWLLibraryMaterialsLoader.h" #include "COLLADASaxFWLLibraryEffectsLoader.h" +#include "COLLADASaxFWLLibraryCamerasLoader.h" #include "COLLADASaxFWLMeshLoader.h" #include "COLLADASaxFWLGeometryLoader.h" #include "COLLADASaxFWLSaxParserErrorHandler.h" @@ -121,7 +122,7 @@ return true; } - //----------------------------- + //----------------------------- bool FileLoader::begin__library_effects( const library_effects__AttributeData& attributeData ) { deleteFilePartLoader(); @@ -132,6 +133,17 @@ return true; } + //----------------------------- + bool FileLoader::begin__library_cameras( const library_cameras__AttributeData& attributeData ) + { + deleteFilePartLoader(); + LibraryCamerasLoader* libraryCamerasLoader = new LibraryCamerasLoader(this); + + setPartLoader(libraryCamerasLoader); + setParser(libraryCamerasLoader); + return true; + } + //----------------------------- bool FileLoader::end__COLLADA () { Added: branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLLibraryCamerasLoader.cpp =================================================================== --- branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLLibraryCamerasLoader.cpp (rev 0) +++ branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLLibraryCamerasLoader.cpp 2009-02-11 13:19:06 UTC (rev 353) @@ -0,0 +1,114 @@ +/* + 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 "COLLADASaxFWLLibraryCamerasLoader.h" + +#include "COLLADAFWIWriter.h" +#include "COLLADAFWCamera.h" + +namespace COLLADASaxFWL +{ + + //------------------------------ + LibraryCamerasLoader::LibraryCamerasLoader( IFilePartLoader* callingFilePartLoader ) + : FilePartLoader(callingFilePartLoader) + , mCurrentCamera(0) + , mCurrentCameraHasX(false) + , mCurrentCameraHasY(false) + , mCurrentCameraHasAspectRatio(false) + { + } + + //------------------------------ + LibraryCamerasLoader::~LibraryCamerasLoader() + { + } + + //------------------------------ + void LibraryCamerasLoader::resetCurrentValues() + { + mCurrentCamera = 0; + mCurrentCameraHasX = false; + mCurrentCameraHasY = false; + mCurrentCameraHasAspectRatio = false; + } + + //------------------------------ + bool LibraryCamerasLoader::end__library_cameras() + { + finish(); + return true; + } + + //------------------------------ + bool LibraryCamerasLoader::begin__camera( const camera__AttributeData& attributeData ) + { + mCurrentCamera = FW_NEW COLLADAFW::Camera( getUniqueIdFromId( attributeData.id, COLLADAFW::Camera::ID()).getObjectId() ); + + if ( attributeData.name ) + mCurrentCamera->setName( (const char*) attributeData.name ); + else if ( attributeData.id ) + mCurrentCamera->setName( (const char*) attributeData.id ); + + return true; + } + + //------------------------------ + bool LibraryCamerasLoader::end__camera() + { + bool success = writer()->writeCamera(mCurrentCamera); + FW_DELETE mCurrentCamera; + resetCurrentValues(); + return success; + } + + //------------------------------ + bool LibraryCamerasLoader::begin__perspective() + { + mCurrentCamera->setCameraType(COLLADAFW::Camera::PERSPECTIVE); + return true; + } + + //------------------------------ + bool LibraryCamerasLoader::data__xfov( double value ) + { + mCurrentCamera->setXFovOrXMag( value ); + return true; + } + + //------------------------------ + bool LibraryCamerasLoader::data__yfov( double value ) + { + mCurrentCamera->setYFovOrYMag( value ); + return true; + } + + //------------------------------ + bool LibraryCamerasLoader::data__perspective__aspect_ratio( double value ) + { + mCurrentCamera->setAspectRatio(value); + return true; + } + + bool LibraryCamerasLoader::data__perspective__znear( double value ) + { + mCurrentCamera->setNearClippingPlane(value); + return true; + } + + bool LibraryCamerasLoader::data__perspective__zfar( double value ) + { + mCurrentCamera->setFarClippingPlane(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-11 11:00:35
|
Revision: 352 http://colladamaya.svn.sourceforge.net/colladamaya/?rev=352&view=rev Author: judithschenk Date: 2009-02-11 11:00:27 +0000 (Wed, 11 Feb 2009) Log Message: ----------- Framework: Management of ids and names; COLLADAMaya: start of material import; COLLADASax: end_COLLADA, finish reading document Modified Paths: -------------- branches/nextgen/COLLADAFramework/include/COLLADAFWGeometry.h branches/nextgen/COLLADAFramework/include/COLLADAFWInstanceGeometry.h branches/nextgen/COLLADAFramework/include/COLLADAFWNode.h branches/nextgen/COLLADAFramework/include/COLLADAFWSceneGraphInstance.h branches/nextgen/COLLADAFramework/include/COLLADAFWVisualScene.h branches/nextgen/COLLADAFramework/src/COLLADAFWInstanceGeometry.cpp branches/nextgen/COLLADAMaya/include/COLLADAMayaBaseImporter.h branches/nextgen/COLLADAMaya/include/COLLADAMayaDocumentImporter.h branches/nextgen/COLLADAMaya/include/COLLADAMayaGeometryImporter.h branches/nextgen/COLLADAMaya/include/COLLADAMayaMaterialImporter.h branches/nextgen/COLLADAMaya/include/COLLADAMayaNode.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/COLLADAMayaMaterialImporter.cpp branches/nextgen/COLLADAMaya/src/COLLADAMayaVisualSceneImporter.cpp branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLFileLoader.h branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLGeometryMaterialIdInfo.h branches/nextgen/COLLADASaxFrameworkLoader/include/COLLADASaxFWLVisualSceneLoader.h branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLFileLoader.cpp branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLLibraryMaterialsLoader.cpp branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLMeshLoader.cpp branches/nextgen/COLLADASaxFrameworkLoader/src/COLLADASaxFWLNodeLoader.cpp Added Paths: ----------- branches/nextgen/COLLADAMaya/include/COLLADAMayaEffectImporter.h branches/nextgen/COLLADAMaya/src/COLLADAMayaBaseImporter.cpp branches/nextgen/COLLADAMaya/src/COLLADAMayaEffectImporter.cpp branches/nextgen/COLLADAMaya/template/ branches/nextgen/COLLADAMaya/template/template.cpp branches/nextgen/COLLADAMaya/template/template.h Modified: branches/nextgen/COLLADAFramework/include/COLLADAFWGeometry.h =================================================================== --- branches/nextgen/COLLADAFramework/include/COLLADAFWGeometry.h 2009-02-11 10:56:37 UTC (rev 351) +++ branches/nextgen/COLLADAFramework/include/COLLADAFWGeometry.h 2009-02-11 11:00:27 UTC (rev 352) @@ -68,14 +68,6 @@ /** Destructor. */ virtual ~Geometry(); - /** A text string containing the unique identifier of the <geometry> 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 <geometry> element. This - value must be unique within the instance document. Optional. */ - void setId ( const String id ) { mId = id; } - /** A text string containing the name of the <geometry> element. Optional. */ const String getName () const { return mName; } Modified: branches/nextgen/COLLADAFramework/include/COLLADAFWInstanceGeometry.h =================================================================== --- branches/nextgen/COLLADAFramework/include/COLLADAFWInstanceGeometry.h 2009-02-11 10:56:37 UTC (rev 351) +++ branches/nextgen/COLLADAFramework/include/COLLADAFWInstanceGeometry.h 2009-02-11 11:00:27 UTC (rev 352) @@ -29,13 +29,20 @@ 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; + + /** The name of the shading engine. */ + String mName; + public: - MaterialBinding(MaterialId materialId, UniqueId referencedMaterial); + MaterialBinding ( const MaterialId& materialId, const UniqueId& referencedMaterial ); + /** @return MaterialId of the mesh primitives that should get bind to a material.*/ COLLADAFW::MaterialId getMaterialId() const { return mMaterialId; } @@ -51,6 +58,10 @@ /** The comparison operator that only compares the material ids.*/ bool operator<( const MaterialBinding& rhs) const { return mMaterialId < rhs.mMaterialId; } + /** The name of the shading engine. */ + const String& getName () const { return mName; } + void setName ( const String& val ) { mName = val; } + private: friend class Array<MaterialBinding>; MaterialBinding(){} Modified: branches/nextgen/COLLADAFramework/include/COLLADAFWNode.h =================================================================== --- branches/nextgen/COLLADAFramework/include/COLLADAFWNode.h 2009-02-11 10:56:37 UTC (rev 351) +++ branches/nextgen/COLLADAFramework/include/COLLADAFWNode.h 2009-02-11 11:00:27 UTC (rev 352) @@ -57,11 +57,6 @@ */ String mName; - /** A text string containing the unique identifier of the element. This value must be - unique within the instance document. Optional. - */ - String mSid; - /** The type of the <node> element. Valid values are JOINT or NODE. The default is NODE. Optional. */ NodeType mType; @@ -90,12 +85,6 @@ /** Sets the name of the node*/ void setName(const String& name) { mName = name; } - /** Returns the sid of the node*/ - const String& getSid() const { return mSid; } - - /** Sets the id of the node*/ - void setSid(const String& sid) { mSid = sid; } - /** The type of the <node> element. Valid values are JOINT or NODE. The default is NODE. Optional. */ const COLLADAFW::Node::NodeType getType () const { return mType; } Modified: branches/nextgen/COLLADAFramework/include/COLLADAFWSceneGraphInstance.h =================================================================== --- branches/nextgen/COLLADAFramework/include/COLLADAFWSceneGraphInstance.h 2009-02-11 10:56:37 UTC (rev 351) +++ branches/nextgen/COLLADAFramework/include/COLLADAFWSceneGraphInstance.h 2009-02-11 11:00:27 UTC (rev 352) @@ -28,15 +28,9 @@ */ String mName; - /** A text string containing the unique identifier of the element. This value must be - unique within the instance document. Optional. - */ - String mSid; - /** The unique id of the instantiated object.*/ UniqueId mInstanciatedObjectId; - public: /** Constructor. Creates an instance of an object with UniqueId @a instanciatedObjectId. @@ -51,12 +45,6 @@ /** Sets the name of the node*/ void getName(const String& name) { mName = name; } - /** Returns the sid of the node*/ - const String& getSid() const { return mSid; } - - /** Sets the id of the node*/ - void getSid(const String& sid) { mSid = sid; } - /** Returns the unique id of the instantiated object.*/ const UniqueId& getInstanciatedObjectId() const { return mInstanciatedObjectId; } Modified: branches/nextgen/COLLADAFramework/include/COLLADAFWVisualScene.h =================================================================== --- branches/nextgen/COLLADAFramework/include/COLLADAFWVisualScene.h 2009-02-11 10:56:37 UTC (rev 351) +++ branches/nextgen/COLLADAFramework/include/COLLADAFWVisualScene.h 2009-02-11 11:00:27 UTC (rev 352) @@ -30,6 +30,7 @@ NodePointerArray mRootNodes; public: + VisualScene(); virtual ~VisualScene(); Modified: branches/nextgen/COLLADAFramework/src/COLLADAFWInstanceGeometry.cpp =================================================================== --- branches/nextgen/COLLADAFramework/src/COLLADAFWInstanceGeometry.cpp 2009-02-11 10:56:37 UTC (rev 351) +++ branches/nextgen/COLLADAFramework/src/COLLADAFWInstanceGeometry.cpp 2009-02-11 11:00:27 UTC (rev 352) @@ -14,11 +14,13 @@ namespace COLLADAFW { + // ---------------------------------- InstanceGeometry::InstanceGeometry( UniqueId instanciatedGeometryId ) : SceneGraphInstance(instanciatedGeometryId) { } + // ---------------------------------- InstanceGeometry::InstanceGeometry( const InstanceGeometry& pre ) : SceneGraphInstance(pre) , mMaterialBindings() @@ -30,12 +32,13 @@ mMaterialBindings[i] = pre.mMaterialBindings[i]; } - //-------------------------------------------------------------------- + // ---------------------------------- InstanceGeometry::~InstanceGeometry() { } - InstanceGeometry::MaterialBinding::MaterialBinding( MaterialId materialId, UniqueId referencedMaterial ) + // ---------------------------------- + InstanceGeometry::MaterialBinding::MaterialBinding ( const MaterialId& materialId, const UniqueId& referencedMaterial ) : mMaterialId(materialId) , mReferencedMaterial(referencedMaterial) { Modified: branches/nextgen/COLLADAMaya/include/COLLADAMayaBaseImporter.h =================================================================== --- branches/nextgen/COLLADAMaya/include/COLLADAMayaBaseImporter.h 2009-02-11 10:56:37 UTC (rev 351) +++ branches/nextgen/COLLADAMaya/include/COLLADAMayaBaseImporter.h 2009-02-11 11:00:27 UTC (rev 352) @@ -31,7 +31,10 @@ This is the base class for all importers. */ class BaseImporter { + public: + typedef std::map<COLLADAFW::UniqueId, String> UniqueIdNamesMap; + private: /** Pointer to the current document importer. */ @@ -53,14 +56,7 @@ * 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 ) - { - 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] ) ) ); - } + MayaDM::double3 toLinearUnit ( const MayaDM::double3& val ); /** * Converts the given value to the linear unit in meters. @@ -68,14 +64,7 @@ * For example, 1.0 for the name "meter"; 1000 for the name "kilometer"; * 0.3048 for the name "foot". */ - MVector toLinearUnit ( const MVector& val ) - { - 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] ) ) ); - } + MVector toLinearUnit ( const MVector& val ); /** * Converts the given value to the linear unit in meters. @@ -83,27 +72,7 @@ * For example, 1.0 for the name "meter"; 1000 for the name "kilometer"; * 0.3048 for the name "foot". */ - void toLinearUnit ( const double val0, const double val1, const double val2, COLLADABU::Math::Vector3& retVal ) - { - 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 ); - } - } + void toLinearUnit ( const double val0, const double val1, const double val2, COLLADABU::Math::Vector3& retVal ); protected: Modified: branches/nextgen/COLLADAMaya/include/COLLADAMayaDocumentImporter.h =================================================================== --- branches/nextgen/COLLADAMaya/include/COLLADAMayaDocumentImporter.h 2009-02-11 10:56:37 UTC (rev 351) +++ branches/nextgen/COLLADAMaya/include/COLLADAMayaDocumentImporter.h 2009-02-11 11:00:27 UTC (rev 352) @@ -26,6 +26,8 @@ #include "COLLADAFWGeometry.h" #include "COLLADAFWMaterial.h" #include "COLLADAFWEffect.h" + +#include "MayaDMMesh.h" #include <set> @@ -34,9 +36,13 @@ { class VisualSceneImporter; class GeometryImporter; + class MaterialImporter; + class EffectImporter; + typedef std::map<COLLADAFW::UniqueId, std::set<const COLLADAFW::UniqueId>> UniqueIdUniqueIdsMap; typedef std::map<COLLADAFW::UniqueId, MayaNode> UniqueIdMayaNodesMap; + typedef std::map<COLLADAFW::UniqueId, MayaDM::Mesh> UniqueIdMayaDMMeshMap; /** The main importer class. This class imports all data of the scene. */ @@ -81,6 +87,15 @@ /** Pointer to the geometry importer. */ GeometryImporter* mGeometryImporter; + /** Pointer to the geometry importer. */ + MaterialImporter* mMaterialImporter; + + /** Pointer to the geometry importer. */ + EffectImporter* mEffectImporter; + + /** The variable tells, how many times the document is read. */ + size_t mDocumentReads; + public: /** Constructor. */ @@ -118,12 +133,19 @@ /** Pointer to the visual scene importer. */ VisualSceneImporter* getVisualSceneImporter () { return mVisualSceneImporter; } const VisualSceneImporter* getVisualSceneImporter () const { return mVisualSceneImporter; } - void setVisualSceneImporter ( VisualSceneImporter* val ) { mVisualSceneImporter = val; } /** Pointer to the geometry importer. */ + GeometryImporter* getGeometryImporter () { return mGeometryImporter; } const GeometryImporter* getGeometryImporter () const { return mGeometryImporter; } - void setGeometryImporter ( GeometryImporter* val ) { mGeometryImporter = val; } + /** Pointer to the geometry importer. */ + MaterialImporter* getMaterialImporter () { return mMaterialImporter; } + const MaterialImporter* getMaterialImporter () const { return mMaterialImporter; } + + /** Pointer to the geometry importer. */ + EffectImporter* getEffectImporter () { return mEffectImporter; } + const EffectImporter* getEffectImporter () const { return mEffectImporter; } + /** This method will be called if an error in the loading process occurred and the loader cannot continue to to load. The writer should undo all operations that have been performed. @param errorMessage A message containing informations about the error that occurred. @@ -133,8 +155,10 @@ /** This is the method called. The writer hast to prepare to receive data.*/ virtual void start (); - /** This method is called after the last write method. - No other methods will be called after this.*/ + /** + * This method is called after the last write method. No other methods will be called after this. + * After the read of the collada document, the connections can be written into the maya file. + */ virtual void finish (); /** Start the import of the model. @@ -147,6 +171,7 @@ void getCurrentDate ( std::stringstream& curDate ); + /** Returns the type of the current up axis. */ const COLLADAFW::FileInfo::UpAxisType& getUpAxisType () const { return mUpAxisType; } /** @@ -171,11 +196,11 @@ /** 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; } + virtual bool writeMaterial ( const COLLADAFW::Material* material ); /** 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; } + virtual bool writeEffect ( const COLLADAFW::Effect* effect ); private: Added: branches/nextgen/COLLADAMaya/include/COLLADAMayaEffectImporter.h =================================================================== --- branches/nextgen/COLLADAMaya/include/COLLADAMayaEffectImporter.h (rev 0) +++ branches/nextgen/COLLADAMaya/include/COLLADAMayaEffectImporter.h 2009-02-11 11:00:27 UTC (rev 352) @@ -0,0 +1,107 @@ +/* + 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 __COLLADAMAYA_EFFECTIMPORTER_H__ +#define __COLLADAMAYA_EFFECTIMPORTER_H__ + +#include "COLLADAFWPrerequisites.h" +#include "COLLADAMayaBaseImporter.h" + +#include "COLLADABUIDList.h" + + +namespace COLLADAMaya +{ + + /** TODO Documentation */ + class EffectImporter : public BaseImporter + { + public: + + typedef std::map<COLLADAFW::UniqueId, MayaDM::DependNode*> UniqueIdMayaDependNodeMap; + typedef std::map<COLLADAFW::UniqueId, std::vector<MayaDM::DependNode*>> UniqueIdDependNodesMap; + + private: + + /** The standard name for a effect without name. */ + static const String EFFECT_NAME; + + private: + + /** + * The list of the unique maya effect names. + */ + COLLADABU::IDList mEffectIdList; + + /** + * The map holds the unique ids of the nodes to the maya effect name. + */ + UniqueIdNamesMap mMayaEffectNamesMap; + + /** + * The map holds the maya effect objects. + */ + UniqueIdMayaDependNodeMap mMayaEffectMap; + + /** + * One effect can have multiple materials. But one material just one effect. + */ + UniqueIdDependNodesMap mEffectMaterialsMap; + + public: + + /** Constructor. */ + EffectImporter ( DocumentImporter* documentImporter ); + + /** Destructor. */ + virtual ~EffectImporter (); + + /** Imports the given material. */ + bool importEffect ( const COLLADAFW::Effect* effect ); + + /** + * The map holds the maya material objects. + */ + const UniqueIdMayaDependNodeMap& getMayaEffectMap () const { return mMayaEffectMap; } + + /** + * The map holds the maya material objects. + */ + MayaDM::DependNode* findMayaEffect ( const COLLADAFW::UniqueId& val ) const; + + /** + * The map holds the maya material objects. + */ + void appendEffect ( const COLLADAFW::UniqueId& id, MayaDM::DependNode* effectNode ); + + /** + * One effect can have multiple materials. But one material just one effect. + */ + const UniqueIdDependNodesMap getEffectMaterialsMap () const { return mEffectMaterialsMap; } + + + private: + + /** + * Imports a lambert shader effect. + */ + void importLambertShader ( const COLLADAFW::Effect* effect ); + + /** Disable default copy ctor. */ + EffectImporter( const EffectImporter& pre ); + + /** Disable default assignment operator. */ + const EffectImporter& operator= ( const EffectImporter& pre ); + + }; + +} // namespace COLLADAMAYA + +#endif // __COLLADAMAYA_EFFECTIMPORTER_H__ Modified: branches/nextgen/COLLADAMaya/include/COLLADAMayaGeometryImporter.h =================================================================== --- branches/nextgen/COLLADAMaya/include/COLLADAMayaGeometryImporter.h 2009-02-11 10:56:37 UTC (rev 351) +++ branches/nextgen/COLLADAMaya/include/COLLADAMayaGeometryImporter.h 2009-02-11 11:00:27 UTC (rev 352) @@ -40,6 +40,9 @@ private: + /** The standard name for geometry without name. */ + static const String GEOMETRY_NAME; + /** * The list of the unique maya mesh node names. */ @@ -50,6 +53,11 @@ */ UniqueIdMayaNodesMap mMayaMeshNodesMap; + /** + * The map holds the unique ids of the nodes to the specific nodes. + */ + UniqueIdMayaDMMeshMap mMayaDMMeshNodesMap; + public: /** Constructor. */ @@ -61,8 +69,6 @@ /** Imports the geometry element. */ bool importGeometry ( const COLLADAFW::Geometry* geometry ); - private: - /** * The map holds the unique ids of the nodes to the maya specific nodes. */ @@ -73,6 +79,11 @@ */ MayaNode* getMayaMeshNode ( const COLLADAFW::UniqueId& uniqueId ); + MayaDM::Mesh* getMayaDMMeshNode ( const COLLADAFW::UniqueId& uniqueId ); + const MayaDM::Mesh* getMayaDMMeshNode ( const COLLADAFW::UniqueId& uniqueId ) const; + + private: + /** * Imports the data of the current mesh element. */ @@ -83,9 +94,18 @@ */ void createMesh ( const COLLADAFW::Mesh* mesh, - MayaNode* parentMayaNode ); + MayaNode* parentMayaNode, + size_t numNodeInstances ); /** + * Create the object group instances and the object groups and write it into the maya file. + */ + void writeObjectGroups ( + const COLLADAFW::Mesh* mesh, + MayaDM::Mesh &meshNode, + size_t numNodeInstances ); + + /** * Iterates over the mesh primitives and reads the edge indices. */ void getEdgeIndices ( @@ -234,6 +254,7 @@ const COLLADAFW::Edge& edge, const std::map<COLLADAFW::Edge,size_t>& edgeIndicesMap, int& edgeIndex ); + }; } Modified: branches/nextgen/COLLADAMaya/include/COLLADAMayaMaterialImporter.h =================================================================== --- branches/nextgen/COLLADAMaya/include/COLLADAMayaMaterialImporter.h 2009-02-11 10:56:37 UTC (rev 351) +++ branches/nextgen/COLLADAMaya/include/COLLADAMayaMaterialImporter.h 2009-02-11 11:00:27 UTC (rev 352) @@ -19,14 +19,43 @@ #include "COLLADAMayaStableHeaders.h" #include "COLLADAMayaBaseImporter.h" +#include "COLLADABUIDList.h" +#include "MayaDMDependNode.h" + + namespace COLLADAMaya { /** Declares the importer class for import materials. */ class MaterialImporter : public BaseImporter { + public: + typedef std::map<COLLADAFW::UniqueId, MayaDM::DependNode*> UniqueIdMayaMaterialMap; + + private: + + /** The standard name for a material without name. */ + static const String MATERIAL_NAME; + + private: + + /** + * The list of the unique maya material names. + */ + COLLADABU::IDList mMaterialIdList; + + /** + * The map holds the unique ids of the nodes to the maya material name. + */ + UniqueIdNamesMap mMayaMaterialNamesMap; + + /** + * The map holds the maya material objects. + */ + UniqueIdMayaMaterialMap mMayaMaterialMap; + public: /** Constructor. */ @@ -35,14 +64,25 @@ /** Destructor. */ virtual ~MaterialImporter () {} - /** Imports all materials from the current collada document. */ - void importMaterials(); + /** Imports the given material. */ + bool importMaterial ( const COLLADAFW::Material* material ); - private: + /** + * The map holds the maya material objects. + */ + const UniqueIdMayaMaterialMap& getMayaMaterialMap () const { return mMayaMaterialMap; } -// /** Imports the current material into the maya scene. */ -// void importMaterial ( domMaterial& material ); + /** + * The map holds the maya material objects. + */ + MayaDM::DependNode* findMayaMaterial ( const COLLADAFW::UniqueId& val ) const; + /** + * The map holds the maya material objects. + */ + void appendMaterial ( const COLLADAFW::UniqueId& id, MayaDM::DependNode* materialNode ); + + }; } Modified: branches/nextgen/COLLADAMaya/include/COLLADAMayaNode.h =================================================================== --- branches/nextgen/COLLADAMaya/include/COLLADAMayaNode.h 2009-02-11 10:56:37 UTC (rev 351) +++ branches/nextgen/COLLADAMaya/include/COLLADAMayaNode.h 2009-02-11 11:00:27 UTC (rev 352) @@ -8,6 +8,9 @@ namespace COLLADAMaya { + /** + * This class exist to have the node path for a node. + */ class MayaNode { private: Modified: branches/nextgen/COLLADAMaya/include/COLLADAMayaVisualSceneImporter.h =================================================================== --- branches/nextgen/COLLADAMaya/include/COLLADAMayaVisualSceneImporter.h 2009-02-11 10:56:37 UTC (rev 351) +++ branches/nextgen/COLLADAMaya/include/COLLADAMayaVisualSceneImporter.h 2009-02-11 11:00:27 UTC (rev 352) @@ -21,11 +21,14 @@ #include "COLLADAMayaNode.h" #include "MayaDMTransform.h" +#include "MayaDMShadingEngine.h" +#include "MayaDMMaterialInfo.h" #include "COLLADAFWVisualScene.h" #include "COLLADAFWSkew.h" #include "COLLADABUIDList.h" + #include "Math/COLLADABUMathUtils.h" #include "Math/COLLADABUMathMatrix4.h" #include "Math/COLLADABUMathQuaternion.h" @@ -43,6 +46,48 @@ private: + class ShaderData + { + private: + MayaDM::ShadingEngine* mShadingEngine; + MayaDM::MaterialInfo* mMaterialInfo; + + public: + ShaderData () : mShadingEngine (0), mMaterialInfo (0) {} + ShaderData ( + MayaDM::ShadingEngine* shadingEngine, + MayaDM::MaterialInfo* materialInfo ) + : mShadingEngine ( shadingEngine ) + , mMaterialInfo ( materialInfo ) + {} + virtual ~ShaderData() {} + + MayaDM::ShadingEngine* getShadingEngine () const { return mShadingEngine; } + MayaDM::MaterialInfo* getMaterialInfo () const { return mMaterialInfo; } + + private: + /** Disable default copy ctor. */ + ShaderData( const ShaderData& pre ); + /** Disable default assignment operator. */ + const ShaderData& operator= ( const ShaderData& pre ); + + }; + + typedef std::map<COLLADAFW::MaterialId, ShaderData*> ShaderDataMap; + + private: + + /** The standard name for a transform node without name. */ + static const String TRANSFORM_NODE_NAME; + + /** The standard name for a shading engine. */ + static const String SHADING_ENGINE_NAME; + + /** The standard name for a material info. */ + static const String MATERIAL_INFO_NAME; + + private: + /** * The list of the unique maya transform node names. */ @@ -59,6 +104,17 @@ */ UniqueIdMayaNodesMap mMayaTransformNodesMap; + /** + * The list of the unique maya shading engine names. + */ + COLLADABU::IDList mShadingEngineIdList; + COLLADABU::IDList mMaterialInfoIdList; + + /** + * The map with the unique ids of the shading engine to the shading engines itself. + */ + ShaderDataMap mShaderDataMap; + /* * Helper class, to handle the transformations. */ @@ -122,13 +178,6 @@ */ bool importVisualScene ( const COLLADAFW::VisualScene* visualScene ); - /* - * Imports the data of the current node. - */ - void importNode ( - const COLLADAFW::Node* rootNode, - const COLLADAFW::UniqueId* parentNodeId = NULL ); - /** * The map holds the unique ids of the nodes to the full node pathes (contains the name). */ @@ -149,6 +198,13 @@ private: + /* + * Imports the data of the current node. + */ + void importNode ( + const COLLADAFW::Node* rootNode, + const COLLADAFW::UniqueId* parentNodeId = NULL ); + /** * Save the transformation ids to the geometry ids. */ @@ -157,6 +213,11 @@ MayaDM::Transform* transformNode ); /** + * Read the shading engines. + */ + void readMaterialInstances ( const COLLADAFW::InstanceGeometry* instanceGeometry ); + + /** * Handle the node instances. */ bool readNodeInstances ( const COLLADAFW::Node* node ); @@ -215,6 +276,29 @@ */ void skewValuesToMayaMatrix ( const COLLADAFW::Skew* skew, MMatrix& matrix ) const; + /** + * The list of the unique maya shading engine names. + */ + const COLLADABU::IDList& getShadingEngineIdList () const { return mShadingEngineIdList; } + + /** + * The map with the unique ids of the shading engine to the shading engines itself. + */ + const ShaderDataMap& getShadingEnginesMap () const { return mShaderDataMap; } + + /** + * The map with the unique ids of the shading engine to the shading engines itself. + */ + ShaderData* findShaderData ( const COLLADAFW::MaterialId& val ); + + /** + * The map with the unique ids of the shading engine to the shading engines itself. + */ + void appendShaderData ( + const COLLADAFW::MaterialId& val, + MayaDM::ShadingEngine* shadingEngine, + MayaDM::MaterialInfo* materialInfo ); + }; } Modified: branches/nextgen/COLLADAMaya/scripts/COLLADAMaya.vcproj =================================================================== --- branches/nextgen/COLLADAMaya/scripts/COLLADAMaya.vcproj 2009-02-11 10:56:37 UTC (rev 351) +++ branches/nextgen/COLLADAMaya/scripts/COLLADAMaya.vcproj 2009-02-11 11:00:27 UTC (rev 352) @@ -2671,6 +2671,10 @@ Name="Importers" > <File + RelativePath="..\src\COLLADAMayaBaseImporter.cpp" + > + </File> + <File RelativePath="..\src\COLLADAMayaDocumentImporter.cpp" > <FileConfiguration @@ -2738,13 +2742,6 @@ /> </FileConfiguration> <FileConfiguration - Name="ReleasePlugin2009|Win32" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration Name="ReleasePlugin2009|x64" ExcludedFromBuild="true" > @@ -2858,6 +2855,10 @@ </FileConfiguration> </File> <File + RelativePath="..\src\COLLADAMayaEffectImporter.cpp" + > + </File> + <File RelativePath="..\src\COLLADAMayaGeometryImporter.cpp" > <FileConfiguration @@ -2925,13 +2926,6 @@ /> </FileConfiguration> <FileConfiguration - Name="ReleasePlugin2009|Win32" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration Name="ReleasePlugin2009|x64" ExcludedFromBuild="true" > @@ -3241,7 +3235,6 @@ </FileConfiguration> <FileConfiguration Name="DebugConsole2009|Win32" - ExcludedFromBuild="true" > <Tool Name="VCCLCompilerTool" @@ -3344,13 +3337,6 @@ /> </FileConfiguration> <FileConfiguration - Name="ReleasePlugin2009|Win32" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration Name="ReleasePlugin2009|x64" ExcludedFromBuild="true" > @@ -4349,6 +4335,10 @@ </FileConfiguration> </File> <File + RelativePath="..\include\COLLADAMayaEffectImporter.h" + > + </File> + <File RelativePath="..\include\COLLADAMayaGeometryImporter.h" > <FileConfiguration @@ -4767,7 +4757,6 @@ </FileConfiguration> <FileConfiguration Name="DebugConsole2009|Win32" - ExcludedFromBuild="true" > <Tool Name="VCCustomBuildTool" Added: branches/nextgen/COLLADAMaya/src/COLLADAMayaBaseImporter.cpp =================================================================== --- branches/nextgen/COLLADAMaya/src/COLLADAMayaBaseImporter.cpp (rev 0) +++ branches/nextgen/COLLADAMaya/src/COLLADAMayaBaseImporter.cpp 2009-02-11 11:00:27 UTC (rev 352) @@ -0,0 +1,50 @@ +#include "COLLADAMayaStableHeaders.h" +#include "COLLADAMayaBaseImporter.h" + +namespace COLLADAMaya +{ + + //----------------------------- + MayaDM::double3 BaseImporter::toLinearUnit ( const MayaDM::double3& val ) + { + 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] ) ) ); + } + + //----------------------------- + MVector BaseImporter::toLinearUnit ( const MVector& val ) + { + 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] ) ) ); + } + + //----------------------------- + void BaseImporter::toLinearUnit ( const double val0, const double val1, const double val2, COLLADABU::Math::Vector3& retVal ) + { + 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 ); + } + } + +} // namespace COLLADAMaya Modified: branches/nextgen/COLLADAMaya/src/COLLADAMayaDocumentImporter.cpp =================================================================== --- branches/nextgen/COLLADAMaya/src/COLLADAMayaDocumentImporter.cpp 2009-02-11 10:56:37 UTC (rev 351) +++ branches/nextgen/COLLADAMaya/src/COLLADAMayaDocumentImporter.cpp 2009-02-11 11:00:27 UTC (rev 352) @@ -18,6 +18,7 @@ #include "COLLADAMayaReferenceManager.h" #include "COLLADAMayaImportOptions.h" #include "COLLADAMayaMaterialImporter.h" +#include "COLLADAMayaEffectImporter.h" #include "COLLADAMayaGeometryImporter.h" #include "COLLADAMayaCameraImporter.h" #include "COLLADAMayaVisualSceneImporter.h" @@ -44,12 +45,15 @@ , mFile ( 0 ) , mVisualSceneImporter (0) , mGeometryImporter (0) + , mMaterialImporter (0) + , mEffectImporter (0) , mSceneGraphWritten ( false ) , mGeometryWritten ( false ) , mAssetWritten ( false ) , mSceneGraphRead ( false ) , mGeometryRead ( false ) , mLinearUnitMeter (1) + , mDocumentReads (0) { } @@ -70,6 +74,8 @@ mVisualSceneImporter = new VisualSceneImporter ( this ); mGeometryImporter = new GeometryImporter ( this ); + mMaterialImporter = new MaterialImporter ( this ); + mEffectImporter = new EffectImporter ( this ); // Get the sceneID (assign a name to the scene) MString sceneName = MFileIO::currentFile (); @@ -84,6 +90,8 @@ { delete mVisualSceneImporter; delete mGeometryImporter; + delete mMaterialImporter; + delete mEffectImporter; } //----------------------------- @@ -163,8 +171,17 @@ //----------------------------- void DocumentImporter::finish () { - // Close the file. - if ( mFile != 0 ) fclose ( mFile ); + // If the last read is ready, we can write the connections and close the file. + --mDocumentReads; + if ( mDocumentReads == 0 ) + { + // TODO After the read of the collada document, + // the connections can be written into the maya file. + + + // Close the file + if ( mFile != 0 ) fclose ( mFile ); + } } //----------------------------- @@ -275,6 +292,8 @@ COLLADAFW::Root root ( &loader, this ); String filename = getColladaFilename (); String fileUriString = URI::nativePathToUri ( filename ); + + ++mDocumentReads; root.loadDocument ( fileUriString ); } @@ -339,4 +358,33 @@ // TODO return false; } + + //----------------------------- + bool DocumentImporter::writeMaterial ( const COLLADAFW::Material* material ) + { + bool retValue = false; + + // Create the file, if not already done. + if ( mFile == 0 ) start(); + + retValue = mMaterialImporter->importMaterial ( material ); + mGeometryWritten = true; + + return retValue; + } + + //----------------------------- + bool DocumentImporter::writeEffect ( const COLLADAFW::Effect* effect ) + { + bool retValue = false; + + // Create the file, if not already done. + if ( mFile == 0 ) start(); + + retValue = mEffectImporter->importEffect ( effect ); + mGeometryWritten = true; + + return retValue; + } + } \ No newline at end of file Added: branches/nextgen/COLLADAMaya/src/COLLADAMayaEffectImporter.cpp =================================================================== --- branches/nextgen/COLLADAMaya/src/COLLADAMayaEffectImporter.cpp (rev 0) +++ branches/nextgen/COLLADAMaya/src/COLLADAMayaEffectImporter.cpp 2009-02-11 11:00:27 UTC (rev 352) @@ -0,0 +1,115 @@ +/* + 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 "COLLADAMayaStableHeaders.h" +#include "COLLADAMayaEffectImporter.h" + +#include "MayaDMLambert.h" + + +namespace COLLADAMaya +{ + + const String EffectImporter::EFFECT_NAME = "Effect"; + + //------------------------------ + EffectImporter::EffectImporter ( DocumentImporter* documentImporter ) + : BaseImporter ( documentImporter ) + {} + + //------------------------------ + EffectImporter::~EffectImporter() + {} + + //------------------------------ + bool EffectImporter::importEffect ( const COLLADAFW::Effect* effect ) + { + const COLLADAFW::CommonEffectPointerArray& commonEffects = effect->getCommonEffects (); + size_t numCommonEffects = commonEffects.getCount (); + for ( size_t i=0; i<numCommonEffects; ++i ) + { + COLLADAFW::EffectCommon* commonEffect = commonEffects [i]; + const COLLADAFW::EffectCommon::ShaderType& shaderType = commonEffect->getShaderType (); + switch ( shaderType ) + { + case COLLADAFW::EffectCommon::SHADER_BLINN: + break; + case COLLADAFW::EffectCommon::SHADER_CONSTANT: + break; + case COLLADAFW::EffectCommon::SHADER_PHONG: + break; + case COLLADAFW::EffectCommon::SHADER_LAMBERT: + importLambertShader ( effect ); + break; + case COLLADAFW::EffectCommon::SHADER_UNKNOWN: + default: + // Standard shader (lambert?) + break; + } + } + + return true; + } + + //------------------------------ + void EffectImporter::importLambertShader ( const COLLADAFW::Effect* effect ) + { + // Get the material name. + String effectName ( effect->getName () ); + if ( COLLADABU::Utils::equals ( effectName, COLLADABU::Utils::EMPTY_STRING ) ) + effectName = EFFECT_NAME; + effectName = mEffectIdList.addId ( effectName ); + + const COLLADAFW::UniqueId& effectId = effect->getUniqueId (); + mMayaEffectNamesMap [effectId] = effectName; + + const COLLADAFW::Color& color = effect->getStandardColor (); + + FILE* file = getDocumentImporter ()->getFile (); + MayaDM::Lambert* lambert = new MayaDM::Lambert ( file, effectName ); + + appendEffect ( effectId, lambert ); + + // TODO + // Find all geometries, which use this effect and create the connections. + MaterialImporter* materialImporter = getDocumentImporter ()->getMaterialImporter (); +// std::vector<COLLADAFW::UniqueId>& materials = materialImporter->findEffectMaterials ( effectId ); +// +// // Iterate over the materials and get all geometries, which use it. +// size_t numMaterials = materials.size (); +// for ( size_t i=0; i<numMaterials; ++i ) +// { +// COLLADAFW::UniqueId& materialId = materials [i]; +// +// // Get the geometries, which use this material +// VisualSceneImporter* visualSceneImporter = getDocumentImporter ()->getVisualSceneImporter (); +// visualSceneImporter->f +// } + + } + + // -------------------------- + MayaDM::DependNode* EffectImporter::findMayaEffect ( const COLLADAFW::UniqueId& val ) const + { + UniqueIdMayaDependNodeMap::const_iterator it = mMayaEffectMap.find ( val ); + if ( it != mMayaEffectMap.end () ) + { + return it->second; + } + return 0; + } + + // -------------------------- + void EffectImporter::appendEffect ( const COLLADAFW::UniqueId& id, MayaDM::DependNode* effectNode ) + { + mMayaEffectMap [id] = effectNode; + } + +} // namespace COLLADAMaya Modified: branches/nextgen/COLLADAMaya/src/COLLADAMayaGeometryImporter.cpp =================================================================== --- branches/nextgen/COLLADAMaya/src/COLLADAMayaGeometryImporter.cpp 2009-02-11 10:56:37 UTC (rev 351) +++ branches/nextgen/COLLADAMaya/src/COLLADAMayaGeometryImporter.cpp 2009-02-11 11:00:27 UTC (rev 352) @@ -25,7 +25,6 @@ #pragma warning(disable:4172) #include "MayaDMTransform.h" -#include "MayaDMPolyCube.h" #include "MayaDMCommands.h" #include "COLLADAFWPolygons.h" @@ -37,6 +36,9 @@ namespace COLLADAMaya { + const String GeometryImporter::GEOMETRY_NAME = "Geometry"; + + // -------------------------------------------- GeometryImporter::GeometryImporter( DocumentImporter* documentImporter ) : BaseImporter ( documentImporter ) @@ -75,17 +77,17 @@ void GeometryImporter::importMesh ( const COLLADAFW::Mesh* mesh ) { // Get the unique framework mesh id - const COLLADAFW::UniqueId& meshUniqueId = mesh->getUniqueId (); + const COLLADAFW::UniqueId& geometryId = mesh->getUniqueId (); // Get the transform node of the current mesh. DocumentImporter* documentImporter = getDocumentImporter (); VisualSceneImporter* visualSceneImporter = documentImporter->getVisualSceneImporter (); - // Get all visual scene nodes, which use this geometry an make the parent connection + // Get all visual scene nodes, which use this geometry and make the parent connections. const std::set<const COLLADAFW::UniqueId>* transformNodesSet = - visualSceneImporter->getGeometryTransformIds ( meshUniqueId ); - size_t numNodes = transformNodesSet->size (); + visualSceneImporter->getGeometryTransformIds ( geometryId ); + size_t numNodeInstances = transformNodesSet->size (); std::set<const COLLADAFW::UniqueId>::const_iterator nodesIter = transformNodesSet->begin (); while ( nodesIter != transformNodesSet->end () ) { @@ -98,7 +100,7 @@ if ( nodesIter == transformNodesSet->begin() ) { // Create the current mesh node. - createMesh ( mesh, mayaTransformNode ); + createMesh ( mesh, mayaTransformNode, numNodeInstances ); } else { @@ -122,14 +124,13 @@ // -------------------------------------------- void GeometryImporter::createMesh ( const COLLADAFW::Mesh* mesh, - MayaNode* mayaTransformNode ) + MayaNode* mayaTransformNode, + size_t numNodeInstances ) { // Create a unique name. String meshName = mesh->getName (); if ( COLLADABU::Utils::equals ( meshName, "" ) ) - meshName = mesh->getId (); - if ( COLLADABU::Utils::equals ( meshName, "" ) ) - meshName = "Mesh"; + meshName = GEOMETRY_NAME; meshName = mMeshNodeIdList.addId ( meshName ); // Create a maya node object of the current node and push it into the map. @@ -144,7 +145,12 @@ // Create the current mesh node. FILE* file = getDocumentImporter ()->getFile (); MayaDM::Mesh meshNode ( file, meshName, transformNodePath ); + mMayaDMMeshNodesMap [uniqueId] = meshNode; + // TODO Writes the object groups for every mesh primitive and + // gets all shader engines, which are used by the primitive elements of the mesh. + writeObjectGroups ( mesh, meshNode, numNodeInstances ); + // Write the vertex positions. // Just write the values, they will be referenced from the edges and the faces. writeVertexPositions ( mesh, meshNode ); @@ -181,6 +187,72 @@ } // -------------------------------------------- + void GeometryImporter::writeObjectGroups ( + const COLLADAFW::Mesh* mesh, + MayaDM::Mesh &meshNode, + size_t numNodeInstances ) + { + // Create the object group instances and the object groups and write it into the maya file. + + // setAttr -size 2 ".instObjGroups"; // for every instance + // setAttr -size 2 ".instObjGroups[0].objectGroups"; // for every mesh primitive + // setAttr ".instObjGroups[0].objectGroups[0].objectGrpCompList" -type "componentList" 1 "f[0:5]"; + // setAttr ".instObjGroups[0].objectGroups[1].objectGrpCompList" -type "componentList" 1 "f[6:11]"; + + // We have to go through every mesh primitive. + const COLLADAFW::MeshPrimitiveArray& meshPrimitives = mesh->getMeshPrimitives (); + size_t meshPrimitivesCount = meshPrimitives.getCount (); + + // Iterate over the object instances. + for ( size_t j=0; j<numNodeInstances; ++j ) + { + size_t initialFaceIndex = 0; + + // Iterate over the mesh primitives + for ( size_t i=0; i<meshPrimitivesCount; ++i ) + { + // Get the number of faces of the current primitive element. + const COLLADAFW::MeshPrimitive* meshPrimitive = meshPrimitives [ i ]; + // TODO Is this also with trifans, etc. the right number??? + size_t numFaces = meshPrimitive->getGroupedVertexElementsCount (); +// COLLADAFW::Trifans* trifans = (COLLADAFW::Trifans*) primitiveElement; +// COLLADAFW::Trifans::VertexCountArray& vertexCountArray = +// trifans->getGroupedVerticesVertexCountArray (); +// meshPrimitive->getFaceCount (); +// meshPrimitive->getGroupedVerticesVertexCount (); + + // Create the string with the face informations for the component list. + String val = "f[" + COLLADABU::Utils::toString ( initialFaceIndex ) + + ":" + COLLADABU::Utils::toString ( numFaces-1 + initialFaceIndex ) + "]"; + + // Create the component list. + MayaDM::componentList componentList; + componentList.push_back ( val ); + + // Increment the initial face index. + initialFaceIndex += numFaces; + + // Write instance object group component list data into the file. + meshNode.setObjectGrpCompList ( j, i, componentList ); + } + } + + for ( size_t i=0; i<meshPrimitivesCount; ++i ) + { + // Get the current primitive element. + const COLLADAFW::MeshPrimitive* meshPrimitive = meshPrimitives [ i ]; + + // Get the shader engine id. + String shaderEngineName = meshPrimitive->getMaterial (); + COLLADAFW::MaterialId shaderEngineId = meshPrimitive->getMaterialId (); + + + // Look for the + + } + } + + // -------------------------------------------- void GeometryImporter::writeVertexPositions ( const COLLADAFW::Mesh* mesh, MayaDM::Mesh &meshNode ) @@ -1107,6 +1179,26 @@ } // -------------------------------------------- + const MayaDM::Mesh* GeometryImporter::getMayaDMMeshNode ( const COLLADAFW::UniqueId& uniqueId ) const + { + UniqueIdMayaDMMeshMap::const_iterator it = mMayaDMMeshNodesMap.find ( uniqueId ); + if ( it != mMayaDMMeshNodesMap.end () ) + return &(*it).second; + + return NULL; + } + + // -------------------------------------------- + MayaDM::Mesh* GeometryImporter::getMayaDMMeshNode ( const COLLADAFW::UniqueId& uniqueId ) + { + UniqueIdMayaDMMeshMap::iterator it = mMayaDMMeshNodesMap.find ( uniqueId ); + if ( it != mMayaDMMeshNodesMap.end () ) + return &(*it).second; + + return NULL; + } + + // -------------------------------------------- bool GeometryImporter::getEdgeIndex ( const COLLADAFW::Edge& edge, const std::map<COLLADAFW::Edge,size_t>& edgeIndicesMap, Modified: branches/nextgen/COLLADAMaya/src/COLLADAMayaMaterialImporter.cpp =================================================================== --- branches/nextgen/COLLADAMaya/src/COLLADAMayaMaterialImporter.cpp 2009-02-11 10:56:37 UTC (rev 351) +++ branches/nextgen/COLLADAMaya/src/COLLADAMayaMaterialImporter.cpp 2009-02-11 11:00:27 UTC (rev 352) @@ -15,46 +15,40 @@ #include "COLLADAMayaStableHeaders.h" #include "COLLADAMayaMaterialImporter.h" -#include "COLLADAMayaShaderHelper.h" -#include "COLLADAMayaDagHelper.h" -#include "COLLADAMayaSyntax.h" +#include "COLLADAMayaEffectImporter.h" -// #include "COLLADADHReader.h" -// #include "COLLADADHElementIterator.h" -// #include "COLLADADHEffectUtil.h" -// -// #include <dom/domMaterial.h> -// #include <dom/domTypes.h> -#include <maya/MFnLambertShader.h> -#include <maya/MFnPhongShader.h> -#include <maya/MFnBlinnShader.h> - namespace COLLADAMaya { + const String MaterialImporter::MATERIAL_NAME = "Material"; + //------------------------------ MaterialImporter::MaterialImporter ( DocumentImporter* documentImporter ) : BaseImporter ( documentImporter ) {} // -------------------------- - void MaterialImporter::importMaterials() + bool MaterialImporter::importMaterial ( const COLLADAFW::Material* material ) { -// daeDocument* document = getDaeDocument(); -// COLLADADH::Reader reader ( *( document ) ); -// -// COLLADADH::Reader::ElementIterator<domMaterial> materialsIter = reader.getMaterials(); -// while ( materialsIter.more() ) -// { -// domMaterial& material = materialsIter.next(); -// importMaterial ( material ); -// } - } + // Get the material name. + String materialName ( material->getName () ); + if ( COLLADABU::Utils::equals ( materialName, COLLADABU::Utils::EMPTY_STRING ) ) + materialName = MATERIAL_NAME; + materialName = mMaterialIdList.addId ( materialName ); + + const COLLADAFW::UniqueId& materialId = material->getUniqueId (); + mMayaMaterialNamesMap [materialId] = materialName; -// // -------------------------- -// void MaterialImporter::importMaterial ( domMaterial& material ) -// { + // Get the effect + const COLLADAFW::UniqueId& effectId = material->getInstantiatedEffect (); + EffectImporter* effectImporter = getDocumentImporter ()->getEffectImporter (); + + effectImporter->findMayaEffect ( effectId ); + + // + + // daeString elementName = material.getElementName(); // xsNCName materialName = material.getName(); // daeString materialTypeName = material.getTypeName(); @@ -374,8 +368,10 @@ // // } // } -// } -// + + return true; + } + // // -------------------------- // // MObject MaterialImporter::importStandardShader ( // // FCDGeometryInstance* colladaInstance, @@ -433,4 +429,21 @@ // // DaeTextureList textures; // // } + // -------------------------- + MayaDM::DependNode* MaterialImporter::findMayaMaterial ( const COLLADAFW::UniqueId& val ) const + { + UniqueIdMayaMaterialMap::const_iterator it = mMayaMaterialMap.find ( val ); + if ( it != mMayaMaterialMap.end () ) + { + return it->second; + } + return 0; + } + + // -------------------------- + void MaterialImporter::appendMaterial ( const COLLADAFW::UniqueId& id, MayaDM::DependNode* materialNode ) + { + mMayaMaterialMap [id] = materialNode; + } + } \ No newline at end of file Modified: branches/nextgen/COLLADAMaya/src/COLLADAMayaVisualSceneImporter.cpp =================================================================== --- branches/nextgen/COLLADAMaya/src/COLLADAMayaVisualSceneImporter.cpp 2009-02-11 10:56:37 UTC (rev 351) +++ branches/nextgen/COLLADAMaya/src/COLLADAMayaVisualSceneImporter.cpp 2009-02-11 11:00:27 UTC (rev 352) @@ -19,9 +19,11 @@ #include "COLLADAMayaDagHelper.h" #include "COLLADAMayaSyntax.h" #include "COLLADAMayaGeometryImporter.h" -#include "ColladaMayaException.h" +#include "COLLADAMayaMaterialImporter.h" #include "MayaDMJoint.h" +#include "MayaDMLambert.h" +#include "MayaDMDependNode.h" #include "MayaDMCommands.h" #include "COLLADAFWRotate.h" @@ -41,6 +43,11 @@ namespace COLLADAMaya { + const String VisualSceneImporter::TRANSFORM_NODE_NAME = "Transform"; + const String VisualSceneImporter::SHADING_ENGINE_NAME = "ShadingEngine"; + const String VisualSceneImporter::MATERIAL_INFO_NAME = "MaterialInfo"; + + // ----------------------------------- VisualSceneImporter::VisualSceneImporter ( DocumentImporter* documentImporter ) : BaseImporter ( documentImporter ) @@ -49,8 +56,6 @@ // ----------------------------------- bool VisualSceneImporter::importVisualScene ( const COLLADAFW::VisualScene* visualScene ) { - String visualSceneName = visualScene->getName (); - // Iterate over the root nodes of the current visual scene const COLLADAFW::NodeArray& rootNodes = visualScene->getRootNodes (); size_t count = rootNodes.getCount (); @@ -82,11 +87,7 @@ // Get the unique node name String nodeName = node->getName (); if ( COLLADABU::Utils::equals ( nodeName, "" ) ) - nodeName = node->getSid (); - if ( COLLADABU::Utils::equals ( nodeName, "" ) ) - nodeName = "Transform"; - - // Create a unique name. + nodeName = TRANSFORM_NODE_NAME; nodeName = mTransformNodeIdList.addId ( nodeName ); // Create the node object (joint or node) @@ -164,6 +165,9 @@ // Save for every geometry a list of transform nodes, which refer to it. mGeometryTransformIdsMap [ geometryId ].insert ( nodeId ); + + // Read the shading engines. + readMaterialInstances ( instanceGeometry ); } return true; @@ -733,4 +737,128 @@ return NULL; } + + // ----------------------------------- + void VisualSceneImporter::readMaterialInstances ( const COLLADAFW::InstanceGeometry* instanceGeometry ) + { + // Go through the bound materials + const COLLADAFW::InstanceGeometry::MaterialBindingArray& materialBindingsArray = instanceGeometry->getMaterialBindings (); + size_t numOfBindings = materialBindingsArray.getCount (); + for ( size_t i=0; i<numOfBindings; ++i ) + { + const COLLADAFW::InstanceGeometry::MaterialBinding& materialBinding = materialBindingsArray [i]; + const COLLADAFW::UniqueId& referencedMaterialId = materialBinding.getReferencedMaterial (); + + // Get the material id and the shading engine name. + COLLADAFW::MaterialId materialId = materialBinding.getMaterialId (); + + // Check if already a shading engine with the materialId exist. + MayaDM::ShadingEngine* shadingEngine; + MayaDM::MaterialInfo* materialInfo; + String shadingEngineName; + ShaderData* shaderData = findShaderData ( materialId ); + if ( shaderData == 0 ) + { + // Get the unique shading engine name. + shadingEngineName = materialBinding.getName (); + if ( COLLADABU::Utils::equals ( shadingEngineName, COLLADABU::Utils::EMPTY_STRING )) + shadingEngineName = SHADING_ENGINE_NAME; + shadingEngineName = mShadingEngineIdList.addId ( shadingEngineName ); + + // Create a shading engine, if we not already have one. + FILE* file = getDocumentImporter ()->getFile (); + shadingEngine = new MayaDM::ShadingEngine ( file, shadingEngineName.c_str () ); + + // Create the material info node for the shading engine. + // createNode materialInfo -name "materialInfo2"; + String materialInfoName = MATERIAL_INFO_NAME; + materialInfoName = mMaterialInfoIdList.addId ( materialInfoName ); + MayaDM::MaterialInfo* materialInfo = new MayaDM::MaterialInfo ( file, materialInfoName.c_str () ); + + // Push it in the map of shading engines + appendShaderData ( materialId, shadingEngine, materialInfo ); + + // Connect the message attribute of the shading engine + // with the shading group of the material info. + // connectAttr "blinn1SG.message" "materialInfo2.shadingGroup"; + connectAttr ( file, shadingEngine->getMessage (), materialInfo->getShadingGroup () ); + + MaterialImporter* materialImporter = getDocumentImporter ()->getMaterialImporter (); + MayaDM::DependNode* materialNode = materialImporter->findMayaMaterial ( referencedMaterialId ); + + // If the materials are already imported, we make the + // connection between the shading engine a... [truncated message content] |
From: <jud...@us...> - 2009-02-11 10:56:50
|
Revision: 351 http://colladamaya.svn.sourceforge.net/colladamaya/?rev=351&view=rev Author: judithschenk Date: 2009-02-11 10:56:37 +0000 (Wed, 11 Feb 2009) Log Message: ----------- Possibility of copy maya nodes; setter for the node names and parents; getter also for connectable attributes; document design; header copyright; Modified Paths: -------------- branches/nextgen/Externals/MayaDataModel/include/MayaDMAbstractBaseCreate.h branches/nextgen/Externals/MayaDataModel/include/MayaDMAbstractBaseNurbsConversion.h branches/nextgen/Externals/MayaDataModel/include/MayaDMAddDoubleLinear.h branches/nextgen/Externals/MayaDataModel/include/MayaDMAddMatrix.h branches/nextgen/Externals/MayaDataModel/include/MayaDMAimConstraint.h branches/nextgen/Externals/MayaDataModel/include/MayaDMAirField.h branches/nextgen/Externals/MayaDataModel/include/MayaDMAlignCurve.h branches/nextgen/Externals/MayaDataModel/include/MayaDMAlignSurface.h branches/nextgen/Externals/MayaDataModel/include/MayaDMAmbientLight.h branches/nextgen/Externals/MayaDataModel/include/MayaDMAngleBetween.h branches/nextgen/Externals/MayaDataModel/include/MayaDMAnimBlend.h branches/nextgen/Externals/MayaDataModel/include/MayaDMAnimBlendInOut.h branches/nextgen/Externals/MayaDataModel/include/MayaDMAnimClip.h branches/nextgen/Externals/MayaDataModel/include/MayaDMAnimCurve.h branches/nextgen/Externals/MayaDataModel/include/MayaDMAnimCurveTA.h branches/nextgen/Externals/MayaDataModel/include/MayaDMAnimCurveTL.h branches/nextgen/Externals/MayaDataModel/include/MayaDMAnimCurveTT.h branches/nextgen/Externals/MayaDataModel/include/MayaDMAnimCurveTU.h branches/nextgen/Externals/MayaDataModel/include/MayaDMAnimCurveUA.h branches/nextgen/Externals/MayaDataModel/include/MayaDMAnimCurveUL.h branches/nextgen/Externals/MayaDataModel/include/MayaDMAnimCurveUT.h branches/nextgen/Externals/MayaDataModel/include/MayaDMAnimCurveUU.h branches/nextgen/Externals/MayaDataModel/include/MayaDMAnisotropic.h branches/nextgen/Externals/MayaDataModel/include/MayaDMAnnotationShape.h branches/nextgen/Externals/MayaDataModel/include/MayaDMArcLengthDimension.h branches/nextgen/Externals/MayaDataModel/include/MayaDMAreaLight.h branches/nextgen/Externals/MayaDataModel/include/MayaDMArrayMapper.h branches/nextgen/Externals/MayaDataModel/include/MayaDMAttachCurve.h branches/nextgen/Externals/MayaDataModel/include/MayaDMAttachSurface.h branches/nextgen/Externals/MayaDataModel/include/MayaDMAudio.h branches/nextgen/Externals/MayaDataModel/include/MayaDMAvgCurves.h branches/nextgen/Externals/MayaDataModel/include/MayaDMAvgNurbsSurfacePoints.h branches/nextgen/Externals/MayaDataModel/include/MayaDMAvgSurfacePoints.h branches/nextgen/Externals/MayaDataModel/include/MayaDMBakeSet.h branches/nextgen/Externals/MayaDataModel/include/MayaDMBaseGeometryVarGroup.h branches/nextgen/Externals/MayaDataModel/include/MayaDMBaseLattice.h branches/nextgen/Externals/MayaDataModel/include/MayaDMBaseShadingSwitch.h branches/nextgen/Externals/MayaDataModel/include/MayaDMBevel.h branches/nextgen/Externals/MayaDataModel/include/MayaDMBevelPlus.h branches/nextgen/Externals/MayaDataModel/include/MayaDMBirailSrf.h branches/nextgen/Externals/MayaDataModel/include/MayaDMBlend.h branches/nextgen/Externals/MayaDataModel/include/MayaDMBlendColorSets.h branches/nextgen/Externals/MayaDataModel/include/MayaDMBlendColors.h branches/nextgen/Externals/MayaDataModel/include/MayaDMBlendDevice.h branches/nextgen/Externals/MayaDataModel/include/MayaDMBlendShape.h branches/nextgen/Externals/MayaDataModel/include/MayaDMBlendTwoAttr.h branches/nextgen/Externals/MayaDataModel/include/MayaDMBlendWeighted.h branches/nextgen/Externals/MayaDataModel/include/MayaDMBlindDataTemplate.h branches/nextgen/Externals/MayaDataModel/include/MayaDMBlinn.h branches/nextgen/Externals/MayaDataModel/include/MayaDMBoneLattice.h branches/nextgen/Externals/MayaDataModel/include/MayaDMBoolean.h branches/nextgen/Externals/MayaDataModel/include/MayaDMBoundary.h branches/nextgen/Externals/MayaDataModel/include/MayaDMBoundaryBase.h branches/nextgen/Externals/MayaDataModel/include/MayaDMBrownian.h branches/nextgen/Externals/MayaDataModel/include/MayaDMBrush.h branches/nextgen/Externals/MayaDataModel/include/MayaDMBulge.h branches/nextgen/Externals/MayaDataModel/include/MayaDMBump2d.h branches/nextgen/Externals/MayaDataModel/include/MayaDMBump3d.h branches/nextgen/Externals/MayaDataModel/include/MayaDMCacheBase.h branches/nextgen/Externals/MayaDataModel/include/MayaDMCacheBlend.h branches/nextgen/Externals/MayaDataModel/include/MayaDMCacheFile.h branches/nextgen/Externals/MayaDataModel/include/MayaDMCamera.h branches/nextgen/Externals/MayaDataModel/include/MayaDMCameraView.h branches/nextgen/Externals/MayaDataModel/include/MayaDMCgfxShader.h branches/nextgen/Externals/MayaDataModel/include/MayaDMCharacter.h branches/nextgen/Externals/MayaDataModel/include/MayaDMCharacterMap.h branches/nextgen/Externals/MayaDataModel/include/MayaDMCharacterOffset.h branches/nextgen/Externals/MayaDataModel/include/MayaDMChecker.h branches/nextgen/Externals/MayaDataModel/include/MayaDMChoice.h branches/nextgen/Externals/MayaDataModel/include/MayaDMChooser.h branches/nextgen/Externals/MayaDataModel/include/MayaDMClamp.h branches/nextgen/Externals/MayaDataModel/include/MayaDMClipLibrary.h branches/nextgen/Externals/MayaDataModel/include/MayaDMClipScheduler.h branches/nextgen/Externals/MayaDataModel/include/MayaDMCloseCurve.h branches/nextgen/Externals/MayaDataModel/include/MayaDMCloseSurface.h branches/nextgen/Externals/MayaDataModel/include/MayaDMClosestPointOnMesh.h branches/nextgen/Externals/MayaDataModel/include/MayaDMClosestPointOnSurface.h branches/nextgen/Externals/MayaDataModel/include/MayaDMCloth.h branches/nextgen/Externals/MayaDataModel/include/MayaDMCloud.h branches/nextgen/Externals/MayaDataModel/include/MayaDMCluster.h branches/nextgen/Externals/MayaDataModel/include/MayaDMClusterHandle.h branches/nextgen/Externals/MayaDataModel/include/MayaDMCommands.h branches/nextgen/Externals/MayaDataModel/include/MayaDMCondition.h branches/nextgen/Externals/MayaDataModel/include/MayaDMConnectables.h branches/nextgen/Externals/MayaDataModel/include/MayaDMConstraint.h branches/nextgen/Externals/MayaDataModel/include/MayaDMContainer.h branches/nextgen/Externals/MayaDataModel/include/MayaDMContrast.h branches/nextgen/Externals/MayaDataModel/include/MayaDMControlPoint.h branches/nextgen/Externals/MayaDataModel/include/MayaDMCopyColorSet.h branches/nextgen/Externals/MayaDataModel/include/MayaDMCopyUVSet.h branches/nextgen/Externals/MayaDataModel/include/MayaDMCrater.h branches/nextgen/Externals/MayaDataModel/include/MayaDMCreateColorSet.h branches/nextgen/Externals/MayaDataModel/include/MayaDMCreateUVSet.h branches/nextgen/Externals/MayaDataModel/include/MayaDMCurveFromMesh.h branches/nextgen/Externals/MayaDataModel/include/MayaDMCurveFromMeshCoM.h branches/nextgen/Externals/MayaDataModel/include/MayaDMCurveFromMeshEdge.h branches/nextgen/Externals/MayaDataModel/include/MayaDMCurveFromSubdiv.h branches/nextgen/Externals/MayaDataModel/include/MayaDMCurveFromSubdivEdge.h branches/nextgen/Externals/MayaDataModel/include/MayaDMCurveFromSubdivFace.h branches/nextgen/Externals/MayaDataModel/include/MayaDMCurveFromSurface.h branches/nextgen/Externals/MayaDataModel/include/MayaDMCurveFromSurfaceBnd.h branches/nextgen/Externals/MayaDataModel/include/MayaDMCurveFromSurfaceCoS.h branches/nextgen/Externals/MayaDataModel/include/MayaDMCurveFromSurfaceIso.h branches/nextgen/Externals/MayaDataModel/include/MayaDMCurveInfo.h branches/nextgen/Externals/MayaDataModel/include/MayaDMCurveIntersect.h branches/nextgen/Externals/MayaDataModel/include/MayaDMCurveNormalizer.h branches/nextgen/Externals/MayaDataModel/include/MayaDMCurveNormalizerAngle.h branches/nextgen/Externals/MayaDataModel/include/MayaDMCurveNormalizerLinear.h branches/nextgen/Externals/MayaDataModel/include/MayaDMCurveRange.h branches/nextgen/Externals/MayaDataModel/include/MayaDMCurveShape.h branches/nextgen/Externals/MayaDataModel/include/MayaDMCurveVarGroup.h branches/nextgen/Externals/MayaDataModel/include/MayaDMDagNode.h branches/nextgen/Externals/MayaDataModel/include/MayaDMDagPose.h branches/nextgen/Externals/MayaDataModel/include/MayaDMDefaultLightList.h branches/nextgen/Externals/MayaDataModel/include/MayaDMDefaultRenderUtilityList.h branches/nextgen/Externals/MayaDataModel/include/MayaDMDefaultShaderList.h branches/nextgen/Externals/MayaDataModel/include/MayaDMDefaultTextureList.h branches/nextgen/Externals/MayaDataModel/include/MayaDMDeformBend.h branches/nextgen/Externals/MayaDataModel/include/MayaDMDeformFlare.h branches/nextgen/Externals/MayaDataModel/include/MayaDMDeformFunc.h branches/nextgen/Externals/MayaDataModel/include/MayaDMDeformSine.h branches/nextgen/Externals/MayaDataModel/include/MayaDMDeformSquash.h branches/nextgen/Externals/MayaDataModel/include/MayaDMDeformTwist.h branches/nextgen/Externals/MayaDataModel/include/MayaDMDeformWave.h branches/nextgen/Externals/MayaDataModel/include/MayaDMDeformableShape.h branches/nextgen/Externals/MayaDataModel/include/MayaDMDeleteColorSet.h branches/nextgen/Externals/MayaDataModel/include/MayaDMDeleteComponent.h branches/nextgen/Externals/MayaDataModel/include/MayaDMDeleteUVSet.h branches/nextgen/Externals/MayaDataModel/include/MayaDMDependNode.h branches/nextgen/Externals/MayaDataModel/include/MayaDMDetachCurve.h branches/nextgen/Externals/MayaDataModel/include/MayaDMDetachSurface.h branches/nextgen/Externals/MayaDataModel/include/MayaDMDimensionShape.h branches/nextgen/Externals/MayaDataModel/include/MayaDMDirectedDisc.h branches/nextgen/Externals/MayaDataModel/include/MayaDMDirectionalLight.h branches/nextgen/Externals/MayaDataModel/include/MayaDMDiskCache.h branches/nextgen/Externals/MayaDataModel/include/MayaDMDisplacementShader.h branches/nextgen/Externals/MayaDataModel/include/MayaDMDisplayLayer.h branches/nextgen/Externals/MayaDataModel/include/MayaDMDisplayLayerManager.h branches/nextgen/Externals/MayaDataModel/include/MayaDMDistanceBetween.h branches/nextgen/Externals/MayaDataModel/include/MayaDMDistanceDimShape.h branches/nextgen/Externals/MayaDataModel/include/MayaDMDof.h branches/nextgen/Externals/MayaDataModel/include/MayaDMDoubleShadingSwitch.h branches/nextgen/Externals/MayaDataModel/include/MayaDMDpBirailSrf.h branches/nextgen/Externals/MayaDataModel/include/MayaDMDragField.h branches/nextgen/Externals/MayaDataModel/include/MayaDMDropoffLocator.h branches/nextgen/Externals/MayaDataModel/include/MayaDMDynBase.h branches/nextgen/Externals/MayaDataModel/include/MayaDMDynGlobals.h branches/nextgen/Externals/MayaDataModel/include/MayaDMDynamicConstraint.h branches/nextgen/Externals/MayaDataModel/include/MayaDMEntity.h branches/nextgen/Externals/MayaDataModel/include/MayaDMEnvBall.h branches/nextgen/Externals/MayaDataModel/include/MayaDMEnvChrome.h branches/nextgen/Externals/MayaDataModel/include/MayaDMEnvCube.h branches/nextgen/Externals/MayaDataModel/include/MayaDMEnvFacade.h branches/nextgen/Externals/MayaDataModel/include/MayaDMEnvFog.h branches/nextgen/Externals/MayaDataModel/include/MayaDMEnvSky.h branches/nextgen/Externals/MayaDataModel/include/MayaDMEnvSphere.h branches/nextgen/Externals/MayaDataModel/include/MayaDMEnvironmentFog.h branches/nextgen/Externals/MayaDataModel/include/MayaDMExplodeNurbsShell.h branches/nextgen/Externals/MayaDataModel/include/MayaDMExpression.h branches/nextgen/Externals/MayaDataModel/include/MayaDMExtendCurve.h branches/nextgen/Externals/MayaDataModel/include/MayaDMExtendSurface.h branches/nextgen/Externals/MayaDataModel/include/MayaDMExtrude.h branches/nextgen/Externals/MayaDataModel/include/MayaDMFacade.h branches/nextgen/Externals/MayaDataModel/include/MayaDMFfBlendSrf.h branches/nextgen/Externals/MayaDataModel/include/MayaDMFfBlendSrfObsolete.h branches/nextgen/Externals/MayaDataModel/include/MayaDMFfFilletSrf.h branches/nextgen/Externals/MayaDataModel/include/MayaDMFfd.h branches/nextgen/Externals/MayaDataModel/include/MayaDMField.h branches/nextgen/Externals/MayaDataModel/include/MayaDMFile.h branches/nextgen/Externals/MayaDataModel/include/MayaDMFilletCurve.h branches/nextgen/Externals/MayaDataModel/include/MayaDMFilter.h branches/nextgen/Externals/MayaDataModel/include/MayaDMFilterClosestSample.h branches/nextgen/Externals/MayaDataModel/include/MayaDMFilterEuler.h branches/nextgen/Externals/MayaDataModel/include/MayaDMFilterResample.h branches/nextgen/Externals/MayaDataModel/include/MayaDMFilterSimplify.h branches/nextgen/Externals/MayaDataModel/include/MayaDMFitBspline.h branches/nextgen/Externals/MayaDataModel/include/MayaDMFlexorShape.h branches/nextgen/Externals/MayaDataModel/include/MayaDMFlow.h branches/nextgen/Externals/MayaDataModel/include/MayaDMFluidEmitter.h branches/nextgen/Externals/MayaDataModel/include/MayaDMFluidShape.h branches/nextgen/Externals/MayaDataModel/include/MayaDMFluidTexture2D.h branches/nextgen/Externals/MayaDataModel/include/MayaDMFluidTexture3D.h branches/nextgen/Externals/MayaDataModel/include/MayaDMFollicle.h branches/nextgen/Externals/MayaDataModel/include/MayaDMFourByFourMatrix.h branches/nextgen/Externals/MayaDataModel/include/MayaDMFractal.h branches/nextgen/Externals/MayaDataModel/include/MayaDMFrameCache.h branches/nextgen/Externals/MayaDataModel/include/MayaDMFurAttractors.h branches/nextgen/Externals/MayaDataModel/include/MayaDMFurCurveAttractors.h branches/nextgen/Externals/MayaDataModel/include/MayaDMFurDescription.h branches/nextgen/Externals/MayaDataModel/include/MayaDMFurFeedback.h branches/nextgen/Externals/MayaDataModel/include/MayaDMFurGlobals.h branches/nextgen/Externals/MayaDataModel/include/MayaDMFurPointOnMeshInfo.h branches/nextgen/Externals/MayaDataModel/include/MayaDMFurPointOnSubd.h branches/nextgen/Externals/MayaDataModel/include/MayaDMGammaCorrect.h branches/nextgen/Externals/MayaDataModel/include/MayaDMGeoConnectable.h branches/nextgen/Externals/MayaDataModel/include/MayaDMGeoConnector.h branches/nextgen/Externals/MayaDataModel/include/MayaDMGeometryConstraint.h branches/nextgen/Externals/MayaDataModel/include/MayaDMGeometryFilter.h branches/nextgen/Externals/MayaDataModel/include/MayaDMGeometryShape.h branches/nextgen/Externals/MayaDataModel/include/MayaDMGeometryVarGroup.h branches/nextgen/Externals/MayaDataModel/include/MayaDMGlobalCacheControl.h branches/nextgen/Externals/MayaDataModel/include/MayaDMGlobalStitch.h branches/nextgen/Externals/MayaDataModel/include/MayaDMGranite.h branches/nextgen/Externals/MayaDataModel/include/MayaDMGravityField.h branches/nextgen/Externals/MayaDataModel/include/MayaDMGrid.h branches/nextgen/Externals/MayaDataModel/include/MayaDMGroupId.h branches/nextgen/Externals/MayaDataModel/include/MayaDMGroupParts.h branches/nextgen/Externals/MayaDataModel/include/MayaDMGuide.h branches/nextgen/Externals/MayaDataModel/include/MayaDMHairConstraint.h branches/nextgen/Externals/MayaDataModel/include/MayaDMHairSystem.h branches/nextgen/Externals/MayaDataModel/include/MayaDMHairTubeShader.h branches/nextgen/Externals/MayaDataModel/include/MayaDMHardenPoint.h branches/nextgen/Externals/MayaDataModel/include/MayaDMHardwareRenderGlobals.h branches/nextgen/Externals/MayaDataModel/include/MayaDMHeightField.h branches/nextgen/Externals/MayaDataModel/include/MayaDMHikEffector.h branches/nextgen/Externals/MayaDataModel/include/MayaDMHikFloorContactMarker.h branches/nextgen/Externals/MayaDataModel/include/MayaDMHikGroundPlane.h branches/nextgen/Externals/MayaDataModel/include/MayaDMHikHandle.h branches/nextgen/Externals/MayaDataModel/include/MayaDMHikSolver.h branches/nextgen/Externals/MayaDataModel/include/MayaDMHistorySwitch.h branches/nextgen/Externals/MayaDataModel/include/MayaDMHoldMatrix.h branches/nextgen/Externals/MayaDataModel/include/MayaDMHsvToRgb.h branches/nextgen/Externals/MayaDataModel/include/MayaDMHwReflectionMap.h branches/nextgen/Externals/MayaDataModel/include/MayaDMHwRenderGlobals.h branches/nextgen/Externals/MayaDataModel/include/MayaDMHwShader.h branches/nextgen/Externals/MayaDataModel/include/MayaDMHyperGraphInfo.h branches/nextgen/Externals/MayaDataModel/include/MayaDMHyperLayout.h branches/nextgen/Externals/MayaDataModel/include/MayaDMHyperView.h branches/nextgen/Externals/MayaDataModel/include/MayaDMIkEffector.h branches/nextgen/Externals/MayaDataModel/include/MayaDMIkHandle.h branches/nextgen/Externals/MayaDataModel/include/MayaDMIkMCsolver.h branches/nextgen/Externals/MayaDataModel/include/MayaDMIkPASolver.h branches/nextgen/Externals/MayaDataModel/include/MayaDMIkRPsolver.h branches/nextgen/Externals/MayaDataModel/include/MayaDMIkSCsolver.h branches/nextgen/Externals/MayaDataModel/include/MayaDMIkSolver.h branches/nextgen/Externals/MayaDataModel/include/MayaDMIkSplineSolver.h branches/nextgen/Externals/MayaDataModel/include/MayaDMIkSystem.h branches/nextgen/Externals/MayaDataModel/include/MayaDMImagePlane.h branches/nextgen/Externals/MayaDataModel/include/MayaDMImplicitBox.h branches/nextgen/Externals/MayaDataModel/include/MayaDMImplicitCone.h branches/nextgen/Externals/MayaDataModel/include/MayaDMImplicitSphere.h branches/nextgen/Externals/MayaDataModel/include/MayaDMInsertKnotCurve.h branches/nextgen/Externals/MayaDataModel/include/MayaDMInsertKnotSurface.h branches/nextgen/Externals/MayaDataModel/include/MayaDMInstancer.h branches/nextgen/Externals/MayaDataModel/include/MayaDMIntersectSurface.h branches/nextgen/Externals/MayaDataModel/include/MayaDMJiggle.h branches/nextgen/Externals/MayaDataModel/include/MayaDMJoint.h branches/nextgen/Externals/MayaDataModel/include/MayaDMJointCluster.h branches/nextgen/Externals/MayaDataModel/include/MayaDMJointFfd.h branches/nextgen/Externals/MayaDataModel/include/MayaDMJointLattice.h branches/nextgen/Externals/MayaDataModel/include/MayaDMLambert.h branches/nextgen/Externals/MayaDataModel/include/MayaDMLattice.h branches/nextgen/Externals/MayaDataModel/include/MayaDMLayeredShader.h branches/nextgen/Externals/MayaDataModel/include/MayaDMLayeredTexture.h branches/nextgen/Externals/MayaDataModel/include/MayaDMLeastSquaresModifier.h branches/nextgen/Externals/MayaDataModel/include/MayaDMLeather.h branches/nextgen/Externals/MayaDataModel/include/MayaDMLight.h branches/nextgen/Externals/MayaDataModel/include/MayaDMLightFog.h branches/nextgen/Externals/MayaDataModel/include/MayaDMLightInfo.h branches/nextgen/Externals/MayaDataModel/include/MayaDMLightLinker.h branches/nextgen/Externals/MayaDataModel/include/MayaDMLightList.h branches/nextgen/Externals/MayaDataModel/include/MayaDMLineModifier.h branches/nextgen/Externals/MayaDataModel/include/MayaDMLocator.h branches/nextgen/Externals/MayaDataModel/include/MayaDMLodGroup.h branches/nextgen/Externals/MayaDataModel/include/MayaDMLodThresholds.h branches/nextgen/Externals/MayaDataModel/include/MayaDMLoft.h branches/nextgen/Externals/MayaDataModel/include/MayaDMLookAt.h branches/nextgen/Externals/MayaDataModel/include/MayaDMLuminance.h branches/nextgen/Externals/MayaDataModel/include/MayaDMMakeCircularArc.h branches/nextgen/Externals/MayaDataModel/include/MayaDMMakeGroup.h branches/nextgen/Externals/MayaDataModel/include/MayaDMMakeIllustratorCurves.h branches/nextgen/Externals/MayaDataModel/include/MayaDMMakeNurbCircle.h branches/nextgen/Externals/MayaDataModel/include/MayaDMMakeNurbCone.h branches/nextgen/Externals/MayaDataModel/include/MayaDMMakeNurbCube.h branches/nextgen/Externals/MayaDataModel/include/MayaDMMakeNurbCylinder.h branches/nextgen/Externals/MayaDataModel/include/MayaDMMakeNurbPlane.h branches/nextgen/Externals/MayaDataModel/include/MayaDMMakeNurbSphere.h branches/nextgen/Externals/MayaDataModel/include/MayaDMMakeNurbTorus.h branches/nextgen/Externals/MayaDataModel/include/MayaDMMakeNurbsSquare.h branches/nextgen/Externals/MayaDataModel/include/MayaDMMakeTextCurves.h branches/nextgen/Externals/MayaDataModel/include/MayaDMMakeThreePointCircularArc.h branches/nextgen/Externals/MayaDataModel/include/MayaDMMakeTwoPointCircularArc.h branches/nextgen/Externals/MayaDataModel/include/MayaDMMarble.h branches/nextgen/Externals/MayaDataModel/include/MayaDMMaterialFacade.h branches/nextgen/Externals/MayaDataModel/include/MayaDMMaterialInfo.h branches/nextgen/Externals/MayaDataModel/include/MayaDMMentalrayIblShape.h branches/nextgen/Externals/MayaDataModel/include/MayaDMMentalrayTexture.h branches/nextgen/Externals/MayaDataModel/include/MayaDMMesh.h branches/nextgen/Externals/MayaDataModel/include/MayaDMMeshVarGroup.h branches/nextgen/Externals/MayaDataModel/include/MayaDMMotionPath.h branches/nextgen/Externals/MayaDataModel/include/MayaDMMountain.h branches/nextgen/Externals/MayaDataModel/include/MayaDMMovie.h branches/nextgen/Externals/MayaDataModel/include/MayaDMMpBirailSrf.h branches/nextgen/Externals/MayaDataModel/include/MayaDMMultDoubleLinear.h branches/nextgen/Externals/MayaDataModel/include/MayaDMMultMatrix.h branches/nextgen/Externals/MayaDataModel/include/MayaDMMultilisterLight.h branches/nextgen/Externals/MayaDataModel/include/MayaDMMultiplyDivide.h branches/nextgen/Externals/MayaDataModel/include/MayaDMMute.h branches/nextgen/Externals/MayaDataModel/include/MayaDMNCloth.h branches/nextgen/Externals/MayaDataModel/include/MayaDMNComponent.h branches/nextgen/Externals/MayaDataModel/include/MayaDMNParticle.h branches/nextgen/Externals/MayaDataModel/include/MayaDMNRigid.h branches/nextgen/Externals/MayaDataModel/include/MayaDMNetwork.h branches/nextgen/Externals/MayaDataModel/include/MayaDMNewtonField.h branches/nextgen/Externals/MayaDataModel/include/MayaDMNoise.h branches/nextgen/Externals/MayaDataModel/include/MayaDMNonAmbientLightShapeNode.h branches/nextgen/Externals/MayaDataModel/include/MayaDMNonExtendedLightShapeNode.h branches/nextgen/Externals/MayaDataModel/include/MayaDMNonLinear.h branches/nextgen/Externals/MayaDataModel/include/MayaDMNormalConstraint.h branches/nextgen/Externals/MayaDataModel/include/MayaDMNucleus.h branches/nextgen/Externals/MayaDataModel/include/MayaDMNurbsCurve.h branches/nextgen/Externals/MayaDataModel/include/MayaDMNurbsDimShape.h branches/nextgen/Externals/MayaDataModel/include/MayaDMNurbsSurface.h branches/nextgen/Externals/MayaDataModel/include/MayaDMNurbsTessellate.h branches/nextgen/Externals/MayaDataModel/include/MayaDMNurbsToSubdiv.h branches/nextgen/Externals/MayaDataModel/include/MayaDMNurbsToSubdivProc.h branches/nextgen/Externals/MayaDataModel/include/MayaDMObjectAttrFilter.h branches/nextgen/Externals/MayaDataModel/include/MayaDMObjectBinFilter.h branches/nextgen/Externals/MayaDataModel/include/MayaDMObjectFilter.h branches/nextgen/Externals/MayaDataModel/include/MayaDMObjectMultiFilter.h branches/nextgen/Externals/MayaDataModel/include/MayaDMObjectNameFilter.h branches/nextgen/Externals/MayaDataModel/include/MayaDMObjectRenderFilter.h branches/nextgen/Externals/MayaDataModel/include/MayaDMObjectScriptFilter.h branches/nextgen/Externals/MayaDataModel/include/MayaDMObjectSet.h branches/nextgen/Externals/MayaDataModel/include/MayaDMObjectTypeFilter.h branches/nextgen/Externals/MayaDataModel/include/MayaDMOcean.h branches/nextgen/Externals/MayaDataModel/include/MayaDMOceanShader.h branches/nextgen/Externals/MayaDataModel/include/MayaDMOffsetCos.h branches/nextgen/Externals/MayaDataModel/include/MayaDMOffsetCurve.h branches/nextgen/Externals/MayaDataModel/include/MayaDMOffsetSurface.h branches/nextgen/Externals/MayaDataModel/include/MayaDMOldBlindDataBase.h branches/nextgen/Externals/MayaDataModel/include/MayaDMOpticalFX.h branches/nextgen/Externals/MayaDataModel/include/MayaDMOrientConstraint.h branches/nextgen/Externals/MayaDataModel/include/MayaDMOrientationMarker.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPairBlend.h branches/nextgen/Externals/MayaDataModel/include/MayaDMParamDimension.h branches/nextgen/Externals/MayaDataModel/include/MayaDMParentConstraint.h branches/nextgen/Externals/MayaDataModel/include/MayaDMParentTessellate.h branches/nextgen/Externals/MayaDataModel/include/MayaDMParticle.h branches/nextgen/Externals/MayaDataModel/include/MayaDMParticleAgeMapper.h branches/nextgen/Externals/MayaDataModel/include/MayaDMParticleCloud.h branches/nextgen/Externals/MayaDataModel/include/MayaDMParticleColorMapper.h branches/nextgen/Externals/MayaDataModel/include/MayaDMParticleIncandMapper.h branches/nextgen/Externals/MayaDataModel/include/MayaDMParticleSamplerInfo.h branches/nextgen/Externals/MayaDataModel/include/MayaDMParticleTranspMapper.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPartition.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPassMatrix.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPfxGeometry.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPfxHair.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPfxToon.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPhong.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPhongE.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPlace2dTexture.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPlace3dTexture.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPlanarTrimSurface.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPlane.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPlusMinusAverage.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPointConstraint.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPointEmitter.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPointLight.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPointMatrixMult.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPointOnCurveInfo.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPointOnSurfaceInfo.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPoleVectorConstraint.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyAppend.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyAppendVertex.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyAutoProj.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyAverageVertex.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyBase.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyBevel.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyBlindData.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyBoolOp.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyBridgeEdge.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyChipOff.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyCloseBorder.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyCollapseEdge.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyCollapseF.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyColorDel.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyColorMod.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyColorPerVertex.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyCone.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyCopyUV.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyCrease.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyCreaseEdge.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyCreateFace.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyCreator.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyCube.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyCut.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyCylProj.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyCylinder.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyDelEdge.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyDelFacet.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyDelVertex.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyDuplicateEdge.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyExtrudeEdge.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyExtrudeFace.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyExtrudeVertex.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyFlipEdge.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyFlipUV.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyHelix.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyLayoutUV.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyMapCut.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyMapDel.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyMapSew.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyMapSewMove.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyMergeEdge.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyMergeFace.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyMergeUV.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyMergeVert.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyMirror.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyModifier.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyModifierUV.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyModifierWorld.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyMoveEdge.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyMoveFace.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyMoveFacetUV.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyMoveUV.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyMoveVertex.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyNormal.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyNormalPerVertex.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyNormalizeUV.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyOptUvs.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyPipe.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyPlanarProj.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyPlane.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyPlatonicSolid.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyPoke.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyPrimitive.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyPrimitiveMisc.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyPrism.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyProj.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyPyramid.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyQuad.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyReduce.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolySeparate.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolySewEdge.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolySmooth.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolySmoothFace.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolySmoothProxy.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolySoftEdge.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolySphProj.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolySphere.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolySplit.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolySplitEdge.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolySplitRing.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolySplitVert.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyStraightenUVBorder.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolySubdEdge.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolySubdFace.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyToSubdiv.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyTorus.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyTransfer.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyTriangulate.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyTweak.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyTweakUV.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyUnite.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPolyWedgeFace.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPositionMarker.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPostProcessList.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPrecompiledHeaders.cpp branches/nextgen/Externals/MayaDataModel/include/MayaDMPrimitive.h branches/nextgen/Externals/MayaDataModel/include/MayaDMProjectCurve.h branches/nextgen/Externals/MayaDataModel/include/MayaDMProjectTangent.h branches/nextgen/Externals/MayaDataModel/include/MayaDMProjection.h branches/nextgen/Externals/MayaDataModel/include/MayaDMProxyManager.h branches/nextgen/Externals/MayaDataModel/include/MayaDMPsdFileTex.h branches/nextgen/Externals/MayaDataModel/include/MayaDMQuadShadingSwitch.h branches/nextgen/Externals/MayaDataModel/include/MayaDMRadialField.h branches/nextgen/Externals/MayaDataModel/include/MayaDMRamp.h branches/nextgen/Externals/MayaDataModel/include/MayaDMRampShader.h branches/nextgen/Externals/MayaDataModel/include/MayaDMRbfSrf.h branches/nextgen/Externals/MayaDataModel/include/MayaDMRebuildCurve.h branches/nextgen/Externals/MayaDataModel/include/MayaDMRebuildSurface.h branches/nextgen/Externals/MayaDataModel/include/MayaDMRecord.h branches/nextgen/Externals/MayaDataModel/include/MayaDMReference.h branches/nextgen/Externals/MayaDataModel/include/MayaDMReflect.h branches/nextgen/Externals/MayaDataModel/include/MayaDMRemapColor.h branches/nextgen/Externals/MayaDataModel/include/MayaDMRemapHsv.h branches/nextgen/Externals/MayaDataModel/include/MayaDMRemapValue.h branches/nextgen/Externals/MayaDataModel/include/MayaDMRenderBox.h branches/nextgen/Externals/MayaDataModel/include/MayaDMRenderCone.h branches/nextgen/Externals/MayaDataModel/include/MayaDMRenderGlobals.h branches/nextgen/Externals/MayaDataModel/include/MayaDMRenderGlobalsList.h branches/nextgen/Externals/MayaDataModel/include/MayaDMRenderLayer.h branches/nextgen/Externals/MayaDataModel/include/MayaDMRenderLayerManager.h branches/nextgen/Externals/MayaDataModel/include/MayaDMRenderLight.h branches/nextgen/Externals/MayaDataModel/include/MayaDMRenderQuality.h branches/nextgen/Externals/MayaDataModel/include/MayaDMRenderRect.h branches/nextgen/Externals/MayaDataModel/include/MayaDMRenderSphere.h branches/nextgen/Externals/MayaDataModel/include/MayaDMResolution.h branches/nextgen/Externals/MayaDataModel/include/MayaDMResultCurve.h branches/nextgen/Externals/MayaDataModel/include/MayaDMResultCurveTimeToAngular.h branches/nextgen/Externals/MayaDataModel/include/MayaDMResultCurveTimeToLinear.h branches/nextgen/Externals/MayaDataModel/include/MayaDMResultCurveTimeToTime.h branches/nextgen/Externals/MayaDataModel/include/MayaDMResultCurveTimeToUnitless.h branches/nextgen/Externals/MayaDataModel/include/MayaDMReverse.h branches/nextgen/Externals/MayaDataModel/include/MayaDMReverseCurve.h branches/nextgen/Externals/MayaDataModel/include/MayaDMReverseSurface.h branches/nextgen/Externals/MayaDataModel/include/MayaDMRevolve.h branches/nextgen/Externals/MayaDataModel/include/MayaDMRevolvedPrimitive.h branches/nextgen/Externals/MayaDataModel/include/MayaDMRgbToHsv.h branches/nextgen/Externals/MayaDataModel/include/MayaDMRigidBody.h branches/nextgen/Externals/MayaDataModel/include/MayaDMRigidConstraint.h branches/nextgen/Externals/MayaDataModel/include/MayaDMRigidSolver.h branches/nextgen/Externals/MayaDataModel/include/MayaDMRock.h branches/nextgen/Externals/MayaDataModel/include/MayaDMRoundConstantRadius.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSampler.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSamplerInfo.h branches/nextgen/Externals/MayaDataModel/include/MayaDMScaleConstraint.h branches/nextgen/Externals/MayaDataModel/include/MayaDMScript.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSculpt.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSelectionListOperator.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSetRange.h branches/nextgen/Externals/MayaDataModel/include/MayaDMShaderGlow.h branches/nextgen/Externals/MayaDataModel/include/MayaDMShadingEngine.h branches/nextgen/Externals/MayaDataModel/include/MayaDMShadingMap.h branches/nextgen/Externals/MayaDataModel/include/MayaDMShape.h branches/nextgen/Externals/MayaDataModel/include/MayaDMShellTessellate.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSimpleVolumeShader.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSingleShadingSwitch.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSketchPlane.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSkinCluster.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSmear.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSmoothCurve.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSmoothTangentSrf.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSnapshot.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSnapshotShape.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSnow.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSoftMod.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSoftModHandle.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSolidFractal.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSpBirailSrf.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSpotLight.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSpring.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSquareSrf.h branches/nextgen/Externals/MayaDataModel/include/MayaDMStableHeaders.h branches/nextgen/Externals/MayaDataModel/include/MayaDMStencil.h branches/nextgen/Externals/MayaDataModel/include/MayaDMStitchAsNurbsShell.h branches/nextgen/Externals/MayaDataModel/include/MayaDMStitchSrf.h branches/nextgen/Externals/MayaDataModel/include/MayaDMStroke.h branches/nextgen/Externals/MayaDataModel/include/MayaDMStrokeGlobals.h branches/nextgen/Externals/MayaDataModel/include/MayaDMStucco.h branches/nextgen/Externals/MayaDataModel/include/MayaDMStudioClearCoat.h branches/nextgen/Externals/MayaDataModel/include/MayaDMStyleCurve.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSubCurve.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSubSurface.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSubdAddTopology.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSubdAutoProj.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSubdBase.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSubdBlindData.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSubdCleanTopology.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSubdHierBlind.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSubdLayoutUV.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSubdMapCut.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSubdMapSewMove.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSubdModifier.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSubdModifierUV.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSubdModifierWorld.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSubdPlanarProj.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSubdTweak.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSubdTweakUV.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSubdiv.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSubdivCollapse.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSubdivComponentId.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSubdivReverseFaces.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSubdivSurfaceVarGroup.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSubdivToNurbs.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSubdivToPoly.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSurfaceInfo.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSurfaceLuminance.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSurfaceSampler.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSurfaceShader.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSurfaceShape.h branches/nextgen/Externals/MayaDataModel/include/MayaDMSurfaceVarGroup.h branches/nextgen/Externals/MayaDataModel/include/MayaDMTangentConstraint.h branches/nextgen/Externals/MayaDataModel/include/MayaDMTexture2d.h branches/nextgen/Externals/MayaDataModel/include/MayaDMTexture3d.h branches/nextgen/Externals/MayaDataModel/include/MayaDMTextureBakeSet.h branches/nextgen/Externals/MayaDataModel/include/MayaDMTextureEnv.h branches/nextgen/Externals/MayaDataModel/include/MayaDMTextureToGeom.h branches/nextgen/Externals/MayaDataModel/include/MayaDMTime.h branches/nextgen/Externals/MayaDataModel/include/MayaDMTimeFunction.h branches/nextgen/Externals/MayaDataModel/include/MayaDMTimeToUnitConversion.h branches/nextgen/Externals/MayaDataModel/include/MayaDMToonLineAttributes.h branches/nextgen/Externals/MayaDataModel/include/MayaDMTransferAttributes.h branches/nextgen/Externals/MayaDataModel/include/MayaDMTransform.h branches/nextgen/Externals/MayaDataModel/include/MayaDMTransformGeometry.h branches/nextgen/Externals/MayaDataModel/include/MayaDMTrim.h branches/nextgen/Externals/MayaDataModel/include/MayaDMTrimWithBoundaries.h branches/nextgen/Externals/MayaDataModel/include/MayaDMTripleShadingSwitch.h branches/nextgen/Externals/MayaDataModel/include/MayaDMTurbulenceField.h branches/nextgen/Externals/MayaDataModel/include/MayaDMTweak.h branches/nextgen/Externals/MayaDataModel/include/MayaDMTypes.h branches/nextgen/Externals/MayaDataModel/include/MayaDMUniformField.h branches/nextgen/Externals/MayaDataModel/include/MayaDMUnitConversion.h branches/nextgen/Externals/MayaDataModel/include/MayaDMUnitToTimeConversion.h branches/nextgen/Externals/MayaDataModel/include/MayaDMUnknown.h branches/nextgen/Externals/MayaDataModel/include/MayaDMUnknownDag.h branches/nextgen/Externals/MayaDataModel/include/MayaDMUnknownTransform.h branches/nextgen/Externals/MayaDataModel/include/MayaDMUntrim.h branches/nextgen/Externals/MayaDataModel/include/MayaDMUseBackground.h branches/nextgen/Externals/MayaDataModel/include/MayaDMUvChooser.h branches/nextgen/Externals/MayaDataModel/include/MayaDMVectorProduct.h branches/nextgen/Externals/MayaDataModel/include/MayaDMVectorRenderGlobals.h branches/nextgen/Externals/MayaDataModel/include/MayaDMVertexBakeSet.h branches/nextgen/Externals/MayaDataModel/include/MayaDMVolumeAxisField.h branches/nextgen/Externals/MayaDataModel/include/MayaDMVolumeFog.h branches/nextgen/Externals/MayaDataModel/include/MayaDMVolumeLight.h branches/nextgen/Externals/MayaDataModel/include/MayaDMVolumeNoise.h branches/nextgen/Externals/MayaDataModel/include/MayaDMVolumeShader.h branches/nextgen/Externals/MayaDataModel/include/MayaDMVortexField.h branches/nextgen/Externals/MayaDataModel/include/MayaDMWater.h branches/nextgen/Externals/MayaDataModel/include/MayaDMWeightGeometryFilter.h branches/nextgen/Externals/MayaDataModel/include/MayaDMWire.h branches/nextgen/Externals/MayaDataModel/include/MayaDMWood.h branches/nextgen/Externals/MayaDataModel/include/MayaDMWrap.h branches/nextgen/Externals/MayaDataModel/include/MayaDMWtAddMatrix.h Property Changed: ---------------- branches/nextgen/Externals/MayaDataModel/ Property changes on: branches/nextgen/Externals/MayaDataModel ___________________________________________________________________ Added: svn:ignore + changes.txt Modified: branches/nextgen/Externals/MayaDataModel/include/MayaDMAbstractBaseCreate.h =================================================================== --- branches/nextgen/Externals/MayaDataModel/include/MayaDMAbstractBaseCreate.h 2009-02-10 14:34:30 UTC (rev 350) +++ branches/nextgen/Externals/MayaDataModel/include/MayaDMAbstractBaseCreate.h 2009-02-11 10:56:37 UTC (rev 351) @@ -1,5 +1,5 @@ /* - Copyright (c) 2008 NetAllied Systems GmbH + Copyright (c) 2008-2009 NetAllied Systems GmbH This file is part of MayaDataModel. @@ -17,10 +17,12 @@ class AbstractBaseCreate : public DependNode { public: + AbstractBaseCreate():DependNode(){} AbstractBaseCreate(FILE* file,const std::string& name,const std::string& parent=""):DependNode(file, name, parent, "abstractBaseCreate"){} virtual ~AbstractBaseCreate(){} protected: - AbstractBaseCreate(FILE* file,const std::string& name,const std::string& parent,const std::string& nodeType):DependNode(file, name, parent, nodeType) {} + AbstractBaseCreate(FILE* file,const std::string& name,const std::string& parent,const std::string& nodeType) + :DependNode(file, name, parent, nodeType) {} }; }//namespace MayaDM Modified: branches/nextgen/Externals/MayaDataModel/include/MayaDMAbstractBaseNurbsConversion.h =================================================================== --- branches/nextgen/Externals/MayaDataModel/include/MayaDMAbstractBaseNurbsConversion.h 2009-02-10 14:34:30 UTC (rev 350) +++ branches/nextgen/Externals/MayaDataModel/include/MayaDMAbstractBaseNurbsConversion.h 2009-02-11 10:56:37 UTC (rev 351) @@ -1,5 +1,5 @@ /* - Copyright (c) 2008 NetAllied Systems GmbH + Copyright (c) 2008-2009 NetAllied Systems GmbH This file is part of MayaDataModel. @@ -17,10 +17,12 @@ class AbstractBaseNurbsConversion : public AbstractBaseCreate { public: + AbstractBaseNurbsConversion():AbstractBaseCreate(){} AbstractBaseNurbsConversion(FILE* file,const std::string& name,const std::string& parent=""):AbstractBaseCreate(file, name, parent, "abstractBaseNurbsConversion"){} virtual ~AbstractBaseNurbsConversion(){} protected: - AbstractBaseNurbsConversion(FILE* file,const std::string& name,const std::string& parent,const std::string& nodeType):AbstractBaseCreate(file, name, parent, nodeType) {} + AbstractBaseNurbsConversion(FILE* file,const std::string& name,const std::string& parent,const std::string& nodeType) + :AbstractBaseCreate(file, name, parent, nodeType) {} }; }//namespace MayaDM Modified: branches/nextgen/Externals/MayaDataModel/include/MayaDMAddDoubleLinear.h =================================================================== --- branches/nextgen/Externals/MayaDataModel/include/MayaDMAddDoubleLinear.h 2009-02-10 14:34:30 UTC (rev 350) +++ branches/nextgen/Externals/MayaDataModel/include/MayaDMAddDoubleLinear.h 2009-02-11 10:56:37 UTC (rev 351) @@ -1,5 +1,5 @@ /* - Copyright (c) 2008 NetAllied Systems GmbH + Copyright (c) 2008-2009 NetAllied Systems GmbH This file is part of MayaDataModel. @@ -18,18 +18,19 @@ { public: public: + AddDoubleLinear():DependNode(){} AddDoubleLinear(FILE* file,const std::string& name,const std::string& parent=""):DependNode(file, name, parent, "addDoubleLinear"){} virtual ~AddDoubleLinear(){} void setInput1(double i1) { if(i1 == 0) return; - fprintf(mFile,"setAttr \".i1\" %f;\n", i1); + fprintf(mFile,"\tsetAttr \".i1\" %f;\n", i1); } void setInput2(double i2) { if(i2 == 0) return; - fprintf(mFile,"setAttr \".i2\" %f;\n", i2); + fprintf(mFile,"\tsetAttr \".i2\" %f;\n", i2); } void getInput1() @@ -48,7 +49,8 @@ } protected: - AddDoubleLinear(FILE* file,const std::string& name,const std::string& parent,const std::string& nodeType):DependNode(file, name, parent, nodeType) {} + AddDoubleLinear(FILE* file,const std::string& name,const std::string& parent,const std::string& nodeType) + :DependNode(file, name, parent, nodeType) {} }; }//namespace MayaDM Modified: branches/nextgen/Externals/MayaDataModel/include/MayaDMAddMatrix.h =================================================================== --- branches/nextgen/Externals/MayaDataModel/include/MayaDMAddMatrix.h 2009-02-10 14:34:30 UTC (rev 350) +++ branches/nextgen/Externals/MayaDataModel/include/MayaDMAddMatrix.h 2009-02-11 10:56:37 UTC (rev 351) @@ -1,5 +1,5 @@ /* - Copyright (c) 2008 NetAllied Systems GmbH + Copyright (c) 2008-2009 NetAllied Systems GmbH This file is part of MayaDataModel. @@ -18,19 +18,20 @@ { public: public: + AddMatrix():DependNode(){} AddMatrix(FILE* file,const std::string& name,const std::string& parent=""):DependNode(file, name, parent, "addMatrix"){} virtual ~AddMatrix(){} void setMatrixIn(size_t i_i,const matrix& i_) { if(i_ == identity) return; - fprintf(mFile,"setAttr \".i[%i]\" -type \"matrix\" ",i_i); + fprintf(mFile,"\tsetAttr \".i[%i]\" -type \"matrix\" ",i_i); i_.write(mFile); fprintf(mFile,";\n"); } void setMatrixIn(size_t i_start,size_t i_end,matrix* i_) { - fprintf(mFile,"setAttr \".i[%i:%i]\" ", i_start,i_end); + fprintf(mFile,"\tsetAttr \".i[%i:%i]\" ", i_start,i_end); size_t size = (i_end-i_start)*1+1; for(size_t i=0;i<size;++i) { @@ -42,7 +43,7 @@ } void startMatrixIn(size_t i_start,size_t i_end) { - fprintf(mFile,"setAttr \".i[%i:%i]\"",i_start,i_end); + fprintf(mFile,"\tsetAttr \".i[%i:%i]\"",i_start,i_end); fprintf(mFile," -type \"matrix\" "); } @@ -68,7 +69,8 @@ } protected: - AddMatrix(FILE* file,const std::string& name,const std::string& parent,const std::string& nodeType):DependNode(file, name, parent, nodeType) {} + AddMatrix(FILE* file,const std::string& name,const std::string& parent,const std::string& nodeType) + :DependNode(file, name, parent, nodeType) {} }; }//namespace MayaDM Modified: branches/nextgen/Externals/MayaDataModel/include/MayaDMAimConstraint.h =================================================================== --- branches/nextgen/Externals/MayaDataModel/include/MayaDMAimConstraint.h 2009-02-10 14:34:30 UTC (rev 350) +++ branches/nextgen/Externals/MayaDataModel/include/MayaDMAimConstraint.h 2009-02-11 10:56:37 UTC (rev 351) @@ -1,5 +1,5 @@ /* - Copyright (c) 2008 NetAllied Systems GmbH + Copyright (c) 2008-2009 NetAllied Systems GmbH This file is part of MayaDataModel. @@ -37,18 +37,19 @@ } }; public: + AimConstraint():Constraint(){} AimConstraint(FILE* file,const std::string& name,const std::string& parent=""):Constraint(file, name, parent, "aimConstraint"){} virtual ~AimConstraint(){} void setTarget(size_t tg_i,const Target& tg) { - fprintf(mFile,"setAttr \".tg[%i]\" ",tg_i); + fprintf(mFile,"\tsetAttr \".tg[%i]\" ",tg_i); tg.write(mFile); fprintf(mFile,";\n"); } void setTargetTranslate(size_t tg_i,const double3& tt) { - fprintf(mFile,"setAttr \".tg[%i].tt\" -type \"double3\" ",tg_i); + fprintf(mFile,"\tsetAttr \".tg[%i].tt\" -type \"double3\" ",tg_i); tt.write(mFile); fprintf(mFile,";\n"); @@ -56,24 +57,24 @@ void setTargetTranslateX(size_t tg_i,double ttx) { if(ttx == 0) return; - fprintf(mFile,"setAttr \".tg[%i].tt.ttx\" %f;\n", tg_i,ttx); + fprintf(mFile,"\tsetAttr \".tg[%i].tt.ttx\" %f;\n", tg_i,ttx); } void setTargetTranslateY(size_t tg_i,double tty) { if(tty == 0) return; - fprintf(mFile,"setAttr \".tg[%i].tt.tty\" %f;\n", tg_i,tty); + fprintf(mFile,"\tsetAttr \".tg[%i].tt.tty\" %f;\n", tg_i,tty); } void setTargetTranslateZ(size_t tg_i,double ttz) { if(ttz == 0) return; - fprintf(mFile,"setAttr \".tg[%i].tt.ttz\" %f;\n", tg_i,ttz); + fprintf(mFile,"\tsetAttr \".tg[%i].tt.ttz\" %f;\n", tg_i,ttz); } void setTargetRotatePivot(size_t tg_i,const double3& trp) { - fprintf(mFile,"setAttr \".tg[%i].trp\" -type \"double3\" ",tg_i); + fprintf(mFile,"\tsetAttr \".tg[%i].trp\" -type \"double3\" ",tg_i); trp.write(mFile); fprintf(mFile,";\n"); @@ -81,24 +82,24 @@ void setTargetRotatePivotX(size_t tg_i,double trpx) { if(trpx == 0) return; - fprintf(mFile,"setAttr \".tg[%i].trp.trpx\" %f;\n", tg_i,trpx); + fprintf(mFile,"\tsetAttr \".tg[%i].trp.trpx\" %f;\n", tg_i,trpx); } void setTargetRotatePivotY(size_t tg_i,double trpy) { if(trpy == 0) return; - fprintf(mFile,"setAttr \".tg[%i].trp.trpy\" %f;\n", tg_i,trpy); + fprintf(mFile,"\tsetAttr \".tg[%i].trp.trpy\" %f;\n", tg_i,trpy); } void setTargetRotatePivotZ(size_t tg_i,double trpz) { if(trpz == 0) return; - fprintf(mFile,"setAttr \".tg[%i].trp.trpz\" %f;\n", tg_i,trpz); + fprintf(mFile,"\tsetAttr \".tg[%i].trp.trpz\" %f;\n", tg_i,trpz); } void setTargetRotateTranslate(size_t tg_i,const double3& trt) { - fprintf(mFile,"setAttr \".tg[%i].trt\" -type \"double3\" ",tg_i); + fprintf(mFile,"\tsetAttr \".tg[%i].trt\" -type \"double3\" ",tg_i); trt.write(mFile); fprintf(mFile,";\n"); @@ -106,25 +107,25 @@ void setTargetRotateTranslateX(size_t tg_i,double trtx) { if(trtx == 0) return; - fprintf(mFile,"setAttr \".tg[%i].trt.trtx\" %f;\n", tg_i,trtx); + fprintf(mFile,"\tsetAttr \".tg[%i].trt.trtx\" %f;\n", tg_i,trtx); } void setTargetRotateTranslateY(size_t tg_i,double trty) { if(trty == 0) return; - fprintf(mFile,"setAttr \".tg[%i].trt.trty\" %f;\n", tg_i,trty); + fprintf(mFile,"\tsetAttr \".tg[%i].trt.trty\" %f;\n", tg_i,trty); } void setTargetRotateTranslateZ(size_t tg_i,double trtz) { if(trtz == 0) return; - fprintf(mFile,"setAttr \".tg[%i].trt.trtz\" %f;\n", tg_i,trtz); + fprintf(mFile,"\tsetAttr \".tg[%i].trt.trtz\" %f;\n", tg_i,trtz); } void setTargetParentMatrix(size_t tg_i,const matrix& tpm) { if(tpm == identity) return; - fprintf(mFile,"setAttr \".tg[%i].tpm\" -type \"matrix\" ",tg_i); + fprintf(mFile,"\tsetAttr \".tg[%i].tpm\" -type \"matrix\" ",tg_i); tpm.write(mFile); fprintf(mFile,";\n"); @@ -132,13 +133,13 @@ void setTargetWeight(size_t tg_i,double tw) { if(tw == 1.0) return; - fprintf(mFile,"setAttr \".tg[%i].tw\" %f;\n", tg_i,tw); + fprintf(mFile,"\tsetAttr \".tg[%i].tw\" %f;\n", tg_i,tw); } void setConstraintParentInverseMatrix(const matrix& cpim) { if(cpim == identity) return; - fprintf(mFile,"setAttr \".cpim\" -type \"matrix\" "); + fprintf(mFile,"\tsetAttr \".cpim\" -type \"matrix\" "); cpim.write(mFile); fprintf(mFile,";\n"); @@ -146,7 +147,7 @@ void setAimVector(const double3& a) { if(a == double3(1.0,0.0,0.0)) return; - fprintf(mFile,"setAttr \".a\" -type \"double3\" "); + fprintf(mFile,"\tsetAttr \".a\" -type \"double3\" "); a.write(mFile); fprintf(mFile,";\n"); @@ -154,25 +155,25 @@ void setAimVectorX(double ax) { if(ax == 1.0) return; - fprintf(mFile,"setAttr \".a.ax\" %f;\n", ax); + fprintf(mFile,"\tsetAttr \".a.ax\" %f;\n", ax); } void setAimVectorY(double ay) { if(ay == 0.0) return; - fprintf(mFile,"setAttr \".a.ay\" %f;\n", ay); + fprintf(mFile,"\tsetAttr \".a.ay\" %f;\n", ay); } void setAimVectorZ(double az) { if(az == 0.0) return; - fprintf(mFile,"setAttr \".a.az\" %f;\n", az); + fprintf(mFile,"\tsetAttr \".a.az\" %f;\n", az); } void setUpVector(const double3& u) { if(u == double3(0.0,1.0,0.0)) return; - fprintf(mFile,"setAttr \".u\" -type \"double3\" "); + fprintf(mFile,"\tsetAttr \".u\" -type \"double3\" "); u.write(mFile); fprintf(mFile,";\n"); @@ -180,25 +181,25 @@ void setUpVectorX(double ux) { if(ux == 0.0) return; - fprintf(mFile,"setAttr \".u.ux\" %f;\n", ux); + fprintf(mFile,"\tsetAttr \".u.ux\" %f;\n", ux); } void setUpVectorY(double uy) { if(uy == 1.0) return; - fprintf(mFile,"setAttr \".u.uy\" %f;\n", uy); + fprintf(mFile,"\tsetAttr \".u.uy\" %f;\n", uy); } void setUpVectorZ(double uz) { if(uz == 0.0) return; - fprintf(mFile,"setAttr \".u.uz\" %f;\n", uz); + fprintf(mFile,"\tsetAttr \".u.uz\" %f;\n", uz); } void setWorldUpVector(const double3& wu) { if(wu == double3(0.0,1.0,0.0)) return; - fprintf(mFile,"setAttr \".wu\" -type \"double3\" "); + fprintf(mFile,"\tsetAttr \".wu\" -type \"double3\" "); wu.write(mFile); fprintf(mFile,";\n"); @@ -206,25 +207,25 @@ void setWorldUpVectorX(double wux) { if(wux == 0.0) return; - fprintf(mFile,"setAttr \".wu.wux\" %f;\n", wux); + fprintf(mFile,"\tsetAttr \".wu.wux\" %f;\n", wux); } void setWorldUpVectorY(double wuy) { if(wuy == 1.0) return; - fprintf(mFile,"setAttr \".wu.wuy\" %f;\n", wuy); + fprintf(mFile,"\tsetAttr \".wu.wuy\" %f;\n", wuy); } void setWorldUpVectorZ(double wuz) { if(wuz == 0.0) return; - fprintf(mFile,"setAttr \".wu.wuz\" %f;\n", wuz); + fprintf(mFile,"\tsetAttr \".wu.wuz\" %f;\n", wuz); } void setWorldUpMatrix(const matrix& wum) { if(wum == identity) return; - fprintf(mFile,"setAttr \".wum\" -type \"matrix\" "); + fprintf(mFile,"\tsetAttr \".wum\" -type \"matrix\" "); wum.write(mFile); fprintf(mFile,";\n"); @@ -232,12 +233,12 @@ void setWorldUpType(unsigned int wut) { if(wut == 3) return; - fprintf(mFile,"setAttr \".wut\" %i;\n", wut); + fprintf(mFile,"\tsetAttr \".wut\" %i;\n", wut); } void setConstraintTranslate(const double3& ct) { - fprintf(mFile,"setAttr \".ct\" -type \"double3\" "); + fprintf(mFile,"\tsetAttr \".ct\" -type \"double3\" "); ct.write(mFile); fprintf(mFile,";\n"); @@ -245,24 +246,24 @@ void setConstraintTranslateX(double ctx) { if(ctx == 0) return; - fprintf(mFile,"setAttr \".ct.ctx\" %f;\n", ctx); + fprintf(mFile,"\tsetAttr \".ct.ctx\" %f;\n", ctx); } void setConstraintTranslateY(double cty) { if(cty == 0) return; - fprintf(mFile,"setAttr \".ct.cty\" %f;\n", cty); + fprintf(mFile,"\tsetAttr \".ct.cty\" %f;\n", cty); } void setConstraintTranslateZ(double ctz) { if(ctz == 0) return; - fprintf(mFile,"setAttr \".ct.ctz\" %f;\n", ctz); + fprintf(mFile,"\tsetAttr \".ct.ctz\" %f;\n", ctz); } void setConstraintRotatePivot(const double3& crp) { - fprintf(mFile,"setAttr \".crp\" -type \"double3\" "); + fprintf(mFile,"\tsetAttr \".crp\" -type \"double3\" "); crp.write(mFile); fprintf(mFile,";\n"); @@ -270,24 +271,24 @@ void setConstraintRotatePivotX(double crpx) { if(crpx == 0) return; - fprintf(mFile,"setAttr \".crp.crpx\" %f;\n", crpx); + fprintf(mFile,"\tsetAttr \".crp.crpx\" %f;\n", crpx); } void setConstraintRotatePivotY(double crpy) { if(crpy == 0) return; - fprintf(mFile,"setA... [truncated message content] |