scene.h

Go to the documentation of this file.
00001 
00002 //**************************************************************************/
00003 // Copyright (c) 2008 Autodesk, Inc.
00004 // All rights reserved.
00005 //
00006 // Use of this software is subject to the terms of the Autodesk license
00007 // agreement provided at the time of installation or download, or which
00008 // otherwise accompanies this software in either electronic or hard copy form.
00009 //
00010 //**************************************************************************/
00011 // DESCRIPTION:
00012 // CREATED: October 2008
00013 //**************************************************************************/
00014 
00015 namespace mudbox {
00016 
00018 class MBDLL_DECL SceneMembershipEventNotifier : public Node
00019 {
00020     DECLARE_CLASS;
00021 
00023     enum Type
00024     {
00025         eAboutToAdd,
00026         eAdded,
00027         eAboutToRemove,
00028         eRemoved
00029     } m_eType;
00030 
00032     aptr<TreeNode> m_pNode;
00033 };
00034 
00040 class MBDLL_DECL Scene : virtual public TreeNode
00041 {
00042     DECLARE_CLASS;
00043 
00044 protected:
00053     Scene( void );
00054 
00055 public:
00056 
00058     struct MBDLL_DECL LoadData
00059     {
00064         enum UpdateFilter
00065         {
00066             updateGeometries = 0x00000001,  
00067             updateCameras = 0x00000002,     
00068             updateAll = 0xffffffff,         
00069             updateNone = 0x00000000         
00070         };
00071 
00073         enum IncludeFilter
00074         {
00075             includeGeometries = 0x00000001,             
00076             includeCameras = 0x00000002,                
00077             includeMaterials = 0x00000004,              
00078             includeLights = 0x00000008,                 
00079             includeCurves = 0x00000010,                 
00080             includeSelectionSets = 0x00000020,          
00081             includeTransformationPalettes = 0x00000040, 
00082             includeAll = 0xffffffff,                    
00083             includeNone = 0x00000000                    
00084         };
00085 
00088         int& IncludeFilter() { return m_eIncludeFilter; }
00089 
00092         int& UpdateFilter() { return m_eUpdateFilter; }
00093 
00095         bool& Merge() { return m_bMerge; }
00096 
00098         void AddDiagnosticMessage( const QString& sMessage ) { m_aDiagnosticMessages.push_back( sMessage ); }
00099 
00101         void LogDiagnosticMessages() const;
00102 
00104         LoadData( bool bMerge = false, int eIncludeFilter = includeAll, int eUpdateFilter = updateNone );
00105 
00107         LoadData( int eUpdateFilter, bool bMerge = false );
00108 
00110         static LoadData ByInclude( bool bGeoms, bool bCams, bool bMats, bool bLights, bool bCurves, bool bSets, bool bPalettes );
00111 
00115         static LoadData& ByMerge( bool bMerge = false );
00116 
00118         bool IncludeGeometries() const { return m_eIncludeFilter & includeGeometries; }
00119 
00121         bool IncludeCameras() const { return m_eIncludeFilter & includeCameras; }
00122 
00124         bool IncludeMaterials() const { return m_eIncludeFilter & includeMaterials; }
00125         
00127         bool IncludeLights() const { return m_eIncludeFilter & includeLights; }
00128         
00130         bool IncludeCurves() const { return m_eIncludeFilter & includeCurves; }
00131         
00133         bool IncludeSelectionSets() const { return m_eIncludeFilter & includeSelectionSets; }
00134 
00136         bool IncludeTransformationPalettes() const { return m_eIncludeFilter & includeTransformationPalettes; }
00137 
00139         bool UpdateGeometries() const { return m_eUpdateFilter & updateGeometries; }
00140 
00142         bool UpdateCameras() const { return m_eUpdateFilter & updateCameras; }
00143         
00144     private:
00145         int m_eIncludeFilter; 
00146 
00147         int m_eUpdateFilter;
00148         
00149         bool m_bMerge;
00150 
00151         QStringList m_aDiagnosticMessages;
00152     };
00153 
00154     // Returns a list of strings of all selected items in the Object List
00155     virtual QStringList SelectedObjectListNames ( void );
00156 
00158     virtual mudbox::CurveBase *ActiveCurve( void ) const;
00159 
00161     virtual void SetActiveCurve( mudbox::CurveBase *curve );
00162 
00164     virtual mudbox::Camera *ActiveCamera( void ) const;
00165 
00167     virtual void SetActiveCamera( mudbox::Camera *camera );
00168 
00170     virtual mudbox::Light *ActiveLight( void ) const;
00171 
00173     virtual unsigned int CameraCount( void ) const;
00174 
00177     virtual unsigned int CurveCount( void ) const;
00178 
00180     virtual unsigned int SelectedCurveCount( void ) const;
00181 
00183     virtual unsigned int LightCount( void ) const;
00184 
00186     virtual unsigned int GeometryCount( void ) const;
00187 
00189     virtual unsigned int SelectedGeometryCount( void ) const;
00190 
00195     virtual mudbox::Camera *AddCamera(
00196         mudbox::Camera *pCamera     
00197         );
00198 
00202     virtual mudbox::Light *AddLight(
00203         mudbox::Light *pLight       
00204         );
00205 
00209     virtual mudbox::CurveBase *AddCurve(
00210         mudbox::CurveBase *pCurve,  
00211         mudbox::Transformation* pTransformation = 0 
00212         );
00213 
00214     
00219     virtual void RemoveCurve(
00220         mudbox::CurveBase *pCurve  
00221         );
00222 
00226     virtual mudbox::Geometry *AddGeometry(
00227         mudbox::Geometry *pGeometry,    
00228         mudbox::Transformation* pTransformation = 0 
00229         );
00230 
00231 
00236     virtual void RemoveGeometry(
00237         mudbox::Geometry *pGeometry  
00238         );
00239 
00244     virtual mudbox::Camera *Camera(
00245         unsigned int iIndex     
00246         ) const;
00247 
00252     virtual mudbox::Light *Light(
00253         unsigned int iIndex     
00254         ) const;
00255 
00260     virtual mudbox::CurveBase *SelectedCurve(
00261         unsigned int iIndex     
00262         ) const;
00263 
00268     virtual mudbox::CurveBase *Curve(
00269         unsigned int iIndex     
00270         ) const;
00271 
00276     virtual mudbox::Geometry *SelectedGeometry(
00277         unsigned int iIndex     
00278         ) const;
00279 
00284     virtual mudbox::Geometry *Geometry(
00285         unsigned int iIndex     
00286         ) const;
00287 
00291     virtual AxisAlignedBoundingBox BoundingBox( void ) const;
00292 
00304     virtual void Render(
00305         bool bSkipMaterials = false     
00306         ) const;
00307         
00309     virtual bool Export(
00310         const QString &sFileName,       
00311         bool bSelectedOnly = false      
00312         );  // export data to an obj file
00313 
00315     virtual bool Load(
00316         QString sFileName,              
00317         Scene::LoadData& cData          
00318         );
00319 
00326     virtual  mudbox::Geometry *Import( 
00327         Scene::LoadData& cData,             
00328         QString sFileName = ""              
00329         );
00330 
00332     virtual bool Save(
00333         QString sFileName               
00334         );
00335         
00341     mudbox::Geometry *ActiveGeometry() const;
00342     
00344     void SetActiveGeometry(
00345         mudbox::Geometry *geometry  
00346         ) const;
00347         
00349     virtual void SetActivePaintLayer(
00350         mudbox::Layer* layer    
00351         );
00352     
00354     virtual void SetActiveTexture(
00355         mudbox::TexturePool* layer  
00356         );
00357     
00361     virtual mudbox::Layer *ActivePaintLayer() const;
00362     
00364     virtual mudbox::TexturePool *ActiveTexture() const;
00365      
00367     virtual void MakeThumbnail(QImage &image, int iSize = 128);
00368 
00371     virtual QString FileName() const;
00372 
00374     virtual bool Dirty() const;
00375 
00378     virtual void SetDirty( bool bDirty = true );
00379 
00383     Mesh *CreateMesh(
00384         Topology::FaceType eType    
00385         );
00386 
00388     static aevent MaterialChangeEvent;
00389 
00392     static aevent ActiveCameraChangeEvent;
00393 
00399     static aptr<mudbox::Geometry> m_pGeometryToAdd;
00400 
00409     static aptr<SceneMembershipEventNotifier> SceneMembershipEvent;
00410 
00413     static aptr<Node> SelectedNode;
00414 
00416     static aevent PaintSelectionEvent;
00417 
00419     static aevent PaintLayerAddedEvent;
00420 
00422     static aevent PaintLayerRemovedEvent;
00423 
00425     static aevent PaintLayerPropertiesChangedEvent;
00426 
00428     static aevent GeometryTransformedEvent;
00429 };
00430 
00431 }; // end of namespace mudbox