mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 18:23:54 +02:00
put physics into its own logging group
This commit is contained in:
parent
3efcc3684e
commit
55bab2efd6
6 changed files with 54 additions and 24 deletions
|
@ -16,6 +16,7 @@
|
|||
#include "EntityMotionState.h"
|
||||
#include "PhysicsEngine.h"
|
||||
#include "PhysicsHelpers.h"
|
||||
#include "PhysicsLogging.h"
|
||||
|
||||
|
||||
QSet<EntityItem*>* _outgoingEntityList;
|
||||
|
@ -108,10 +109,10 @@ void EntityMotionState::setWorldTransform(const btTransform& worldTrans) {
|
|||
|
||||
#ifdef WANT_DEBUG
|
||||
quint64 now = usecTimestampNow();
|
||||
qDebug() << "EntityMotionState::setWorldTransform()... changed entity:" << _entity->getEntityItemID();
|
||||
qDebug() << " last edited:" << _entity->getLastEdited() << formatUsecTime(now - _entity->getLastEdited()) << "ago";
|
||||
qDebug() << " last simulated:" << _entity->getLastSimulated() << formatUsecTime(now - _entity->getLastSimulated()) << "ago";
|
||||
qDebug() << " last updated:" << _entity->getLastUpdated() << formatUsecTime(now - _entity->getLastUpdated()) << "ago";
|
||||
qCDebug(physics) << "EntityMotionState::setWorldTransform()... changed entity:" << _entity->getEntityItemID();
|
||||
qCDebug(physics) << " last edited:" << _entity->getLastEdited() << formatUsecTime(now - _entity->getLastEdited()) << "ago";
|
||||
qCDebug(physics) << " last simulated:" << _entity->getLastSimulated() << formatUsecTime(now - _entity->getLastSimulated()) << "ago";
|
||||
qCDebug(physics) << " last updated:" << _entity->getLastUpdated() << formatUsecTime(now - _entity->getLastUpdated()) << "ago";
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -238,9 +239,9 @@ void EntityMotionState::sendUpdate(OctreeEditPacketSender* packetSender, uint32_
|
|||
|
||||
#ifdef WANT_DEBUG
|
||||
quint64 now = usecTimestampNow();
|
||||
qDebug() << "EntityMotionState::sendUpdate()";
|
||||
qDebug() << " EntityItemId:" << _entity->getEntityItemID() << "---------------------------------------------";
|
||||
qDebug() << " lastSimulated:" << debugTime(lastSimulated, now);
|
||||
qCDebug(physics) << "EntityMotionState::sendUpdate()";
|
||||
qCDebug(physics) << " EntityItemId:" << _entity->getEntityItemID() << "---------------------------------------------";
|
||||
qCDebug(physics) << " lastSimulated:" << debugTime(lastSimulated, now);
|
||||
#endif //def WANT_DEBUG
|
||||
|
||||
} else {
|
||||
|
@ -251,12 +252,12 @@ void EntityMotionState::sendUpdate(OctreeEditPacketSender* packetSender, uint32_
|
|||
EntityItemID id(_entity->getID());
|
||||
EntityEditPacketSender* entityPacketSender = static_cast<EntityEditPacketSender*>(packetSender);
|
||||
#ifdef WANT_DEBUG
|
||||
qDebug() << "EntityMotionState::sendUpdate()... calling queueEditEntityMessage()...";
|
||||
qCDebug(physics) << "EntityMotionState::sendUpdate()... calling queueEditEntityMessage()...";
|
||||
#endif
|
||||
entityPacketSender->queueEditEntityMessage(PacketTypeEntityAddOrEdit, id, properties);
|
||||
} else {
|
||||
#ifdef WANT_DEBUG
|
||||
qDebug() << "EntityMotionState::sendUpdate()... NOT sending update as requested.";
|
||||
qCDebug(physics) << "EntityMotionState::sendUpdate()... NOT sending update as requested.";
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "ObjectMotionState.h"
|
||||
#include "PhysicsEngine.h"
|
||||
#include "PhysicsHelpers.h"
|
||||
#include "PhysicsLogging.h"
|
||||
|
||||
const float DEFAULT_FRICTION = 0.5f;
|
||||
const float MAX_FRICTION = 10.0f;
|
||||
|
@ -161,11 +162,11 @@ bool ObjectMotionState::shouldSendUpdate(uint32_t simulationFrame) {
|
|||
if (dx2 > MAX_POSITION_ERROR_SQUARED) {
|
||||
|
||||
#ifdef WANT_DEBUG
|
||||
qDebug() << ".... (dx2 > MAX_POSITION_ERROR_SQUARED) ....";
|
||||
qDebug() << "wasPosition:" << wasPosition;
|
||||
qDebug() << "bullet position:" << position;
|
||||
qDebug() << "_sentPosition:" << _sentPosition;
|
||||
qDebug() << "dx2:" << dx2;
|
||||
qCDebug(physics) << ".... (dx2 > MAX_POSITION_ERROR_SQUARED) ....";
|
||||
qCDebug(physics) << "wasPosition:" << wasPosition;
|
||||
qCDebug(physics) << "bullet position:" << position;
|
||||
qCDebug(physics) << "_sentPosition:" << _sentPosition;
|
||||
qCDebug(physics) << "dx2:" << dx2;
|
||||
#endif
|
||||
|
||||
return true;
|
||||
|
@ -187,17 +188,17 @@ bool ObjectMotionState::shouldSendUpdate(uint32_t simulationFrame) {
|
|||
|
||||
#ifdef WANT_DEBUG
|
||||
if ((fabsf(glm::dot(actualRotation, _sentRotation)) < MIN_ROTATION_DOT)) {
|
||||
qDebug() << ".... ((fabsf(glm::dot(actualRotation, _sentRotation)) < MIN_ROTATION_DOT)) ....";
|
||||
qCDebug(physics) << ".... ((fabsf(glm::dot(actualRotation, _sentRotation)) < MIN_ROTATION_DOT)) ....";
|
||||
|
||||
qDebug() << "wasAngularVelocity:" << wasAngularVelocity;
|
||||
qDebug() << "_sentAngularVelocity:" << _sentAngularVelocity;
|
||||
qCDebug(physics) << "wasAngularVelocity:" << wasAngularVelocity;
|
||||
qCDebug(physics) << "_sentAngularVelocity:" << _sentAngularVelocity;
|
||||
|
||||
qDebug() << "length wasAngularVelocity:" << glm::length(wasAngularVelocity);
|
||||
qDebug() << "length _sentAngularVelocity:" << glm::length(_sentAngularVelocity);
|
||||
qCDebug(physics) << "length wasAngularVelocity:" << glm::length(wasAngularVelocity);
|
||||
qCDebug(physics) << "length _sentAngularVelocity:" << glm::length(_sentAngularVelocity);
|
||||
|
||||
qDebug() << "wasRotation:" << wasRotation;
|
||||
qDebug() << "bullet actualRotation:" << actualRotation;
|
||||
qDebug() << "_sentRotation:" << _sentRotation;
|
||||
qCDebug(physics) << "wasRotation:" << wasRotation;
|
||||
qCDebug(physics) << "bullet actualRotation:" << actualRotation;
|
||||
qCDebug(physics) << "_sentRotation:" << _sentRotation;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ void PhysicsEngine::addEntityInternal(EntityItem* entity) {
|
|||
motionState->setKinematic(true, _numSubsteps);
|
||||
_nonPhysicalKinematicObjects.insert(motionState);
|
||||
// We failed to add the entity to the simulation. Probably because we couldn't create a shape for it.
|
||||
//qDebug() << "failed to add entity " << entity->getEntityItemID() << " to physics engine";
|
||||
//qCDebug(physics) << "failed to add entity " << entity->getEntityItemID() << " to physics engine";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
14
libraries/physics/src/PhysicsLogging.cpp
Normal file
14
libraries/physics/src/PhysicsLogging.cpp
Normal file
|
@ -0,0 +1,14 @@
|
|||
//
|
||||
// PhysicsLogging.h
|
||||
// libraries/physics/src
|
||||
//
|
||||
// Created by Seth Alves on 4/6/15.
|
||||
// Copyright 2014 High Fidelity, Inc.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
#include "PhysicsLogging.h"
|
||||
|
||||
Q_LOGGING_CATEGORY(physics, "hifi.physics")
|
14
libraries/physics/src/PhysicsLogging.h
Normal file
14
libraries/physics/src/PhysicsLogging.h
Normal file
|
@ -0,0 +1,14 @@
|
|||
//
|
||||
// PhysicsLogging.h
|
||||
// libraries/physics/src
|
||||
//
|
||||
// Created by Seth Alves on 4/6/15.
|
||||
// Copyright 2014 High Fidelity, Inc.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
#include <QLoggingCategory>
|
||||
|
||||
Q_DECLARE_LOGGING_CATEGORY(physics)
|
|
@ -37,7 +37,7 @@ btCollisionShape* ShapeManager::getShape(const ShapeInfo& info) {
|
|||
const float MIN_SHAPE_DIAGONAL_SQUARED = 3.0e-4f; // 1 cm cube
|
||||
const float MAX_SHAPE_DIAGONAL_SQUARED = 3.0e6f; // 1000 m cube
|
||||
if (diagonal < MIN_SHAPE_DIAGONAL_SQUARED || diagonal > MAX_SHAPE_DIAGONAL_SQUARED) {
|
||||
// qDebug() << "ShapeManager::getShape -- not making shape due to size" << diagonal;
|
||||
// qCDebug(physics) << "ShapeManager::getShape -- not making shape due to size" << diagonal;
|
||||
return NULL;
|
||||
}
|
||||
DoubleHashKey key = info.getHash();
|
||||
|
|
Loading…
Reference in a new issue