MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / load

Method load

Engine/source/terrain/terrFile.cpp:295–330  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

293}
294
295TerrainFile* TerrainFile::load( const Torque::Path &path )
296{
297 FileStream stream;
298
299 stream.open( path.getFullPath(), Torque::FS::File::Read );
300 if ( stream.getStatus() != Stream::Ok )
301 {
302 Con::errorf( "Resource<TerrainFile>::create - could not open '%s'", path.getFullPath().c_str() );
303 return NULL;
304 }
305
306 U8 version;
307 stream.read(&version);
308 if (version > TerrainFile::FILE_VERSION)
309 {
310 Con::errorf( "Resource<TerrainFile>::create - file version '%i' is newer than engine version '%i'", version, TerrainFile::FILE_VERSION );
311 return NULL;
312 }
313
314 TerrainFile *ret = new TerrainFile;
315 ret->mFileVersion = version;
316 ret->mFilePath = path;
317
318 if ( version >= 7 )
319 ret->_load( stream );
320 else
321 ret->_loadLegacy( stream );
322
323 // Update the collision structures.
324 ret->_buildGridMap();
325
326 // Do the material mapping.
327 ret->_initMaterialInstMapping();
328
329 return ret;
330}
331
332void TerrainFile::_load( FileStream &stream )
333{

Callers 5

initMeshFromFileMethod · 0.45
addSequenceMethod · 0.45
setFileMethod · 0.45
terrImport.cppFile · 0.45

Calls 9

_loadLegacyMethod · 0.80
_buildGridMapMethod · 0.80
openMethod · 0.65
errorfFunction · 0.50
getStatusMethod · 0.45
c_strMethod · 0.45
readMethod · 0.45
_loadMethod · 0.45

Tested by

no test coverage detected