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] |