本文整理汇总了C++中FVector::ComponentMax方法的典型用法代码示例。如果您正苦于以下问题:C++ FVector::ComponentMax方法的具体用法?C++ FVector::ComponentMax怎么用?C++ FVector::ComponentMax使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FVector
的用法示例。
在下文中一共展示了FVector::ComponentMax方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetCollisionShape
FCollisionShape UBoxComponent::GetCollisionShape(float Inflation) const
{
FVector Extent = GetScaledBoxExtent() + Inflation;
if (Inflation < 0.f)
{
// Don't shrink below zero size.
Extent = Extent.ComponentMax(FVector::ZeroVector);
}
return FCollisionShape::MakeBox(Extent);
}
示例2: UnpackRelativeBox
static void UnpackRelativeBox(const FVector& InRefOrigin, const FVector& InRefExtent, uint32 InPackedRelBox, FVector& OutOrigin, FVector& OutExtent)
{
const uint32 PackedMinX = InPackedRelBox & 31;
const uint32 PackedMinY = (InPackedRelBox >> 5) & 31;
const uint32 PackedMinZ = (InPackedRelBox >> 10) & 63;
const uint32 PackedMaxX = (InPackedRelBox >> 16) & 31;
const uint32 PackedMaxY = (InPackedRelBox >> 21) & 31;
const uint32 PackedMaxZ = (InPackedRelBox >> 26) & 63;
const FVector RefMin = InRefOrigin - InRefExtent;
// 15.5 and 31.5 have the / 2 scale included
const FVector UnpackScale = InRefExtent.ComponentMax(FVector(KINDA_SMALL_NUMBER, KINDA_SMALL_NUMBER, KINDA_SMALL_NUMBER)) / FVector(15.5f, 15.5f, 31.5f);
const FVector Min = FVector((float)PackedMinX, (float)PackedMinY, (float)PackedMinZ) * UnpackScale + RefMin;
const FVector Max = FVector((float)PackedMaxX, (float)PackedMaxY, (float)PackedMaxZ) * UnpackScale + RefMin;
OutOrigin = .5 * (Min + Max);
OutExtent = .5 * (Max - Min);
}
示例3: PackRelativeBox
static uint32 PackRelativeBox(const FVector& RefOrigin, const FVector& RefExtent, const FVector& Origin, const FVector& Extent)
{
const FVector RefMin = RefOrigin - RefExtent;
// 15.5 and 31.5 have the / 2 scale included
const FVector PackScale = FVector(15.5f, 15.5f, 31.5f) / RefExtent.ComponentMax(FVector(KINDA_SMALL_NUMBER, KINDA_SMALL_NUMBER, KINDA_SMALL_NUMBER));
const FVector Min = Origin - Extent;
const FVector Max = Origin + Extent;
const FVector RelMin = (Min - RefMin) * PackScale;
const FVector RelMax = (Max - RefMin) * PackScale;
const uint32 PackedMinX = (uint32)FMath::Clamp<int32>(FMath::FloorToInt(RelMin.X), 0, 31);
const uint32 PackedMinY = (uint32)FMath::Clamp<int32>(FMath::FloorToInt(RelMin.Y), 0, 31);
const uint32 PackedMinZ = (uint32)FMath::Clamp<int32>(FMath::FloorToInt(RelMin.Z), 0, 63);
const uint32 PackedMaxX = (uint32)FMath::Clamp<int32>(FMath::CeilToInt(RelMax.X), 0, 31);
const uint32 PackedMaxY = (uint32)FMath::Clamp<int32>(FMath::CeilToInt(RelMax.Y), 0, 31);
const uint32 PackedMaxZ = (uint32)FMath::Clamp<int32>(FMath::CeilToInt(RelMax.Z), 0, 63);
return PackedMinX | (PackedMinY << 5) | (PackedMinZ << 10) | (PackedMaxX << 16) | (PackedMaxY << 21) | (PackedMaxZ << 26);
}