4
5
11#include "Logging/LogMacros.h"
20FORCEINLINE bool FOctreeChildNodeSubset::Contains(FOctreeChildNodeRef ChildRef)
const
23 const FOctreeChildNodeSubset ChildSubset(ChildRef);
24 return (ChildBits & ChildSubset.ChildBits) == ChildSubset.ChildBits;
27FORCEINLINE FOctreeChildNodeSubset FOctreeNodeContext::GetIntersectingChildren(
const FBoxCenterAndExtent& QueryBounds)
const
29 FOctreeChildNodeSubset Result;
32 const VectorRegister QueryBoundsCenter = VectorLoadAligned(&QueryBounds.Center);
33 const VectorRegister QueryBoundsExtent = VectorLoadAligned(&QueryBounds.Extent);
34 const VectorRegister QueryBoundsMax = VectorAdd(QueryBoundsCenter,QueryBoundsExtent);
35 const VectorRegister QueryBoundsMin = VectorSubtract(QueryBoundsCenter,QueryBoundsExtent);
38 const VectorRegister BoundsCenter = VectorLoadAligned(&Bounds.Center);
39 const VectorRegister BoundsExtent = VectorLoadAligned(&Bounds.Extent);
40 const VectorRegister PositiveChildBoundsMin = VectorSubtract(
41 VectorAdd(BoundsCenter,VectorLoadFloat1(&ChildCenterOffset)),
42 VectorLoadFloat1(&ChildExtent)
44 const VectorRegister NegativeChildBoundsMax = VectorAdd(
45 VectorSubtract(BoundsCenter,VectorLoadFloat1(&ChildCenterOffset)),
46 VectorLoadFloat1(&ChildExtent)
50 Result.PositiveChildBits = VectorMaskBits(VectorCompareGT(QueryBoundsMax, PositiveChildBoundsMin)) & 0x7;
51 Result.NegativeChildBits = VectorMaskBits(VectorCompareLE(QueryBoundsMin, NegativeChildBoundsMax)) & 0x7;
55FORCEINLINE FOctreeChildNodeRef FOctreeNodeContext::GetContainingChild(
const FBoxCenterAndExtent& QueryBounds)
const
57 FOctreeChildNodeRef Result;
60 const VectorRegister QueryBoundsCenter = VectorLoadAligned(&QueryBounds.Center);
61 const VectorRegister QueryBoundsExtent = VectorLoadAligned(&QueryBounds.Extent);
64 const VectorRegister BoundsCenter = VectorLoadAligned(&Bounds.Center);
65 const VectorRegister ChildCenterOffsetVector = VectorLoadFloat1(&ChildCenterOffset);
66 const VectorRegister NegativeCenterDifference = VectorSubtract(QueryBoundsCenter,VectorSubtract(BoundsCenter,ChildCenterOffsetVector));
67 const VectorRegister PositiveCenterDifference = VectorSubtract(VectorAdd(BoundsCenter,ChildCenterOffsetVector),QueryBoundsCenter);
70 const VectorRegister MinDifference = VectorMin(PositiveCenterDifference,NegativeCenterDifference);
71 if(VectorAnyGreaterThan(VectorAdd(QueryBoundsExtent,MinDifference),VectorLoadFloat1(&ChildExtent)))
78 Result.Index = VectorMaskBits(VectorCompareGT(QueryBoundsCenter, BoundsCenter)) & 0x7;