MCPcopy Create free account
hub / github.com/OGRECave/ogre-next / loadImpl

Method loadImpl

OgreMain/src/OgreMesh.cpp:284–328  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

282 //-----------------------------------------------------------------------
283 void Mesh::unprepareImpl() { mFreshFromDisk.reset(); }
284 void Mesh::loadImpl()
285 {
286 OgreProfileExhaustive( "v1::Mesh::loadImpl" );
287
288 MeshSerializer serializer;
289 serializer.setListener( MeshManager::getSingleton().getListener() );
290
291 // If the only copy is local on the stack, it will be cleaned
292 // up reliably in case of exceptions, etc
293 DataStreamPtr data( mFreshFromDisk );
294 mFreshFromDisk.reset();
295
296 if( !data )
297 {
298 OGRE_EXCEPT( Exception::ERR_INVALID_STATE,
299 "Data doesn't appear to have been prepared in " + mName,
300 "Mesh::loadImpl()" );
301 }
302
303 serializer.importMesh( data, this );
304
305 if( mHashForCaches[0] == 0u && mHashForCaches[1] == 0u && Ogre::Mesh::msUseTimestampAsHash )
306 {
307 try
308 {
309 LogManager::getSingleton().logMessage(
310 "Using timestamp as hash cache for Mesh " + mName, LML_TRIVIAL );
311 Archive *archive = ResourceGroupManager::getSingleton()._getArchiveToResource(
312 mName, mGroup, true );
313 mHashForCaches[0] = static_cast<uint64>( archive->getModifiedTime( mName ) );
314 }
315 catch( Exception & )
316 {
317 LogManager::getSingleton().logMessage(
318 "Using timestamp as hash cache for Mesh " + mName, LML_TRIVIAL );
319 }
320 }
321
322 /* check all submeshes to see if their materials should be
323 updated. If the submesh has texture aliases that match those
324 found in the current material then a new material is created using
325 the textures from the submesh.
326 */
327 updateMaterialForAllSubMeshes();
328 }
329
330 //-----------------------------------------------------------------------
331 void Mesh::unloadImpl()

Callers

nothing calls this directly

Calls 7

_getArchiveToResourceMethod · 0.80
setListenerMethod · 0.45
getListenerMethod · 0.45
resetMethod · 0.45
importMeshMethod · 0.45
logMessageMethod · 0.45
getModifiedTimeMethod · 0.45

Tested by

no test coverage detected