remove some debug spam

This commit is contained in:
Seth Alves 2015-03-24 16:23:51 -07:00
parent 6e3be26013
commit 1eeb2e89f8
6 changed files with 15 additions and 91 deletions

View file

@ -267,50 +267,26 @@ bool RenderableModelEntityItem::findDetailedRayIntersection(const glm::vec3& ori
return _model->findRayIntersectionAgainstSubMeshes(origin, direction, distance, face, extraInfo, precisionPicking); return _model->findRayIntersectionAgainstSubMeshes(origin, direction, distance, face, extraInfo, precisionPicking);
} }
// void RenderableModelEntityItem::setCollisionModelURL(const QString& url) {
// // XXX PhysicsEngine::entityChangedInternal(this);
// // EntityTree* x = this->getElement()->_myTree;
// // EntityTreeRenderer* _myRenderer;
// qDebug() << "--------------------------------";
// this->ModelEntityItem::setCollisionModelURL(url);
// if ((_dirtyFlags & (EntityItem::DIRTY_SHAPE | EntityItem::DIRTY_MASS)) ==
// (EntityItem::DIRTY_SHAPE | EntityItem::DIRTY_MASS)) {
// EntityTreeElement* element = this->getElement();
// if (element) {
// qDebug() << "element =" << element;
// EntityTree* tree = element->getTree();
// qDebug() << "tree =" << tree;
// tree->reconfigureEntity(this);
// }
// }
// }
void RenderableModelEntityItem::setCollisionModelURL(const QString& url) { void RenderableModelEntityItem::setCollisionModelURL(const QString& url) {
ModelEntityItem::setCollisionModelURL(url); ModelEntityItem::setCollisionModelURL(url);
_model->setCollisionModelURL(QUrl(url)); if (_model) {
_model->setCollisionModelURL(QUrl(url));
}
} }
bool RenderableModelEntityItem::hasCollisionModel() const { bool RenderableModelEntityItem::hasCollisionModel() const {
// return !_collisionModelURL.isEmpty(); if (_model) {
return ! _model->getCollisionURL().isEmpty(); return ! _model->getCollisionURL().isEmpty();
} else {
return !_collisionModelURL.isEmpty();
}
} }
const QString& RenderableModelEntityItem::getCollisionModelURL() const { const QString& RenderableModelEntityItem::getCollisionModelURL() const {
// return _collisionModelURL; assert (!_model || _collisionModelURL == _model->getCollisionURL().toString());
_collisionModelURL = _model->getCollisionURL().toString();
return _collisionModelURL; return _collisionModelURL;
} }
void RenderableModelEntityItem::updateDimensions(const glm::vec3& value) { void RenderableModelEntityItem::updateDimensions(const glm::vec3& value) {
if (glm::distance(_dimensions, value) > MIN_DIMENSIONS_DELTA) { if (glm::distance(_dimensions, value) > MIN_DIMENSIONS_DELTA) {
_dimensions = value; _dimensions = value;
@ -342,12 +318,9 @@ bool RenderableModelEntityItem::isReadyToComputeShape() {
} }
void RenderableModelEntityItem::computeShapeInfo(ShapeInfo& info) { void RenderableModelEntityItem::computeShapeInfo(ShapeInfo& info) {
qDebug() << "RenderableModelEntityItem::computeShapeInfo";
if (_model->getCollisionURL().isEmpty()) { if (_model->getCollisionURL().isEmpty()) {
qDebug() << " _model->getCollisionURL().isEmpty()";
info.setParams(getShapeType(), 0.5f * getDimensions()); info.setParams(getShapeType(), 0.5f * getDimensions());
} else { } else {
qDebug() << " _model->getCollisionURL() wasn't empty.";
const QSharedPointer<NetworkGeometry> collisionNetworkGeometry = _model->getCollisionGeometry(); const QSharedPointer<NetworkGeometry> collisionNetworkGeometry = _model->getCollisionGeometry();
const FBXGeometry& fbxGeometry = collisionNetworkGeometry->getFBXGeometry(); const FBXGeometry& fbxGeometry = collisionNetworkGeometry->getFBXGeometry();

View file

@ -74,7 +74,7 @@ bool ModelEntityItem::setProperties(const EntityItemProperties& properties) {
SET_ENTITY_PROPERTY_FROM_PROPERTIES(shapeType, updateShapeType); SET_ENTITY_PROPERTY_FROM_PROPERTIES(shapeType, updateShapeType);
if (somethingChanged) { if (somethingChanged) {
bool wantDebug = true; bool wantDebug = false;
if (wantDebug) { if (wantDebug) {
uint64_t now = usecTimestampNow(); uint64_t now = usecTimestampNow();
int elapsed = now - getLastEdited(); int elapsed = now - getLastEdited();
@ -284,10 +284,6 @@ void ModelEntityItem::updateShapeType(ShapeType type) {
void ModelEntityItem::setCollisionModelURL(const QString& url) void ModelEntityItem::setCollisionModelURL(const QString& url)
{ {
if (_collisionModelURL != url) { if (_collisionModelURL != url) {
qDebug() << "\n\n----";
qDebug() << "ModelEntityItem::setCollisionModelURL";
_collisionModelURL = url; _collisionModelURL = url;
_dirtyFlags |= EntityItem::DIRTY_SHAPE | EntityItem::DIRTY_MASS; _dirtyFlags |= EntityItem::DIRTY_SHAPE | EntityItem::DIRTY_MASS;
} }

View file

@ -168,12 +168,10 @@ void EntityMotionState::updateObjectVelocities() {
} }
} }
bool EntityMotionState::computeShapeInfo(ShapeInfo& shapeInfo) { void EntityMotionState::computeShapeInfo(ShapeInfo& shapeInfo) {
if (_entity->isReadyToComputeShape()) { if (_entity->isReadyToComputeShape()) {
_entity->computeShapeInfo(shapeInfo); _entity->computeShapeInfo(shapeInfo);
return true;
} }
return false;
} }
float EntityMotionState::computeMass(const ShapeInfo& shapeInfo) const { float EntityMotionState::computeMass(const ShapeInfo& shapeInfo) const {

View file

@ -53,7 +53,7 @@ public:
virtual void updateObjectEasy(uint32_t flags, uint32_t frame); virtual void updateObjectEasy(uint32_t flags, uint32_t frame);
virtual void updateObjectVelocities(); virtual void updateObjectVelocities();
virtual bool computeShapeInfo(ShapeInfo& shapeInfo); virtual void computeShapeInfo(ShapeInfo& shapeInfo);
virtual float computeMass(const ShapeInfo& shapeInfo) const; virtual float computeMass(const ShapeInfo& shapeInfo) const;
virtual void sendUpdate(OctreeEditPacketSender* packetSender, uint32_t frame); virtual void sendUpdate(OctreeEditPacketSender* packetSender, uint32_t frame);

View file

@ -67,7 +67,7 @@ public:
MotionStateType getType() const { return _type; } MotionStateType getType() const { return _type; }
virtual MotionType getMotionType() const { return _motionType; } virtual MotionType getMotionType() const { return _motionType; }
virtual bool computeShapeInfo(ShapeInfo& info) = 0; virtual void computeShapeInfo(ShapeInfo& info) = 0;
virtual float computeMass(const ShapeInfo& shapeInfo) const = 0; virtual float computeMass(const ShapeInfo& shapeInfo) const = 0;
void setFriction(float friction); void setFriction(float friction);

View file

@ -59,33 +59,21 @@ void PhysicsEngine::updateEntitiesInternal(const quint64& now) {
} }
bool PhysicsEngine::addEntityInternal(EntityItem* entity) { bool PhysicsEngine::addEntityInternal(EntityItem* entity) {
qDebug() << "PhysicsEngine::addEntityInternal";
assert(entity); assert(entity);
void* physicsInfo = entity->getPhysicsInfo(); void* physicsInfo = entity->getPhysicsInfo();
if (!physicsInfo) { if (!physicsInfo) {
qDebug() << " PhysicsEngine::addEntityInternal no physicsInfo";
if (! entity->isReadyToComputeShape()) { if (! entity->isReadyToComputeShape()) {
qDebug() << " PhysicsEngine::addEntityInternal not ready to compute";
return false; return false;
} }
qDebug() << " PhysicsEngine::addEntityInternal ready to compute";
ShapeInfo shapeInfo; ShapeInfo shapeInfo;
entity->computeShapeInfo(shapeInfo); entity->computeShapeInfo(shapeInfo);
DoubleHashKey hkey = shapeInfo.getHash();
qDebug() << " shapeInfo hash:" << hkey.getHash() << hkey.getHash2();
btCollisionShape* shape = _shapeManager.getShape(shapeInfo); btCollisionShape* shape = _shapeManager.getShape(shapeInfo);
if (shape) { if (shape) {
qDebug() << " got a shape";
EntityMotionState* motionState = new EntityMotionState(entity); EntityMotionState* motionState = new EntityMotionState(entity);
entity->setPhysicsInfo(static_cast<void*>(motionState)); entity->setPhysicsInfo(static_cast<void*>(motionState));
_entityMotionStates.insert(motionState); _entityMotionStates.insert(motionState);
addObject(shapeInfo, shape, motionState); addObject(shapeInfo, shape, motionState);
} else if (entity->isMoving()) { } else if (entity->isMoving()) {
qDebug() << " no shape but is moving";
EntityMotionState* motionState = new EntityMotionState(entity); EntityMotionState* motionState = new EntityMotionState(entity);
entity->setPhysicsInfo(static_cast<void*>(motionState)); entity->setPhysicsInfo(static_cast<void*>(motionState));
_entityMotionStates.insert(motionState); _entityMotionStates.insert(motionState);
@ -94,11 +82,7 @@ bool PhysicsEngine::addEntityInternal(EntityItem* entity) {
_nonPhysicalKinematicObjects.insert(motionState); _nonPhysicalKinematicObjects.insert(motionState);
// We failed to add the entity to the simulation. Probably because we couldn't create a shape for it. // 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"; //qDebug() << "failed to add entity " << entity->getEntityItemID() << " to physics engine";
} else {
qDebug() << " no shape and not moving";
} }
} else {
qDebug() << " PhysicsEngine::addEntityInternal already had physicsInfo";
} }
return true; return true;
} }
@ -123,28 +107,18 @@ void PhysicsEngine::removeEntityInternal(EntityItem* entity) {
} }
void PhysicsEngine::entityChangedInternal(EntityItem* entity) { void PhysicsEngine::entityChangedInternal(EntityItem* entity) {
qDebug() << "PhysicsEngine::entityChangedInternal";
// queue incoming changes: from external sources (script, EntityServer, etc) to physics engine // queue incoming changes: from external sources (script, EntityServer, etc) to physics engine
assert(entity); assert(entity);
void* physicsInfo = entity->getPhysicsInfo(); void* physicsInfo = entity->getPhysicsInfo();
if (physicsInfo) { if (physicsInfo) {
qDebug() << " PhysicsEngine::entityChangedInternal had physicsInfo";
ObjectMotionState* motionState = static_cast<ObjectMotionState*>(physicsInfo); ObjectMotionState* motionState = static_cast<ObjectMotionState*>(physicsInfo);
_incomingChanges.insert(motionState); _incomingChanges.insert(motionState);
} else { } else {
qDebug() << " PhysicsEngine::entityChangedInternal had no physicsInfo";
// try to add this entity again (maybe something changed such that it will work this time) // try to add this entity again (maybe something changed such that it will work this time)
addEntity(entity); addEntity(entity);
} }
} }
// void PhysicsEngine::reconfigureEntity(EntityItem* entity) {
// qDebug() << "PhysicsEngine::reconfigureEntity";
// entityChangedInternal(entity);
// }
void PhysicsEngine::sortEntitiesThatMovedInternal() { void PhysicsEngine::sortEntitiesThatMovedInternal() {
// entities that have been simulated forward (hence in the _entitiesToBeSorted list) // entities that have been simulated forward (hence in the _entitiesToBeSorted list)
// also need to be put in the outgoingPackets list // also need to be put in the outgoingPackets list
@ -537,20 +511,8 @@ bool PhysicsEngine::updateObjectHard(btRigidBody* body, ObjectMotionState* motio
// get new shape // get new shape
btCollisionShape* oldShape = body->getCollisionShape(); btCollisionShape* oldShape = body->getCollisionShape();
ShapeInfo shapeInfo; ShapeInfo shapeInfo;
motionState->computeShapeInfo(shapeInfo);
bool computeShapeInfoResult = motionState->computeShapeInfo(shapeInfo);
qDebug() << "\n\n---";
qDebug() << "PhysicsEngine::updateObjectHard #1 computeShapeInfoResult =" << computeShapeInfoResult;
btCollisionShape* newShape = _shapeManager.getShape(shapeInfo); btCollisionShape* newShape = _shapeManager.getShape(shapeInfo);
DoubleHashKey hkey = shapeInfo.getHash();
qDebug() << " shapeInfo hash:" << hkey.getHash() << hkey.getHash2();
qDebug() << " newShape =" << newShape;
if (!newShape) { if (!newShape) {
// FAIL! we are unable to support these changes! // FAIL! we are unable to support these changes!
_shapeManager.releaseShape(oldShape); _shapeManager.releaseShape(oldShape);
@ -603,12 +565,7 @@ bool PhysicsEngine::updateObjectHard(btRigidBody* body, ObjectMotionState* motio
if (! (flags & EntityItem::DIRTY_MASS)) { if (! (flags & EntityItem::DIRTY_MASS)) {
// always update mass properties when going dynamic (unless it's already been done above) // always update mass properties when going dynamic (unless it's already been done above)
ShapeInfo shapeInfo; ShapeInfo shapeInfo;
bool computeShapeInfoResult = motionState->computeShapeInfo(shapeInfo); motionState->computeShapeInfo(shapeInfo);
qDebug() << "\n\n---";
qDebug() << "PhysicsEngine::updateObjectHard #2 computeShapeInfoResult =" << computeShapeInfoResult;
float mass = motionState->computeMass(shapeInfo); float mass = motionState->computeMass(shapeInfo);
btVector3 inertia(0.0f, 0.0f, 0.0f); btVector3 inertia(0.0f, 0.0f, 0.0f);
body->getCollisionShape()->calculateLocalInertia(mass, inertia); body->getCollisionShape()->calculateLocalInertia(mass, inertia);