| 694 | } |
| 695 | |
| 696 | void BackgroundLoader::serialize(PxCollection* collection, ChunkID id) |
| 697 | { |
| 698 | const char* theBinPath = getPathname( id ); |
| 699 | SampleFramework::File* fp = NULL; |
| 700 | PxToolkit::fopen_s(&fp, theBinPath, "rb"); |
| 701 | if( fp ) |
| 702 | { |
| 703 | fclose(fp); |
| 704 | return; |
| 705 | } |
| 706 | |
| 707 | PxCollection* theExtRef = PxCreateCollection(); |
| 708 | theExtRef->add(mMaterial, MATERIAL_ID); |
| 709 | PxDefaultMemoryOutputStream memBuf; |
| 710 | |
| 711 | PxSerialization::complete(*collection, *mSr, theExtRef); |
| 712 | bool bRet = PxSerialization::serializeCollectionToBinary(memBuf, *collection, *mSr, theExtRef, true ); |
| 713 | PX_ASSERT(bRet); |
| 714 | PX_UNUSED(bRet); |
| 715 | |
| 716 | PxDefaultFileOutputStream s( getPathname( id ) ); |
| 717 | |
| 718 | Ps::Time localTimer; |
| 719 | localTimer.getElapsedSeconds(); |
| 720 | s.write( memBuf.getData(), memBuf.getSize()); |
| 721 | mDiskIOTimeCounter += localTimer.getElapsedSeconds(); |
| 722 | |
| 723 | theExtRef->release(); |
| 724 | } |
| 725 | |
| 726 | //PhysX support buffer inserting actor, so no care about whether physic is simulating here |
| 727 | void BackgroundLoader::addReadyChunkToScene(ChunkID id) |
nothing calls this directly
no test coverage detected