MCPcopy Create free account
hub / github.com/RavEngine/RavEngine / addAggregate

Method addAggregate

deps/physx/physx/source/physx/src/NpScene.cpp:1127–1180  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1125///////////////////////////////////////////////////////////////////////////////
1126
1127void NpScene::addAggregate(PxAggregate& aggregate)
1128{
1129 PX_PROFILE_ZONE("API.addAggregate", getContextId());
1130 NP_WRITE_CHECK(this);
1131 PX_SIMD_GUARD;
1132
1133 NpAggregate& np = static_cast<NpAggregate&>(aggregate);
1134
1135 const PxU32 nb = np.getCurrentSizeFast();
1136#if PX_CHECKED
1137 for(PxU32 i=0;i<nb;i++)
1138 {
1139 PxRigidStatic* a = np.getActorFast(i)->is<PxRigidStatic>();
1140 if(a && !static_cast<NpRigidStatic*>(a)->checkConstraintValidity())
1141 {
1142 Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "PxScene::addAggregate(): Aggregate contains an actor with an invalid constraint!");
1143 return;
1144 }
1145 }
1146#endif
1147
1148 Scb::Aggregate& agg = np.getScbAggregate();
1149 const Scb::ControlState::Enum cs = agg.getControlState();
1150 if ((cs == Scb::ControlState::eNOT_IN_SCENE) || ((cs == Scb::ControlState::eREMOVE_PENDING) && (agg.getScbScene()->getPxScene() == this)))
1151 {
1152 mScene.addAggregate(agg);
1153
1154 for(PxU32 i=0;i<nb;i++)
1155 {
1156 PX_ASSERT(np.getActorFast(i));
1157 PxActor& actor = *np.getActorFast(i);
1158
1159 //A.B. check if a bvh structure was connected to that actor, we will use it for the insert and remove it
1160 NpActor& npActor = NpActor::getFromPxActor(actor);
1161 Gu::BVHStructure* bvhStructure = NULL;
1162 if(npActor.getConnectors<Gu::BVHStructure>(NpConnectorType::eBvhStructure, &bvhStructure, 1))
1163 {
1164 npActor.removeConnector(actor, NpConnectorType::eBvhStructure, bvhStructure, "PxBVHStructure connector could not have been removed!");
1165 }
1166
1167 np.addActorInternal(actor, *this, bvhStructure);
1168
1169 // if a bvh structure was used dec ref count, we increased the ref count when adding the actor connection
1170 if(bvhStructure)
1171 {
1172 bvhStructure->decRefCount();
1173 }
1174 }
1175
1176 mAggregates.insert(&aggregate);
1177 }
1178 else
1179 Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "PxScene::addAggregate(): Aggregate already assigned to a scene. Call will be ignored!");
1180}
1181
1182void NpScene::removeAggregate(PxAggregate& aggregate, bool wakeOnLostTouch)
1183{

Callers 1

createLargeSphereFunction · 0.45

Calls 10

getCurrentSizeFastMethod · 0.80
getActorFastMethod · 0.80
getPxSceneMethod · 0.80
removeConnectorMethod · 0.80
getContextIdFunction · 0.50
errorMethod · 0.45
addActorInternalMethod · 0.45
decRefCountMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected