#include <scenemanager.h>
Public Member Functions | |
| SceneManager () | |
| Class constructor. | |
| ~SceneManager () | |
| Class destructor. | |
| Scene * | GetScene (SCENE_ID sceneID) const |
| Get scene container. | |
| size_t | GetSceneIDs (std::vector< SCENE_ID > &IDlist) const |
| SCENE_ID | AddSceneGraph (SceneNode *sceneRoot) |
| Scene * | RemoveSceneGraph (SCENE_ID id) |
| Remove scene graph (does not delete). | |
| const Image * | GetImage (const wxString &imgPath, bool loadIfNotFound=true) |
Private Member Functions | |
| WX_DECLARE_STRING_HASH_MAP (Image *, ImageList) | |
Private Attributes | |
| std::vector< Scene * > | sceneList |
| List of managed scenes. | |
| ImageList | imageList |
| Loaded images list. | |
Definition at line 28 of file scenemanager.h.
| SceneManager::SceneManager | ( | ) |
Class constructor.
Definition at line 22 of file scenemanager.cpp.
00023 { 00024 wxImage::AddHandler(new wxRGBHandler()); 00025 }
| SceneManager::~SceneManager | ( | ) |
Class destructor.
Definition at line 28 of file scenemanager.cpp.
00029 { 00030 SAFE_DELETE_ARR_EACH(sceneList, sceneList.size()); 00031 ImageList::iterator it = imageList.begin(); 00032 for ( ; it != imageList.end(); it++) 00033 SAFE_DELETE(it->second); 00034 }
| VRUT::SceneManager::WX_DECLARE_STRING_HASH_MAP | ( | Image * | , | |
| ImageList | ||||
| ) | [private] |
| size_t SceneManager::GetSceneIDs | ( | std::vector< SCENE_ID > & | IDlist | ) | const |
Get list of SCENE_IDs
| [out] | IDlist | List of SCENE_IDs |
Definition at line 37 of file scenemanager.cpp.
00038 { 00039 IDlist.clear(); 00040 for (size_t i=0; i<sceneList.size(); i++) 00041 { 00042 if (sceneList[i]) 00043 IDlist.push_back(SCENE_ID(i)); 00044 } 00045 return IDlist.size(); 00046 }
Add scene graph
Definition at line 49 of file scenemanager.cpp.
00050 { 00051 SCENE_ID id = SCENE_ID(sceneList.size()); 00052 Scene * scene = new Scene(id, KERNEL->GetMessageSink()); 00053 scene->Insert(sceneRoot, NODE_ID_NONE); 00054 sceneList.push_back(scene); 00055 scene->sceneManager = this; 00056 return id; 00057 }
Remove scene graph (does not delete).
Definition at line 60 of file scenemanager.cpp.
00061 { 00062 Scene * scene = GetScene(id); 00063 if (scene) 00064 { 00065 sceneList[id] = (Scene *)NULL; 00066 scene->sceneManager = (SceneManager *)NULL; 00067 } 00068 return scene; 00069 }
| const Image * SceneManager::GetImage | ( | const wxString & | imgPath, | |
| bool | loadIfNotFound = true | |||
| ) |
Get texture image, load from given filename if not loaded NOTE: If called from module, module must call wxInitAllImageHandlers() first
| [in] | imgPath | Path to image file (also a key to hash map with images) |
| [in] | loadIfNotFound | Load texture from file if not found in image list |
NULL Definition at line 72 of file scenemanager.cpp.
00073 { 00074 ImageList::iterator img = imageList.find(imgPath); 00075 if (img != imageList.end()) 00076 return img->second; 00077 else if (loadIfNotFound) 00078 { 00079 wxFileName fname(imgPath); 00080 Image * image = (Image *)NULL; 00081 if (fname.GetExt().IsSameAs(wxT("dds"), false)) 00082 image = new ImageDDS; 00083 else 00084 image = new ImageCommon; 00085 if (image && image->Load(imgPath)) 00086 { 00087 ImageList::Insert_Result res = imageList.insert(ImageList::value_type(imgPath, image)); 00088 if (res.second) 00089 { 00090 wxCommandEvent evRes = Event::GET_EVT_SCENE_IMAGE_ADDED(imgPath); 00091 KERNEL->GetMessageSink()->PostEvent(evRes); 00092 return image; 00093 } 00094 } 00095 else 00096 SAFE_DELETE(image); 00097 } 00098 00099 return (Image *)NULL; 00100 }
std::vector<Scene *> VRUT::SceneManager::sceneList [private] |
ImageList VRUT::SceneManager::imageList [private] |
1.5.5