scene.h

Go to the documentation of this file.
00001 
00002 
00003 //**************************************************************************/
00004 
00005 // Copyright (c) 2008 Autodesk, Inc.
00006 
00007 // All rights reserved.
00008 
00009 //
00010 
00011 // Use of this software is subject to the terms of the Autodesk license
00012 
00013 // agreement provided at the time of installation or download, or which
00014 
00015 // otherwise accompanies this software in either electronic or hard copy form.
00016 
00017 //
00018 
00019 //**************************************************************************/
00020 
00021 // DESCRIPTION:
00022 
00023 // CREATED: October 2008
00024 
00025 //**************************************************************************/
00026 
00027 
00028 
00029 namespace mudbox {
00030 
00031 
00032 
00034 
00036 
00038 
00040 
00041 class MBDLL_DECL Scene : virtual public TreeNode
00042 
00043 {
00044 
00045     DECLARE_CLASS;
00046 
00047 
00048 
00049 protected:
00050 
00052 
00054 
00056 
00058 
00060 
00062 
00064 
00066 
00067     Scene( void );
00068 
00069 
00070 
00071 public:
00072 
00073 
00074 
00076 
00077     struct MBDLL_DECL LoadData
00078 
00079     {
00080 
00082 
00084 
00086 
00088 
00089         enum UpdateFilter
00090 
00091         {
00092 
00093             updateGeometries = 0x00000001,  
00094 
00095             updateCameras = 0x00000002,     
00096 
00097             updateAll = 0xffffffff,         
00098 
00099             updateNone = 0x00000000         
00100 
00101         };
00102 
00103 
00104 
00106 
00107         enum IncludeFilter
00108 
00109         {
00110 
00111             includeGeometries = 0x00000001,             
00112 
00113             includeCameras = 0x00000002,                
00114 
00115             includeMaterials = 0x00000004,              
00116 
00117             includeLights = 0x00000008,                 
00118 
00119             includeCurves = 0x00000010,                 
00120 
00121             includeSelectionSets = 0x00000020,          
00122 
00123             includeTransformationPalettes = 0x00000040, 
00124 
00125             includeAll = 0xffffffff,                    
00126 
00127             includeNone = 0x00000000                    
00128 
00129         };
00130 
00131 
00132 
00134 
00136 
00137         int& IncludeFilter() { return m_eIncludeFilter; }
00138 
00139 
00140 
00142 
00144 
00145         int& UpdateFilter() { return m_eUpdateFilter; }
00146 
00147 
00148 
00150 
00151         bool& Merge() { return m_bMerge; }
00152 
00153 
00154 
00156 
00157         void AddDiagnosticMessage( const QString& sMessage ) { m_aDiagnosticMessages.push_back( sMessage ); }
00158 
00159 
00160 
00162 
00163         void LogDiagnosticMessages() const;
00164 
00165 
00166 
00168 
00169         LoadData( bool bMerge = false, int eIncludeFilter = includeAll, int eUpdateFilter = updateNone );
00170 
00171 
00172 
00174 
00175         LoadData( int eUpdateFilter, bool bMerge = false );
00176 
00177 
00178 
00180 
00181         static LoadData ByInclude( bool bGeoms, bool bCams, bool bMats, bool bLights, bool bCurves, bool bSets, bool bPalettes );
00182 
00183 
00184 
00186 
00188 
00190 
00191         static LoadData& ByMerge( bool bMerge = false );
00192 
00193 
00194 
00196 
00197         bool IncludeGeometries() const { return m_eIncludeFilter & includeGeometries; }
00198 
00199 
00200 
00202 
00203         bool IncludeCameras() const { return m_eIncludeFilter & includeCameras; }
00204 
00205 
00206 
00208 
00209         bool IncludeMaterials() const { return m_eIncludeFilter & includeMaterials; }
00210 
00211         
00212 
00214 
00215         bool IncludeLights() const { return m_eIncludeFilter & includeLights; }
00216 
00217         
00218 
00220 
00221         bool IncludeCurves() const { return m_eIncludeFilter & includeCurves; }
00222 
00223         
00224 
00226 
00227         bool IncludeSelectionSets() const { return m_eIncludeFilter & includeSelectionSets; }
00228 
00229 
00230 
00232 
00233         bool IncludeTransformationPalettes() const { return m_eIncludeFilter & includeTransformationPalettes; }
00234 
00235 
00236 
00238 
00239         bool UpdateGeometries() const { return m_eUpdateFilter & updateGeometries; }
00240 
00241 
00242 
00244 
00245         bool UpdateCameras() const { return m_eUpdateFilter & updateCameras; }
00246 
00247         
00248 
00249     private:
00250 
00251         int m_eIncludeFilter; 
00252 
00253 
00254 
00255         int m_eUpdateFilter;
00256 
00257         
00258 
00259         bool m_bMerge;
00260 
00261 
00262 
00263         QStringList m_aDiagnosticMessages;
00264 
00265     };
00266 
00267 
00268 
00270 
00271     virtual mudbox::Camera *ActiveCamera( void ) const;
00272 
00273 
00274 
00276 
00277     virtual void SetActiveCamera( mudbox::Camera *camera );
00278 
00279 
00280 
00282 
00283     virtual mudbox::Light *ActiveLight( void ) const;
00284 
00285 
00286 
00288 
00289     virtual unsigned int CameraCount( void ) const;
00290 
00291 
00292 
00294 
00295     virtual unsigned int LightCount( void ) const;
00296 
00297 
00298 
00300 
00301     virtual unsigned int GeometryCount( void ) const;
00302 
00303 
00304 
00306 
00307     virtual unsigned int SelectedGeometryCount( void ) const;
00308 
00309 
00310 
00312 
00314 
00316 
00318 
00319     virtual mudbox::Camera *AddCamera(
00320 
00321         mudbox::Camera *pCamera     
00322 
00323         );
00324 
00325 
00326 
00328 
00330 
00332 
00333     virtual mudbox::Light *AddLight(
00334 
00335         mudbox::Light *pLight       
00336 
00337         );
00338 
00339 
00340 
00342 
00344 
00346 
00347     virtual mudbox::Geometry *AddGeometry(
00348 
00349         mudbox::Geometry *pGeometry,    
00350 
00351         mudbox::Transformation* pTransformation = 0 
00352 
00353         );
00354 
00355 
00356 
00358 
00360 
00362 
00364 
00365     virtual void RemoveGeometry(
00366 
00367         mudbox::Geometry *pGeometry  
00368 
00369         );
00370 
00371 
00372 
00374 
00376 
00378 
00380 
00381     virtual mudbox::Camera *Camera(
00382 
00383         unsigned int iIndex     
00384 
00385         ) const;
00386 
00387 
00388 
00390 
00392 
00394 
00396 
00397     virtual mudbox::Light *Light(
00398 
00399         unsigned int iIndex     
00400 
00401         ) const;
00402 
00403 
00404 
00406 
00408 
00410 
00412 
00413     virtual mudbox::Geometry *SelectedGeometry(
00414 
00415         unsigned int iIndex     
00416 
00417         ) const;
00418 
00419 
00420 
00422 
00424 
00426 
00428 
00429     virtual mudbox::Geometry *Geometry(
00430 
00431         unsigned int iIndex     
00432 
00433         ) const;
00434 
00435 
00436 
00438 
00440 
00442 
00443     virtual AxisAlignedBoundingBox BoundingBox( void ) const;
00444 
00445 
00446 
00448 
00450 
00452 
00454 
00456 
00458 
00460 
00462 
00464 
00466 
00468 
00469     virtual void Render(
00470 
00471         bool bSkipMaterials = false     
00472 
00473         ) const;
00474 
00475         
00476 
00478 
00479     virtual bool Export(
00480 
00481         const QString &sFileName,       
00482 
00483         bool bSelectedOnly = false      
00484 
00485         );  // export data to an obj file
00486 
00487 
00488 
00490 
00491     virtual bool Load(
00492 
00493         QString sFileName,              
00494 
00495         Scene::LoadData& cData          
00496 
00497         );
00498 
00499 
00500 
00502 
00504 
00506 
00508 
00510 
00512 
00513     virtual  mudbox::Geometry *Import( 
00514 
00515         Scene::LoadData& cData,             
00516 
00517         QString sFileName = ""              
00518 
00519         );
00520 
00521 
00522 
00524 
00525     virtual bool Save(
00526 
00527         QString sFileName               
00528 
00529         );
00530 
00531         
00532 
00534 
00536 
00538 
00540 
00542 
00543     mudbox::Geometry *ActiveGeometry() const;
00544 
00545     
00546 
00548 
00549     void SetActiveGeometry(
00550 
00551         mudbox::Geometry *geometry  
00552 
00553         ) const;
00554 
00555         
00556 
00558 
00559     virtual void SetActivePaintLayer(
00560 
00561         mudbox::Layer* layer    
00562 
00563         );
00564 
00565     
00566 
00568 
00569     virtual void SetActiveTexture(
00570 
00571         mudbox::TexturePool* layer  
00572 
00573         );
00574 
00575     
00576 
00578 
00580 
00582 
00583     virtual mudbox::Layer *ActivePaintLayer() const;
00584 
00585     
00586 
00588 
00589     virtual mudbox::TexturePool *ActiveTexture() const;
00590 
00591      
00592 
00594 
00595     virtual void MakeThumbnail(QImage &image, int iSize = 128);
00596 
00597 
00598 
00600 
00602 
00603     virtual QString FileName() const;
00604 
00605 
00606 
00608 
00609     virtual bool Dirty() const;
00610 
00611 
00612 
00614 
00616 
00617     virtual void SetDirty( bool bDirty = true );
00618 
00619 
00620 
00621     aevent m_eSceneRender;
00622 
00623 };
00624 
00625 
00626 
00627 }; // end of namespace mudbox
00628