mirror of
https://github.com/godotengine/godot.git
synced 2024-11-24 21:22:48 +00:00
rvo2: Sync with upstream commit bfc0486
bfc048670a
(cherry picked from commit86cdf1f2cf
)
This commit is contained in:
parent
e317b7efbb
commit
52da1bcdca
@ -28,8 +28,8 @@
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#ifndef RVO_SPACE_H
|
||||
#define RVO_SPACE_H
|
||||
#ifndef NAV_MAP_H
|
||||
#define NAV_MAP_H
|
||||
|
||||
#include "nav_rid.h"
|
||||
|
||||
@ -149,4 +149,4 @@ private:
|
||||
void clip_path(const std::vector<gd::NavigationPoly> &p_navigation_polys, Vector<Vector3> &path, const gd::NavigationPoly *from_poly, const Vector3 &p_to_point, const gd::NavigationPoly *p_to_poly) const;
|
||||
};
|
||||
|
||||
#endif // RVO_SPACE_H
|
||||
#endif // NAV_MAP_H
|
||||
|
2
thirdparty/README.md
vendored
2
thirdparty/README.md
vendored
@ -500,7 +500,7 @@ Files extracted from upstream source:
|
||||
## rvo2
|
||||
|
||||
- Upstream: https://github.com/snape/RVO2-3D
|
||||
- Version: 1.0.1 (e3883f288a9e55ecfed3633a01af3e12778c6acf, 2016)
|
||||
- Version: git (bfc048670a4e85066e86a1f923d8ea92e3add3b2, 2021)
|
||||
- License: Apache 2.0
|
||||
|
||||
Files extracted from upstream source:
|
||||
|
43
thirdparty/rvo2/API.h
vendored
43
thirdparty/rvo2/API.h
vendored
@ -1,43 +0,0 @@
|
||||
/*
|
||||
* API.h
|
||||
* RVO2-3D Library
|
||||
*
|
||||
* Copyright 2008 University of North Carolina at Chapel Hill
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* Please send all bug reports to <geom@cs.unc.edu>.
|
||||
*
|
||||
* The authors may be contacted via:
|
||||
*
|
||||
* Jur van den Berg, Stephen J. Guy, Jamie Snape, Ming C. Lin, Dinesh Manocha
|
||||
* Dept. of Computer Science
|
||||
* 201 S. Columbia St.
|
||||
* Frederick P. Brooks, Jr. Computer Science Bldg.
|
||||
* Chapel Hill, N.C. 27599-3175
|
||||
* United States of America
|
||||
*
|
||||
* <http://gamma.cs.unc.edu/RVO2/>
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file API.h
|
||||
* \brief Contains definitions related to Microsoft Windows.
|
||||
*/
|
||||
|
||||
#ifndef RVO_API_H_
|
||||
#define RVO_API_H_
|
||||
|
||||
#define RVO_API
|
||||
|
||||
#endif /* RVO_API_H_ */
|
24
thirdparty/rvo2/Agent.cpp
vendored
24
thirdparty/rvo2/Agent.cpp
vendored
@ -8,7 +8,7 @@
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@ -27,7 +27,7 @@
|
||||
* Chapel Hill, N.C. 27599-3175
|
||||
* United States of America
|
||||
*
|
||||
* <http://gamma.cs.unc.edu/RVO2/>
|
||||
* <https://gamma.cs.unc.edu/RVO2/>
|
||||
*/
|
||||
|
||||
#include "Agent.h"
|
||||
@ -42,7 +42,7 @@ namespace RVO {
|
||||
/**
|
||||
* \brief A sufficiently small positive number.
|
||||
*/
|
||||
const float RVO_EPSILON = 0.00001f;
|
||||
const float RVO3D_EPSILON = 0.00001f;
|
||||
|
||||
/**
|
||||
* \brief Defines a directed line.
|
||||
@ -168,12 +168,12 @@ namespace RVO {
|
||||
const float b = relativePosition * relativeVelocity;
|
||||
const float c = absSq(relativeVelocity) - absSq(cross(relativePosition, relativeVelocity)) / (distSq - combinedRadiusSq);
|
||||
const float t = (b + std::sqrt(sqr(b) - a * c)) / a;
|
||||
const Vector3 w = relativeVelocity - t * relativePosition;
|
||||
const float wLength = abs(w);
|
||||
const Vector3 unitW = w / wLength;
|
||||
const Vector3 ww = relativeVelocity - t * relativePosition;
|
||||
const float wwLength = abs(ww);
|
||||
const Vector3 unitWW = ww / wwLength;
|
||||
|
||||
plane.normal = unitW;
|
||||
u = (combinedRadius * t - wLength) * unitW;
|
||||
plane.normal = unitWW;
|
||||
u = (combinedRadius * t - wwLength) * unitWW;
|
||||
}
|
||||
}
|
||||
else {
|
||||
@ -247,7 +247,7 @@ namespace RVO {
|
||||
const float numerator = (planes[i].point - line.point) * planes[i].normal;
|
||||
const float denominator = line.direction * planes[i].normal;
|
||||
|
||||
if (sqr(denominator) <= RVO_EPSILON) {
|
||||
if (sqr(denominator) <= RVO3D_EPSILON) {
|
||||
/* Lines line is (almost) parallel to plane i. */
|
||||
if (numerator > 0.0f) {
|
||||
return false;
|
||||
@ -322,7 +322,7 @@ namespace RVO {
|
||||
const Vector3 planeOptVelocity = optVelocity - (optVelocity * planes[planeNo].normal) * planes[planeNo].normal;
|
||||
const float planeOptVelocityLengthSq = absSq(planeOptVelocity);
|
||||
|
||||
if (planeOptVelocityLengthSq <= RVO_EPSILON) {
|
||||
if (planeOptVelocityLengthSq <= RVO3D_EPSILON) {
|
||||
result = planeCenter;
|
||||
}
|
||||
else {
|
||||
@ -347,7 +347,7 @@ namespace RVO {
|
||||
/* Compute intersection line of plane i and plane planeNo. */
|
||||
Vector3 crossProduct = cross(planes[i].normal, planes[planeNo].normal);
|
||||
|
||||
if (absSq(crossProduct) <= RVO_EPSILON) {
|
||||
if (absSq(crossProduct) <= RVO3D_EPSILON) {
|
||||
/* Planes planeNo and i are (almost) parallel, and plane i fully invalidates plane planeNo. */
|
||||
return false;
|
||||
}
|
||||
@ -410,7 +410,7 @@ namespace RVO {
|
||||
|
||||
const Vector3 crossProduct = cross(planes[j].normal, planes[i].normal);
|
||||
|
||||
if (absSq(crossProduct) <= RVO_EPSILON) {
|
||||
if (absSq(crossProduct) <= RVO3D_EPSILON) {
|
||||
/* Plane i and plane j are (almost) parallel. */
|
||||
if (planes[i].normal * planes[j].normal > 0.0f) {
|
||||
/* Plane i and plane j point in the same direction. */
|
||||
|
12
thirdparty/rvo2/Agent.h
vendored
12
thirdparty/rvo2/Agent.h
vendored
@ -8,7 +8,7 @@
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@ -27,17 +27,15 @@
|
||||
* Chapel Hill, N.C. 27599-3175
|
||||
* United States of America
|
||||
*
|
||||
* <http://gamma.cs.unc.edu/RVO2/>
|
||||
* <https://gamma.cs.unc.edu/RVO2/>
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file Agent.h
|
||||
* \brief Contains the Agent class.
|
||||
*/
|
||||
#ifndef RVO_AGENT_H_
|
||||
#define RVO_AGENT_H_
|
||||
|
||||
#include "API.h"
|
||||
#ifndef RVO3D_AGENT_H_
|
||||
#define RVO3D_AGENT_H_
|
||||
|
||||
#include <cstddef>
|
||||
#include <utility>
|
||||
@ -117,4 +115,4 @@ namespace RVO {
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* RVO_AGENT_H_ */
|
||||
#endif /* RVO3D_AGENT_H_ */
|
||||
|
12
thirdparty/rvo2/Definitions.h
vendored
12
thirdparty/rvo2/Definitions.h
vendored
@ -8,7 +8,7 @@
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@ -27,7 +27,7 @@
|
||||
* Chapel Hill, N.C. 27599-3175
|
||||
* United States of America
|
||||
*
|
||||
* <http://gamma.cs.unc.edu/RVO2/>
|
||||
* <https://gamma.cs.unc.edu/RVO2/>
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -35,10 +35,8 @@
|
||||
* \brief Contains functions and constants used in multiple classes.
|
||||
*/
|
||||
|
||||
#ifndef RVO_DEFINITIONS_H_
|
||||
#define RVO_DEFINITIONS_H_
|
||||
|
||||
#include "API.h"
|
||||
#ifndef RVO3D_DEFINITIONS_H_
|
||||
#define RVO3D_DEFINITIONS_H_
|
||||
|
||||
namespace RVO {
|
||||
/**
|
||||
@ -52,4 +50,4 @@ namespace RVO {
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* RVO_DEFINITIONS_H_ */
|
||||
#endif /* RVO3D_DEFINITIONS_H_ */
|
||||
|
10
thirdparty/rvo2/KdTree.cpp
vendored
10
thirdparty/rvo2/KdTree.cpp
vendored
@ -8,7 +8,7 @@
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@ -27,7 +27,7 @@
|
||||
* Chapel Hill, N.C. 27599-3175
|
||||
* United States of America
|
||||
*
|
||||
* <http://gamma.cs.unc.edu/RVO2/>
|
||||
* <https://gamma.cs.unc.edu/RVO2/>
|
||||
*/
|
||||
|
||||
#include "KdTree.h"
|
||||
@ -38,7 +38,7 @@
|
||||
#include "Definitions.h"
|
||||
|
||||
namespace RVO {
|
||||
const size_t RVO_MAX_LEAF_SIZE = 10;
|
||||
const size_t RVO3D_MAX_LEAF_SIZE = 10;
|
||||
|
||||
KdTree::KdTree() { }
|
||||
|
||||
@ -68,7 +68,7 @@ namespace RVO {
|
||||
agentTree_[node].minCoord[2] = std::min(agentTree_[node].minCoord[2], agents_[i]->position_.z());
|
||||
}
|
||||
|
||||
if (end - begin > RVO_MAX_LEAF_SIZE) {
|
||||
if (end - begin > RVO3D_MAX_LEAF_SIZE) {
|
||||
/* No leaf node. */
|
||||
size_t coord;
|
||||
|
||||
@ -127,7 +127,7 @@ namespace RVO {
|
||||
|
||||
void KdTree::queryAgentTreeRecursive(Agent *agent, float &rangeSq, size_t node) const
|
||||
{
|
||||
if (agentTree_[node].end - agentTree_[node].begin <= RVO_MAX_LEAF_SIZE) {
|
||||
if (agentTree_[node].end - agentTree_[node].begin <= RVO3D_MAX_LEAF_SIZE) {
|
||||
for (size_t i = agentTree_[node].begin; i < agentTree_[node].end; ++i) {
|
||||
agent->insertAgentNeighbor(agents_[i], rangeSq);
|
||||
}
|
||||
|
12
thirdparty/rvo2/KdTree.h
vendored
12
thirdparty/rvo2/KdTree.h
vendored
@ -8,7 +8,7 @@
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@ -27,16 +27,14 @@
|
||||
* Chapel Hill, N.C. 27599-3175
|
||||
* United States of America
|
||||
*
|
||||
* <http://gamma.cs.unc.edu/RVO2/>
|
||||
* <https://gamma.cs.unc.edu/RVO2/>
|
||||
*/
|
||||
/**
|
||||
* \file KdTree.h
|
||||
* \brief Contains the KdTree class.
|
||||
*/
|
||||
#ifndef RVO_KD_TREE_H_
|
||||
#define RVO_KD_TREE_H_
|
||||
|
||||
#include "API.h"
|
||||
#ifndef RVO3D_KD_TREE_H_
|
||||
#define RVO3D_KD_TREE_H_
|
||||
|
||||
#include <cstddef>
|
||||
#include <vector>
|
||||
@ -121,4 +119,4 @@ namespace RVO {
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* RVO_KD_TREE_H_ */
|
||||
#endif /* RVO3D_KD_TREE_H_ */
|
||||
|
66
thirdparty/rvo2/Vector3.h
vendored
66
thirdparty/rvo2/Vector3.h
vendored
@ -8,7 +8,7 @@
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@ -27,32 +27,32 @@
|
||||
* Chapel Hill, N.C. 27599-3175
|
||||
* United States of America
|
||||
*
|
||||
* <http://gamma.cs.unc.edu/RVO2/>
|
||||
* <https://gamma.cs.unc.edu/RVO2/>
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file Vector3.h
|
||||
* \brief Contains the Vector3 class.
|
||||
*/
|
||||
#ifndef RVO_VECTOR3_H_
|
||||
#define RVO_VECTOR3_H_
|
||||
|
||||
#include "API.h"
|
||||
#ifndef RVO3D_VECTOR3_H_
|
||||
#define RVO3D_VECTOR3_H_
|
||||
|
||||
#include <cmath>
|
||||
#include <cstddef>
|
||||
#include <ostream>
|
||||
|
||||
#define RVO3D_EXPORT
|
||||
|
||||
namespace RVO {
|
||||
/**
|
||||
* \brief Defines a three-dimensional vector.
|
||||
*/
|
||||
class Vector3 {
|
||||
class RVO3D_EXPORT Vector3 {
|
||||
public:
|
||||
/**
|
||||
* \brief Constructs and initializes a three-dimensional vector instance to zero.
|
||||
*/
|
||||
RVO_API inline Vector3()
|
||||
inline Vector3()
|
||||
{
|
||||
val_[0] = 0.0f;
|
||||
val_[1] = 0.0f;
|
||||
@ -63,7 +63,7 @@ namespace RVO {
|
||||
* \brief Constructs and initializes a three-dimensional vector from the specified three-element array.
|
||||
* \param val The three-element array containing the xyz-coordinates.
|
||||
*/
|
||||
RVO_API inline explicit Vector3(const float val[3])
|
||||
inline explicit Vector3(const float val[3])
|
||||
{
|
||||
val_[0] = val[0];
|
||||
val_[1] = val[1];
|
||||
@ -76,7 +76,7 @@ namespace RVO {
|
||||
* \param y The y-coordinate of the three-dimensional vector.
|
||||
* \param z The z-coordinate of the three-dimensional vector.
|
||||
*/
|
||||
RVO_API inline Vector3(float x, float y, float z)
|
||||
inline Vector3(float x, float y, float z)
|
||||
{
|
||||
val_[0] = x;
|
||||
val_[1] = y;
|
||||
@ -87,39 +87,39 @@ namespace RVO {
|
||||
* \brief Returns the x-coordinate of this three-dimensional vector.
|
||||
* \return The x-coordinate of the three-dimensional vector.
|
||||
*/
|
||||
RVO_API inline float x() const { return val_[0]; }
|
||||
inline float x() const { return val_[0]; }
|
||||
|
||||
/**
|
||||
* \brief Returns the y-coordinate of this three-dimensional vector.
|
||||
* \return The y-coordinate of the three-dimensional vector.
|
||||
*/
|
||||
RVO_API inline float y() const { return val_[1]; }
|
||||
inline float y() const { return val_[1]; }
|
||||
|
||||
/**
|
||||
* \brief Returns the z-coordinate of this three-dimensional vector.
|
||||
* \return The z-coordinate of the three-dimensional vector.
|
||||
*/
|
||||
RVO_API inline float z() const { return val_[2]; }
|
||||
inline float z() const { return val_[2]; }
|
||||
|
||||
/**
|
||||
* \brief Returns the specified coordinate of this three-dimensional vector.
|
||||
* \param i The coordinate that should be returned (0 <= i < 3).
|
||||
* \return The specified coordinate of the three-dimensional vector.
|
||||
*/
|
||||
RVO_API inline float operator[](size_t i) const { return val_[i]; }
|
||||
inline float operator[](size_t i) const { return val_[i]; }
|
||||
|
||||
/**
|
||||
* \brief Returns a reference to the specified coordinate of this three-dimensional vector.
|
||||
* \param i The coordinate to which a reference should be returned (0 <= i < 3).
|
||||
* \return A reference to the specified coordinate of the three-dimensional vector.
|
||||
*/
|
||||
RVO_API inline float &operator[](size_t i) { return val_[i]; }
|
||||
inline float &operator[](size_t i) { return val_[i]; }
|
||||
|
||||
/**
|
||||
* \brief Computes the negation of this three-dimensional vector.
|
||||
* \return The negation of this three-dimensional vector.
|
||||
*/
|
||||
RVO_API inline Vector3 operator-() const
|
||||
inline Vector3 operator-() const
|
||||
{
|
||||
return Vector3(-val_[0], -val_[1], -val_[2]);
|
||||
}
|
||||
@ -129,7 +129,7 @@ namespace RVO {
|
||||
* \param vector The three-dimensional vector with which the dot product should be computed.
|
||||
* \return The dot product of this three-dimensional vector with a specified three-dimensional vector.
|
||||
*/
|
||||
RVO_API inline float operator*(const Vector3 &vector) const
|
||||
inline float operator*(const Vector3 &vector) const
|
||||
{
|
||||
return val_[0] * vector[0] + val_[1] * vector[1] + val_[2] * vector[2];
|
||||
}
|
||||
@ -139,7 +139,7 @@ namespace RVO {
|
||||
* \param scalar The scalar value with which the scalar multiplication should be computed.
|
||||
* \return The scalar multiplication of this three-dimensional vector with a specified scalar value.
|
||||
*/
|
||||
RVO_API inline Vector3 operator*(float scalar) const
|
||||
inline Vector3 operator*(float scalar) const
|
||||
{
|
||||
return Vector3(val_[0] * scalar, val_[1] * scalar, val_[2] * scalar);
|
||||
}
|
||||
@ -149,7 +149,7 @@ namespace RVO {
|
||||
* \param scalar The scalar value with which the scalar division should be computed.
|
||||
* \return The scalar division of this three-dimensional vector with a specified scalar value.
|
||||
*/
|
||||
RVO_API inline Vector3 operator/(float scalar) const
|
||||
inline Vector3 operator/(float scalar) const
|
||||
{
|
||||
const float invScalar = 1.0f / scalar;
|
||||
|
||||
@ -161,7 +161,7 @@ namespace RVO {
|
||||
* \param vector The three-dimensional vector with which the vector sum should be computed.
|
||||
* \return The vector sum of this three-dimensional vector with a specified three-dimensional vector.
|
||||
*/
|
||||
RVO_API inline Vector3 operator+(const Vector3 &vector) const
|
||||
inline Vector3 operator+(const Vector3 &vector) const
|
||||
{
|
||||
return Vector3(val_[0] + vector[0], val_[1] + vector[1], val_[2] + vector[2]);
|
||||
}
|
||||
@ -171,7 +171,7 @@ namespace RVO {
|
||||
* \param vector The three-dimensional vector with which the vector difference should be computed.
|
||||
* \return The vector difference of this three-dimensional vector with a specified three-dimensional vector.
|
||||
*/
|
||||
RVO_API inline Vector3 operator-(const Vector3 &vector) const
|
||||
inline Vector3 operator-(const Vector3 &vector) const
|
||||
{
|
||||
return Vector3(val_[0] - vector[0], val_[1] - vector[1], val_[2] - vector[2]);
|
||||
}
|
||||
@ -181,7 +181,7 @@ namespace RVO {
|
||||
* \param vector The three-dimensional vector with which to test for equality.
|
||||
* \return True if the three-dimensional vectors are equal.
|
||||
*/
|
||||
RVO_API inline bool operator==(const Vector3 &vector) const
|
||||
inline bool operator==(const Vector3 &vector) const
|
||||
{
|
||||
return val_[0] == vector[0] && val_[1] == vector[1] && val_[2] == vector[2];
|
||||
}
|
||||
@ -191,7 +191,7 @@ namespace RVO {
|
||||
* \param vector The three-dimensional vector with which to test for inequality.
|
||||
* \return True if the three-dimensional vectors are not equal.
|
||||
*/
|
||||
RVO_API inline bool operator!=(const Vector3 &vector) const
|
||||
inline bool operator!=(const Vector3 &vector) const
|
||||
{
|
||||
return val_[0] != vector[0] || val_[1] != vector[1] || val_[2] != vector[2];
|
||||
}
|
||||
@ -201,7 +201,7 @@ namespace RVO {
|
||||
* \param scalar The scalar value with which the scalar multiplication should be computed.
|
||||
* \return A reference to this three-dimensional vector.
|
||||
*/
|
||||
RVO_API inline Vector3 &operator*=(float scalar)
|
||||
inline Vector3 &operator*=(float scalar)
|
||||
{
|
||||
val_[0] *= scalar;
|
||||
val_[1] *= scalar;
|
||||
@ -215,7 +215,7 @@ namespace RVO {
|
||||
* \param scalar The scalar value with which the scalar division should be computed.
|
||||
* \return A reference to this three-dimensional vector.
|
||||
*/
|
||||
RVO_API inline Vector3 &operator/=(float scalar)
|
||||
inline Vector3 &operator/=(float scalar)
|
||||
{
|
||||
const float invScalar = 1.0f / scalar;
|
||||
|
||||
@ -232,7 +232,7 @@ namespace RVO {
|
||||
* \param vector The three-dimensional vector with which the vector sum should be computed.
|
||||
* \return A reference to this three-dimensional vector.
|
||||
*/
|
||||
RVO_API inline Vector3 &operator+=(const Vector3 &vector)
|
||||
inline Vector3 &operator+=(const Vector3 &vector)
|
||||
{
|
||||
val_[0] += vector[0];
|
||||
val_[1] += vector[1];
|
||||
@ -246,7 +246,7 @@ namespace RVO {
|
||||
* \param vector The three-dimensional vector with which the vector difference should be computed.
|
||||
* \return A reference to this three-dimensional vector.
|
||||
*/
|
||||
RVO_API inline Vector3 &operator-=(const Vector3 &vector)
|
||||
inline Vector3 &operator-=(const Vector3 &vector)
|
||||
{
|
||||
val_[0] -= vector[0];
|
||||
val_[1] -= vector[1];
|
||||
@ -267,7 +267,7 @@ namespace RVO {
|
||||
* \param vector The three-dimensional vector with which the scalar multiplication should be computed.
|
||||
* \return The scalar multiplication of the three-dimensional vector with the scalar value.
|
||||
*/
|
||||
inline Vector3 operator*(float scalar, const Vector3 &vector)
|
||||
RVO3D_EXPORT inline Vector3 operator*(float scalar, const Vector3 &vector)
|
||||
{
|
||||
return Vector3(scalar * vector[0], scalar * vector[1], scalar * vector[2]);
|
||||
}
|
||||
@ -279,7 +279,7 @@ namespace RVO {
|
||||
* \param vector2 The second vector with which the cross product should be computed.
|
||||
* \return The cross product of the two specified vectors.
|
||||
*/
|
||||
inline Vector3 cross(const Vector3 &vector1, const Vector3 &vector2)
|
||||
RVO3D_EXPORT inline Vector3 cross(const Vector3 &vector1, const Vector3 &vector2)
|
||||
{
|
||||
return Vector3(vector1[1] * vector2[2] - vector1[2] * vector2[1], vector1[2] * vector2[0] - vector1[0] * vector2[2], vector1[0] * vector2[1] - vector1[1] * vector2[0]);
|
||||
}
|
||||
@ -291,7 +291,7 @@ namespace RVO {
|
||||
* \param vector The three-dimensional vector which to insert into the output stream.
|
||||
* \return A reference to the output stream.
|
||||
*/
|
||||
inline std::ostream &operator<<(std::ostream &os, const Vector3 &vector)
|
||||
RVO3D_EXPORT inline std::ostream &operator<<(std::ostream &os, const Vector3 &vector)
|
||||
{
|
||||
os << "(" << vector[0] << "," << vector[1] << "," << vector[2] << ")";
|
||||
|
||||
@ -304,7 +304,7 @@ namespace RVO {
|
||||
* \param vector The three-dimensional vector whose length is to be computed.
|
||||
* \return The length of the three-dimensional vector.
|
||||
*/
|
||||
inline float abs(const Vector3 &vector)
|
||||
RVO3D_EXPORT inline float abs(const Vector3 &vector)
|
||||
{
|
||||
return std::sqrt(vector * vector);
|
||||
}
|
||||
@ -315,7 +315,7 @@ namespace RVO {
|
||||
* \param vector The three-dimensional vector whose squared length is to be computed.
|
||||
* \return The squared length of the three-dimensional vector.
|
||||
*/
|
||||
inline float absSq(const Vector3 &vector)
|
||||
RVO3D_EXPORT inline float absSq(const Vector3 &vector)
|
||||
{
|
||||
return vector * vector;
|
||||
}
|
||||
@ -326,7 +326,7 @@ namespace RVO {
|
||||
* \param vector The three-dimensional vector whose normalization is to be computed.
|
||||
* \return The normalization of the three-dimensional vector.
|
||||
*/
|
||||
inline Vector3 normalize(const Vector3 &vector)
|
||||
RVO3D_EXPORT inline Vector3 normalize(const Vector3 &vector)
|
||||
{
|
||||
return vector / abs(vector);
|
||||
}
|
||||
|
72
thirdparty/rvo2/patches/rvo2-godot-changes.patch
vendored
72
thirdparty/rvo2/patches/rvo2-godot-changes.patch
vendored
@ -1,40 +1,5 @@
|
||||
diff --git a/thirdparty/rvo2/API.h b/thirdparty/rvo2/API.h
|
||||
index afef140253..9d424a661b 100644
|
||||
--- a/thirdparty/rvo2/API.h
|
||||
+++ b/thirdparty/rvo2/API.h
|
||||
@@ -38,30 +38,6 @@
|
||||
#ifndef RVO_API_H_
|
||||
#define RVO_API_H_
|
||||
|
||||
-#ifdef _WIN32
|
||||
-#include <SDKDDKVer.h>
|
||||
-#define WIN32_LEAN_AND_MEAN
|
||||
-#define NOCOMM
|
||||
-#define NOIMAGE
|
||||
-#define NOIME
|
||||
-#define NOKANJI
|
||||
-#define NOMCX
|
||||
-#define NOMINMAX
|
||||
-#define NOPROXYSTUB
|
||||
-#define NOSERVICE
|
||||
-#define NOSOUND
|
||||
-#define NOTAPE
|
||||
-#define NORPC
|
||||
-#define _USE_MATH_DEFINES
|
||||
-#include <windows.h>
|
||||
-#endif
|
||||
-
|
||||
-#ifdef RVO_EXPORTS
|
||||
-#define RVO_API __declspec(dllexport)
|
||||
-#elif defined(RVO_IMPORTS)
|
||||
-#define RVO_API __declspec(dllimport)
|
||||
-#else
|
||||
#define RVO_API
|
||||
-#endif
|
||||
|
||||
#endif /* RVO_API_H_ */
|
||||
diff --git a/thirdparty/rvo2/Agent.cpp b/thirdparty/rvo2/Agent.cpp
|
||||
index 1a236c7831..49f14c4f7d 100644
|
||||
index 5e49a3554c..b35eee9c12 100644
|
||||
--- a/thirdparty/rvo2/Agent.cpp
|
||||
+++ b/thirdparty/rvo2/Agent.cpp
|
||||
@@ -105,18 +105,17 @@ namespace RVO {
|
||||
@ -123,10 +88,10 @@ index 1a236c7831..49f14c4f7d 100644
|
||||
{
|
||||
const float dotProduct = line.point * line.direction;
|
||||
diff --git a/thirdparty/rvo2/Agent.h b/thirdparty/rvo2/Agent.h
|
||||
index 238f2d31b7..fd0bf4d1d4 100644
|
||||
index d3922ec645..45fbead2f5 100644
|
||||
--- a/thirdparty/rvo2/Agent.h
|
||||
+++ b/thirdparty/rvo2/Agent.h
|
||||
@@ -43,30 +43,52 @@
|
||||
@@ -41,30 +41,52 @@
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
@ -184,7 +149,7 @@ index 238f2d31b7..fd0bf4d1d4 100644
|
||||
|
||||
/**
|
||||
* \brief Inserts an agent neighbor into the set of neighbors of this agent.
|
||||
@@ -75,16 +97,10 @@ namespace RVO {
|
||||
@@ -73,16 +95,10 @@ namespace RVO {
|
||||
*/
|
||||
void insertAgentNeighbor(const Agent *agent, float &rangeSq);
|
||||
|
||||
@ -201,7 +166,7 @@ index 238f2d31b7..fd0bf4d1d4 100644
|
||||
size_t id_;
|
||||
size_t maxNeighbors_;
|
||||
float maxSpeed_;
|
||||
@@ -93,9 +109,11 @@ namespace RVO {
|
||||
@@ -91,9 +107,11 @@ namespace RVO {
|
||||
float timeHorizon_;
|
||||
std::vector<std::pair<float, const Agent *> > agentNeighbors_;
|
||||
std::vector<Plane> orcaPlanes_;
|
||||
@ -215,7 +180,7 @@ index 238f2d31b7..fd0bf4d1d4 100644
|
||||
}
|
||||
|
||||
diff --git a/thirdparty/rvo2/KdTree.cpp b/thirdparty/rvo2/KdTree.cpp
|
||||
index 719fabdf34..c6d43ee415 100644
|
||||
index 5e9e9777a6..c857f299df 100644
|
||||
--- a/thirdparty/rvo2/KdTree.cpp
|
||||
+++ b/thirdparty/rvo2/KdTree.cpp
|
||||
@@ -36,16 +36,15 @@
|
||||
@ -225,7 +190,7 @@ index 719fabdf34..c6d43ee415 100644
|
||||
-#include "RVOSimulator.h"
|
||||
|
||||
namespace RVO {
|
||||
const size_t RVO_MAX_LEAF_SIZE = 10;
|
||||
const size_t RVO3D_MAX_LEAF_SIZE = 10;
|
||||
|
||||
- KdTree::KdTree(RVOSimulator *sim) : sim_(sim) { }
|
||||
+ KdTree::KdTree() { }
|
||||
@ -239,10 +204,10 @@ index 719fabdf34..c6d43ee415 100644
|
||||
if (!agents_.empty()) {
|
||||
agentTree_.resize(2 * agents_.size() - 1);
|
||||
diff --git a/thirdparty/rvo2/KdTree.h b/thirdparty/rvo2/KdTree.h
|
||||
index 5dbc2b492f..e05a7f40d4 100644
|
||||
index a09384c20f..69d8920ce0 100644
|
||||
--- a/thirdparty/rvo2/KdTree.h
|
||||
+++ b/thirdparty/rvo2/KdTree.h
|
||||
@@ -43,6 +43,9 @@
|
||||
@@ -41,6 +41,9 @@
|
||||
|
||||
#include "Vector3.h"
|
||||
|
||||
@ -252,7 +217,7 @@ index 5dbc2b492f..e05a7f40d4 100644
|
||||
namespace RVO {
|
||||
class Agent;
|
||||
class RVOSimulator;
|
||||
@@ -51,7 +54,7 @@ namespace RVO {
|
||||
@@ -49,7 +52,7 @@ namespace RVO {
|
||||
* \brief Defines <i>k</i>d-trees for agents in the simulation.
|
||||
*/
|
||||
class KdTree {
|
||||
@ -261,7 +226,7 @@ index 5dbc2b492f..e05a7f40d4 100644
|
||||
/**
|
||||
* \brief Defines an agent <i>k</i>d-tree node.
|
||||
*/
|
||||
@@ -92,12 +95,12 @@ namespace RVO {
|
||||
@@ -90,12 +93,12 @@ namespace RVO {
|
||||
* \brief Constructs a <i>k</i>d-tree instance.
|
||||
* \param sim The simulator instance.
|
||||
*/
|
||||
@ -276,7 +241,7 @@ index 5dbc2b492f..e05a7f40d4 100644
|
||||
|
||||
void buildAgentTreeRecursive(size_t begin, size_t end, size_t node);
|
||||
|
||||
@@ -112,7 +115,6 @@ namespace RVO {
|
||||
@@ -110,7 +113,6 @@ namespace RVO {
|
||||
|
||||
std::vector<Agent *> agents_;
|
||||
std::vector<AgentTreeNode> agentTree_;
|
||||
@ -285,9 +250,18 @@ index 5dbc2b492f..e05a7f40d4 100644
|
||||
friend class Agent;
|
||||
friend class RVOSimulator;
|
||||
diff --git a/thirdparty/rvo2/Vector3.h b/thirdparty/rvo2/Vector3.h
|
||||
index adf3382339..8c8835c865 100644
|
||||
index 6c3223bb87..f44e311f29 100644
|
||||
--- a/thirdparty/rvo2/Vector3.h
|
||||
+++ b/thirdparty/rvo2/Vector3.h
|
||||
@@ -41,7 +41,7 @@
|
||||
#include <cstddef>
|
||||
#include <ostream>
|
||||
|
||||
-#include "Export.h"
|
||||
+#define RVO3D_EXPORT
|
||||
|
||||
namespace RVO {
|
||||
/**
|
||||
@@ -59,17 +59,6 @@ namespace RVO {
|
||||
val_[2] = 0.0f;
|
||||
}
|
||||
@ -296,7 +270,7 @@ index adf3382339..8c8835c865 100644
|
||||
- * \brief Constructs and initializes a three-dimensional vector from the specified three-dimensional vector.
|
||||
- * \param vector The three-dimensional vector containing the xyz-coordinates.
|
||||
- */
|
||||
- RVO_API inline Vector3(const Vector3 &vector)
|
||||
- inline Vector3(const Vector3 &vector)
|
||||
- {
|
||||
- val_[0] = vector[0];
|
||||
- val_[1] = vector[1];
|
||||
|
Loading…
Reference in New Issue
Block a user