inline some pimpl methods in order to improve function call performance for regularly called methods

This commit is contained in:
Mamadou Babaei
2023-08-14 17:25:57 +02:00
parent be3647e310
commit 5951ac9c33
2 changed files with 31 additions and 42 deletions
@@ -127,7 +127,10 @@ struct USGVirtualHandComponent::FImpl
bool UninitializeBackend() const;
bool CheckGlove() const;
void SetVisibility(bool bInVisible) const;
FORCEINLINE void SetVisibility(const bool bInVisible) const
{
Owner->SetVisibility(bInVisible, true);
}
void DrawDebugVirtualHand() const;
};
@@ -758,11 +761,6 @@ bool USGVirtualHandComponent::FImpl::CheckGlove() const
return bFoundGlove;
}
void USGVirtualHandComponent::FImpl::SetVisibility(const bool bInVisible) const
{
Owner->SetVisibility(bInVisible, true);
}
void USGVirtualHandComponent::FImpl::DrawDebugVirtualHand() const
{
const UWorld* World{Owner->GetWorld()};
@@ -103,14 +103,35 @@ struct ASGPawn::FImpl
void UpdateRightHandLocationAndRotation(
const FVector& Location, const FRotator& Rotation, const bool bUpdateVirtualHand);
void RegisterLeftHandOverlappedActor(const AActor* Actor) const;
void UnregisterLeftHandOverlappedActor(const AActor* Actor) const;
FORCEINLINE void RegisterLeftHandOverlappedActor(const AActor* Actor) const
{
Owner->LeftHandOverlappedActors.AddUnique(Actor);
}
void RegisterRightHandOverlappedActor(const AActor* Actor) const;
void UnregisterRightHandOverlappedActor(const AActor* Actor) const;
FORCEINLINE void UnregisterLeftHandOverlappedActor(const AActor* Actor) const
{
Owner->LeftHandOverlappedActors.Remove(Actor);
}
bool IsLeftHandOverlappingWithAnyActor() const;
bool IsRightHandOverlappingWithAnyActor() const;
FORCEINLINE void RegisterRightHandOverlappedActor(const AActor* Actor) const
{
Owner->RightHandOverlappedActors.AddUnique(Actor);
}
FORCEINLINE void UnregisterRightHandOverlappedActor(const AActor* Actor) const
{
Owner->RightHandOverlappedActors.Remove(Actor);
}
FORCEINLINE bool IsLeftHandOverlappingWithAnyActor() const
{
return Owner->LeftHandOverlappedActors.Num() > 0;
}
FORCEINLINE bool IsRightHandOverlappingWithAnyActor() const
{
return Owner->RightHandOverlappedActors.Num() > 0;
}
void DisableActorPhysics(const AActor* Actor) const;
void EnableActorPhysics(const AActor* Actor) const;
@@ -1759,36 +1780,6 @@ void ASGPawn::FImpl::UpdateRightHandLocationAndRotation(
UpdateRightHandRotation(Rotation, bUpdateVirtualHand);
}
void ASGPawn::FImpl::RegisterLeftHandOverlappedActor(const AActor* Actor) const
{
Owner->LeftHandOverlappedActors.AddUnique(Actor);
}
void ASGPawn::FImpl::UnregisterLeftHandOverlappedActor(const AActor* Actor) const
{
Owner->LeftHandOverlappedActors.Remove(Actor);
}
void ASGPawn::FImpl::RegisterRightHandOverlappedActor(const AActor* Actor) const
{
Owner->RightHandOverlappedActors.AddUnique(Actor);
}
void ASGPawn::FImpl::UnregisterRightHandOverlappedActor(const AActor* Actor) const
{
Owner->RightHandOverlappedActors.Remove(Actor);
}
bool ASGPawn::FImpl::IsLeftHandOverlappingWithAnyActor() const
{
return Owner->LeftHandOverlappedActors.Num() > 0;
}
bool ASGPawn::FImpl::IsRightHandOverlappingWithAnyActor() const
{
return Owner->RightHandOverlappedActors.Num() > 0;
}
void ASGPawn::FImpl::DisableActorPhysics(const AActor* Actor) const
{
UPrimitiveComponent* ActorRootComponent{Cast<UPrimitiveComponent>(Actor->GetRootComponent())};