void ClearWorld bool lvs g_LoadEnd g_LoadEnd false AddToLog Очистка да

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
void ClearWorld()
{
bool lvs = g_LoadEnd;
g_LoadEnd = false;
AddToLog("Очистка данных редактора...");
// очищаем массив текстур
vector< Material >::iterator m = g_Texture.begin();
while ( m != g_Texture.end() )
{
if(m->IsInit)
{
m->IsInit = false;
vector< Material >::iterator k = g_Texture.begin();
while ( k != g_Texture.end() )
{
if(m->Tex == k->Tex && m != k)
k->Tex = NULL;
k++;
}
if(m->Tex != NULL)
{
m->Tex->Release();
m->Tex = NULL;
}
}
m++;
}
g_Texture.clear();
// очищаем массив мешей
vector< RenderMesh >::iterator r = g_Mesh.begin();
while ( r != g_Mesh.end() )
{
if( r->IsInit && r->Mesh != NULL )
{
r->Mesh->Release();
r->Mesh = NULL;
}
r++;
}
g_Mesh.clear();
// очищаем массив обьектов
g_Object.clear();
AddToLog("Очистка завершена");
SendMessage(GetDlgItem(g_hWnd, ID_STATUSBAR), SB_SETTEXT, 0, (LPARAM)"World not loaded");
g_LoadEnd = lvs;
}