game_machine 0.0.11 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +12 -1
- data/Gemfile.lock +32 -47
- data/Rakefile +0 -27
- data/bin/bundle_run.sh +1 -0
- data/bin/game_machine +29 -27
- data/config/cluster.conf +6 -5
- data/config/default.conf +164 -0
- data/config/game_machine.sql +33 -0
- data/config/game_messages.proto +87 -25
- data/config/gamecloud.conf +140 -0
- data/config/messages.proto +46 -53
- data/config/test.conf +149 -0
- data/game_machine.gemspec +10 -5
- data/games/boot.rb +3 -0
- data/games/example/data/game_data.yml +4 -4
- data/games/example/lib/aggressive_npc.rb +1 -1
- data/games/example/lib/game.rb +1 -2
- data/games/example/lib/player_register.rb +1 -1
- data/games/routes.rb +9 -0
- data/games/tutorial/boot.rb +12 -0
- data/games/tutorial/item_manager.rb +256 -0
- data/games/tutorial/object_store.rb +55 -0
- data/games/tutorial/seed.rb +52 -0
- data/games/tutorial/sql_store.rb +30 -0
- data/java/project/build.gradle +134 -0
- data/java/project/component.erb +719 -0
- data/java/{gradle.properties → project/gradle.properties} +1 -1
- data/java/project/gradle/wrapper/gradle-wrapper.jar +0 -0
- data/java/{gradle → project/gradle}/wrapper/gradle-wrapper.properties +2 -2
- data/java/{gradlew → project/gradlew} +0 -0
- data/java/{gradlew.bat → project/gradlew.bat} +0 -0
- data/java/project/local_lib/AdminUi.jar +0 -0
- data/java/{local_lib/protostuff-compiler-1.0.7-jarjar.jar → project/local_lib/protostuff-compiler-1.0.8-jarjar.jar} +0 -0
- data/java/project/local_lib/sigar/libsigar-amd64-freebsd-6.so +0 -0
- data/java/project/local_lib/sigar/libsigar-amd64-linux.so +0 -0
- data/java/project/local_lib/sigar/libsigar-amd64-solaris.so +0 -0
- data/java/project/local_lib/sigar/libsigar-ia64-hpux-11.sl +0 -0
- data/java/project/local_lib/sigar/libsigar-ia64-linux.so +0 -0
- data/java/project/local_lib/sigar/libsigar-pa-hpux-11.sl +0 -0
- data/java/project/local_lib/sigar/libsigar-ppc-aix-5.so +0 -0
- data/java/project/local_lib/sigar/libsigar-ppc-linux.so +0 -0
- data/java/project/local_lib/sigar/libsigar-ppc64-aix-5.so +0 -0
- data/java/project/local_lib/sigar/libsigar-ppc64-linux.so +0 -0
- data/java/project/local_lib/sigar/libsigar-s390x-linux.so +0 -0
- data/java/project/local_lib/sigar/libsigar-sparc-solaris.so +0 -0
- data/java/project/local_lib/sigar/libsigar-sparc64-solaris.so +0 -0
- data/java/project/local_lib/sigar/libsigar-universal-macosx.dylib +0 -0
- data/java/project/local_lib/sigar/libsigar-universal64-macosx.dylib +0 -0
- data/java/project/local_lib/sigar/libsigar-x86-freebsd-5.so +0 -0
- data/java/project/local_lib/sigar/libsigar-x86-freebsd-6.so +0 -0
- data/java/project/local_lib/sigar/libsigar-x86-linux.so +0 -0
- data/java/project/local_lib/sigar/libsigar-x86-solaris.so +0 -0
- data/java/project/local_lib/sigar/sigar-amd64-winnt.dll +0 -0
- data/java/project/local_lib/sigar/sigar-x86-winnt.dll +0 -0
- data/java/project/local_lib/sigar/sigar-x86-winnt.lib +0 -0
- data/java/project/model.erb +99 -0
- data/java/{settings.gradle → project/settings.gradle} +0 -0
- data/java/project/src/main/java/com/game_machine/authentication/DefaultAuthenticator.java +28 -0
- data/java/project/src/main/java/com/game_machine/authentication/PlayerAuthenticator.java +6 -0
- data/java/project/src/main/java/com/game_machine/authentication/PublicAuthenticator.java +20 -0
- data/java/{src → project/src}/main/java/com/game_machine/core/ActorFactory.java +0 -0
- data/java/{src → project/src}/main/java/com/game_machine/core/ActorUtil.java +13 -0
- data/java/project/src/main/java/com/game_machine/core/AuthorizedPlayers.java +23 -0
- data/java/project/src/main/java/com/game_machine/core/ClientMessageDecoder.java +36 -0
- data/java/project/src/main/java/com/game_machine/core/ClientMessageEncoder.java +19 -0
- data/java/project/src/main/java/com/game_machine/core/CloudClient.java +298 -0
- data/java/{src → project/src}/main/java/com/game_machine/core/CommandProxy.java +0 -0
- data/java/project/src/main/java/com/game_machine/core/Commands.java +20 -0
- data/java/project/src/main/java/com/game_machine/core/DatastoreCommands.java +43 -0
- data/java/project/src/main/java/com/game_machine/core/DbConnectionPool.java +72 -0
- data/java/project/src/main/java/com/game_machine/core/DefaultMovementVerifier.java +56 -0
- data/java/{src → project/src}/main/java/com/game_machine/core/EntitySerializer.java +0 -0
- data/java/project/src/main/java/com/game_machine/core/EntityTracking.java +119 -0
- data/java/{src → project/src}/main/java/com/game_machine/core/EventStreamHandler.java +1 -1
- data/java/project/src/main/java/com/game_machine/core/GameActor.java +73 -0
- data/java/project/src/main/java/com/game_machine/core/GameMachineLoader.java +43 -0
- data/java/project/src/main/java/com/game_machine/core/GameMessageActor.java +44 -0
- data/java/project/src/main/java/com/game_machine/core/Grid.java +255 -0
- data/java/{src → project/src}/main/java/com/game_machine/core/GridValue.java +0 -0
- data/java/project/src/main/java/com/game_machine/core/Hashring.java +66 -0
- data/java/{src → project/src}/main/java/com/game_machine/core/IActorFactory.java +0 -0
- data/java/project/src/main/java/com/game_machine/core/LocalLinkedBuffer.java +20 -0
- data/java/project/src/main/java/com/game_machine/core/MessageGateway.java +120 -0
- data/java/project/src/main/java/com/game_machine/core/MessagePersister.java +26 -0
- data/java/project/src/main/java/com/game_machine/core/MonoProxy.java +39 -0
- data/java/project/src/main/java/com/game_machine/core/MovementVerifier.java +7 -0
- data/java/{src → project/src}/main/java/com/game_machine/core/NetMessage.java +10 -6
- data/java/project/src/main/java/com/game_machine/core/PersistentMessage.java +9 -0
- data/java/project/src/main/java/com/game_machine/core/PlayerCommands.java +31 -0
- data/java/project/src/main/java/com/game_machine/core/TcpServer.java +100 -0
- data/java/project/src/main/java/com/game_machine/core/TcpServerHandler.java +54 -0
- data/java/project/src/main/java/com/game_machine/core/TcpServerInitializer.java +32 -0
- data/java/project/src/main/java/com/game_machine/core/UdpClient.java +86 -0
- data/java/{src → project/src}/main/java/com/game_machine/core/UdpServer.java +18 -27
- data/java/{src → project/src}/main/java/com/game_machine/core/UdpServerHandler.java +23 -26
- data/java/project/src/main/java/com/game_machine/core/Vector3.java +159 -0
- data/java/project/src/main/java/com/game_machine/orm/models/PlayerItem.java +118 -0
- data/java/project/src/main/java/com/game_machine/orm/models/TestObject.java +110 -0
- data/java/project/src/main/java/com/game_machine/tutorial/LootGenerator.java +26 -0
- data/java/{src → project/src}/main/resources/game_machine.java.stg +3 -1
- data/java/project/src/main/resources/logback.properties +13 -0
- data/java/project/src/main/resources/logback.xml +76 -0
- data/java/{src → project/src}/main/resources/protostuff.properties +0 -0
- data/java/src/main/java/game/MyGameActor.java +26 -0
- data/lib/game_machine.rb +17 -16
- data/lib/game_machine/actor.rb +1 -1
- data/lib/game_machine/actor/base.rb +8 -31
- data/lib/game_machine/actor/builder.rb +5 -6
- data/lib/game_machine/actor/game_actor.rb +55 -0
- data/lib/game_machine/actor/reloadable.rb +6 -1
- data/lib/game_machine/akka.rb +26 -32
- data/lib/game_machine/app_config.rb +39 -26
- data/lib/game_machine/application.rb +56 -62
- data/lib/game_machine/client_manager.rb +14 -8
- data/lib/game_machine/cloud_updater.rb +51 -0
- data/lib/game_machine/cluster_monitor.rb +3 -3
- data/lib/game_machine/commands.rb +1 -1
- data/lib/game_machine/commands/misc_commands.rb +4 -8
- data/lib/game_machine/commands/player_commands.rb +8 -0
- data/lib/game_machine/console.rb +1 -0
- data/lib/game_machine/console/build.rb +57 -24
- data/lib/game_machine/console/bundle.rb +95 -0
- data/lib/game_machine/console/deploy.rb +30 -0
- data/lib/game_machine/console/install.rb +70 -36
- data/lib/game_machine/console/server.rb +2 -69
- data/lib/game_machine/data_store.rb +111 -15
- data/lib/game_machine/data_stores/couchbase.rb +8 -3
- data/lib/game_machine/data_stores/gamecloud.rb +93 -0
- data/lib/game_machine/data_stores/jdbc.rb +98 -0
- data/lib/game_machine/default_handlers.rb +2 -0
- data/lib/game_machine/default_handlers/team_handler.rb +51 -0
- data/lib/game_machine/default_handlers/zone_manager.rb +30 -0
- data/lib/game_machine/endpoints.rb +0 -4
- data/lib/game_machine/endpoints/udp_incoming.rb +13 -5
- data/lib/game_machine/endpoints/udp_outgoing.rb +15 -9
- data/lib/game_machine/game_systems.rb +0 -2
- data/lib/game_machine/game_systems/agents/controller.rb +2 -2
- data/lib/game_machine/game_systems/entity_tracking.rb +0 -3
- data/lib/game_machine/game_systems/region_manager.rb +3 -2
- data/lib/game_machine/game_systems/region_service.rb +2 -2
- data/lib/game_machine/game_systems/remote_echo.rb +10 -0
- data/lib/game_machine/game_systems/team_manager.rb +2 -11
- data/lib/game_machine/grid.rb +5 -18
- data/lib/game_machine/handlers/authentication.rb +1 -9
- data/lib/game_machine/handlers/game.rb +27 -2
- data/lib/game_machine/handlers/player_authentication.rb +87 -0
- data/lib/game_machine/handlers/request.rb +9 -11
- data/lib/game_machine/hocon_config.rb +81 -0
- data/lib/game_machine/java_lib.rb +14 -1
- data/lib/game_machine/logger.rb +10 -23
- data/lib/game_machine/models.rb +1 -0
- data/lib/game_machine/mono_server.rb +6 -1
- data/lib/game_machine/object_db.rb +12 -6
- data/lib/game_machine/protobuf.rb +1 -1
- data/lib/game_machine/protobuf/game_messages.rb +13 -3
- data/lib/game_machine/protobuf/generate.rb +107 -5
- data/lib/game_machine/restart_watcher.rb +1 -1
- data/lib/game_machine/routes.rb +23 -0
- data/lib/game_machine/scheduler.rb +1 -1
- data/lib/game_machine/securerandom.rb +2 -0
- data/lib/game_machine/system_stats.rb +28 -7
- data/lib/game_machine/version.rb +1 -1
- data/lib/game_machine/wavefront_ext.rb +47 -0
- data/lib/game_machine/write_behind_cache.rb +24 -9
- data/mono/server/Makefile +1 -1
- data/mono/server/Newtonsoft.Json.dll +0 -0
- data/mono/server/build.bat +1 -1
- data/mono/server/callable.cs +9 -0
- data/mono/server/echo.cs +17 -0
- data/mono/server/message_router.cs +16 -23
- data/mono/server/messages.cs +1792 -417
- data/mono/server/protobuf-net.dll +0 -0
- data/mono/server/server.cs +120 -0
- data/mono/server/server.exe +0 -0
- data/pathfinding/astar.cpp +149 -0
- data/pathfinding/build.sh +6 -0
- data/pathfinding/build.txt +16 -0
- data/pathfinding/crowd.cpp +194 -0
- data/pathfinding/include/astar.h +49 -0
- data/pathfinding/include/common.h +5 -0
- data/pathfinding/include/crowd.h +43 -0
- data/pathfinding/include/micropather.h +511 -0
- data/pathfinding/include/navmesh.h +114 -0
- data/pathfinding/include/pathfinder.h +24 -0
- data/pathfinding/main.cpp +108 -17
- data/pathfinding/micropather.cpp +1062 -0
- data/pathfinding/navmesh.cpp +408 -0
- data/pathfinding/overrides/DetourCrowd.cpp +1446 -0
- data/pathfinding/overrides/DetourNavMeshQuery.cpp +3551 -0
- data/pathfinding/overrides/DetourNavMeshQuery.h +538 -0
- data/pathfinding/pathfinder.cpp +117 -0
- data/pathfinding/{bin → premake}/premake4 +0 -0
- data/pathfinding/premake/premake4.exe +0 -0
- data/pathfinding/premake4.lua +12 -3
- data/spec/actor/actor_spec.rb +0 -7
- data/spec/client_manager_spec.rb +1 -1
- data/spec/couchproxy_spec.rb +38 -0
- data/spec/entity_persistence_spec.rb +129 -0
- data/spec/game_systems/team_manager_spec.rb +2 -2
- data/spec/hashring_spec.rb +17 -39
- data/spec/java_grid_spec.rb +0 -2
- data/spec/misc_spec.rb +111 -0
- data/spec/mono_spec.rb +50 -3
- data/spec/reliable_message_spec.rb +38 -0
- data/spec/spec_helper.rb +4 -4
- data/spec/spec_helper_minimal.rb +10 -0
- data/web/app.rb +108 -86
- data/web/config/trinidad.yml +1 -0
- data/web/views/add_player.erb +25 -0
- data/web/views/index.erb +0 -0
- data/web/views/layout.erb +48 -0
- data/web/views/login.erb +25 -0
- data/web/views/players.erb +24 -0
- metadata +209 -94
- data/config/config.example.yml +0 -100
- data/config/regions.example.yml +0 -9
- data/games/example/lib/authentication_handler.rb +0 -69
- data/games/models.rb +0 -3
- data/games/models/clan_member.rb +0 -8
- data/games/models/clan_profile.rb +0 -9
- data/games/models/player.rb +0 -7
- data/games/plugins.rb +0 -1
- data/games/plugins/team_handler.rb +0 -49
- data/games/preload.rb +0 -13
- data/java/.gitignore +0 -1
- data/java/build.gradle +0 -95
- data/java/component.erb +0 -396
- data/java/gradle/wrapper/gradle-wrapper.jar +0 -0
- data/java/src/main/java/com/game_machine/core/GameMachineLoader.java +0 -25
- data/java/src/main/java/com/game_machine/core/Grid.java +0 -195
- data/java/src/main/resources/logback.xml +0 -14
- data/java/src/main/resources/logging.properties +0 -3
- data/lib/game_machine/actor/mono_actor.rb +0 -89
- data/lib/game_machine/auth_handlers/base.rb +0 -21
- data/lib/game_machine/auth_handlers/public.rb +0 -34
- data/lib/game_machine/endpoints/mono_gateway.rb +0 -87
- data/lib/game_machine/endpoints/tcp.rb +0 -51
- data/lib/game_machine/endpoints/tcp_handler.rb +0 -75
- data/lib/game_machine/endpoints/udp.rb +0 -88
- data/lib/game_machine/game_loader.rb +0 -46
- data/lib/game_machine/game_systems/region_settings.rb +0 -13
- data/lib/game_machine/hashring.rb +0 -48
- data/lib/game_machine/settings.rb +0 -11
- data/mono/server/actor.cs +0 -37
- data/mono/server/iactor.cs +0 -11
- data/mono/server/message_util.cs +0 -29
- data/mono/server/proxy_client.cs +0 -73
- data/mono/server/proxy_server.cs +0 -30
- data/mono/server/test_actor.cs +0 -33
- data/pathfinding/include/pathfind.h +0 -167
- data/pathfinding/pathfind.cpp +0 -174
- data/pathfinding/pathfinder.cs +0 -66
- data/script/server.sh +0 -109
- data/script/watch.sh +0 -11
- data/spec/commands/navigation_commands_spec.rb +0 -51
- data/spec/game_systems/entity_tracking_spec.rb +0 -64
- data/spec/navigation/detour_navmesh_spec.rb +0 -34
- data/spec/navigation/detour_path_spec.rb +0 -25
- data/spec/udp_server_spec.rb +0 -10
- data/web/controllers/auth_controller.rb +0 -19
- data/web/controllers/base_controller.rb +0 -16
- data/web/controllers/index_controller.rb +0 -7
- data/web/controllers/log_controller.rb +0 -47
- data/web/controllers/messages_controller.rb +0 -59
- data/web/controllers/player_register_controller.rb +0 -15
- data/web/views/game_messages.haml +0 -45
- data/web/views/index.haml +0 -6
- data/web/views/layout.haml +0 -41
- data/web/views/logs.haml +0 -32
- data/web/views/player_register.haml +0 -22
- data/web/views/player_registered.haml +0 -2
- data/web/views/register_layout.haml +0 -22
- data/web/views/restart.haml +0 -35
@@ -0,0 +1,538 @@
|
|
1
|
+
//
|
2
|
+
// Copyright (c) 2009-2010 Mikko Mononen memon@inside.org
|
3
|
+
//
|
4
|
+
// This software is provided 'as-is', without any express or implied
|
5
|
+
// warranty. In no event will the authors be held liable for any damages
|
6
|
+
// arising from the use of this software.
|
7
|
+
// Permission is granted to anyone to use this software for any purpose,
|
8
|
+
// including commercial applications, and to alter it and redistribute it
|
9
|
+
// freely, subject to the following restrictions:
|
10
|
+
// 1. The origin of this software must not be misrepresented; you must not
|
11
|
+
// claim that you wrote the original software. If you use this software
|
12
|
+
// in a product, an acknowledgment in the product documentation would be
|
13
|
+
// appreciated but is not required.
|
14
|
+
// 2. Altered source versions must be plainly marked as such, and must not be
|
15
|
+
// misrepresented as being the original software.
|
16
|
+
// 3. This notice may not be removed or altered from any source distribution.
|
17
|
+
//
|
18
|
+
|
19
|
+
#ifndef DETOURNAVMESHQUERY_H
|
20
|
+
#define DETOURNAVMESHQUERY_H
|
21
|
+
|
22
|
+
#include "DetourNavMesh.h"
|
23
|
+
#include "DetourStatus.h"
|
24
|
+
|
25
|
+
|
26
|
+
// Define DT_VIRTUAL_QUERYFILTER if you wish to derive a custom filter from dtQueryFilter.
|
27
|
+
// On certain platforms indirect or virtual function call is expensive. The default
|
28
|
+
// setting is to use non-virtual functions, the actual implementations of the functions
|
29
|
+
// are declared as inline for maximum speed.
|
30
|
+
|
31
|
+
#define DT_VIRTUAL_QUERYFILTER 1
|
32
|
+
|
33
|
+
/// Defines polygon filtering and traversal costs for navigation mesh query operations.
|
34
|
+
/// @ingroup detour
|
35
|
+
class dtQueryFilter
|
36
|
+
{
|
37
|
+
float m_areaCost[DT_MAX_AREAS]; ///< Cost per area type. (Used by default implementation.)
|
38
|
+
unsigned short m_includeFlags; ///< Flags for polygons that can be visited. (Used by default implementation.)
|
39
|
+
unsigned short m_excludeFlags; ///< Flags for polygons that should not be visted. (Used by default implementation.)
|
40
|
+
|
41
|
+
public:
|
42
|
+
dtQueryFilter();
|
43
|
+
|
44
|
+
#ifdef DT_VIRTUAL_QUERYFILTER
|
45
|
+
virtual ~dtQueryFilter() { }
|
46
|
+
#endif
|
47
|
+
|
48
|
+
/// Returns true if the polygon can be visited. (I.e. Is traversable.)
|
49
|
+
/// @param[in] ref The reference id of the polygon test.
|
50
|
+
/// @param[in] tile The tile containing the polygon.
|
51
|
+
/// @param[in] poly The polygon to test.
|
52
|
+
#ifdef DT_VIRTUAL_QUERYFILTER
|
53
|
+
virtual bool passFilter(const dtPolyRef ref,
|
54
|
+
const dtMeshTile* tile,
|
55
|
+
const dtPoly* poly) const;
|
56
|
+
|
57
|
+
virtual bool isPassable(const float* pa, const float* pb) const;
|
58
|
+
#else
|
59
|
+
bool passFilter(const dtPolyRef ref,
|
60
|
+
const dtMeshTile* tile,
|
61
|
+
const dtPoly* poly) const;
|
62
|
+
#endif
|
63
|
+
|
64
|
+
/// Returns cost to move from the beginning to the end of a line segment
|
65
|
+
/// that is fully contained within a polygon.
|
66
|
+
/// @param[in] pa The start position on the edge of the previous and current polygon. [(x, y, z)]
|
67
|
+
/// @param[in] pb The end position on the edge of the current and next polygon. [(x, y, z)]
|
68
|
+
/// @param[in] prevRef The reference id of the previous polygon. [opt]
|
69
|
+
/// @param[in] prevTile The tile containing the previous polygon. [opt]
|
70
|
+
/// @param[in] prevPoly The previous polygon. [opt]
|
71
|
+
/// @param[in] curRef The reference id of the current polygon.
|
72
|
+
/// @param[in] curTile The tile containing the current polygon.
|
73
|
+
/// @param[in] curPoly The current polygon.
|
74
|
+
/// @param[in] nextRef The refernece id of the next polygon. [opt]
|
75
|
+
/// @param[in] nextTile The tile containing the next polygon. [opt]
|
76
|
+
/// @param[in] nextPoly The next polygon. [opt]
|
77
|
+
#ifdef DT_VIRTUAL_QUERYFILTER
|
78
|
+
virtual float getCost(const float* pa, const float* pb,
|
79
|
+
const dtPolyRef prevRef, const dtMeshTile* prevTile, const dtPoly* prevPoly,
|
80
|
+
const dtPolyRef curRef, const dtMeshTile* curTile, const dtPoly* curPoly,
|
81
|
+
const dtPolyRef nextRef, const dtMeshTile* nextTile, const dtPoly* nextPoly) const;
|
82
|
+
#else
|
83
|
+
float getCost(const float* pa, const float* pb,
|
84
|
+
const dtPolyRef prevRef, const dtMeshTile* prevTile, const dtPoly* prevPoly,
|
85
|
+
const dtPolyRef curRef, const dtMeshTile* curTile, const dtPoly* curPoly,
|
86
|
+
const dtPolyRef nextRef, const dtMeshTile* nextTile, const dtPoly* nextPoly) const;
|
87
|
+
#endif
|
88
|
+
|
89
|
+
/// @name Getters and setters for the default implementation data.
|
90
|
+
///@{
|
91
|
+
|
92
|
+
/// Returns the traversal cost of the area.
|
93
|
+
/// @param[in] i The id of the area.
|
94
|
+
/// @returns The traversal cost of the area.
|
95
|
+
inline float getAreaCost(const int i) const { return m_areaCost[i]; }
|
96
|
+
|
97
|
+
/// Sets the traversal cost of the area.
|
98
|
+
/// @param[in] i The id of the area.
|
99
|
+
/// @param[in] cost The new cost of traversing the area.
|
100
|
+
inline void setAreaCost(const int i, const float cost) { m_areaCost[i] = cost; }
|
101
|
+
|
102
|
+
/// Returns the include flags for the filter.
|
103
|
+
/// Any polygons that include one or more of these flags will be
|
104
|
+
/// included in the operation.
|
105
|
+
inline unsigned short getIncludeFlags() const { return m_includeFlags; }
|
106
|
+
|
107
|
+
/// Sets the include flags for the filter.
|
108
|
+
/// @param[in] flags The new flags.
|
109
|
+
inline void setIncludeFlags(const unsigned short flags) { m_includeFlags = flags; }
|
110
|
+
|
111
|
+
/// Returns the exclude flags for the filter.
|
112
|
+
/// Any polygons that include one ore more of these flags will be
|
113
|
+
/// excluded from the operation.
|
114
|
+
inline unsigned short getExcludeFlags() const { return m_excludeFlags; }
|
115
|
+
|
116
|
+
/// Sets the exclude flags for the filter.
|
117
|
+
/// @param[in] flags The new flags.
|
118
|
+
inline void setExcludeFlags(const unsigned short flags) { m_excludeFlags = flags; }
|
119
|
+
|
120
|
+
///@}
|
121
|
+
|
122
|
+
};
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
/// Provides information about raycast hit
|
127
|
+
/// filled by dtNavMeshQuery::raycast
|
128
|
+
/// @ingroup detour
|
129
|
+
struct dtRaycastHit
|
130
|
+
{
|
131
|
+
/// The hit parameter. (FLT_MAX if no wall hit.)
|
132
|
+
float t;
|
133
|
+
|
134
|
+
/// hitNormal The normal of the nearest wall hit. [(x, y, z)]
|
135
|
+
float hitNormal[3];
|
136
|
+
|
137
|
+
/// Pointer to an array of reference ids of the visited polygons. [opt]
|
138
|
+
dtPolyRef* path;
|
139
|
+
|
140
|
+
/// The number of visited polygons. [opt]
|
141
|
+
int pathCount;
|
142
|
+
|
143
|
+
/// The maximum number of polygons the @p path array can hold.
|
144
|
+
int maxPath;
|
145
|
+
|
146
|
+
/// The cost of the path until hit.
|
147
|
+
float pathCost;
|
148
|
+
};
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
/// Provides the ability to perform pathfinding related queries against
|
153
|
+
/// a navigation mesh.
|
154
|
+
/// @ingroup detour
|
155
|
+
class dtNavMeshQuery
|
156
|
+
{
|
157
|
+
public:
|
158
|
+
dtNavMeshQuery();
|
159
|
+
~dtNavMeshQuery();
|
160
|
+
|
161
|
+
/// Initializes the query object.
|
162
|
+
/// @param[in] nav Pointer to the dtNavMesh object to use for all queries.
|
163
|
+
/// @param[in] maxNodes Maximum number of search nodes. [Limits: 0 < value <= 65536]
|
164
|
+
/// @returns The status flags for the query.
|
165
|
+
dtStatus init(const dtNavMesh* nav, const int maxNodes);
|
166
|
+
|
167
|
+
/// @name Standard Pathfinding Functions
|
168
|
+
// /@{
|
169
|
+
|
170
|
+
/// Finds a path from the start polygon to the end polygon.
|
171
|
+
/// @param[in] startRef The refrence id of the start polygon.
|
172
|
+
/// @param[in] endRef The reference id of the end polygon.
|
173
|
+
/// @param[in] startPos A position within the start polygon. [(x, y, z)]
|
174
|
+
/// @param[in] endPos A position within the end polygon. [(x, y, z)]
|
175
|
+
/// @param[in] filter The polygon filter to apply to the query.
|
176
|
+
/// @param[out] path An ordered list of polygon references representing the path. (Start to end.)
|
177
|
+
/// [(polyRef) * @p pathCount]
|
178
|
+
/// @param[out] pathCount The number of polygons returned in the @p path array.
|
179
|
+
/// @param[in] maxPath The maximum number of polygons the @p path array can hold. [Limit: >= 1]
|
180
|
+
dtStatus findPath(dtPolyRef startRef, dtPolyRef endRef,
|
181
|
+
const float* startPos, const float* endPos,
|
182
|
+
const dtQueryFilter* filter,
|
183
|
+
dtPolyRef* path, int* pathCount, const int maxPath) const;
|
184
|
+
|
185
|
+
/// Finds the straight path from the start to the end position within the polygon corridor.
|
186
|
+
/// @param[in] startPos Path start position. [(x, y, z)]
|
187
|
+
/// @param[in] endPos Path end position. [(x, y, z)]
|
188
|
+
/// @param[in] path An array of polygon references that represent the path corridor.
|
189
|
+
/// @param[in] pathSize The number of polygons in the @p path array.
|
190
|
+
/// @param[out] straightPath Points describing the straight path. [(x, y, z) * @p straightPathCount].
|
191
|
+
/// @param[out] straightPathFlags Flags describing each point. (See: #dtStraightPathFlags) [opt]
|
192
|
+
/// @param[out] straightPathRefs The reference id of the polygon that is being entered at each point. [opt]
|
193
|
+
/// @param[out] straightPathCount The number of points in the straight path.
|
194
|
+
/// @param[in] maxStraightPath The maximum number of points the straight path arrays can hold. [Limit: > 0]
|
195
|
+
/// @param[in] options Query options. (see: #dtStraightPathOptions)
|
196
|
+
/// @returns The status flags for the query.
|
197
|
+
dtStatus findStraightPath(const float* startPos, const float* endPos,
|
198
|
+
const dtPolyRef* path, const int pathSize,
|
199
|
+
float* straightPath, unsigned char* straightPathFlags, dtPolyRef* straightPathRefs,
|
200
|
+
int* straightPathCount, const int maxStraightPath, const int options = 0) const;
|
201
|
+
|
202
|
+
///@}
|
203
|
+
/// @name Sliced Pathfinding Functions
|
204
|
+
/// Common use case:
|
205
|
+
/// -# Call initSlicedFindPath() to initialize the sliced path query.
|
206
|
+
/// -# Call updateSlicedFindPath() until it returns complete.
|
207
|
+
/// -# Call finalizeSlicedFindPath() to get the path.
|
208
|
+
///@{
|
209
|
+
|
210
|
+
/// Intializes a sliced path query.
|
211
|
+
/// @param[in] startRef The refrence id of the start polygon.
|
212
|
+
/// @param[in] endRef The reference id of the end polygon.
|
213
|
+
/// @param[in] startPos A position within the start polygon. [(x, y, z)]
|
214
|
+
/// @param[in] endPos A position within the end polygon. [(x, y, z)]
|
215
|
+
/// @param[in] filter The polygon filter to apply to the query.
|
216
|
+
/// @param[in] options query options (see: #dtFindPathOptions)
|
217
|
+
/// @returns The status flags for the query.
|
218
|
+
dtStatus initSlicedFindPath(dtPolyRef startRef, dtPolyRef endRef,
|
219
|
+
const float* startPos, const float* endPos,
|
220
|
+
const dtQueryFilter* filter, const unsigned int options = 0);
|
221
|
+
|
222
|
+
/// Updates an in-progress sliced path query.
|
223
|
+
/// @param[in] maxIter The maximum number of iterations to perform.
|
224
|
+
/// @param[out] doneIters The actual number of iterations completed. [opt]
|
225
|
+
/// @returns The status flags for the query.
|
226
|
+
dtStatus updateSlicedFindPath(const int maxIter, int* doneIters);
|
227
|
+
|
228
|
+
/// Finalizes and returns the results of a sliced path query.
|
229
|
+
/// @param[out] path An ordered list of polygon references representing the path. (Start to end.)
|
230
|
+
/// [(polyRef) * @p pathCount]
|
231
|
+
/// @param[out] pathCount The number of polygons returned in the @p path array.
|
232
|
+
/// @param[in] maxPath The max number of polygons the path array can hold. [Limit: >= 1]
|
233
|
+
/// @returns The status flags for the query.
|
234
|
+
dtStatus finalizeSlicedFindPath(dtPolyRef* path, int* pathCount, const int maxPath);
|
235
|
+
|
236
|
+
/// Finalizes and returns the results of an incomplete sliced path query, returning the path to the furthest
|
237
|
+
/// polygon on the existing path that was visited during the search.
|
238
|
+
/// @param[in] existing An array of polygon references for the existing path.
|
239
|
+
/// @param[in] existingSize The number of polygon in the @p existing array.
|
240
|
+
/// @param[out] path An ordered list of polygon references representing the path. (Start to end.)
|
241
|
+
/// [(polyRef) * @p pathCount]
|
242
|
+
/// @param[out] pathCount The number of polygons returned in the @p path array.
|
243
|
+
/// @param[in] maxPath The max number of polygons the @p path array can hold. [Limit: >= 1]
|
244
|
+
/// @returns The status flags for the query.
|
245
|
+
dtStatus finalizeSlicedFindPathPartial(const dtPolyRef* existing, const int existingSize,
|
246
|
+
dtPolyRef* path, int* pathCount, const int maxPath);
|
247
|
+
|
248
|
+
///@}
|
249
|
+
/// @name Dijkstra Search Functions
|
250
|
+
/// @{
|
251
|
+
|
252
|
+
/// Finds the polygons along the navigation graph that touch the specified circle.
|
253
|
+
/// @param[in] startRef The reference id of the polygon where the search starts.
|
254
|
+
/// @param[in] centerPos The center of the search circle. [(x, y, z)]
|
255
|
+
/// @param[in] radius The radius of the search circle.
|
256
|
+
/// @param[in] filter The polygon filter to apply to the query.
|
257
|
+
/// @param[out] resultRef The reference ids of the polygons touched by the circle. [opt]
|
258
|
+
/// @param[out] resultParent The reference ids of the parent polygons for each result.
|
259
|
+
/// Zero if a result polygon has no parent. [opt]
|
260
|
+
/// @param[out] resultCost The search cost from @p centerPos to the polygon. [opt]
|
261
|
+
/// @param[out] resultCount The number of polygons found. [opt]
|
262
|
+
/// @param[in] maxResult The maximum number of polygons the result arrays can hold.
|
263
|
+
/// @returns The status flags for the query.
|
264
|
+
dtStatus findPolysAroundCircle(dtPolyRef startRef, const float* centerPos, const float radius,
|
265
|
+
const dtQueryFilter* filter,
|
266
|
+
dtPolyRef* resultRef, dtPolyRef* resultParent, float* resultCost,
|
267
|
+
int* resultCount, const int maxResult) const;
|
268
|
+
|
269
|
+
/// Finds the polygons along the naviation graph that touch the specified convex polygon.
|
270
|
+
/// @param[in] startRef The reference id of the polygon where the search starts.
|
271
|
+
/// @param[in] verts The vertices describing the convex polygon. (CCW)
|
272
|
+
/// [(x, y, z) * @p nverts]
|
273
|
+
/// @param[in] nverts The number of vertices in the polygon.
|
274
|
+
/// @param[in] filter The polygon filter to apply to the query.
|
275
|
+
/// @param[out] resultRef The reference ids of the polygons touched by the search polygon. [opt]
|
276
|
+
/// @param[out] resultParent The reference ids of the parent polygons for each result. Zero if a
|
277
|
+
/// result polygon has no parent. [opt]
|
278
|
+
/// @param[out] resultCost The search cost from the centroid point to the polygon. [opt]
|
279
|
+
/// @param[out] resultCount The number of polygons found.
|
280
|
+
/// @param[in] maxResult The maximum number of polygons the result arrays can hold.
|
281
|
+
/// @returns The status flags for the query.
|
282
|
+
dtStatus findPolysAroundShape(dtPolyRef startRef, const float* verts, const int nverts,
|
283
|
+
const dtQueryFilter* filter,
|
284
|
+
dtPolyRef* resultRef, dtPolyRef* resultParent, float* resultCost,
|
285
|
+
int* resultCount, const int maxResult) const;
|
286
|
+
|
287
|
+
/// @}
|
288
|
+
/// @name Local Query Functions
|
289
|
+
///@{
|
290
|
+
|
291
|
+
/// Finds the polygon nearest to the specified center point.
|
292
|
+
/// @param[in] center The center of the search box. [(x, y, z)]
|
293
|
+
/// @param[in] extents The search distance along each axis. [(x, y, z)]
|
294
|
+
/// @param[in] filter The polygon filter to apply to the query.
|
295
|
+
/// @param[out] nearestRef The reference id of the nearest polygon.
|
296
|
+
/// @param[out] nearestPt The nearest point on the polygon. [opt] [(x, y, z)]
|
297
|
+
/// @returns The status flags for the query.
|
298
|
+
dtStatus findNearestPoly(const float* center, const float* extents,
|
299
|
+
const dtQueryFilter* filter,
|
300
|
+
dtPolyRef* nearestRef, float* nearestPt) const;
|
301
|
+
|
302
|
+
/// Finds polygons that overlap the search box.
|
303
|
+
/// @param[in] center The center of the search box. [(x, y, z)]
|
304
|
+
/// @param[in] extents The search distance along each axis. [(x, y, z)]
|
305
|
+
/// @param[in] filter The polygon filter to apply to the query.
|
306
|
+
/// @param[out] polys The reference ids of the polygons that overlap the query box.
|
307
|
+
/// @param[out] polyCount The number of polygons in the search result.
|
308
|
+
/// @param[in] maxPolys The maximum number of polygons the search result can hold.
|
309
|
+
/// @returns The status flags for the query.
|
310
|
+
dtStatus queryPolygons(const float* center, const float* extents,
|
311
|
+
const dtQueryFilter* filter,
|
312
|
+
dtPolyRef* polys, int* polyCount, const int maxPolys) const;
|
313
|
+
|
314
|
+
/// Finds the non-overlapping navigation polygons in the local neighbourhood around the center position.
|
315
|
+
/// @param[in] startRef The reference id of the polygon where the search starts.
|
316
|
+
/// @param[in] centerPos The center of the query circle. [(x, y, z)]
|
317
|
+
/// @param[in] radius The radius of the query circle.
|
318
|
+
/// @param[in] filter The polygon filter to apply to the query.
|
319
|
+
/// @param[out] resultRef The reference ids of the polygons touched by the circle.
|
320
|
+
/// @param[out] resultParent The reference ids of the parent polygons for each result.
|
321
|
+
/// Zero if a result polygon has no parent. [opt]
|
322
|
+
/// @param[out] resultCount The number of polygons found.
|
323
|
+
/// @param[in] maxResult The maximum number of polygons the result arrays can hold.
|
324
|
+
/// @returns The status flags for the query.
|
325
|
+
dtStatus findLocalNeighbourhood(dtPolyRef startRef, const float* centerPos, const float radius,
|
326
|
+
const dtQueryFilter* filter,
|
327
|
+
dtPolyRef* resultRef, dtPolyRef* resultParent,
|
328
|
+
int* resultCount, const int maxResult) const;
|
329
|
+
|
330
|
+
/// Moves from the start to the end position constrained to the navigation mesh.
|
331
|
+
/// @param[in] startRef The reference id of the start polygon.
|
332
|
+
/// @param[in] startPos A position of the mover within the start polygon. [(x, y, x)]
|
333
|
+
/// @param[in] endPos The desired end position of the mover. [(x, y, z)]
|
334
|
+
/// @param[in] filter The polygon filter to apply to the query.
|
335
|
+
/// @param[out] resultPos The result position of the mover. [(x, y, z)]
|
336
|
+
/// @param[out] visited The reference ids of the polygons visited during the move.
|
337
|
+
/// @param[out] visitedCount The number of polygons visited during the move.
|
338
|
+
/// @param[in] maxVisitedSize The maximum number of polygons the @p visited array can hold.
|
339
|
+
/// @returns The status flags for the query.
|
340
|
+
dtStatus moveAlongSurface(dtPolyRef startRef, const float* startPos, const float* endPos,
|
341
|
+
const dtQueryFilter* filter,
|
342
|
+
float* resultPos, dtPolyRef* visited, int* visitedCount, const int maxVisitedSize) const;
|
343
|
+
|
344
|
+
/// Casts a 'walkability' ray along the surface of the navigation mesh from
|
345
|
+
/// the start position toward the end position.
|
346
|
+
/// @note A wrapper around raycast(..., RaycastHit*). Retained for backward compatibility.
|
347
|
+
/// @param[in] startRef The reference id of the start polygon.
|
348
|
+
/// @param[in] startPos A position within the start polygon representing
|
349
|
+
/// the start of the ray. [(x, y, z)]
|
350
|
+
/// @param[in] endPos The position to cast the ray toward. [(x, y, z)]
|
351
|
+
/// @param[out] t The hit parameter. (FLT_MAX if no wall hit.)
|
352
|
+
/// @param[out] hitNormal The normal of the nearest wall hit. [(x, y, z)]
|
353
|
+
/// @param[in] filter The polygon filter to apply to the query.
|
354
|
+
/// @param[out] path The reference ids of the visited polygons. [opt]
|
355
|
+
/// @param[out] pathCount The number of visited polygons. [opt]
|
356
|
+
/// @param[in] maxPath The maximum number of polygons the @p path array can hold.
|
357
|
+
/// @returns The status flags for the query.
|
358
|
+
dtStatus raycast(dtPolyRef startRef, const float* startPos, const float* endPos,
|
359
|
+
const dtQueryFilter* filter,
|
360
|
+
float* t, float* hitNormal, dtPolyRef* path, int* pathCount, const int maxPath) const;
|
361
|
+
|
362
|
+
/// Casts a 'walkability' ray along the surface of the navigation mesh from
|
363
|
+
/// the start position toward the end position.
|
364
|
+
/// @param[in] startRef The reference id of the start polygon.
|
365
|
+
/// @param[in] startPos A position within the start polygon representing
|
366
|
+
/// the start of the ray. [(x, y, z)]
|
367
|
+
/// @param[in] endPos The position to cast the ray toward. [(x, y, z)]
|
368
|
+
/// @param[in] filter The polygon filter to apply to the query.
|
369
|
+
/// @param[in] flags govern how the raycast behaves. See dtRaycastOptions
|
370
|
+
/// @param[out] hit Pointer to a raycast hit structure which will be filled by the results.
|
371
|
+
/// @param[in] prevRef parent of start ref. Used during for cost calculation [opt]
|
372
|
+
/// @returns The status flags for the query.
|
373
|
+
dtStatus raycast(dtPolyRef startRef, const float* startPos, const float* endPos,
|
374
|
+
const dtQueryFilter* filter, const unsigned int options,
|
375
|
+
dtRaycastHit* hit, dtPolyRef prevRef = 0) const;
|
376
|
+
|
377
|
+
|
378
|
+
/// Finds the distance from the specified position to the nearest polygon wall.
|
379
|
+
/// @param[in] startRef The reference id of the polygon containing @p centerPos.
|
380
|
+
/// @param[in] centerPos The center of the search circle. [(x, y, z)]
|
381
|
+
/// @param[in] maxRadius The radius of the search circle.
|
382
|
+
/// @param[in] filter The polygon filter to apply to the query.
|
383
|
+
/// @param[out] hitDist The distance to the nearest wall from @p centerPos.
|
384
|
+
/// @param[out] hitPos The nearest position on the wall that was hit. [(x, y, z)]
|
385
|
+
/// @param[out] hitNormal The normalized ray formed from the wall point to the
|
386
|
+
/// source point. [(x, y, z)]
|
387
|
+
/// @returns The status flags for the query.
|
388
|
+
dtStatus findDistanceToWall(dtPolyRef startRef, const float* centerPos, const float maxRadius,
|
389
|
+
const dtQueryFilter* filter,
|
390
|
+
float* hitDist, float* hitPos, float* hitNormal) const;
|
391
|
+
|
392
|
+
/// Returns the segments for the specified polygon, optionally including portals.
|
393
|
+
/// @param[in] ref The reference id of the polygon.
|
394
|
+
/// @param[in] filter The polygon filter to apply to the query.
|
395
|
+
/// @param[out] segmentVerts The segments. [(ax, ay, az, bx, by, bz) * segmentCount]
|
396
|
+
/// @param[out] segmentRefs The reference ids of each segment's neighbor polygon.
|
397
|
+
/// Or zero if the segment is a wall. [opt] [(parentRef) * @p segmentCount]
|
398
|
+
/// @param[out] segmentCount The number of segments returned.
|
399
|
+
/// @param[in] maxSegments The maximum number of segments the result arrays can hold.
|
400
|
+
/// @returns The status flags for the query.
|
401
|
+
dtStatus getPolyWallSegments(dtPolyRef ref, const dtQueryFilter* filter,
|
402
|
+
float* segmentVerts, dtPolyRef* segmentRefs, int* segmentCount,
|
403
|
+
const int maxSegments) const;
|
404
|
+
|
405
|
+
/// Returns random location on navmesh.
|
406
|
+
/// Polygons are chosen weighted by area. The search runs in linear related to number of polygon.
|
407
|
+
/// @param[in] filter The polygon filter to apply to the query.
|
408
|
+
/// @param[in] frand Function returning a random number [0..1).
|
409
|
+
/// @param[out] randomRef The reference id of the random location.
|
410
|
+
/// @param[out] randomPt The random location.
|
411
|
+
/// @returns The status flags for the query.
|
412
|
+
dtStatus findRandomPoint(const dtQueryFilter* filter, float (*frand)(),
|
413
|
+
dtPolyRef* randomRef, float* randomPt) const;
|
414
|
+
|
415
|
+
/// Returns random location on navmesh within the reach of specified location.
|
416
|
+
/// Polygons are chosen weighted by area. The search runs in linear related to number of polygon.
|
417
|
+
/// The location is not exactly constrained by the circle, but it limits the visited polygons.
|
418
|
+
/// @param[in] startRef The reference id of the polygon where the search starts.
|
419
|
+
/// @param[in] centerPos The center of the search circle. [(x, y, z)]
|
420
|
+
/// @param[in] filter The polygon filter to apply to the query.
|
421
|
+
/// @param[in] frand Function returning a random number [0..1).
|
422
|
+
/// @param[out] randomRef The reference id of the random location.
|
423
|
+
/// @param[out] randomPt The random location. [(x, y, z)]
|
424
|
+
/// @returns The status flags for the query.
|
425
|
+
dtStatus findRandomPointAroundCircle(dtPolyRef startRef, const float* centerPos, const float maxRadius,
|
426
|
+
const dtQueryFilter* filter, float (*frand)(),
|
427
|
+
dtPolyRef* randomRef, float* randomPt) const;
|
428
|
+
|
429
|
+
/// Finds the closest point on the specified polygon.
|
430
|
+
/// @param[in] ref The reference id of the polygon.
|
431
|
+
/// @param[in] pos The position to check. [(x, y, z)]
|
432
|
+
/// @param[out] closest The closest point on the polygon. [(x, y, z)]
|
433
|
+
/// @param[out] posOverPoly True of the position is over the polygon.
|
434
|
+
/// @returns The status flags for the query.
|
435
|
+
dtStatus closestPointOnPoly(dtPolyRef ref, const float* pos, float* closest, bool* posOverPoly) const;
|
436
|
+
|
437
|
+
/// Returns a point on the boundary closest to the source point if the source point is outside the
|
438
|
+
/// polygon's xz-bounds.
|
439
|
+
/// @param[in] ref The reference id to the polygon.
|
440
|
+
/// @param[in] pos The position to check. [(x, y, z)]
|
441
|
+
/// @param[out] closest The closest point. [(x, y, z)]
|
442
|
+
/// @returns The status flags for the query.
|
443
|
+
dtStatus closestPointOnPolyBoundary(dtPolyRef ref, const float* pos, float* closest) const;
|
444
|
+
|
445
|
+
/// Gets the height of the polygon at the provided position using the height detail. (Most accurate.)
|
446
|
+
/// @param[in] ref The reference id of the polygon.
|
447
|
+
/// @param[in] pos A position within the xz-bounds of the polygon. [(x, y, z)]
|
448
|
+
/// @param[out] height The height at the surface of the polygon.
|
449
|
+
/// @returns The status flags for the query.
|
450
|
+
dtStatus getPolyHeight(dtPolyRef ref, const float* pos, float* height) const;
|
451
|
+
|
452
|
+
/// @}
|
453
|
+
/// @name Miscellaneous Functions
|
454
|
+
/// @{
|
455
|
+
|
456
|
+
/// Returns true if the polygon reference is valid and passes the filter restrictions.
|
457
|
+
/// @param[in] ref The polygon reference to check.
|
458
|
+
/// @param[in] filter The filter to apply.
|
459
|
+
bool isValidPolyRef(dtPolyRef ref, const dtQueryFilter* filter) const;
|
460
|
+
|
461
|
+
/// Returns true if the polygon reference is in the closed list.
|
462
|
+
/// @param[in] ref The reference id of the polygon to check.
|
463
|
+
/// @returns True if the polygon is in closed list.
|
464
|
+
bool isInClosedList(dtPolyRef ref) const;
|
465
|
+
|
466
|
+
/// Gets the node pool.
|
467
|
+
/// @returns The node pool.
|
468
|
+
class dtNodePool* getNodePool() const { return m_nodePool; }
|
469
|
+
|
470
|
+
/// Gets the navigation mesh the query object is using.
|
471
|
+
/// @return The navigation mesh the query object is using.
|
472
|
+
const dtNavMesh* getAttachedNavMesh() const { return m_nav; }
|
473
|
+
|
474
|
+
/// @}
|
475
|
+
|
476
|
+
private:
|
477
|
+
|
478
|
+
/// Returns neighbour tile based on side.
|
479
|
+
dtMeshTile* getNeighbourTileAt(int x, int y, int side) const;
|
480
|
+
|
481
|
+
/// Queries polygons within a tile.
|
482
|
+
int queryPolygonsInTile(const dtMeshTile* tile, const float* qmin, const float* qmax, const dtQueryFilter* filter,
|
483
|
+
dtPolyRef* polys, const int maxPolys) const;
|
484
|
+
|
485
|
+
/// Returns portal points between two polygons.
|
486
|
+
dtStatus getPortalPoints(dtPolyRef from, dtPolyRef to, float* left, float* right,
|
487
|
+
unsigned char& fromType, unsigned char& toType) const;
|
488
|
+
dtStatus getPortalPoints(dtPolyRef from, const dtPoly* fromPoly, const dtMeshTile* fromTile,
|
489
|
+
dtPolyRef to, const dtPoly* toPoly, const dtMeshTile* toTile,
|
490
|
+
float* left, float* right) const;
|
491
|
+
|
492
|
+
/// Returns edge mid point between two polygons.
|
493
|
+
dtStatus getEdgeMidPoint(dtPolyRef from, dtPolyRef to, float* mid) const;
|
494
|
+
dtStatus getEdgeMidPoint(dtPolyRef from, const dtPoly* fromPoly, const dtMeshTile* fromTile,
|
495
|
+
dtPolyRef to, const dtPoly* toPoly, const dtMeshTile* toTile,
|
496
|
+
float* mid) const;
|
497
|
+
|
498
|
+
// Appends vertex to a straight path
|
499
|
+
dtStatus appendVertex(const float* pos, const unsigned char flags, const dtPolyRef ref,
|
500
|
+
float* straightPath, unsigned char* straightPathFlags, dtPolyRef* straightPathRefs,
|
501
|
+
int* straightPathCount, const int maxStraightPath) const;
|
502
|
+
|
503
|
+
// Appends intermediate portal points to a straight path.
|
504
|
+
dtStatus appendPortals(const int startIdx, const int endIdx, const float* endPos, const dtPolyRef* path,
|
505
|
+
float* straightPath, unsigned char* straightPathFlags, dtPolyRef* straightPathRefs,
|
506
|
+
int* straightPathCount, const int maxStraightPath, const int options) const;
|
507
|
+
|
508
|
+
const dtNavMesh* m_nav; ///< Pointer to navmesh data.
|
509
|
+
|
510
|
+
struct dtQueryData
|
511
|
+
{
|
512
|
+
dtStatus status;
|
513
|
+
struct dtNode* lastBestNode;
|
514
|
+
float lastBestNodeCost;
|
515
|
+
dtPolyRef startRef, endRef;
|
516
|
+
float startPos[3], endPos[3];
|
517
|
+
const dtQueryFilter* filter;
|
518
|
+
unsigned int options;
|
519
|
+
float raycastLimitSqr;
|
520
|
+
};
|
521
|
+
dtQueryData m_query; ///< Sliced query state.
|
522
|
+
|
523
|
+
class dtNodePool* m_tinyNodePool; ///< Pointer to small node pool.
|
524
|
+
class dtNodePool* m_nodePool; ///< Pointer to node pool.
|
525
|
+
class dtNodeQueue* m_openList; ///< Pointer to open list queue.
|
526
|
+
};
|
527
|
+
|
528
|
+
/// Allocates a query object using the Detour allocator.
|
529
|
+
/// @return An allocated query object, or null on failure.
|
530
|
+
/// @ingroup detour
|
531
|
+
dtNavMeshQuery* dtAllocNavMeshQuery();
|
532
|
+
|
533
|
+
/// Frees the specified query object using the Detour allocator.
|
534
|
+
/// @param[in] query A query object allocated using #dtAllocNavMeshQuery
|
535
|
+
/// @ingroup detour
|
536
|
+
void dtFreeNavMeshQuery(dtNavMeshQuery* query);
|
537
|
+
|
538
|
+
#endif // DETOURNAVMESHQUERY_H
|