summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e80d553)
raw | patch | inline | side by side (parent: e80d553)
author | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Mon, 21 Aug 2017 20:17:26 +0000 (23:17 +0300) | ||
committer | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Mon, 21 Aug 2017 21:02:16 +0000 (00:02 +0300) |
src/game/z_aabbtree.pas | patch | blob | history |
index 72206539078e070e414dfdf5e1b7794b1624d475..88c7b8862aee31067522d79fd922d20d980e8fb2 100644 (file)
--- a/src/game/z_aabbtree.pas
+++ b/src/game/z_aabbtree.pas
function aabbQuery (ax, ay, aw, ah: TreeNumber; cb: TQueryOverlapCB; tagmask: Integer=-1): TTreeFlesh;
function pointQuery (ax, ay: TreeNumber; cb: TQueryOverlapCB; tagmask: Integer=-1): TTreeFlesh;
- function segmentQuery (out qr: TSegmentQueryResult; ax, ay, bx, by: TreeNumber; cb: TSegQueryCallback; tagmask: Integer=-1): Boolean;
+ function segmentQuery (out qr: TSegmentQueryResult; const ax, ay, bx, by: TreeNumber; cb: TSegQueryCallback; tagmask: Integer=-1): Boolean;
function computeTreeHeight (): Integer; // compute the height of the tree
// segment querying method
-function TDynAABBTreeBase.segmentQuery (out qr: TSegmentQueryResult; ax, ay, bx, by: TreeNumber; cb: TSegQueryCallback; tagmask: Integer=-1): Boolean;
+function TDynAABBTreeBase.segmentQuery (out qr: TSegmentQueryResult; const ax, ay, bx, by: TreeNumber; cb: TSegQueryCallback; tagmask: Integer=-1): Boolean;
var
oldcurax, oldcuray: Single;
oldcurbx, oldcurby: Single;
diry := olddiry;
traceRay := oldray;
- result := qr.valid;
+ if qr.valid and (qr.time <= (bx-ax)*(bx-ax)+(by-ay)*(by-ay)) then
+ begin
+ result := true;
+ end
+ else
+ begin
+ result := false;
+ qr.flesh := nil;
+ end;
end;