Merge pull request #2203 from elsid/update_recastnavigation

Update recastnavigation
pull/541/head
Bret Curtis 6 years ago committed by GitHub
commit 84ce9814fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -114,27 +114,27 @@ namespace
EXPECT_EQ(mPath, std::deque<osg::Vec3f>({
osg::Vec3f(-215, 215, 1.85963428020477294921875),
osg::Vec3f(-194.9653167724609375, 194.9653167724609375, -6.5760211944580078125),
osg::Vec3f(-194.9653167724609375, 194.9653167724609375, -6.57602214813232421875),
osg::Vec3f(-174.930633544921875, 174.930633544921875, -15.01167774200439453125),
osg::Vec3f(-154.8959503173828125, 154.8959503173828125, -23.4473323822021484375),
osg::Vec3f(-134.86126708984375, 134.86126708984375, -31.8829898834228515625),
osg::Vec3f(-154.8959503173828125, 154.8959503173828125, -23.4473361968994140625),
osg::Vec3f(-134.86126708984375, 134.86126708984375, -31.8829936981201171875),
osg::Vec3f(-114.82657623291015625, 114.82657623291015625, -40.3186492919921875),
osg::Vec3f(-94.7918853759765625, 94.7918853759765625, -47.39907073974609375),
osg::Vec3f(-94.7918853759765625, 94.7918853759765625, -47.3990631103515625),
osg::Vec3f(-74.75719451904296875, 74.75719451904296875, -53.7258148193359375),
osg::Vec3f(-54.722499847412109375, 54.722499847412109375, -60.052555084228515625),
osg::Vec3f(-34.68780517578125, 34.68780517578125, -66.37929534912109375),
osg::Vec3f(-34.68780517578125, 34.68780517578125, -66.37931060791015625),
osg::Vec3f(-14.6531162261962890625, 14.6531162261962890625, -72.70604705810546875),
osg::Vec3f(5.3815765380859375, -5.3815765380859375, -75.35065460205078125),
osg::Vec3f(25.41626739501953125, -25.41626739501953125, -67.96945953369140625),
osg::Vec3f(45.450958251953125, -45.450958251953125, -60.58824920654296875),
osg::Vec3f(25.41626739501953125, -25.41626739501953125, -67.9694671630859375),
osg::Vec3f(45.450958251953125, -45.450958251953125, -60.5882568359375),
osg::Vec3f(65.48564910888671875, -65.48564910888671875, -53.20705413818359375),
osg::Vec3f(85.5203399658203125, -85.5203399658203125, -45.825855255126953125),
osg::Vec3f(85.5203399658203125, -85.5203399658203125, -45.82585906982421875),
osg::Vec3f(105.55503082275390625, -105.55503082275390625, -38.44464874267578125),
osg::Vec3f(125.5897216796875, -125.5897216796875, -31.063449859619140625),
osg::Vec3f(145.6244049072265625, -145.6244049072265625, -23.6822509765625),
osg::Vec3f(165.659088134765625, -165.659088134765625, -16.3010540008544921875),
osg::Vec3f(185.6937713623046875, -185.6937713623046875, -8.91985416412353515625),
osg::Vec3f(205.7284698486328125, -205.7284698486328125, -1.53864824771881103515625),
osg::Vec3f(185.6937713623046875, -185.6937713623046875, -8.91985321044921875),
osg::Vec3f(205.7284698486328125, -205.7284698486328125, -1.5386486053466796875),
osg::Vec3f(215, -215, 1.877177715301513671875),
})) << mPath;
}
@ -164,27 +164,27 @@ namespace
EXPECT_EQ(mPath, std::deque<osg::Vec3f>({
osg::Vec3f(-215, 215, 1.85963428020477294921875),
osg::Vec3f(-194.9653167724609375, 194.9653167724609375, -6.5760211944580078125),
osg::Vec3f(-194.9653167724609375, 194.9653167724609375, -6.57602214813232421875),
osg::Vec3f(-174.930633544921875, 174.930633544921875, -15.01167774200439453125),
osg::Vec3f(-154.8959503173828125, 154.8959503173828125, -23.4473323822021484375),
osg::Vec3f(-134.86126708984375, 134.86126708984375, -31.8829898834228515625),
osg::Vec3f(-154.8959503173828125, 154.8959503173828125, -23.4473361968994140625),
osg::Vec3f(-134.86126708984375, 134.86126708984375, -31.8829936981201171875),
osg::Vec3f(-114.82657623291015625, 114.82657623291015625, -40.3186492919921875),
osg::Vec3f(-94.7918853759765625, 94.7918853759765625, -47.39907073974609375),
osg::Vec3f(-94.7918853759765625, 94.7918853759765625, -47.3990631103515625),
osg::Vec3f(-74.75719451904296875, 74.75719451904296875, -53.7258148193359375),
osg::Vec3f(-54.722499847412109375, 54.722499847412109375, -60.052555084228515625),
osg::Vec3f(-34.68780517578125, 34.68780517578125, -66.37929534912109375),
osg::Vec3f(-34.68780517578125, 34.68780517578125, -66.37931060791015625),
osg::Vec3f(-14.6531162261962890625, 14.6531162261962890625, -72.70604705810546875),
osg::Vec3f(5.3815765380859375, -5.3815765380859375, -75.35065460205078125),
osg::Vec3f(25.41626739501953125, -25.41626739501953125, -67.96945953369140625),
osg::Vec3f(45.450958251953125, -45.450958251953125, -60.58824920654296875),
osg::Vec3f(25.41626739501953125, -25.41626739501953125, -67.9694671630859375),
osg::Vec3f(45.450958251953125, -45.450958251953125, -60.5882568359375),
osg::Vec3f(65.48564910888671875, -65.48564910888671875, -53.20705413818359375),
osg::Vec3f(85.5203399658203125, -85.5203399658203125, -45.825855255126953125),
osg::Vec3f(85.5203399658203125, -85.5203399658203125, -45.82585906982421875),
osg::Vec3f(105.55503082275390625, -105.55503082275390625, -38.44464874267578125),
osg::Vec3f(125.5897216796875, -125.5897216796875, -31.063449859619140625),
osg::Vec3f(145.6244049072265625, -145.6244049072265625, -23.6822509765625),
osg::Vec3f(165.659088134765625, -165.659088134765625, -16.3010540008544921875),
osg::Vec3f(185.6937713623046875, -185.6937713623046875, -8.91985416412353515625),
osg::Vec3f(205.7284698486328125, -205.7284698486328125, -1.53864824771881103515625),
osg::Vec3f(185.6937713623046875, -185.6937713623046875, -8.91985321044921875),
osg::Vec3f(205.7284698486328125, -205.7284698486328125, -1.5386486053466796875),
osg::Vec3f(215, -215, 1.877177715301513671875),
})) << mPath;
@ -196,13 +196,13 @@ namespace
mNavigator->findPath(mAgentHalfExtents, mStart, mEnd, Flag_walk, std::back_inserter(mPath));
EXPECT_EQ(mPath, std::deque<osg::Vec3f>({
osg::Vec3f(-215, 215, 1.87827122211456298828125),
osg::Vec3f(-215, 215, 1.87826788425445556640625),
osg::Vec3f(-199.7968292236328125, 191.09100341796875, -3.54876613616943359375),
osg::Vec3f(-184.5936431884765625, 167.1819915771484375, -8.97847270965576171875),
osg::Vec3f(-169.3904571533203125, 143.2729949951171875, -14.40817737579345703125),
osg::Vec3f(-184.5936431884765625, 167.1819915771484375, -8.97847843170166015625),
osg::Vec3f(-169.3904571533203125, 143.2729949951171875, -14.408184051513671875),
osg::Vec3f(-154.1872711181640625, 119.36397552490234375, -19.837890625),
osg::Vec3f(-138.9840850830078125, 95.45496368408203125, -25.2675952911376953125),
osg::Vec3f(-123.78090667724609375, 71.54595184326171875, -30.6972980499267578125),
osg::Vec3f(-138.9840850830078125, 95.45496368408203125, -25.2675991058349609375),
osg::Vec3f(-123.78090667724609375, 71.54595184326171875, -30.6973056793212890625),
osg::Vec3f(-108.57772064208984375, 47.636936187744140625, -36.12701416015625),
osg::Vec3f(-93.3745269775390625, 23.7279262542724609375, -40.754688262939453125),
osg::Vec3f(-78.17134857177734375, -0.18108306825160980224609375, -37.128787994384765625),
@ -210,15 +210,15 @@ namespace
osg::Vec3f(-47.764972686767578125, -47.999103546142578125, -30.797946929931640625),
osg::Vec3f(-23.852447509765625, -63.196765899658203125, -33.97112274169921875),
osg::Vec3f(0.0600789971649646759033203125, -78.39443206787109375, -37.14543914794921875),
osg::Vec3f(23.97260284423828125, -93.5920867919921875, -40.7740936279296875),
osg::Vec3f(47.885128021240234375, -108.78974151611328125, -36.051288604736328125),
osg::Vec3f(71.7976531982421875, -123.98740386962890625, -30.62355804443359375),
osg::Vec3f(95.71018218994140625, -139.18505859375, -25.1958160400390625),
osg::Vec3f(23.97260284423828125, -93.5920867919921875, -40.774089813232421875),
osg::Vec3f(47.885128021240234375, -108.78974151611328125, -36.05129241943359375),
osg::Vec3f(71.7976531982421875, -123.98740386962890625, -30.6235561370849609375),
osg::Vec3f(95.71018218994140625, -139.18505859375, -25.1958255767822265625),
osg::Vec3f(119.6226959228515625, -154.382720947265625, -19.7680912017822265625),
osg::Vec3f(143.53521728515625, -169.58038330078125, -14.3403491973876953125),
osg::Vec3f(167.4477386474609375, -184.778045654296875, -8.91261768341064453125),
osg::Vec3f(191.360260009765625, -199.9757080078125, -3.484879016876220703125),
osg::Vec3f(215, -215, 1.87827455997467041015625),
osg::Vec3f(143.53521728515625, -169.58038330078125, -14.34035205841064453125),
osg::Vec3f(167.4477386474609375, -184.778045654296875, -8.9126186370849609375),
osg::Vec3f(191.360260009765625, -199.9757080078125, -3.4848802089691162109375),
osg::Vec3f(215, -215, 1.87826788425445556640625),
})) << mPath;
}
@ -247,13 +247,13 @@ namespace
mNavigator->findPath(mAgentHalfExtents, mStart, mEnd, Flag_walk, std::back_inserter(mPath));
EXPECT_EQ(mPath, std::deque<osg::Vec3f>({
osg::Vec3f(-215, 215, 1.87827122211456298828125),
osg::Vec3f(-215, 215, 1.87826788425445556640625),
osg::Vec3f(-199.7968292236328125, 191.09100341796875, -3.54876613616943359375),
osg::Vec3f(-184.5936431884765625, 167.1819915771484375, -8.97847270965576171875),
osg::Vec3f(-169.3904571533203125, 143.2729949951171875, -14.40817737579345703125),
osg::Vec3f(-184.5936431884765625, 167.1819915771484375, -8.97847843170166015625),
osg::Vec3f(-169.3904571533203125, 143.2729949951171875, -14.408184051513671875),
osg::Vec3f(-154.1872711181640625, 119.36397552490234375, -19.837890625),
osg::Vec3f(-138.9840850830078125, 95.45496368408203125, -25.2675952911376953125),
osg::Vec3f(-123.78090667724609375, 71.54595184326171875, -30.6972980499267578125),
osg::Vec3f(-138.9840850830078125, 95.45496368408203125, -25.2675991058349609375),
osg::Vec3f(-123.78090667724609375, 71.54595184326171875, -30.6973056793212890625),
osg::Vec3f(-108.57772064208984375, 47.636936187744140625, -36.12701416015625),
osg::Vec3f(-93.3745269775390625, 23.7279262542724609375, -40.754688262939453125),
osg::Vec3f(-78.17134857177734375, -0.18108306825160980224609375, -37.128787994384765625),
@ -261,15 +261,15 @@ namespace
osg::Vec3f(-47.764972686767578125, -47.999103546142578125, -30.797946929931640625),
osg::Vec3f(-23.852447509765625, -63.196765899658203125, -33.97112274169921875),
osg::Vec3f(0.0600789971649646759033203125, -78.39443206787109375, -37.14543914794921875),
osg::Vec3f(23.97260284423828125, -93.5920867919921875, -40.7740936279296875),
osg::Vec3f(47.885128021240234375, -108.78974151611328125, -36.051288604736328125),
osg::Vec3f(71.7976531982421875, -123.98740386962890625, -30.62355804443359375),
osg::Vec3f(95.71018218994140625, -139.18505859375, -25.1958160400390625),
osg::Vec3f(23.97260284423828125, -93.5920867919921875, -40.774089813232421875),
osg::Vec3f(47.885128021240234375, -108.78974151611328125, -36.05129241943359375),
osg::Vec3f(71.7976531982421875, -123.98740386962890625, -30.6235561370849609375),
osg::Vec3f(95.71018218994140625, -139.18505859375, -25.1958255767822265625),
osg::Vec3f(119.6226959228515625, -154.382720947265625, -19.7680912017822265625),
osg::Vec3f(143.53521728515625, -169.58038330078125, -14.3403491973876953125),
osg::Vec3f(167.4477386474609375, -184.778045654296875, -8.91261768341064453125),
osg::Vec3f(191.360260009765625, -199.9757080078125, -3.484879016876220703125),
osg::Vec3f(215, -215, 1.87827455997467041015625),
osg::Vec3f(143.53521728515625, -169.58038330078125, -14.34035205841064453125),
osg::Vec3f(167.4477386474609375, -184.778045654296875, -8.9126186370849609375),
osg::Vec3f(191.360260009765625, -199.9757080078125, -3.4848802089691162109375),
osg::Vec3f(215, -215, 1.87826788425445556640625),
})) << mPath;
compoundShape.updateChildTransform(0, btTransform(btMatrix3x3::getIdentity(), btVector3(1000, 0, 0)));
@ -283,27 +283,27 @@ namespace
EXPECT_EQ(mPath, std::deque<osg::Vec3f>({
osg::Vec3f(-215, 215, 1.85963428020477294921875),
osg::Vec3f(-194.9653167724609375, 194.9653167724609375, -6.5760211944580078125),
osg::Vec3f(-194.9653167724609375, 194.9653167724609375, -6.57602214813232421875),
osg::Vec3f(-174.930633544921875, 174.930633544921875, -15.01167774200439453125),
osg::Vec3f(-154.8959503173828125, 154.8959503173828125, -23.4473323822021484375),
osg::Vec3f(-134.86126708984375, 134.86126708984375, -31.8829898834228515625),
osg::Vec3f(-154.8959503173828125, 154.8959503173828125, -23.4473361968994140625),
osg::Vec3f(-134.86126708984375, 134.86126708984375, -31.8829936981201171875),
osg::Vec3f(-114.82657623291015625, 114.82657623291015625, -40.3186492919921875),
osg::Vec3f(-94.7918853759765625, 94.7918853759765625, -47.39907073974609375),
osg::Vec3f(-94.7918853759765625, 94.7918853759765625, -47.3990631103515625),
osg::Vec3f(-74.75719451904296875, 74.75719451904296875, -53.7258148193359375),
osg::Vec3f(-54.722499847412109375, 54.722499847412109375, -60.052555084228515625),
osg::Vec3f(-34.68780517578125, 34.68780517578125, -66.37929534912109375),
osg::Vec3f(-34.68780517578125, 34.68780517578125, -66.37931060791015625),
osg::Vec3f(-14.6531162261962890625, 14.6531162261962890625, -72.70604705810546875),
osg::Vec3f(5.3815765380859375, -5.3815765380859375, -75.35065460205078125),
osg::Vec3f(25.41626739501953125, -25.41626739501953125, -67.96945953369140625),
osg::Vec3f(45.450958251953125, -45.450958251953125, -60.58824920654296875),
osg::Vec3f(25.41626739501953125, -25.41626739501953125, -67.9694671630859375),
osg::Vec3f(45.450958251953125, -45.450958251953125, -60.5882568359375),
osg::Vec3f(65.48564910888671875, -65.48564910888671875, -53.20705413818359375),
osg::Vec3f(85.5203399658203125, -85.5203399658203125, -45.825855255126953125),
osg::Vec3f(85.5203399658203125, -85.5203399658203125, -45.82585906982421875),
osg::Vec3f(105.55503082275390625, -105.55503082275390625, -38.44464874267578125),
osg::Vec3f(125.5897216796875, -125.5897216796875, -31.063449859619140625),
osg::Vec3f(145.6244049072265625, -145.6244049072265625, -23.6822509765625),
osg::Vec3f(165.659088134765625, -165.659088134765625, -16.3010540008544921875),
osg::Vec3f(185.6937713623046875, -185.6937713623046875, -8.91985416412353515625),
osg::Vec3f(205.7284698486328125, -205.7284698486328125, -1.53864824771881103515625),
osg::Vec3f(185.6937713623046875, -185.6937713623046875, -8.91985321044921875),
osg::Vec3f(205.7284698486328125, -205.7284698486328125, -1.5386486053466796875),
osg::Vec3f(215, -215, 1.877177715301513671875),
})) << mPath;
}
@ -340,27 +340,27 @@ namespace
EXPECT_EQ(mPath, std::deque<osg::Vec3f>({
osg::Vec3f(-215, 215, 1.96328866481781005859375),
osg::Vec3f(-194.9653167724609375, 194.9653167724609375, -0.2422157227993011474609375),
osg::Vec3f(-174.930633544921875, 174.930633544921875, -2.44772052764892578125),
osg::Vec3f(-154.8959503173828125, 154.8959503173828125, -4.653223514556884765625),
osg::Vec3f(-134.86126708984375, 134.86126708984375, -6.858728885650634765625),
osg::Vec3f(-114.82657623291015625, 114.82657623291015625, -9.0642337799072265625),
osg::Vec3f(-94.7918853759765625, 94.7918853759765625, -11.26973724365234375),
osg::Vec3f(-194.9653167724609375, 194.9653167724609375, -0.242215454578399658203125),
osg::Vec3f(-174.930633544921875, 174.930633544921875, -2.447719097137451171875),
osg::Vec3f(-154.8959503173828125, 154.8959503173828125, -4.65322399139404296875),
osg::Vec3f(-134.86126708984375, 134.86126708984375, -6.858726978302001953125),
osg::Vec3f(-114.82657623291015625, 114.82657623291015625, -9.06423282623291015625),
osg::Vec3f(-94.7918853759765625, 94.7918853759765625, -11.26973628997802734375),
osg::Vec3f(-74.75719451904296875, 74.75719451904296875, -13.26497173309326171875),
osg::Vec3f(-54.722499847412109375, 54.722499847412109375, -15.24860286712646484375),
osg::Vec3f(-34.68780517578125, 34.68780517578125, -17.2322368621826171875),
osg::Vec3f(-14.6531162261962890625, 14.6531162261962890625, -19.2158660888671875),
osg::Vec3f(-54.722499847412109375, 54.722499847412109375, -15.24860477447509765625),
osg::Vec3f(-34.68780517578125, 34.68780517578125, -17.23223876953125),
osg::Vec3f(-14.6531162261962890625, 14.6531162261962890625, -19.215869903564453125),
osg::Vec3f(5.3815765380859375, -5.3815765380859375, -20.1338443756103515625),
osg::Vec3f(25.41626739501953125, -25.41626739501953125, -18.150211334228515625),
osg::Vec3f(25.41626739501953125, -25.41626739501953125, -18.1502132415771484375),
osg::Vec3f(45.450958251953125, -45.450958251953125, -16.1665802001953125),
osg::Vec3f(65.48564910888671875, -65.48564910888671875, -14.18294811248779296875),
osg::Vec3f(85.5203399658203125, -85.5203399658203125, -12.19931507110595703125),
osg::Vec3f(105.55503082275390625, -105.55503082275390625, -10.08488559722900390625),
osg::Vec3f(125.5897216796875, -125.5897216796875, -7.879383563995361328125),
osg::Vec3f(145.6244049072265625, -145.6244049072265625, -5.673877239227294921875),
osg::Vec3f(165.659088134765625, -165.659088134765625, -3.4683735370635986328125),
osg::Vec3f(185.6937713623046875, -185.6937713623046875, -1.2628715038299560546875),
osg::Vec3f(205.7284698486328125, -205.7284698486328125, 0.9426348209381103515625),
osg::Vec3f(65.48564910888671875, -65.48564910888671875, -14.18294620513916015625),
osg::Vec3f(85.5203399658203125, -85.5203399658203125, -12.199314117431640625),
osg::Vec3f(105.55503082275390625, -105.55503082275390625, -10.08488368988037109375),
osg::Vec3f(125.5897216796875, -125.5897216796875, -7.87938022613525390625),
osg::Vec3f(145.6244049072265625, -145.6244049072265625, -5.673875331878662109375),
osg::Vec3f(165.659088134765625, -165.659088134765625, -3.468370914459228515625),
osg::Vec3f(185.6937713623046875, -185.6937713623046875, -1.26286637783050537109375),
osg::Vec3f(205.7284698486328125, -205.7284698486328125, 0.942641556262969970703125),
osg::Vec3f(215, -215, 1.96328866481781005859375),
})) << mPath;
}
@ -399,26 +399,26 @@ namespace
osg::Vec3f(-200.8159637451171875, 190.47265625, -0.639537751674652099609375),
osg::Vec3f(-186.6319427490234375, 165.9453125, -3.2184507846832275390625),
osg::Vec3f(-172.447906494140625, 141.41796875, -5.797363758087158203125),
osg::Vec3f(-158.263885498046875, 116.8906097412109375, -8.37627887725830078125),
osg::Vec3f(-144.079864501953125, 92.3632659912109375, -10.95519161224365234375),
osg::Vec3f(-129.89581298828125, 67.83591461181640625, -13.534107208251953125),
osg::Vec3f(-158.263885498046875, 116.8906097412109375, -8.37627696990966796875),
osg::Vec3f(-144.079864501953125, 92.3632659912109375, -10.9551906585693359375),
osg::Vec3f(-129.89581298828125, 67.83591461181640625, -13.53410625457763671875),
osg::Vec3f(-115.7117919921875, 43.308563232421875, -16.1130199432373046875),
osg::Vec3f(-101.5277557373046875, 18.7812137603759765625, -18.6919345855712890625),
osg::Vec3f(-87.34372711181640625, -5.7461376190185546875, -20.4680538177490234375),
osg::Vec3f(-67.02922821044921875, -25.4970550537109375, -20.514247894287109375),
osg::Vec3f(-46.714717864990234375, -45.2479705810546875, -20.5604457855224609375),
osg::Vec3f(-46.714717864990234375, -45.2479705810546875, -20.560443878173828125),
osg::Vec3f(-26.40021514892578125, -64.99889373779296875, -20.6066417694091796875),
osg::Vec3f(-6.085712432861328125, -84.74980926513671875, -20.652835845947265625),
osg::Vec3f(14.22879505157470703125, -104.50072479248046875, -18.151393890380859375),
osg::Vec3f(39.05098724365234375, -118.16222381591796875, -15.6674861907958984375),
osg::Vec3f(63.87317657470703125, -131.82373046875, -13.18357944488525390625),
osg::Vec3f(88.69537353515625, -145.4852142333984375, -10.69967365264892578125),
osg::Vec3f(113.51757049560546875, -159.146697998046875, -8.21576690673828125),
osg::Vec3f(138.3397674560546875, -172.808197021484375, -5.731858730316162109375),
osg::Vec3f(163.1619720458984375, -186.469696044921875, -3.2479503154754638671875),
osg::Vec3f(187.984161376953125, -200.1311798095703125, -0.764044582843780517578125),
osg::Vec3f(212.8063507080078125, -213.7926788330078125, 1.7198636531829833984375),
osg::Vec3f(215, -215, 1.93937528133392333984375),
osg::Vec3f(14.22879505157470703125, -104.50072479248046875, -18.151397705078125),
osg::Vec3f(39.05098724365234375, -118.16222381591796875, -15.66748714447021484375),
osg::Vec3f(63.87317657470703125, -131.82373046875, -13.18358135223388671875),
osg::Vec3f(88.69537353515625, -145.4852142333984375, -10.699672698974609375),
osg::Vec3f(113.51757049560546875, -159.146697998046875, -8.21576786041259765625),
osg::Vec3f(138.3397674560546875, -172.808197021484375, -5.731859683990478515625),
osg::Vec3f(163.1619720458984375, -186.469696044921875, -3.2479507923126220703125),
osg::Vec3f(187.984161376953125, -200.1311798095703125, -0.764044821262359619140625),
osg::Vec3f(212.8063507080078125, -213.7926788330078125, 1.719865322113037109375),
osg::Vec3f(215, -215, 1.9393787384033203125),
})) << mPath;
}
@ -507,10 +507,10 @@ namespace
osg::Vec3f(0, -68.33331298828125, -143.3333587646484375),
osg::Vec3f(0, -96.66664886474609375, -137.3043670654296875),
osg::Vec3f(0, -124.99997711181640625, -127.44930267333984375),
osg::Vec3f(0, -153.33331298828125, -117.5942230224609375),
osg::Vec3f(0, -181.6666412353515625, -107.7391510009765625),
osg::Vec3f(0, -209.999969482421875, -97.79712677001953125),
osg::Vec3f(0, -215, -94.753631591796875),
osg::Vec3f(0, -153.33331298828125, -117.59423065185546875),
osg::Vec3f(0, -181.6666412353515625, -107.73915863037109375),
osg::Vec3f(0, -209.999969482421875, -97.7971343994140625),
osg::Vec3f(0, -215, -94.75363922119140625),
})) << mPath;
}
@ -553,10 +553,10 @@ namespace
osg::Vec3f(0, -68.33331298828125, -143.3333587646484375),
osg::Vec3f(0, -96.66664886474609375, -137.3043670654296875),
osg::Vec3f(0, -124.99997711181640625, -127.44930267333984375),
osg::Vec3f(0, -153.33331298828125, -117.5942230224609375),
osg::Vec3f(0, -181.6666412353515625, -107.7391510009765625),
osg::Vec3f(0, -209.999969482421875, -97.79712677001953125),
osg::Vec3f(0, -215, -94.753631591796875),
osg::Vec3f(0, -153.33331298828125, -117.59423065185546875),
osg::Vec3f(0, -181.6666412353515625, -107.73915863037109375),
osg::Vec3f(0, -209.999969482421875, -97.7971343994140625),
osg::Vec3f(0, -215, -94.75363922119140625),
})) << mPath;
}
@ -587,8 +587,8 @@ namespace
EXPECT_EQ(mPath, std::deque<osg::Vec3f>({
osg::Vec3f(0, 215, -94.75363922119140625),
osg::Vec3f(9.8083515167236328125, 188.4185333251953125, -105.19994354248046875),
osg::Vec3f(19.6167049407958984375, 161.837066650390625, -114.25496673583984375),
osg::Vec3f(9.8083515167236328125, 188.4185333251953125, -105.199951171875),
osg::Vec3f(19.6167049407958984375, 161.837066650390625, -114.25495147705078125),
osg::Vec3f(29.42505645751953125, 135.255615234375, -123.309967041015625),
osg::Vec3f(39.23340606689453125, 108.674163818359375, -132.3649749755859375),
osg::Vec3f(49.04175567626953125, 82.09270477294921875, -137.2874755859375),
@ -601,9 +601,9 @@ namespace
osg::Vec3f(64.8477935791015625, -104.598602294921875, -137.840911865234375),
osg::Vec3f(50.497714996337890625, -129.0291748046875, -131.45831298828125),
osg::Vec3f(36.147632598876953125, -153.459747314453125, -121.42321014404296875),
osg::Vec3f(21.7975559234619140625, -177.8903350830078125, -111.38809967041015625),
osg::Vec3f(7.44747829437255859375, -202.3209075927734375, -101.1938323974609375),
osg::Vec3f(0, -215, -94.753631591796875),
osg::Vec3f(21.7975559234619140625, -177.8903350830078125, -111.38811492919921875),
osg::Vec3f(7.44747829437255859375, -202.3209075927734375, -101.19382476806640625),
osg::Vec3f(0, -215, -94.75363922119140625),
})) << mPath;
}
@ -636,27 +636,27 @@ namespace
EXPECT_EQ(mPath, std::deque<osg::Vec3f>({
osg::Vec3f(-215, 215, 1.85963428020477294921875),
osg::Vec3f(-194.9653167724609375, 194.9653167724609375, -6.5760211944580078125),
osg::Vec3f(-194.9653167724609375, 194.9653167724609375, -6.57602214813232421875),
osg::Vec3f(-174.930633544921875, 174.930633544921875, -15.01167774200439453125),
osg::Vec3f(-154.8959503173828125, 154.8959503173828125, -23.4473323822021484375),
osg::Vec3f(-134.86126708984375, 134.86126708984375, -31.8829898834228515625),
osg::Vec3f(-154.8959503173828125, 154.8959503173828125, -23.4473361968994140625),
osg::Vec3f(-134.86126708984375, 134.86126708984375, -31.8829936981201171875),
osg::Vec3f(-114.82657623291015625, 114.82657623291015625, -40.3186492919921875),
osg::Vec3f(-94.7918853759765625, 94.7918853759765625, -47.39907073974609375),
osg::Vec3f(-94.7918853759765625, 94.7918853759765625, -47.3990631103515625),
osg::Vec3f(-74.75719451904296875, 74.75719451904296875, -53.7258148193359375),
osg::Vec3f(-54.722499847412109375, 54.722499847412109375, -60.052555084228515625),
osg::Vec3f(-34.68780517578125, 34.68780517578125, -66.37929534912109375),
osg::Vec3f(-34.68780517578125, 34.68780517578125, -66.37931060791015625),
osg::Vec3f(-14.6531162261962890625, 14.6531162261962890625, -72.70604705810546875),
osg::Vec3f(5.3815765380859375, -5.3815765380859375, -75.35065460205078125),
osg::Vec3f(25.41626739501953125, -25.41626739501953125, -67.96945953369140625),
osg::Vec3f(45.450958251953125, -45.450958251953125, -60.58824920654296875),
osg::Vec3f(25.41626739501953125, -25.41626739501953125, -67.9694671630859375),
osg::Vec3f(45.450958251953125, -45.450958251953125, -60.5882568359375),
osg::Vec3f(65.48564910888671875, -65.48564910888671875, -53.20705413818359375),
osg::Vec3f(85.5203399658203125, -85.5203399658203125, -45.825855255126953125),
osg::Vec3f(85.5203399658203125, -85.5203399658203125, -45.82585906982421875),
osg::Vec3f(105.55503082275390625, -105.55503082275390625, -38.44464874267578125),
osg::Vec3f(125.5897216796875, -125.5897216796875, -31.063449859619140625),
osg::Vec3f(145.6244049072265625, -145.6244049072265625, -23.6822509765625),
osg::Vec3f(165.659088134765625, -165.659088134765625, -16.3010540008544921875),
osg::Vec3f(185.6937713623046875, -185.6937713623046875, -8.91985416412353515625),
osg::Vec3f(205.7284698486328125, -205.7284698486328125, -1.53864824771881103515625),
osg::Vec3f(185.6937713623046875, -185.6937713623046875, -8.91985321044921875),
osg::Vec3f(205.7284698486328125, -205.7284698486328125, -1.5386486053466796875),
osg::Vec3f(215, -215, 1.877177715301513671875),
})) << mPath;
}

@ -29,7 +29,10 @@ namespace testing
for (const auto& v : value)
{
std::ostringstream stream;
stream << v;
stream << "osg::Vec3f("
<< std::setprecision(std::numeric_limits<float>::max_exponent10) << v.x() << ", "
<< std::setprecision(std::numeric_limits<float>::max_exponent10) << v.y() << ", "
<< std::setprecision(std::numeric_limits<float>::max_exponent10) << v.z() << ")";
(*this) << stream.str() << ",\n";
}
return (*this) << "}";

@ -1,36 +1,72 @@
sudo: false
language: cpp
branches:
only:
- master
- coverity_scan
- /recast-.*$/
# Build with gcc and clang.
compiler:
- gcc
- clang
# Build both debug and release configurations, through use of an environment variable in the build matrix.
env:
- BUILD_TYPE=debug CMAKE_BUILD_TYPE=Debug
- BUILD_TYPE=release CMAKE_BUILD_TYPE=Release
sudo: false
addons:
apt:
packages:
- libsdl2-dev
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-xenial-7
packages: [ cmake, clang-7, clang-tools-7, gcc-8, g++-8, libsdl2-dev ]
install:
- wget https://github.com/premake/premake-core/releases/download/v5.0.0-alpha12/premake-5.0.0-alpha12-linux.tar.gz -O premake.tar.gz
- tar -xf premake.tar.gz
- rm premake.tar.gz
matrix:
include:
- name: Recastnavigation (all) on MacOS xcode9.4
os: osx
osx_image: xcode9.4
before_install:
- brew update
- brew install sdl2
if: branch != coverity_scan
- name: Recastnavigation on Ubuntu Xenial GCC-5
os: linux
dist: xenial
sudo: required
if: branch != coverity_scan
- name: Recastnavigation on Ubuntu Xenial GCC-8
os: linux
dist: xenial
sudo: required
env:
- MATRIX_EVAL="CC=gcc-8 && CXX=g++-8"
if: branch != coverity_scan
- name: Recastnavigation on Ubuntu Xenial GCC-5 using Premake5
os: linux
dist: xenial
sudo: required
if: branch != coverity_scan
before_install:
- wget https://github.com/premake/premake-core/releases/download/v5.0.0-alpha12/premake-5.0.0-alpha12-linux.tar.gz -O premake.tar.gz
- tar -xf premake.tar.gz
env:
- PREMAKE=1
- name: Recastnavigation on Ubuntu Xenial Clang-7 with Static Analysis
os: linux
dist: xenial
sudo: required
env:
- MATRIX_EVAL="CC=clang-7 && CXX=clang++-7"
- ANALYZE="scan-build-7 --force-analyze-debug-code --use-cc clang-7 --use-c++ clang++-7"
if: branch != coverity_scan
compiler: clang
- name: Recastnavigation Coverity Scan
os: linux
dist: xenial
sudo: required
if: branch = coverity_scan
# Run premake to generate makefiles.
# Have to cd into directory and back out since premake5 doesn't appear to accept a directory argument.
before_script:
- cd RecastDemo && ../premake5 gmake && cd ..
- mkdir build && cd build && cmake -D CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} .. && cd ..
- if [ "${TRAVIS_OS_NAME}" = "linux" ]; then eval "${MATRIX_EVAL}"; fi
- if [ "${PREMAKE}" = "1" ]; then cd RecastDemo && ../premake5 gmake && cd ..; fi
- if [ "${PREMAKE}" != "1" ]; then mkdir -p build && cd build && ${ANALYZE} cmake ../ && cd ..; fi
# Run make in the directory containing generated makefiles, on the configuration specified by the environment variable.
script:
- make -C RecastDemo/Build/gmake -j$(nproc) config=${BUILD_TYPE}
- RecastDemo/Bin/Tests
- make -C build -j$(nproc)
- cd build && ctest
script: # 2 CPUs on Travis-CI + 1 extra for IO bound process
- if [ "${PREMAKE}" = "1" ]; then make -C RecastDemo/Build/gmake -j3; fi
- if [ "${PREMAKE}" != "1" ]; then make -C build -j3; fi
- if [ "${PREMAKE}" = "1" ]; then RecastDemo/Bin/Tests; fi
- if [ "${PREMAKE}" != "1" ]; then cd build && ctest; fi

@ -283,6 +283,28 @@ inline bool dtVequal(const float* p0, const float* p1)
return d < thr;
}
/// Checks that the specified vector's components are all finite.
/// @param[in] v A point. [(x, y, z)]
/// @return True if all of the point's components are finite, i.e. not NaN
/// or any of the infinities.
inline bool dtVisfinite(const float* v)
{
bool result =
dtMathIsfinite(v[0]) &&
dtMathIsfinite(v[1]) &&
dtMathIsfinite(v[2]);
return result;
}
/// Checks that the specified vector's 2D components are finite.
/// @param[in] v A point. [(x, y, z)]
inline bool dtVisfinite2D(const float* v)
{
bool result = dtMathIsfinite(v[0]) && dtMathIsfinite(v[2]);
return result;
}
/// Derives the dot product of two vectors on the xz-plane. (@p u . @p v)
/// @param[in] u A vector [(x, y, z)]
/// @param[in] v A vector [(x, y, z)]

@ -8,6 +8,9 @@ Members in this module are wrappers around the standard math library
#define DETOURMATH_H
#include <math.h>
// This include is required because libstdc++ has problems with isfinite
// if cmath is included before math.h.
#include <cmath>
inline float dtMathFabsf(float x) { return fabsf(x); }
inline float dtMathSqrtf(float x) { return sqrtf(x); }
@ -16,5 +19,6 @@ inline float dtMathCeilf(float x) { return ceilf(x); }
inline float dtMathCosf(float x) { return cosf(x); }
inline float dtMathSinf(float x) { return sinf(x); }
inline float dtMathAtan2f(float y, float x) { return atan2f(y, x); }
inline bool dtMathIsfinite(float x) { return std::isfinite(x); }
#endif

@ -204,32 +204,31 @@ void dtCalcPolyCenter(float* tc, const unsigned short* idx, int nidx, const floa
bool dtClosestHeightPointTriangle(const float* p, const float* a, const float* b, const float* c, float& h)
{
float v0[3], v1[3], v2[3];
dtVsub(v0, c,a);
dtVsub(v1, b,a);
dtVsub(v2, p,a);
const float dot00 = dtVdot2D(v0, v0);
const float dot01 = dtVdot2D(v0, v1);
const float dot02 = dtVdot2D(v0, v2);
const float dot11 = dtVdot2D(v1, v1);
const float dot12 = dtVdot2D(v1, v2);
// Compute scaled barycentric coordinates
float denom = v0[0] * v1[2] - v0[2] * v1[0];
float u = v1[2] * v2[0] - v1[0] * v2[2];
float v = v0[0] * v2[2] - v0[2] * v2[0];
// Compute barycentric coordinates
const float invDenom = 1.0f / (dot00 * dot11 - dot01 * dot01);
const float u = (dot11 * dot02 - dot01 * dot12) * invDenom;
const float v = (dot00 * dot12 - dot01 * dot02) * invDenom;
if (denom < 0) {
denom = -denom;
u = -u;
v = -v;
}
// The (sloppy) epsilon is needed to allow to get height of points which
// are interpolated along the edges of the triangles.
static const float EPS = 1e-4f;
float epsilon = - 1e-4f * denom;
// If point lies inside the triangle, return interpolated ycoord.
if (u >= -EPS && v >= -EPS && (u+v) <= 1+EPS)
{
h = a[1] + v0[1]*u + v1[1]*v;
if (u >= epsilon && v >= epsilon && (u+v) <= denom - epsilon) {
h = a[1] + (v0[1]*u + v1[1]*v) / denom;
return true;
}
return false;
}

@ -223,6 +223,9 @@ dtStatus dtNavMeshQuery::findRandomPoint(const dtQueryFilter* filter, float (*fr
{
dtAssert(m_nav);
if (!filter || !frand || !randomRef || !randomPt)
return DT_FAILURE | DT_INVALID_PARAM;
// Randomly pick one tile. Assume that all tiles cover roughly the same area.
const dtMeshTile* tile = 0;
float tsum = 0.0f;
@ -319,8 +322,13 @@ dtStatus dtNavMeshQuery::findRandomPointAroundCircle(dtPolyRef startRef, const f
dtAssert(m_openList);
// Validate input
if (!startRef || !m_nav->isValidPolyRef(startRef))
if (!m_nav->isValidPolyRef(startRef) ||
!centerPos || !dtVisfinite(centerPos) ||
maxRadius < 0 || !dtMathIsfinite(maxRadius) ||
!filter || !frand || !randomRef || !randomPt)
{
return DT_FAILURE | DT_INVALID_PARAM;
}
const dtMeshTile* startTile = 0;
const dtPoly* startPoly = 0;
@ -513,6 +521,9 @@ dtStatus dtNavMeshQuery::closestPointOnPoly(dtPolyRef ref, const float* pos, flo
if (!tile)
return DT_FAILURE | DT_INVALID_PARAM;
if (!pos || !dtVisfinite(pos) || !closest)
return DT_FAILURE | DT_INVALID_PARAM;
// Off-mesh connections don't have detail polygons.
if (poly->getType() == DT_POLYTYPE_OFFMESH_CONNECTION)
{
@ -608,6 +619,9 @@ dtStatus dtNavMeshQuery::closestPointOnPolyBoundary(dtPolyRef ref, const float*
if (dtStatusFailed(m_nav->getTileAndPolyByRef(ref, &tile, &poly)))
return DT_FAILURE | DT_INVALID_PARAM;
if (!pos || !dtVisfinite(pos) || !closest)
return DT_FAILURE | DT_INVALID_PARAM;
// Collect vertices.
float verts[DT_VERTS_PER_POLYGON*3];
float edged[DT_VERTS_PER_POLYGON];
@ -660,6 +674,9 @@ dtStatus dtNavMeshQuery::getPolyHeight(dtPolyRef ref, const float* pos, float* h
if (dtStatusFailed(m_nav->getTileAndPolyByRef(ref, &tile, &poly)))
return DT_FAILURE | DT_INVALID_PARAM;
if (!pos || !dtVisfinite2D(pos))
return DT_FAILURE | DT_INVALID_PARAM;
if (poly->getType() == DT_POLYTYPE_OFFMESH_CONNECTION)
{
const float* v0 = &tile->verts[poly->verts[0]*3];
@ -768,6 +785,8 @@ dtStatus dtNavMeshQuery::findNearestPoly(const float* center, const float* halfE
if (!nearestRef)
return DT_FAILURE | DT_INVALID_PARAM;
// queryPolygons below will check rest of params
dtFindNearestPolyQuery query(this, center);
dtStatus status = queryPolygons(center, halfExtents, filter, &query);
@ -972,8 +991,12 @@ dtStatus dtNavMeshQuery::queryPolygons(const float* center, const float* halfExt
{
dtAssert(m_nav);
if (!center || !halfExtents || !filter || !query)
if (!center || !dtVisfinite(center) ||
!halfExtents || !dtVisfinite(halfExtents) ||
!filter || !query)
{
return DT_FAILURE | DT_INVALID_PARAM;
}
float bmin[3], bmax[3];
dtVsub(bmin, center, halfExtents);
@ -1022,13 +1045,19 @@ dtStatus dtNavMeshQuery::findPath(dtPolyRef startRef, dtPolyRef endRef,
dtAssert(m_nodePool);
dtAssert(m_openList);
if (pathCount)
*pathCount = 0;
if (!pathCount)
return DT_FAILURE | DT_INVALID_PARAM;
*pathCount = 0;
// Validate input
if (!m_nav->isValidPolyRef(startRef) || !m_nav->isValidPolyRef(endRef) ||
!startPos || !endPos || !filter || maxPath <= 0 || !path || !pathCount)
!startPos || !dtVisfinite(startPos) ||
!endPos || !dtVisfinite(endPos) ||
!filter || !path || maxPath <= 0)
{
return DT_FAILURE | DT_INVALID_PARAM;
}
if (startRef == endRef)
{
@ -1263,18 +1292,21 @@ dtStatus dtNavMeshQuery::initSlicedFindPath(dtPolyRef startRef, dtPolyRef endRef
m_query.status = DT_FAILURE;
m_query.startRef = startRef;
m_query.endRef = endRef;
dtVcopy(m_query.startPos, startPos);
dtVcopy(m_query.endPos, endPos);
if (startPos)
dtVcopy(m_query.startPos, startPos);
if (endPos)
dtVcopy(m_query.endPos, endPos);
m_query.filter = filter;
m_query.options = options;
m_query.raycastLimitSqr = FLT_MAX;
if (!startRef || !endRef)
return DT_FAILURE | DT_INVALID_PARAM;
// Validate input
if (!m_nav->isValidPolyRef(startRef) || !m_nav->isValidPolyRef(endRef))
if (!m_nav->isValidPolyRef(startRef) || !m_nav->isValidPolyRef(endRef) ||
!startPos || !dtVisfinite(startPos) ||
!endPos || !dtVisfinite(endPos) || !filter)
{
return DT_FAILURE | DT_INVALID_PARAM;
}
// trade quality with performance?
if (options & DT_FINDPATH_ANY_ANGLE)
@ -1530,8 +1562,14 @@ dtStatus dtNavMeshQuery::updateSlicedFindPath(const int maxIter, int* doneIters)
dtStatus dtNavMeshQuery::finalizeSlicedFindPath(dtPolyRef* path, int* pathCount, const int maxPath)
{
if (!pathCount)
return DT_FAILURE | DT_INVALID_PARAM;
*pathCount = 0;
if (!path || maxPath <= 0)
return DT_FAILURE | DT_INVALID_PARAM;
if (dtStatusFailed(m_query.status))
{
// Reset query.
@ -1615,12 +1653,13 @@ dtStatus dtNavMeshQuery::finalizeSlicedFindPath(dtPolyRef* path, int* pathCount,
dtStatus dtNavMeshQuery::finalizeSlicedFindPathPartial(const dtPolyRef* existing, const int existingSize,
dtPolyRef* path, int* pathCount, const int maxPath)
{
if (!pathCount)
return DT_FAILURE | DT_INVALID_PARAM;
*pathCount = 0;
if (existingSize == 0)
{
return DT_FAILURE;
}
if (!existing || existingSize <= 0 || !path || !pathCount || maxPath <= 0)
return DT_FAILURE | DT_INVALID_PARAM;
if (dtStatusFailed(m_query.status))
{
@ -1824,13 +1863,18 @@ dtStatus dtNavMeshQuery::findStraightPath(const float* startPos, const float* en
{
dtAssert(m_nav);
*straightPathCount = 0;
if (!maxStraightPath)
if (!straightPathCount)
return DT_FAILURE | DT_INVALID_PARAM;
if (!path[0])
*straightPathCount = 0;
if (!startPos || !dtVisfinite(startPos) ||
!endPos || !dtVisfinite(endPos) ||
!path || pathSize <= 0 || !path[0] ||
maxStraightPath <= 0)
{
return DT_FAILURE | DT_INVALID_PARAM;
}
dtStatus stat = 0;
@ -2070,13 +2114,19 @@ dtStatus dtNavMeshQuery::moveAlongSurface(dtPolyRef startRef, const float* start
dtAssert(m_nav);
dtAssert(m_tinyNodePool);
if (!visitedCount)
return DT_FAILURE | DT_INVALID_PARAM;
*visitedCount = 0;
// Validate input
if (!startRef)
return DT_FAILURE | DT_INVALID_PARAM;
if (!m_nav->isValidPolyRef(startRef))
if (!m_nav->isValidPolyRef(startRef) ||
!startPos || !dtVisfinite(startPos) ||
!endPos || !dtVisfinite(endPos) ||
!filter || !resultPos || !visited ||
maxVisitedSize <= 0)
{
return DT_FAILURE | DT_INVALID_PARAM;
}
dtStatus status = DT_SUCCESS;
@ -2485,15 +2535,22 @@ dtStatus dtNavMeshQuery::raycast(dtPolyRef startRef, const float* startPos, cons
{
dtAssert(m_nav);
if (!hit)
return DT_FAILURE | DT_INVALID_PARAM;
hit->t = 0;
hit->pathCount = 0;
hit->pathCost = 0;
// Validate input
if (!startRef || !m_nav->isValidPolyRef(startRef))
return DT_FAILURE | DT_INVALID_PARAM;
if (prevRef && !m_nav->isValidPolyRef(prevRef))
if (!m_nav->isValidPolyRef(startRef) ||
!startPos || !dtVisfinite(startPos) ||
!endPos || !dtVisfinite(endPos) ||
!filter ||
(prevRef && !m_nav->isValidPolyRef(prevRef)))
{
return DT_FAILURE | DT_INVALID_PARAM;
}
float dir[3], curPos[3], lastPos[3];
float verts[DT_VERTS_PER_POLYGON*3+3];
@ -2735,11 +2792,18 @@ dtStatus dtNavMeshQuery::findPolysAroundCircle(dtPolyRef startRef, const float*
dtAssert(m_nodePool);
dtAssert(m_openList);
if (!resultCount)
return DT_FAILURE | DT_INVALID_PARAM;
*resultCount = 0;
// Validate input
if (!startRef || !m_nav->isValidPolyRef(startRef))
if (!m_nav->isValidPolyRef(startRef) ||
!centerPos || !dtVisfinite(centerPos) ||
radius < 0 || !dtMathIsfinite(radius) ||
!filter || maxResult < 0)
{
return DT_FAILURE | DT_INVALID_PARAM;
}
m_nodePool->clear();
m_openList->clear();
@ -2902,8 +2966,18 @@ dtStatus dtNavMeshQuery::findPolysAroundShape(dtPolyRef startRef, const float* v
dtAssert(m_nodePool);
dtAssert(m_openList);
if (!resultCount)
return DT_FAILURE | DT_INVALID_PARAM;
*resultCount = 0;
if (!m_nav->isValidPolyRef(startRef) ||
!verts || nverts < 3 ||
!filter || maxResult < 0)
{
return DT_FAILURE | DT_INVALID_PARAM;
}
// Validate input
if (!startRef || !m_nav->isValidPolyRef(startRef))
return DT_FAILURE | DT_INVALID_PARAM;
@ -3089,11 +3163,18 @@ dtStatus dtNavMeshQuery::findLocalNeighbourhood(dtPolyRef startRef, const float*
dtAssert(m_nav);
dtAssert(m_tinyNodePool);
if (!resultCount)
return DT_FAILURE | DT_INVALID_PARAM;
*resultCount = 0;
// Validate input
if (!startRef || !m_nav->isValidPolyRef(startRef))
if (!m_nav->isValidPolyRef(startRef) ||
!centerPos || !dtVisfinite(centerPos) ||
radius < 0 || !dtMathIsfinite(radius) ||
!filter || maxResult < 0)
{
return DT_FAILURE | DT_INVALID_PARAM;
}
static const int MAX_STACK = 48;
dtNode* stack[MAX_STACK];
@ -3302,6 +3383,9 @@ dtStatus dtNavMeshQuery::getPolyWallSegments(dtPolyRef ref, const dtQueryFilter*
{
dtAssert(m_nav);
if (!segmentCount)
return DT_FAILURE | DT_INVALID_PARAM;
*segmentCount = 0;
const dtMeshTile* tile = 0;
@ -3309,6 +3393,9 @@ dtStatus dtNavMeshQuery::getPolyWallSegments(dtPolyRef ref, const dtQueryFilter*
if (dtStatusFailed(m_nav->getTileAndPolyByRef(ref, &tile, &poly)))
return DT_FAILURE | DT_INVALID_PARAM;
if (!filter || !segmentVerts || maxSegments < 0)
return DT_FAILURE | DT_INVALID_PARAM;
int n = 0;
static const int MAX_INTERVAL = 16;
dtSegInterval ints[MAX_INTERVAL];
@ -3455,8 +3542,13 @@ dtStatus dtNavMeshQuery::findDistanceToWall(dtPolyRef startRef, const float* cen
dtAssert(m_openList);
// Validate input
if (!startRef || !m_nav->isValidPolyRef(startRef))
if (!m_nav->isValidPolyRef(startRef) ||
!centerPos || !dtVisfinite(centerPos) ||
maxRadius < 0 || !dtMathIsfinite(maxRadius) ||
!filter || !hitDist || !hitPos || !hitNormal)
{
return DT_FAILURE | DT_INVALID_PARAM;
}
m_nodePool->clear();
m_openList->clear();

@ -38,7 +38,9 @@ endif()
add_dependencies(RecastDemo DebugUtils Detour DetourCrowd DetourTileCache Recast)
target_link_libraries(RecastDemo ${OPENGL_LIBRARIES} SDL2::SDL2main DebugUtils Detour DetourCrowd DetourTileCache Recast)
install(TARGETS RecastDemo RUNTIME DESTINATION bin)
install(TARGETS RecastDemo
RUNTIME DESTINATION bin
BUNDLE DESTINATION bin)
install(DIRECTORY Bin/Meshes DESTINATION bin)
install(DIRECTORY Bin/TestCases DESTINATION bin)
install(FILES Bin/DroidSans.ttf DESTINATION bin)

Loading…
Cancel
Save