UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
GenericOctree.inl
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3/*=============================================================================
4 GenericOctree.inl: Generic octree implementation.
5=============================================================================*/
6
7#pragma once
8
9#include "CoreTypes.h"
10#include "CoreFwd.h"
11#include "Logging/LogMacros.h"
12
17struct FMath;
18
19
21{
22 // This subset contains the child if it has all the bits set that are set for the subset containing only the child node.
24 return (ChildBits & ChildSubset.ChildBits) == ChildSubset.ChildBits;
25}
26
28{
30
31 // Load the query bounding box values as VectorRegisters.
36
37 // Compute the bounds of the node's children.
38 const VectorRegister BoundsCenter = VectorLoadAligned(&Bounds.Center);
39 const VectorRegister BoundsExtent = VectorLoadAligned(&Bounds.Extent);
43 );
47 );
48
49 // Intersect the query bounds with the node's children's bounds.
50 Result.PositiveChildBits = VectorMaskBits(VectorCompareGT(QueryBoundsMax, PositiveChildBoundsMin)) & 0x7;
51 Result.NegativeChildBits = VectorMaskBits(VectorCompareLE(QueryBoundsMin, NegativeChildBoundsMax)) & 0x7;
52 return Result;
53}
54
56{
58
59 // Load the query bounding box values as VectorRegisters.
62
63 // Compute the bounds of the node's children.
64 const VectorRegister BoundsCenter = VectorLoadAligned(&Bounds.Center);
68
69 // If the query bounds isn't entirely inside the bounding box of the child it's closest to, it's not contained by any of the child nodes.
72 {
73 Result.SetNULL();
74 }
75 else
76 {
77 // Return the child node that the query is closest to as the containing child.
78 Result.Index = VectorMaskBits(VectorCompareGT(QueryBoundsCenter, BoundsCenter)) & 0x7;
79 }
80
81 return Result;
82}
83
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
FORCEINLINE VectorRegister4Float VectorSubtract(const VectorRegister4Float &Vec1, const VectorRegister4Float &Vec2)
Definition UnrealMathFPU.h:731
FORCEINLINE uint32 VectorAnyGreaterThan(const VectorRegister4Float &Vec1, const VectorRegister4Float &Vec2)
Definition UnrealMathFPU.h:1917
FORCEINLINE VectorRegister4Float VectorMin(const VectorRegister4Float &Vec1, const VectorRegister4Float &Vec2)
Definition UnrealMathFPU.h:1686
FORCEINLINE VectorRegister4Float VectorLoadFloat1(const float *Ptr)
Definition UnrealMathFPU.h:468
VectorRegister4Float VectorLoadAligned(const float *Ptr)
Definition UnrealMathFPU.h:451
FORCEINLINE VectorRegister4Float VectorCompareGT(const VectorRegister4Float &Vec1, const VectorRegister4Float &Vec2)
Definition UnrealMathFPU.h:974
FORCEINLINE int32 VectorMaskBits(const VectorRegister4Float &Vec1)
Definition UnrealMathFPU.h:1075
FORCEINLINE VectorRegister4Float VectorAdd(const VectorRegister4Float &Vec1, const VectorRegister4Float &Vec2)
Definition UnrealMathFPU.h:704
FORCEINLINE VectorRegister4Float VectorCompareLE(const VectorRegister4Float &Vec1, const VectorRegister4Float &Vec2)
Definition UnrealMathFPU.h:1050
Definition GenericOctree.h:42
FVector4 Center
Definition GenericOctree.h:46
FVector4 Extent
Definition GenericOctree.h:47
Definition GenericOctree.h:146
Definition GenericOctree.h:201
uint32 ChildBits
Definition GenericOctree.h:226
bool Contains(FOctreeChildNodeRef ChildRef) const
Definition GenericOctree.inl:20
Definition GenericOctree.h:252
FOctreeChildNodeRef GetContainingChild(const FBoxCenterAndExtent &BoundingBox) const
Definition GenericOctree.inl:55
FReal ChildCenterOffset
Definition GenericOctree.h:267
FReal ChildExtent
Definition GenericOctree.h:264
FBoxCenterAndExtent Bounds
Definition GenericOctree.h:261
FOctreeChildNodeSubset GetIntersectingChildren(const FBoxCenterAndExtent &BoundingBox) const
Definition GenericOctree.inl:27
Definition UnrealMathUtility.h:270
Definition UnrealMathFPU.h:42