Skip to content

Commit 37182d8

Browse files
committed
gl_loader: Update implementation.
1 parent 6418f7e commit 37182d8

File tree

1 file changed

+29
-32
lines changed

1 file changed

+29
-32
lines changed

src/Layers/xrRenderPC_GL/gl_loader.cpp

Lines changed: 29 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
11
#include "stdafx.h"
22
#include "rgl.h"
3-
#include "../xrRender/ResourceManager.h"
4-
#include "../xrRender/fbasicvisual.h"
5-
#include "../../xrEngine/fmesh.h"
6-
#include "../../xrEngine/xrLevel.h"
7-
#include "../../xrEngine/x_ray.h"
8-
#include "../../xrEngine/IGame_Persistent.h"
9-
#include "../../xrCore/stream_reader.h"
10-
11-
#include "../xrRenderPC_GL/glRenderDeviceRender.h"
12-
13-
#include "../xrRenderGL/glBufferUtils.h"
14-
15-
#include "../xrRender/FHierrarhyVisual.h"
3+
#include "Layers/xrRender/ResourceManager.h"
4+
#include "Layers/xrRender/FBasicVisual.h"
5+
#include "xrCore/FMesh.hpp"
6+
#include "Common/LevelStructure.hpp"
7+
#include "xrEngine/x_ray.h"
8+
#include "xrEngine/IGame_Persistent.h"
9+
#include "xrCore/stream_reader.h"
10+
#include "Layers/xrRenderGL/glBufferUtils.h"
11+
#include "Layers/xrRender/FHierrarhyVisual.h"
1612

1713
#pragma warning(push)
1814
#pragma warning(disable:4995)
@@ -26,11 +22,12 @@ void CRender::level_Load(IReader* fs)
2622

2723
// Begin
2824
pApp->LoadBegin ();
29-
glRenderDeviceRender::Instance().Resources->DeferredLoad (TRUE);
25+
Resources->DeferredLoad (TRUE);
3026
IReader* chunk;
3127

3228
// Shaders
33-
g_pGamePersistent->LoadTitle ("st_loading_shaders");
29+
// g_pGamePersistent->LoadTitle ("st_loading_shaders");
30+
g_pGamePersistent->LoadTitle ();
3431
{
3532
chunk = fs->open_chunk (fsL_SHADERS);
3633
R_ASSERT2 (chunk,"Level doesn't builded correctly.");
@@ -42,22 +39,23 @@ void CRender::level_Load(IReader* fs)
4239
LPCSTR n = LPCSTR(chunk->pointer());
4340
chunk->skip_stringZ ();
4441
if (0==n[0]) continue;
45-
strcpy_s (n_sh,n);
42+
xr_strcpy (n_sh,n);
4643
LPSTR delim = strchr(n_sh,'/');
4744
*delim = 0;
48-
strcpy_s (n_tlist,delim+1);
49-
Shaders[i] = glRenderDeviceRender::Instance().Resources->Create(n_sh,n_tlist);
45+
xr_strcpy (n_tlist,delim+1);
46+
Shaders[i] = Resources->Create(n_sh,n_tlist);
5047
}
5148
chunk->close();
5249
}
5350

5451
// Components
55-
Wallmarks = new CWallmarksEngine();
56-
Details = new CDetailManager();
52+
Wallmarks = xr_new<CWallmarksEngine> ();
53+
Details = xr_new<CDetailManager> ();
5754

5855
if (!g_dedicated_server) {
5956
// VB,IB,SWI
60-
g_pGamePersistent->LoadTitle("st_loading_geometry");
57+
// g_pGamePersistent->LoadTitle("st_loading_geometry");
58+
g_pGamePersistent->LoadTitle();
6159
{
6260
CStreamReader *geom = FS.rs_open("$level$","level.geom");
6361
R_ASSERT2 (geom, "level.geom");
@@ -75,24 +73,23 @@ void CRender::level_Load(IReader* fs)
7573
}
7674

7775
// Visuals
78-
g_pGamePersistent->LoadTitle("st_loading_spatial_db");
76+
// g_pGamePersistent->LoadTitle("st_loading_spatial_db");
77+
g_pGamePersistent->LoadTitle();
7978
chunk = fs->open_chunk(fsL_VISUALS);
8079
LoadVisuals (chunk);
8180
chunk->close ();
8281

8382
// Details
84-
g_pGamePersistent->LoadTitle("st_loading_details");
83+
// g_pGamePersistent->LoadTitle("st_loading_details");
84+
g_pGamePersistent->LoadTitle();
8585
Details->Load ();
8686
}
8787

8888
// Sectors
89-
g_pGamePersistent->LoadTitle("st_loading_sectors_portals");
89+
// g_pGamePersistent->LoadTitle("st_loading_sectors_portals");
90+
g_pGamePersistent->LoadTitle();
9091
LoadSectors (fs);
9192

92-
// 3D Fluid
93-
// TODO: OGL: Implement 3D Fluid simulation
94-
//Load3DFluid ();
95-
9693
// HOM
9794
HOM.Load ();
9895

@@ -174,7 +171,7 @@ void CRender::level_Unload()
174171
void CRender::LoadBuffers (CStreamReader *base_fs, BOOL _alternative)
175172
{
176173
R_ASSERT2 (base_fs,"Could not load geometry. File not found.");
177-
glRenderDeviceRender::Instance().Resources->Evict ();
174+
Resources->Evict ();
178175
// u32 dwUsage = D3DUSAGE_WRITEONLY;
179176

180177
xr_vector<VertexDeclarator> &_DC = _alternative?xDC:nDC;
@@ -298,7 +295,7 @@ void CRender::LoadSectors(IReader* fs)
298295
u32 count = size/sizeof(b_portal);
299296
Portals.resize (count);
300297
for (u32 c=0; c<count; c++)
301-
Portals[c] = new CPortal();
298+
Portals[c] = xr_new<CPortal> ();
302299

303300
// load sectors
304301
IReader* S = fs->open_chunk(fsL_SECTORS);
@@ -307,7 +304,7 @@ void CRender::LoadSectors(IReader* fs)
307304
IReader* P = S->open_chunk(i);
308305
if (0==P) break;
309306

310-
CSector* __S = new CSector();
307+
CSector* __S = xr_new<CSector> ();
311308
__S->load (*P);
312309
Sectors.push_back (__S);
313310

@@ -344,7 +341,7 @@ void CRender::LoadSectors(IReader* fs)
344341
}
345342

346343
// build portal model
347-
rmPortals = new CDB::MODEL();
344+
rmPortals = xr_new<CDB::MODEL> ();
348345
rmPortals->build (CL.getV(),int(CL.getVS()),CL.getT(),int(CL.getTS()));
349346
} else {
350347
rmPortals = 0;

0 commit comments

Comments
 (0)