MCPcopy Create free account
hub / github.com/OGSR/OGSR-Engine / Instance_Load

Method Instance_Load

ogsr_engine/Layers/xrRender/ModelPool.cpp:96–139  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

94}
95
96dxRender_Visual* CModelPool::Instance_Load(LPCSTR N, BOOL allow_register)
97{
98 string_path fn;
99 string_path name;
100
101 // Add default ext if no ext at all
102 if (nullptr == strext(N))
103 strconcat(sizeof(name), name, N, ".ogf");
104 else
105 xr_strcpy(name, sizeof(name), N);
106
107 // Load data from MESHES or LEVEL
108 if (!FS.exist(fn, fsgame::level, name))
109 {
110 if (!FS.exist(fn, fsgame::game_meshes, name))
111 {
112 FATAL("Can't find model file [%s]", name);
113 }
114 }
115
116 // Actual loading
117#ifdef DEBUG
118 if (bLogging)
119 Msg("- Uncached model loading: %s", fn);
120#endif // DEBUG
121
122 IReader* data = FS.r_open(fn);
123
124 dxRender_Visual* V;
125
126 ogf_header H;
127 data->r_chunk_safe(OGF_HEADER, &H, sizeof(H));
128 V = Instance_Create(H.type);
129 V->Load(N, data, 0);
130 FS.r_close(data);
131
132 g_pGamePersistent->RegisterModel(V);
133
134 // Registration
135 if (allow_register)
136 Instance_Register(N, V);
137
138 return V;
139}
140
141dxRender_Visual* CModelPool::Instance_Load(LPCSTR N, IReader* data, BOOL allow_register)
142{

Callers

nothing calls this directly

Calls 8

strextFunction · 0.85
MsgFunction · 0.85
existMethod · 0.80
r_openMethod · 0.80
r_chunk_safeMethod · 0.80
r_closeMethod · 0.80
RegisterModelMethod · 0.80
LoadMethod · 0.45

Tested by

no test coverage detected