mirror of
https://github.com/lubosz/overte.git
synced 2025-04-29 22:23:10 +02:00
Merge pull request #14827 from luiscuenca/FixShapeInfoAssertion
Case 14722: Fix assertion when trying to create multisphere shapeInfo with empty data (80.0/master)
This commit is contained in:
commit
e6cdfe3377
2 changed files with 12 additions and 9 deletions
|
@ -1736,6 +1736,7 @@ void Avatar::computeShapeInfo(ShapeInfo& shapeInfo) {
|
||||||
void Avatar::computeDetailedShapeInfo(ShapeInfo& shapeInfo, int jointIndex) {
|
void Avatar::computeDetailedShapeInfo(ShapeInfo& shapeInfo, int jointIndex) {
|
||||||
if (jointIndex > -1 && jointIndex < (int)_multiSphereShapes.size()) {
|
if (jointIndex > -1 && jointIndex < (int)_multiSphereShapes.size()) {
|
||||||
auto& data = _multiSphereShapes[jointIndex].getSpheresData();
|
auto& data = _multiSphereShapes[jointIndex].getSpheresData();
|
||||||
|
if (data.size() > 0) {
|
||||||
std::vector<glm::vec3> positions;
|
std::vector<glm::vec3> positions;
|
||||||
std::vector<btScalar> radiuses;
|
std::vector<btScalar> radiuses;
|
||||||
positions.reserve(data.size());
|
positions.reserve(data.size());
|
||||||
|
@ -1746,6 +1747,7 @@ void Avatar::computeDetailedShapeInfo(ShapeInfo& shapeInfo, int jointIndex) {
|
||||||
}
|
}
|
||||||
shapeInfo.setMultiSphere(positions, radiuses);
|
shapeInfo.setMultiSphere(positions, radiuses);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Avatar::getCapsule(glm::vec3& start, glm::vec3& end, float& radius) {
|
void Avatar::getCapsule(glm::vec3& start, glm::vec3& end, float& radius) {
|
||||||
|
|
|
@ -152,7 +152,8 @@ void ShapeInfo::setSphere(float radius) {
|
||||||
void ShapeInfo::setMultiSphere(const std::vector<glm::vec3>& centers, const std::vector<float>& radiuses) {
|
void ShapeInfo::setMultiSphere(const std::vector<glm::vec3>& centers, const std::vector<float>& radiuses) {
|
||||||
_url = "";
|
_url = "";
|
||||||
_type = SHAPE_TYPE_MULTISPHERE;
|
_type = SHAPE_TYPE_MULTISPHERE;
|
||||||
assert(centers.size() == radiuses.size() && centers.size() > 0);
|
assert(centers.size() == radiuses.size());
|
||||||
|
assert(centers.size() > 0);
|
||||||
for (size_t i = 0; i < centers.size(); i++) {
|
for (size_t i = 0; i < centers.size(); i++) {
|
||||||
SphereData sphere = SphereData(centers[i], radiuses[i]);
|
SphereData sphere = SphereData(centers[i], radiuses[i]);
|
||||||
_sphereCollection.push_back(sphere);
|
_sphereCollection.push_back(sphere);
|
||||||
|
|
Loading…
Reference in a new issue