-
-
Notifications
You must be signed in to change notification settings - Fork 386
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Convert Space.GetBodies() to use a type filter
- Avoids pushing all bodies in Space to Lua every time we want to perform a very simple type filter operation - Also avoids a Lua -> C -> Lua -> C call chain for each body - Replace with lua-side filtering on a reduced set of bodies where class filter isn't granular enough - Convert all classnames into ObjectType enum values for filtering
- Loading branch information
Showing
10 changed files
with
100 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
-- Copyright © 2008-2023 Pioneer Developers. See AUTHORS.txt for details | ||
-- Licensed under the terms of the GPL v3. See licenses/GPL-3.txt | ||
|
||
-- This file implements type information about C++ classes for Lua static analysis | ||
|
||
---@meta | ||
|
||
local Space = {} | ||
|
||
package.core["Space"] = Space | ||
|
||
-- Returns a list of bodies simulated in the current system, optionally filtered by type | ||
---@generic T | ||
---@param class `T` an optional body classname to filter the returned results by | ||
---@return T[] | ||
---@overload fun(): Body[] | ||
function Space.GetBodies(class) end | ||
|
||
-- Returns a list of bodies at most dist away from the given body, optionally filtered by type | ||
---@generic T | ||
---@param body Body the reference body | ||
---@param dist number the maximum distance from the reference body to search | ||
---@param filter `T` an optional body classname to filter the returned results by | ||
---@return T[] | ||
---@overload fun(body: Body, dist: number): Body[] | ||
function Space.GetBodiesNear(body, dist, filter) end | ||
|
||
return Space |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters