UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
DetourProximityGrid.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2// Modified version of Recast/Detour's source file
3
4//
5// Copyright (c) 2009-2010 Mikko Mononen memon@inside.org
6//
7// This software is provided 'as-is', without any express or implied
8// warranty. In no event will the authors be held liable for any damages
9// arising from the use of this software.
10// Permission is granted to anyone to use this software for any purpose,
11// including commercial applications, and to alter it and redistribute it
12// freely, subject to the following restrictions:
13// 1. The origin of this software must not be misrepresented; you must not
14// claim that you wrote the original software. If you use this software
15// in a product, an acknowledgment in the product documentation would be
16// appreciated but is not required.
17// 2. Altered source versions must be plainly marked as such, and must not be
18// misrepresented as being the original software.
19// 3. This notice may not be removed or altered from any source distribution.
20//
21
22#ifndef DETOURPROXIMITYGRID_H
23#define DETOURPROXIMITYGRID_H
24
25#include "CoreMinimal.h"
27
29{
30 dtReal m_cellSize;
31 dtReal m_invCellSize;
32
33 struct Item
34 {
35 unsigned short id;
36 short x,y;
37 unsigned short next;
38 };
39 Item* m_pool;
40 int m_poolHead;
41 int m_poolSize;
42
43 unsigned short* m_buckets;
44 int m_bucketsSize;
45
46 int m_bounds[4];
47
48public:
51
52 bool init(const int maxItems, const dtReal cellSize);
53
54 void clear();
55
56 void addItem(const unsigned short id,
57 const dtReal minx, const dtReal miny,
58 const dtReal maxx, const dtReal maxy);
59
60 int queryItems(const dtReal minx, const dtReal miny,
61 const dtReal maxx, const dtReal maxy,
62 unsigned short* ids, const int maxIds) const;
63
64 int getItemCountAt(const int x, const int y) const;
65
66 inline const int* getBounds() const { return m_bounds; }
67 inline const dtReal getCellSize() const { return m_cellSize; }
68};
69
72
73
74#endif // DETOURPROXIMITYGRID_H
75
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
double dtReal
Definition DetourLargeWorldCoordinates.h:15
void dtFreeProximityGrid(dtProximityGrid *ptr)
Definition DetourProximityGrid.cpp:35
dtProximityGrid * dtAllocProximityGrid()
Definition DetourProximityGrid.cpp:28
Definition DetourProximityGrid.h:29
int queryItems(const dtReal minx, const dtReal miny, const dtReal maxx, const dtReal maxy, unsigned short *ids, const int maxIds) const
Definition DetourProximityGrid.cpp:135
const dtReal getCellSize() const
Definition DetourProximityGrid.h:67
~dtProximityGrid()
Definition DetourProximityGrid.cpp:59
const int * getBounds() const
Definition DetourProximityGrid.h:66
bool init(const int maxItems, const dtReal cellSize)
Definition DetourProximityGrid.cpp:65
void clear()
Definition DetourProximityGrid.cpp:91
int getItemCountAt(const int x, const int y) const
Definition DetourProximityGrid.cpp:178
dtProximityGrid()
Definition DetourProximityGrid.cpp:49
void addItem(const unsigned short id, const dtReal minx, const dtReal miny, const dtReal maxx, const dtReal maxy)
Definition DetourProximityGrid.cpp:101