PhysX support buffer inserting actor, so no care about whether physic is simulating here
| 725 | |
| 726 | //PhysX support buffer inserting actor, so no care about whether physic is simulating here |
| 727 | void BackgroundLoader::addReadyChunkToScene(ChunkID id) |
| 728 | { |
| 729 | PxCollection *theCollection = NULL; |
| 730 | { |
| 731 | shdfnd::Mutex::ScopedLock al( mCollectionLock ); |
| 732 | CollectionIdMap::iterator it = mCollectionIdMap.find(id); |
| 733 | if(it == mCollectionIdMap.end() || it->second.addToScene ) |
| 734 | { |
| 735 | return; |
| 736 | } |
| 737 | |
| 738 | theCollection = it->second.collection; |
| 739 | if( !theCollection ) |
| 740 | return; |
| 741 | |
| 742 | it->second.addToScene = true; |
| 743 | } |
| 744 | |
| 745 | PxU32 count = theCollection->getNbObjects(); |
| 746 | for(PxU32 i = 0; i < count; i++) |
| 747 | { |
| 748 | PxBase *object = &theCollection->getObject(i); |
| 749 | PX_ASSERT(object); |
| 750 | PxType theType = object->getConcreteType(); |
| 751 | if( theType == PxConcreteType::eRIGID_DYNAMIC ) |
| 752 | { |
| 753 | PxRigidActor *actor = static_cast<PxRigidActor*>(object); |
| 754 | mSampleLargeWorld->createRenderObjectsFromActor(actor); |
| 755 | } |
| 756 | else if(theType == PxConcreteType::eRIGID_STATIC) |
| 757 | { |
| 758 | PxRigidStatic* actor = static_cast<PxRigidStatic*>(object); |
| 759 | PxShape* shape = getShape( *actor ); |
| 760 | PxTriangleMeshGeometry geometry; |
| 761 | shape->getTriangleMeshGeometry(geometry); |
| 762 | //We create static render mesh in another loop |
| 763 | if(shape->getGeometryType() != PxGeometryType::eTRIANGLEMESH) |
| 764 | { |
| 765 | mSampleLargeWorld->createRenderObjectsFromActor(actor, NULL); |
| 766 | } |
| 767 | } |
| 768 | } |
| 769 | |
| 770 | { |
| 771 | PxSceneWriteLock scopedLock(mSampleLargeWorld->getActiveScene()); |
| 772 | mScene.addCollection(*theCollection); |
| 773 | } |
| 774 | |
| 775 | //Melt the freezon important actors on this chunk |
| 776 | for(unsigned i = 0; i < mDyncActors.size(); ++i) |
| 777 | { |
| 778 | DynamicObjects* obj = mDyncActors[i]; |
| 779 | if( obj->id.id == id.id && obj->isImportant ) |
| 780 | { |
| 781 | PxSceneWriteLock scopedLock(mSampleLargeWorld->getActiveScene()); |
| 782 | obj->actor->setRigidBodyFlag(PxRigidBodyFlag::eKINEMATIC, false); |
| 783 | } |
| 784 | } |
nothing calls this directly
no test coverage detected