mirror of
https://github.com/lubosz/overte.git
synced 2025-04-24 11:43:16 +02:00
manipulate the extents for SHAPE_TYPE_SPHERE
The conversion from ShapeInfo to btShape MUST be reversable! Otherwise we leak shapes in the ShapeManager class.
This commit is contained in:
parent
f4a4c9786c
commit
d89548312e
1 changed files with 16 additions and 1 deletions
|
@ -24,7 +24,22 @@ void ShapeInfo::clear() {
|
|||
|
||||
void ShapeInfo::setParams(ShapeType type, const glm::vec3& halfExtents, QVector<glm::vec3>* data) {
|
||||
_type = type;
|
||||
_halfExtents = halfExtents;
|
||||
switch(type) {
|
||||
case SHAPE_TYPE_NONE:
|
||||
_halfExtents = glm::vec3(0.0f);
|
||||
break;
|
||||
case SHAPE_TYPE_BOX:
|
||||
_halfExtents = halfExtents;
|
||||
break;
|
||||
case SHAPE_TYPE_SPHERE: {
|
||||
// sphere radius is max of halfExtents
|
||||
float radius = glm::max(glm::max(halfExtents.x, halfExtents.y), halfExtents.z);
|
||||
_halfExtents = glm::vec3(radius);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
_halfExtents = halfExtents;
|
||||
}
|
||||
_externalData = data;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue