mirror of
https://github.com/overte-org/overte.git
synced 2025-07-23 22:44:13 +02:00
don't compute polyvox shapes if they are collisionless
This commit is contained in:
parent
0c84ddc503
commit
76c873ce81
1 changed files with 15 additions and 1 deletions
|
@ -501,6 +501,9 @@ PolyVox::RaycastResult RenderablePolyVoxEntityItem::doRayCast(glm::vec4 originIn
|
||||||
|
|
||||||
// virtual
|
// virtual
|
||||||
ShapeType RenderablePolyVoxEntityItem::getShapeType() const {
|
ShapeType RenderablePolyVoxEntityItem::getShapeType() const {
|
||||||
|
if (_collisionless) {
|
||||||
|
return SHAPE_TYPE_NONE;
|
||||||
|
}
|
||||||
return SHAPE_TYPE_COMPOUND;
|
return SHAPE_TYPE_COMPOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -512,6 +515,11 @@ void RenderablePolyVoxEntityItem::updateRegistrationPoint(const glm::vec3& value
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RenderablePolyVoxEntityItem::isReadyToComputeShape() {
|
bool RenderablePolyVoxEntityItem::isReadyToComputeShape() {
|
||||||
|
ShapeType shapeType = getShapeType();
|
||||||
|
if (shapeType == SHAPE_TYPE_NONE) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// we determine if we are ready to compute the physics shape by actually doing so.
|
// we determine if we are ready to compute the physics shape by actually doing so.
|
||||||
// if _voxelDataDirty or _volDataDirty is set, don't do this yet -- wait for their
|
// if _voxelDataDirty or _volDataDirty is set, don't do this yet -- wait for their
|
||||||
// threads to finish before creating the collision shape.
|
// threads to finish before creating the collision shape.
|
||||||
|
@ -524,6 +532,12 @@ bool RenderablePolyVoxEntityItem::isReadyToComputeShape() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderablePolyVoxEntityItem::computeShapeInfo(ShapeInfo& info) {
|
void RenderablePolyVoxEntityItem::computeShapeInfo(ShapeInfo& info) {
|
||||||
|
ShapeType shapeType = getShapeType();
|
||||||
|
if (shapeType == SHAPE_TYPE_NONE) {
|
||||||
|
info.setParams(getShapeType(), 0.5f * getDimensions());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// the shape was actually computed in isReadyToComputeShape. Just hand it off, here.
|
// the shape was actually computed in isReadyToComputeShape. Just hand it off, here.
|
||||||
withWriteLock([&] {
|
withWriteLock([&] {
|
||||||
info = _shapeInfo;
|
info = _shapeInfo;
|
||||||
|
@ -736,7 +750,7 @@ glm::vec3 RenderablePolyVoxEntityItem::localCoordsToVoxelCoords(glm::vec3& local
|
||||||
|
|
||||||
void RenderablePolyVoxEntityItem::setVoxelVolumeSize(glm::vec3 voxelVolumeSize) {
|
void RenderablePolyVoxEntityItem::setVoxelVolumeSize(glm::vec3 voxelVolumeSize) {
|
||||||
// This controls how many individual voxels are in the entity. This is unrelated to
|
// This controls how many individual voxels are in the entity. This is unrelated to
|
||||||
// the dimentions of the entity -- it defines the size of the arrays that hold voxel values.
|
// the dimentions of the entity -- it defines the sizes of the arrays that hold voxel values.
|
||||||
// In addition to setting the number of voxels, this is used in a few places for its
|
// In addition to setting the number of voxels, this is used in a few places for its
|
||||||
// side-effect of allocating _volData to be the correct size.
|
// side-effect of allocating _volData to be the correct size.
|
||||||
withWriteLock([&] {
|
withWriteLock([&] {
|
||||||
|
|
Loading…
Reference in a new issue