mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 12:38:27 +02:00
Merge pull request #13389 from AndrewMeadows/misc-001
crash fixes, removing unnecessary writes, and misc cleanup
This commit is contained in:
commit
b255cf0ba9
12 changed files with 31 additions and 35 deletions
|
@ -812,7 +812,7 @@ Menu::Menu() {
|
||||||
});
|
});
|
||||||
essLogAction->setEnabled(nodeList->getThisNodeCanRez());
|
essLogAction->setEnabled(nodeList->getThisNodeCanRez());
|
||||||
|
|
||||||
action = addActionToQMenuAndActionHash(developerMenu, "Script Log (HMD friendly)...", Qt::NoButton,
|
addActionToQMenuAndActionHash(developerMenu, "Script Log (HMD friendly)...", Qt::NoButton,
|
||||||
qApp, SLOT(showScriptLogs()));
|
qApp, SLOT(showScriptLogs()));
|
||||||
|
|
||||||
addCheckableActionToQMenuAndActionHash(developerMenu, MenuOption::VerboseLogging, 0, false,
|
addCheckableActionToQMenuAndActionHash(developerMenu, MenuOption::VerboseLogging, 0, false,
|
||||||
|
|
|
@ -201,13 +201,12 @@ void Circle3DOverlay::render(RenderArgs* args) {
|
||||||
|
|
||||||
float tickMarkAngle = getMajorTickMarksAngle();
|
float tickMarkAngle = getMajorTickMarksAngle();
|
||||||
float angle = _startAt - fmodf(_startAt, tickMarkAngle) + tickMarkAngle;
|
float angle = _startAt - fmodf(_startAt, tickMarkAngle) + tickMarkAngle;
|
||||||
float angleInRadians = glm::radians(angle);
|
|
||||||
float tickMarkLength = getMajorTickMarksLength();
|
float tickMarkLength = getMajorTickMarksLength();
|
||||||
float startRadius = (tickMarkLength > 0.0f) ? _innerRadius : _outerRadius;
|
float startRadius = (tickMarkLength > 0.0f) ? _innerRadius : _outerRadius;
|
||||||
float endRadius = startRadius + tickMarkLength;
|
float endRadius = startRadius + tickMarkLength;
|
||||||
|
|
||||||
while (angle <= _endAt) {
|
while (angle <= _endAt) {
|
||||||
angleInRadians = glm::radians(angle);
|
float angleInRadians = glm::radians(angle);
|
||||||
|
|
||||||
glm::vec2 thisPointA(cosf(angleInRadians) * startRadius, sinf(angleInRadians) * startRadius);
|
glm::vec2 thisPointA(cosf(angleInRadians) * startRadius, sinf(angleInRadians) * startRadius);
|
||||||
glm::vec2 thisPointB(cosf(angleInRadians) * endRadius, sinf(angleInRadians) * endRadius);
|
glm::vec2 thisPointB(cosf(angleInRadians) * endRadius, sinf(angleInRadians) * endRadius);
|
||||||
|
@ -223,13 +222,12 @@ void Circle3DOverlay::render(RenderArgs* args) {
|
||||||
|
|
||||||
float tickMarkAngle = getMinorTickMarksAngle();
|
float tickMarkAngle = getMinorTickMarksAngle();
|
||||||
float angle = _startAt - fmodf(_startAt, tickMarkAngle) + tickMarkAngle;
|
float angle = _startAt - fmodf(_startAt, tickMarkAngle) + tickMarkAngle;
|
||||||
float angleInRadians = glm::radians(angle);
|
|
||||||
float tickMarkLength = getMinorTickMarksLength();
|
float tickMarkLength = getMinorTickMarksLength();
|
||||||
float startRadius = (tickMarkLength > 0.0f) ? _innerRadius : _outerRadius;
|
float startRadius = (tickMarkLength > 0.0f) ? _innerRadius : _outerRadius;
|
||||||
float endRadius = startRadius + tickMarkLength;
|
float endRadius = startRadius + tickMarkLength;
|
||||||
|
|
||||||
while (angle <= _endAt) {
|
while (angle <= _endAt) {
|
||||||
angleInRadians = glm::radians(angle);
|
float angleInRadians = glm::radians(angle);
|
||||||
|
|
||||||
glm::vec2 thisPointA(cosf(angleInRadians) * startRadius, sinf(angleInRadians) * startRadius);
|
glm::vec2 thisPointA(cosf(angleInRadians) * startRadius, sinf(angleInRadians) * startRadius);
|
||||||
glm::vec2 thisPointB(cosf(angleInRadians) * endRadius, sinf(angleInRadians) * endRadius);
|
glm::vec2 thisPointB(cosf(angleInRadians) * endRadius, sinf(angleInRadians) * endRadius);
|
||||||
|
|
|
@ -105,8 +105,10 @@ QStringList Animation::getJointNames() const {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
QStringList names;
|
QStringList names;
|
||||||
foreach (const FBXJoint& joint, _geometry->joints) {
|
if (_geometry) {
|
||||||
names.append(joint.name);
|
foreach (const FBXJoint& joint, _geometry->joints) {
|
||||||
|
names.append(joint.name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return names;
|
return names;
|
||||||
}
|
}
|
||||||
|
@ -114,11 +116,15 @@ QStringList Animation::getJointNames() const {
|
||||||
QVector<FBXAnimationFrame> Animation::getFrames() const {
|
QVector<FBXAnimationFrame> Animation::getFrames() const {
|
||||||
if (QThread::currentThread() != thread()) {
|
if (QThread::currentThread() != thread()) {
|
||||||
QVector<FBXAnimationFrame> result;
|
QVector<FBXAnimationFrame> result;
|
||||||
BLOCKING_INVOKE_METHOD(const_cast<Animation*>(this), "getFrames",
|
BLOCKING_INVOKE_METHOD(const_cast<Animation*>(this), "getFrames",
|
||||||
Q_RETURN_ARG(QVector<FBXAnimationFrame>, result));
|
Q_RETURN_ARG(QVector<FBXAnimationFrame>, result));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
return _geometry->animationFrames;
|
if (_geometry) {
|
||||||
|
return _geometry->animationFrames;
|
||||||
|
} else {
|
||||||
|
return QVector<FBXAnimationFrame>();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const QVector<FBXAnimationFrame>& Animation::getFramesReference() const {
|
const QVector<FBXAnimationFrame>& Animation::getFramesReference() const {
|
||||||
|
|
|
@ -2423,9 +2423,7 @@ OctreeElement::AppendState EntityItemProperties::encodeEntityEditPacket(PacketTy
|
||||||
if (appendState != OctreeElement::COMPLETED) {
|
if (appendState != OctreeElement::COMPLETED) {
|
||||||
didntFitProperties = propertiesDidntFit;
|
didntFitProperties = propertiesDidntFit;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (success) {
|
|
||||||
packetData->endSubTree();
|
packetData->endSubTree();
|
||||||
|
|
||||||
const char* finalizedData = reinterpret_cast<const char*>(packetData->getFinalizedData());
|
const char* finalizedData = reinterpret_cast<const char*>(packetData->getFinalizedData());
|
||||||
|
@ -2436,7 +2434,6 @@ OctreeElement::AppendState EntityItemProperties::encodeEntityEditPacket(PacketTy
|
||||||
buffer.resize(finalizedSize);
|
buffer.resize(finalizedSize);
|
||||||
} else {
|
} else {
|
||||||
qCDebug(entities) << "ERROR - encoded edit message doesn't fit in output buffer.";
|
qCDebug(entities) << "ERROR - encoded edit message doesn't fit in output buffer.";
|
||||||
success = false;
|
|
||||||
appendState = OctreeElement::NONE; // if we got here, then we didn't include the item
|
appendState = OctreeElement::NONE; // if we got here, then we didn't include the item
|
||||||
// maybe we should assert!!!
|
// maybe we should assert!!!
|
||||||
}
|
}
|
||||||
|
@ -2444,7 +2441,6 @@ OctreeElement::AppendState EntityItemProperties::encodeEntityEditPacket(PacketTy
|
||||||
packetData->discardSubTree();
|
packetData->discardSubTree();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return appendState;
|
return appendState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2834,7 +2830,6 @@ bool EntityItemProperties::encodeEraseEntityMessage(const EntityItemID& entityIt
|
||||||
outputLength = sizeof(numberOfIds);
|
outputLength = sizeof(numberOfIds);
|
||||||
|
|
||||||
memcpy(copyAt, entityItemID.toRfc4122().constData(), NUM_BYTES_RFC4122_UUID);
|
memcpy(copyAt, entityItemID.toRfc4122().constData(), NUM_BYTES_RFC4122_UUID);
|
||||||
copyAt += NUM_BYTES_RFC4122_UUID;
|
|
||||||
outputLength += NUM_BYTES_RFC4122_UUID;
|
outputLength += NUM_BYTES_RFC4122_UUID;
|
||||||
|
|
||||||
buffer.resize(outputLength);
|
buffer.resize(outputLength);
|
||||||
|
@ -2856,7 +2851,6 @@ bool EntityItemProperties::encodeCloneEntityMessage(const EntityItemID& entityID
|
||||||
outputLength += NUM_BYTES_RFC4122_UUID;
|
outputLength += NUM_BYTES_RFC4122_UUID;
|
||||||
|
|
||||||
memcpy(copyAt, newEntityID.toRfc4122().constData(), NUM_BYTES_RFC4122_UUID);
|
memcpy(copyAt, newEntityID.toRfc4122().constData(), NUM_BYTES_RFC4122_UUID);
|
||||||
copyAt += NUM_BYTES_RFC4122_UUID;
|
|
||||||
outputLength += NUM_BYTES_RFC4122_UUID;
|
outputLength += NUM_BYTES_RFC4122_UUID;
|
||||||
|
|
||||||
buffer.resize(outputLength);
|
buffer.resize(outputLength);
|
||||||
|
|
|
@ -67,11 +67,12 @@
|
||||||
// when multiple participants (with variable ping-times to the server) bid simultaneously for a
|
// when multiple participants (with variable ping-times to the server) bid simultaneously for a
|
||||||
// recently activated entity.
|
// recently activated entity.
|
||||||
//
|
//
|
||||||
// (9) When a participant changes an entity's transform/velocity it will bid at priority = POKE (=127)
|
// (9) When a participant changes an entity's transform/velocity (via script) it will bid at
|
||||||
|
// priority = POKE (=127).
|
||||||
//
|
//
|
||||||
// (10) When an entity touches MyAvatar the participant it will bid at priority = POKE.
|
// (10) When an entity collides with MyAvatar the participant it will bid at priority = POKE.
|
||||||
//
|
//
|
||||||
// (11) When a participant grabs an entity it will bid at priority = GRAB (=128).
|
// (11) When a participant grabs (via script) an entity it will bid at priority = GRAB (=128).
|
||||||
//
|
//
|
||||||
// (12) When entityA, locally owned at priority = N, collides with an unowned entityB the owner will
|
// (12) When entityA, locally owned at priority = N, collides with an unowned entityB the owner will
|
||||||
// also bid for entityB at priority = N-1 (or VOLUNTEER, whichever is larger).
|
// also bid for entityB at priority = N-1 (or VOLUNTEER, whichever is larger).
|
||||||
|
@ -79,7 +80,7 @@
|
||||||
// (13) When an entity comes to rest and is deactivated in the physics simulation the owner will
|
// (13) When an entity comes to rest and is deactivated in the physics simulation the owner will
|
||||||
// send an update to: clear their ownerhsip, set priority to zero, and set the object's
|
// send an update to: clear their ownerhsip, set priority to zero, and set the object's
|
||||||
// velocities to be zero. As per a normal bid, the owner does NOT assume that its ownership
|
// velocities to be zero. As per a normal bid, the owner does NOT assume that its ownership
|
||||||
// has been cleared until it hears from the entity-server. This, if the packet is lost the
|
// has been cleared until it hears from the entity-server. Thus, if the packet is lost the
|
||||||
// owner will re-send after some period.
|
// owner will re-send after some period.
|
||||||
//
|
//
|
||||||
// (14) When an entity's ownership priority drops below VOLUNTEER other participants may bid for it
|
// (14) When an entity's ownership priority drops below VOLUNTEER other participants may bid for it
|
||||||
|
|
|
@ -63,13 +63,13 @@ Sysmem& Sysmem::operator=(const Sysmem& sysmem) {
|
||||||
|
|
||||||
Sysmem::~Sysmem() {
|
Sysmem::~Sysmem() {
|
||||||
deallocateMemory( _data, _size );
|
deallocateMemory( _data, _size );
|
||||||
_data = NULL;
|
_data = nullptr;
|
||||||
_size = 0;
|
_size = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Size Sysmem::allocate(Size size) {
|
Size Sysmem::allocate(Size size) {
|
||||||
if (size != _size) {
|
if (size != _size) {
|
||||||
Byte* newData = NULL;
|
Byte* newData = nullptr;
|
||||||
Size newSize = 0;
|
Size newSize = 0;
|
||||||
if (size > 0) {
|
if (size > 0) {
|
||||||
Size allocated = allocateMemory(&newData, size);
|
Size allocated = allocateMemory(&newData, size);
|
||||||
|
@ -90,7 +90,7 @@ Size Sysmem::allocate(Size size) {
|
||||||
|
|
||||||
Size Sysmem::resize(Size size) {
|
Size Sysmem::resize(Size size) {
|
||||||
if (size != _size) {
|
if (size != _size) {
|
||||||
Byte* newData = NULL;
|
Byte* newData = nullptr;
|
||||||
Size newSize = 0;
|
Size newSize = 0;
|
||||||
if (size > 0) {
|
if (size > 0) {
|
||||||
Size allocated = allocateMemory(&newData, size);
|
Size allocated = allocateMemory(&newData, size);
|
||||||
|
@ -124,7 +124,7 @@ Size Sysmem::setData( Size size, const Byte* bytes ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Size Sysmem::setSubData( Size offset, Size size, const Byte* bytes) {
|
Size Sysmem::setSubData( Size offset, Size size, const Byte* bytes) {
|
||||||
if (size && ((offset + size) <= getSize()) && bytes) {
|
if (_data && size && ((offset + size) <= getSize()) && bytes) {
|
||||||
memcpy( _data + offset, bytes, size );
|
memcpy( _data + offset, bytes, size );
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
|
@ -140,7 +140,6 @@ struct IrradianceKTXPayload {
|
||||||
data += sizeof(Version);
|
data += sizeof(Version);
|
||||||
|
|
||||||
memcpy(&_irradianceSH, data, sizeof(SphericalHarmonics));
|
memcpy(&_irradianceSH, data, sizeof(SphericalHarmonics));
|
||||||
data += sizeof(SphericalHarmonics);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -267,8 +267,6 @@ bool PacketSender::nonThreadedProcess() {
|
||||||
// Keep average packets and time for "second half" of check interval
|
// Keep average packets and time for "second half" of check interval
|
||||||
_lastPPSCheck += (elapsedSinceLastCheck / 2);
|
_lastPPSCheck += (elapsedSinceLastCheck / 2);
|
||||||
_packetsOverCheckInterval = (_packetsOverCheckInterval / 2);
|
_packetsOverCheckInterval = (_packetsOverCheckInterval / 2);
|
||||||
|
|
||||||
elapsedSinceLastCheck = now - _lastPPSCheck;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -296,12 +294,10 @@ bool PacketSender::nonThreadedProcess() {
|
||||||
DependencyManager::get<NodeList>()->sendPacketList(std::move(packetPair.second.second), *packetPair.first);
|
DependencyManager::get<NodeList>()->sendPacketList(std::move(packetPair.second.second), *packetPair.first);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
packetsSentThisCall += packetCount;
|
packetsSentThisCall += packetCount;
|
||||||
_packetsOverCheckInterval += packetCount;
|
_packetsOverCheckInterval += packetCount;
|
||||||
_totalPacketsSent += packetCount;
|
_totalPacketsSent += packetCount;
|
||||||
|
|
||||||
|
|
||||||
_totalBytesSent += packetSize;
|
_totalBytesSent += packetSize;
|
||||||
emit packetSent(packetSize); // FIXME should include number of packets?
|
emit packetSent(packetSize); // FIXME should include number of packets?
|
||||||
_lastSendTime = now;
|
_lastSendTime = now;
|
||||||
|
|
|
@ -401,7 +401,6 @@ int Octree::readElementData(const OctreeElementPointer& destinationElement, cons
|
||||||
// tell the element to read the subsequent data
|
// tell the element to read the subsequent data
|
||||||
int rootDataSize = _rootElement->readElementDataFromBuffer(nodeData + bytesRead, bytesLeftToRead, args);
|
int rootDataSize = _rootElement->readElementDataFromBuffer(nodeData + bytesRead, bytesLeftToRead, args);
|
||||||
bytesRead += rootDataSize;
|
bytesRead += rootDataSize;
|
||||||
bytesLeftToRead -= rootDataSize;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return bytesRead;
|
return bytesRead;
|
||||||
|
|
|
@ -92,7 +92,7 @@ void ObjectMotionState::setMass(float mass) {
|
||||||
}
|
}
|
||||||
|
|
||||||
float ObjectMotionState::getMass() const {
|
float ObjectMotionState::getMass() const {
|
||||||
if (_shape) {
|
if (_shape && _shape->getShapeType() != TRIANGLE_MESH_SHAPE_PROXYTYPE) {
|
||||||
// scale the density by the current Aabb volume to get mass
|
// scale the density by the current Aabb volume to get mass
|
||||||
btTransform transform;
|
btTransform transform;
|
||||||
transform.setIdentity();
|
transform.setIdentity();
|
||||||
|
@ -348,8 +348,10 @@ void ObjectMotionState::updateLastKinematicStep() {
|
||||||
|
|
||||||
void ObjectMotionState::updateBodyMassProperties() {
|
void ObjectMotionState::updateBodyMassProperties() {
|
||||||
float mass = getMass();
|
float mass = getMass();
|
||||||
btVector3 inertia(0.0f, 0.0f, 0.0f);
|
btVector3 inertia(1.0f, 1.0f, 1.0f);
|
||||||
_body->getCollisionShape()->calculateLocalInertia(mass, inertia);
|
if (mass > 0.0f) {
|
||||||
|
_body->getCollisionShape()->calculateLocalInertia(mass, inertia);
|
||||||
|
}
|
||||||
_body->setMassProps(mass, inertia);
|
_body->setMassProps(mass, inertia);
|
||||||
_body->updateInertiaTensor();
|
_body->updateInertiaTensor();
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,6 @@ PointerFrameHeaderList parseFrameHeaders(uchar* const start, const size_t& size)
|
||||||
current += sizeof(FrameSize);
|
current += sizeof(FrameSize);
|
||||||
header.fileOffset = current - start;
|
header.fileOffset = current - start;
|
||||||
if (end - current < header.size) {
|
if (end - current < header.size) {
|
||||||
current = end;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
current += header.size;
|
current += header.size;
|
||||||
|
|
|
@ -402,8 +402,10 @@ MenuWrapper* Menu::addMenu(const QString& menuName, const QString& grouping) {
|
||||||
|
|
||||||
// hook our show/hide for popup menus, so we can keep track of whether or not one
|
// hook our show/hide for popup menus, so we can keep track of whether or not one
|
||||||
// of our submenus is currently showing.
|
// of our submenus is currently showing.
|
||||||
connect(menu->_realMenu, &QMenu::aboutToShow, []() { _isSomeSubmenuShown = true; });
|
if (menu && menu->_realMenu) {
|
||||||
connect(menu->_realMenu, &QMenu::aboutToHide, []() { _isSomeSubmenuShown = false; });
|
connect(menu->_realMenu, &QMenu::aboutToShow, []() { _isSomeSubmenuShown = true; });
|
||||||
|
connect(menu->_realMenu, &QMenu::aboutToHide, []() { _isSomeSubmenuShown = false; });
|
||||||
|
}
|
||||||
|
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue